Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
fec72b3
Add pytest_{collection_modifyitems,configure} hooks
khaeru Apr 18, 2026
f2040b8
Add .testing.MARK["ci_linux_only"]
khaeru Apr 18, 2026
ab97437
Mark 6 tests "ci_linux_only" to lower GHA run time
khaeru Apr 18, 2026
e0e6256
Rename 9 entries in MARK; adjust usage
khaeru Apr 18, 2026
9af5565
Reverse relationship of {,transport}.testing.MARK
khaeru Apr 18, 2026
6468fe6
Rename 5 transport test marks; adjust usage
khaeru Apr 18, 2026
4bdfc6e
Add .util.pytest.MarkFactory
khaeru Apr 19, 2026
ebf403a
Replace transport.testing.make_mark w/ MarkFactory
khaeru Apr 19, 2026
ccd11b8
Add growth_{activity,new_cap}_lo for 2 LDV techs
khaeru Apr 19, 2026
2031f60
Reduce R12_EEU LDV lifetime 28 → 22 years
khaeru Apr 19, 2026
a9407e1
Improve IEA_Future_of_Trucks
khaeru Apr 20, 2026
bb8e27a
Add .transport.data.InputVehicle
khaeru Apr 20, 2026
72f3c56
Merge energy input data for F RAIL and F ROAD
khaeru Apr 20, 2026
bb232c6
Check input values are generated for F usage techs
khaeru Apr 30, 2026
0d9b6e8
Update reference to "t::F usage"
khaeru Apr 30, 2026
112d3bc
Remove gdp_ppp key from report/global.yaml
khaeru May 7, 2026
6f7173a
Adjust "Final Energy|Transportation" IAMC vars
khaeru May 7, 2026
f615190
Add #497 to doc/whatsnew
khaeru Apr 15, 2026
b7fc7cc
Partly revert d86843e76ad08c5cc1fa709e543848a3742dfb38
khaeru Apr 26, 2026
e1b8d1f
Sort .cli.submodules
khaeru Apr 26, 2026
62407f1
Add TODO reduce complexity of prepare_data_B()
khaeru Apr 26, 2026
7618e5d
Use .transport.workflow.add_steps in .bmt.workflow
khaeru Feb 13, 2026
c7983a9
Update BMT workflow
yiyi1991 Feb 17, 2026
e41f17d
Update material haircut vetting
yiyi1991 Feb 17, 2026
aa55249
Update T in the BMT workflow
yiyi1991 Mar 9, 2026
2be870c
Update T report TODO
yiyi1991 Mar 9, 2026
218bebe
Add add_macro and clean BMT config
yiyi1991 Mar 10, 2026
56bca1b
Update add_macro for BMT
yiyi1991 Mar 10, 2026
f392d96
Update add_macro_materials
yiyi1991 Mar 10, 2026
d378b8e
Replace transport.report 0 with blanks in y<y₀
yiyi1991 Mar 18, 2026
1fa24a2
Call transport report in BMT workflow
yiyi1991 Mar 18, 2026
a11549a
Mute assert to run transport.report with y₀>2020
yiyi1991 Mar 18, 2026
230f250
Update final setup for NGFS C1
yiyi1991 Mar 19, 2026
523cae1
Update BMT config
yiyi1991 Mar 22, 2026
2a4dd56
Update test_bmt
yiyi1991 May 11, 2026
a766c65
Update test_workflow for bmt
yiyi1991 May 11, 2026
e6113c4
Update bmt doc
yiyi1991 May 11, 2026
2e4daf9
Improve build_PM and other tests
yiyi1991 May 12, 2026
c87eaa5
Add _floor_demolition to balance_equality to avoid oversupply
yiyi1991 May 12, 2026
c8b5086
Update test for build_PM
yiyi1991 May 12, 2026
69e167d
Change default region config in model/config from R14 to R12
OFR-IIASA Dec 2, 2024
90cdba0
add h2_pyro_elec with correct inv_cost and smr reduction curves
Tyler-lc Jul 29, 2025
b2b0ce0
add git ignore
Tyler-lc Jul 30, 2025
88d51ba
modify type technology for regional diff
Tyler-lc Aug 11, 2025
4781492
add alk, soe, pem electrolyzers
Tyler-lc Sep 18, 2025
a5dadde
add hydrogen turbine in 2030
Tyler-lc Sep 25, 2025
c487311
add h2_pyro_elec with correct inv_cost and smr reduction curves
Tyler-lc Jul 29, 2025
cc1a806
modify type technology for regional diff
Tyler-lc Aug 11, 2025
2aff4ba
add alk, soe, pem electrolyzers
Tyler-lc Sep 18, 2025
f63cb24
add hydrogen turbine in 2030
Tyler-lc Sep 25, 2025
a4fcd3c
add reporting for hydrogen leakages
Tyler-lc Oct 2, 2025
2ca1eb1
add reporting for h2 production and emissions
Tyler-lc Oct 6, 2025
3bbf0de
ignore debug utilities
Tyler-lc Oct 6, 2025
e167afb
fix units in hydrogen production reporting
Tyler-lc Oct 8, 2025
91cfff2
fix double counting for catalytic_reforming_ref
Tyler-lc Oct 8, 2025
3621ab0
add original_unit and target unit to yaml for unit conversion in repo…
Tyler-lc Oct 9, 2025
12e2571
add original_unit and target unit to yaml for unit conversion
Tyler-lc Oct 9, 2025
0ef9922
improve unit conversion for reporting
Tyler-lc Oct 10, 2025
860686d
attempt liquid hydrogen accounting
Tyler-lc Oct 15, 2025
389067b
add automatic fetching of variables from data/hydrogen folder
Tyler-lc Oct 15, 2025
d53b399
add files for hydrogen Default workflow
Tyler-lc Oct 20, 2025
3193009
add rough implementation for default workflow.
Tyler-lc Oct 20, 2025
d534619
add historical data for electrolyzers
Tyler-lc Oct 21, 2025
88318df
update yaml for new default workflow
Tyler-lc Oct 21, 2025
2ab5f04
add utility methods for default workflow
Tyler-lc Oct 21, 2025
643b328
add csv for hydrogen technology parameters
Tyler-lc Oct 22, 2025
124c403
add sets and methods to load them
Tyler-lc Oct 22, 2025
cff0bf0
Add hydrogen technologies to default
Tyler-lc Oct 22, 2025
209561f
Add sets and debugging
Tyler-lc Oct 22, 2025
ca41fcc
Remove CO2_Emission_Global_Total from rel_act
Tyler-lc Oct 22, 2025
d15e8e4
Comment out debug print. Improve printing
Tyler-lc Oct 22, 2025
7ba97e4
Change units to Mt/yr and remove R12_ from regions
Tyler-lc Oct 23, 2025
6f5bcb7
Add removal of old techs
Tyler-lc Oct 24, 2025
237e168
Fix reporting for H2_leak
Tyler-lc Oct 29, 2025
ade6f17
feat: Add transient hydrogen reporting with stoichiometric conversion
Tyler-lc Oct 29, 2025
716132f
Update h2 transient aggregation
Tyler-lc Oct 30, 2025
98fd666
Fix aggregations for Refinery
Tyler-lc Nov 4, 2025
0239cc0
Add groupby for stoichiometric aggregation
Tyler-lc Nov 4, 2025
b5eb5d6
Add differentiation for multipliers
Tyler-lc Nov 5, 2025
7b3a6e5
Add historical reporting keys
Tyler-lc Nov 25, 2025
ddd8f1a
Add genno keys for historical reporting
Tyler-lc Nov 25, 2025
46a49df
Move imports, add correct report vars for historical, fix empty DF issue
Tyler-lc Nov 25, 2025
7495640
Debugging historical reporting
Tyler-lc Nov 25, 2025
66d22c3
validate and debug historical reporting
Tyler-lc Nov 25, 2025
1aabcf5
Add hist yaml and aggrs
Tyler-lc Nov 25, 2025
e68454c
Add geological (white) hydrogen to h2_prod reporting
Tyler-lc Mar 24, 2026
129cb66
Track hydrogen module/reporting docs; ignore scenario outputs at repo…
Tyler-lc May 7, 2026
9b20b04
Add EFC cli
yiyi1991 May 13, 2026
fa521e8
Add initial EFC workflow structure
yiyi1991 May 13, 2026
3ead37d
hydrogen reporting: IAMC renames + Hydrogen|Fossil aggregator family
Tyler-lc May 26, 2026
403aa91
hydrogen: fix add_hydrogen_techs transact call, empty IamDataFrame in…
Tyler-lc May 26, 2026
8a969ed
efc: add Yoga meth_h2 mode-parity port + wire into EFC workflow
Tyler-lc May 26, 2026
70c8932
Add in|/out| hydrogen flow reporting (EFC concrete energy flows)
Tyler-lc May 29, 2026
f5ea67f
fix modes for h2_elec_*
Tyler-lc May 29, 2026
cf99cfd
aggregation across R12_GLB naming
Tyler-lc May 29, 2026
ccb0aff
remove "commit_message" as argument, use positional
Tyler-lc Jun 1, 2026
a6a7bb5
add hydrogen sets first
Tyler-lc Jun 1, 2026
dcf69d8
fix stale dictionary nesting
Tyler-lc Jun 1, 2026
e57d595
efc: build BMT config in workflow generate() so transport reporting runs
Tyler-lc Jun 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ cache/

# Scratch files
*scratch*

# GDX and input files
scenario_parameters.pkl
*/data/bilateralize/gdx/*
Expand All @@ -163,3 +162,19 @@ scenario_parameters.pkl
*/data/bilateralize/*/bare_files/*
*/data/bilateralize/*/GEM/*
/message_ix_models/project/newpathways/diagnostics/data

# SSP driver data files (large)
message_ix_models/data/ssp/*.csv.xz
message_ix_models/data/ssp/*.csv.gz
message_ix_models/data/ssp/*.csv.zip
message_ix_models/data/ssp/*.txt

# Hydrogen debug utilities
message_ix_models/data/hydrogen/debug_utils/

# Scenario output artifacts at repo root
/hyway_*.xlsx
/SSP_*.csv
/SSP_*.xlsx
/_*.xlsx
/*_check.xlsx
293 changes: 293 additions & 0 deletions HYDROGEN_REPORTING_CHANGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,293 @@
# Hydrogen Reporting Implementation - Changes Summary

## Date: 2025-10-06

## Changes Made

### 1. Fixed YAML Configuration Files

#### `h2_fgt_emi.yaml`
- ✅ **Fixed line 70:** Removed double comma in technology list
- Before: `[furnace_h2_refining, fc_h2_refining, hydro_cracking_ref, , h2_i, h2_fc_I]`
- After: `[furnace_h2_refining, fc_h2_refining, hydro_cracking_ref, h2_i, h2_fc_I]`

#### `h2_fgt_emi_aggregates.yaml`
- ✅ **Fixed level_1:** Removed incorrect electricity production aggregate
- The base file defines `emi_h2_fgt_prod_elec` as a single aggregated variable (all 3 electrolyzer types)
- The aggregates file was trying to re-aggregate it from components that don't exist as base variables
- Now level_2 correctly references the existing `emi_h2_fgt_prod_elec` directly

- ✅ **Fixed level_3:** Added missing methanol component
- Before: Industry aggregate was missing `emi_h2_fgt_dem_ind_meth`
- After: Includes all 6 industry subsectors (steel, cement, alu, chem, meth, other)

### 2. Created Missing File

#### `h2_prod_aggregates.yaml` (NEW)
- Created complete aggregation hierarchy for hydrogen production
- Defines 2 levels of aggregation:
- **Level 1:** By fuel type (Gas, Coal, Biomass, Electricity)
- **Level 2:** Total hydrogen production
- All short names match those defined in `h2_prod.yaml`

### 3. Updated Python Code

#### Deleted: `message_ix_models/model/material/report/h2_reporting.py`
- This file was in the wrong location (material module instead of hydrogen module)
- It was trying to import from material reporting which uses a different Config class
- Hydrogen reporting should be separate from material reporting

#### Updated: `message_ix_models/report/hydrogen/h2_reporting.py`
- ✅ **Added `run_h2_prod_reporting()` function** for hydrogen production reporting
- ✅ **Updated `run_h2_reporting()` function** to include production reporting
- Now generates 3 types of reports:
1. Hydrogen production
2. H2 fugitive emissions
3. LH2 fugitive emissions

#### Updated: `run_h2_reporting_example.py`
- ✅ **Fixed Reporter import**
- Before: `from message_ix_models.report import Reporter` (incorrect)
- After: `from message_ix.report import Reporter` (correct)

### 4. Created Documentation

#### `HYDROGEN_REPORTING_GUIDE.md` (NEW)
- Comprehensive guide covering:
- File structure and organization
- How configuration files work
- Complete technology coverage
- Aggregation hierarchies
- Usage instructions
- Verification and quality checks
- Troubleshooting common issues
- Maintenance procedures
- Best practices

## Verification Checklist

### ✅ Configuration Files

- [ ] **No double-counting in base files**
- Each technology-mode-commodity-level combination appears only once
- No overlapping filters

- [ ] **Complete coverage**
- All production technologies have:
- Entry in `h2_prod.yaml`
- Entry in `h2_fgt_emi.yaml` (for emissions)
- All demand sectors covered in `h2_fgt_emi.yaml`

- [ ] **Valid aggregations**
- All `components` reference existing `short` names
- No circular references
- Proper hierarchy (level_1 → level_2 → level_3 → level_4)

### ✅ File Structure

```
✅ data/hydrogen/reporting/
✅ h2_prod.yaml (exists, corrected)
✅ h2_prod_aggregates.yaml (CREATED)
✅ h2_fgt_emi.yaml (exists, corrected)
✅ h2_fgt_emi_aggregates.yaml (exists, corrected)
✅ lh2_fgt_emi.yaml (exists, unchanged)

✅ report/hydrogen/
✅ __init__.py (exists)
✅ config.py (exists, unchanged)
✅ h2_reporting.py (updated)
✅ cli.py (exists, unchanged)

✅ Root directory:
✅ run_h2_reporting_example.py (updated)
✅ HYDROGEN_REPORTING_GUIDE.md (CREATED)
✅ HYDROGEN_REPORTING_CHANGES.md (this file)
```

## Testing Instructions

### 1. Basic Functionality Test

```python
import ixmp
import message_ix
from message_ix.report import Reporter
from message_ix_models.report.hydrogen.h2_reporting import run_h2_reporting
import pyam

# Load scenario
mp = ixmp.Platform(name="ixmp-dev")
scenario = message_ix.Scenario(mp, model="your_model", scenario="your_scenario")

# Create reporter and run
rep = Reporter.from_scenario(scenario)
dfs = run_h2_reporting(rep, scenario.model, scenario.scenario)

# Check results
py_df = pyam.concat(dfs)
assert not py_df.empty, "No data generated!"
print(f"Generated {len(py_df.variable)} variables")
print(py_df.variable)
```

### 2. Verify Production Reporting

```python
# Check production variables exist
prod_vars = py_df.filter(variable="Production|Hydrogen*")
print("Production variables:")
print(prod_vars.variable)

# Should include:
# - Production|Hydrogen (total)
# - Production|Hydrogen|Gas (aggregate)
# - Production|Hydrogen|Gas|SMR w/o CCS (base)
# - Production|Hydrogen|Gas|SMR w/ CCS (base)
# - Production|Hydrogen|Gas|Pyrolysis (base)
# - Production|Hydrogen|Coal (aggregate)
# - etc.
```

### 3. Verify Emission Reporting

```python
# Check emission variables exist
emi_vars = py_df.filter(variable="Emissions|H2|Fugitive*")
print(f"Found {len(emi_vars.variable)} emission variables")

# Check for key aggregates
assert "Emissions|H2|Fugitive|Energy|Supply|Hydrogen|Production" in emi_vars.variable
assert "Emissions|H2|Fugitive|Energy|Demand|Industry" in emi_vars.variable
```

### 4. Verify Aggregations

```python
# Test that aggregates equal sum of components
# Example: Total hydrogen production should equal sum of fuel types

total_h2 = py_df.filter(
variable="Production|Hydrogen",
level=0 # Only the exact variable, not children
).timeseries()

h2_gas = py_df.filter(variable="Production|Hydrogen|Gas", level=0).timeseries()
h2_coal = py_df.filter(variable="Production|Hydrogen|Coal", level=0).timeseries()
h2_bio = py_df.filter(variable="Production|Hydrogen|Biomass", level=0).timeseries()
h2_elec = py_df.filter(variable="Production|Hydrogen|Electricity", level=0).timeseries()

calculated_total = h2_gas.add(h2_coal, fill_value=0).add(h2_bio, fill_value=0).add(h2_elec, fill_value=0)

# Check they match (within small tolerance for floating point)
diff = (total_h2 - calculated_total).abs()
assert (diff < 0.001).all().all(), "Aggregation mismatch found!"
print("✅ Aggregations verified correctly")
```

### 5. Run Example Script

```bash
# Edit run_h2_reporting_example.py with your platform/scenario details
# Then run:
python run_h2_reporting_example.py

# Should produce:
# - Console output with summary
# - Excel file: {model}_{scenario}_h2_report.xlsx
```

## Known Issues and Notes

### 1. Technology Mode Variations

Some technologies in `h2_fgt_emi.yaml` have comments noting mode differences:
- `fc_h2_steel` does not have `high_temp` mode
- `fc_h2_aluminum` does not have `high_temp` mode
- Other `fc_x` technologies do not have `high_temp` mode

**Current solution:** Filters include both `[high_temp, low_temp]` modes. The Reporter will simply not find data for non-existent modes, which is acceptable.

**Alternative solution (if issues arise):** Create separate filter entries for furnace vs. fuel cell technologies.

### 2. Electrolyzer Aggregation

The base file `h2_fgt_emi.yaml` aggregates all electrolyzer types into a single variable:
```yaml
Energy|Supply|Hydrogen|Production|Electricity:
filter: { technology: [h2_elec_pem, h2_elec_soe, h2_elec_alkaline], ... }
short: emi_h2_fgt_prod_elec
```

This means:
- ✅ No separate emissions by electrolyzer type
- ✅ Only total electricity-based H2 fugitive emissions
- ℹ️ Different from production reporting, which has separate variables per type

**Rationale:** Fugitive emissions from electrolysis are likely similar across types, so aggregation is acceptable.

### 3. Methanol Production

Methanol production using hydrogen (`meth_h2`) has multiple modes:
- `feedstock_dac`, `feedstock_bic`, `feedstock_fic` (using different carbon sources)
- `fuel_dac`, `fuel_bic`, `fuel_fic` (if methanol is used as fuel)

The filter captures all modes to ensure complete coverage.

## Integration with Existing Reporting

### Separation from Material Reporting

The hydrogen reporting system is **intentionally separate** from material reporting:

**Reasons:**
1. Different scope (energy commodity vs. materials)
2. Different stakeholders and use cases
3. Allows independent evolution
4. Prevents complexity in material reporting

**How they coexist:**
- Hydrogen: `message_ix_models/report/hydrogen/`
- Material: `message_ix_models/model/material/report/`
- Shared utilities: Config class structure is similar but separate
- Both use same Reporter infrastructure

### Running Both Systems

You can run both reporting systems independently:

```python
# Material reporting
from message_ix_models.model.material.report.run_reporting import run
material_df = run(scenario, upload_ts=False)

# Hydrogen reporting
from message_ix_models.report.hydrogen.h2_reporting import run_h2_reporting
hydrogen_dfs = run_h2_reporting(rep, scenario.model, scenario.scenario)

# Combine if needed
combined_df = pyam.concat([material_df] + hydrogen_dfs)
```

## Next Steps

1. **Test with real scenario data** - Run on actual MESSAGEix scenario
2. **Validate outputs** - Check that numbers make sense
3. **Add CLI command** - Create `mix-models hydrogen report` command (optional)
4. **Add unit tests** - Test Config loading and aggregations
5. **Benchmark performance** - Ensure reporting runs efficiently

## Questions for Review

1. ❓ Should we add more detailed breakdowns (e.g., separate electrolyzer emissions)?
2. ❓ Are there other hydrogen demand sectors missing?
3. ❓ Should we add capacity reporting (installed capacity by technology)?
4. ❓ Do we need investment cost reporting?

## Contact

For questions or issues with hydrogen reporting:
- Check `HYDROGEN_REPORTING_GUIDE.md` for detailed documentation
- Review this changes summary for what was modified
- Test with example script: `run_h2_reporting_example.py`

Loading
Loading