Implement GMPL → MUIO conversion pipeline (ClickSAND / UTOPIA to OSeMOSYS UI JSON)#17
Open
parthdagia05 wants to merge 1 commit intoOSeMOSYS:masterfrom
Open
Conversation
Implements 3-layer architecture: - GMPLParser (syntax extraction) - SliceInterpreter (wildcard expansion to tuples) - MuioTransformer (tuple → MUIO JSON schema) Includes validation scripts and UTOPIA/MUIO fixtures.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Feature: OSeMOSYS GMPL to MUIO JSON Transformation Pipeline ⚙️
Closes: #1
Summary
This PR implements a complete, structured pipeline for transforming standard OSeMOSYS GMPL models (e.g., ClickSAND / UTOPIA format) into MUIO-compatible JSON case structures. It automates the conversion of standard OSeMOSYS
.datfiles into the structured JSON format required by the OSeMOSYS UI and Cloud platforms.The implementation follows a modular 3-layer architecture to ensure clean separation between syntax parsing, semantic expansion, and schema transformation.
Motivation
Currently, two primary data presentation formats exist within the ecosystem:
This PR bridges the gap by introducing a Python-based transformation engine capable of parsing standard GMPL, interpreting wildcard slice semantics, and generating exact MUIO JSON schemas.
Architecture
The pipeline flows through three distinct phases:
GMPL (.dat / .txt)→ Phase 1: GMPLParser → Phase 2: SliceInterpreter → Phase 3: MuioTransformer →MUIO JSONPhase 1 — GMPLParser (Syntax Layer)
Focuses on pure structural extraction of GMPL content without applying transformation logic.
:=placement variations, comment stripping (#), andend;terminations.Phase 2 — SliceInterpreter (Semantic Layer)
Expands GMPL slice notation into normalized tuples.
[REGION,*,FUEL,MODE,*]) into normalized mapping:(region, tech, fuel, mode, year) → value.Phase 3 — MuioTransformer (Application Layer)
Transforms normalized tuples into the final MUIO JSON schema.
FUELtoCOMMODITYand injects MUIO-specific sets (STORAGEINTRADAY,UDC, etc.).TECHNOLOGY→T_0,COMMODITY→C_0).genData.jsonand creates the scenario envelope (SC_0).Validation & Testing
Comprehensive validation scripts are included to ensure transformation accuracy:
validate_parser.py|validate_interpreter.py|validate_transformer.pyTesting Fixtures:
Assertions Covered: Correct slice expansion, ID determinism, set injection, and JSON record shape completeness. All checks pass.
Impact & Compatibility
Future Extensions (Optional)
While the core engine is complete, a small wrapper can be added to:
Feedback on architecture, mapping completeness, or integration strategy is welcome.