Skip to content

minimal data requirements and small pixi fix - #54

Merged
energyLS merged 3 commits into
mainfrom
fix/cost-year-wildcard-hardcodes
Aug 10, 2026
Merged

minimal data requirements and small pixi fix#54
energyLS merged 3 commits into
mainfrom
fix/cost-year-wildcard-hardcodes

Conversation

@JanTautorus

@JanTautorus JanTautorus commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

necessary external input data:

data/
├── wacc-global.csv
├── bus_locations.csv
├── trade_opt.csv
├── un_enerdata_demand_2050_final.csv
├── grid_potential_custom.csv
├── devlin2023-supplementary.xlsx          
├── political-stability/
│   └── globaleconomy.csv
├── owid-iron-ore/
│   └── iron-ore-crude-ore-production.csv
├── demand/steel_demands/output_data/
│   └── country_raw_steel_demand_and_dri_share.csv
├── labour/unido-raw/
│   └── data.csv                           
└── renewable_profiles_global_merged.nc + .geojson   (only if cluster_renewables: True)

there was a silent dependeny on unido-raw data without an explicity mention in the snakemake rule that it requires this input. Also added papermill to pixi to run preperation notebooks properly via snakemake.

Snakemake's notebook: directive shells out to papermill to execute
prepare_wacc, prepare_political_stability, prepare_chokepoints,
prepare_steel_demand, and the plotting notebooks. It was missing from
every pixi environment, so none of those rules could run.
rules/trade_model.smk hardcoded cost_year=[2050] when pulling supply
curves into model_trade, ignoring the actual requested wildcard, so
trade runs at any other cost_year silently used stale 2050 supply
curves. Dropping the hardcode lets it flow through allow_missing like
region/interone/intertwo already do.

prepare-steel-demand.ipynb called mock_snakemake(cost_year=2050)
unconditionally (missing the `if "snakemake" not in globals():` guard
used by the other prep notebooks), so it overwrote Snakemake's real
injected object on every run and always wrote
steel_demand_clustered_2050.csv regardless of the wildcard requested.

Verified: dry-running a cost_year~2030 trade target now resolves
supply-curve dependencies at cost_year~2030 (previously 2050), and a
real run of prepare_steel_demand for cost_year=2030 now produces
resources/steel_demand_clustered_2030.csv with genuinely different
data from the 2050 file.
download_labour_data had no input: block, so the script's read of
data/labour/unido-raw/data.csv was invisible to the DAG. If that file
was missing, the rule ran "successfully" but silently skipped the
UNIDO merge and never wrote resources/merged_labour_inputs.csv,
surfacing only as a confusing MissingOutputException instead of a
clear MissingInputException naming the real cause.

Declares the file as input.unido_raw and has the script read the
Snakemake-provided path instead of its own hardcoded module constant,
so a missing file is now caught at DAG-build time.

Verified: dry-run now lists data/labour/unido-raw/data.csv as an
input; temporarily removing it correctly raises MissingInputException;
restoring it and running for real still produces
resources/merged_labour_inputs.csv as before.
@JanTautorus JanTautorus changed the title minimal data requires and small pixi fix minimal data requirements and small pixi fix Aug 5, 2026
@JanTautorus
JanTautorus requested a review from energyLS August 5, 2026 10:14
@energyLS

Copy link
Copy Markdown
Owner

Thank you @JanTautorus. I have reviewed your PR and accept it.

@energyLS
energyLS merged commit 55abce0 into main Aug 10, 2026
@JanTautorus
JanTautorus deleted the fix/cost-year-wildcard-hardcodes branch August 11, 2026 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants