Skip to content

Commit

Permalink
Run MAGICC separately
Browse files Browse the repository at this point in the history
  • Loading branch information
phackstock committed Sep 12, 2024
1 parent 8a048d9 commit 63bc103
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,34 @@ def main(df: pyam.IamDataFrame) -> pyam.IamDataFrame:

# Run the validation and region-processing
dsd = DataStructureDefinition(here / "definitions")
region_processor = RegionProcessor.from_directory(
path=here / "mappings",
dsd=dsd,
processed_df = process(
df,
dsd,
processor=RegionProcessor.from_directory(
path=here / "mappings",
dsd=dsd,
),
)
if FOUND_MAGICC:
magicc_processor = MAGICCProcessor(
run_type="complete",
magicc_worker_number=8,
magicc_variables=[
"*Atmospheric concentrations*"
"*Exceedance probability*"
"*Effective radiative forcing*"
"*Surface temperature*",
"*Infilled*",
"*Harmonized*",
],
)
try:
return process(
df,
dsd,
processor=[region_processor, magicc_processor],
)
return magicc_processor.apply(processed_df)
except Exception as e:
log.warning(
(
"Error with MAGICC processing, repeat processing without MAGICC, "
f"details: {e}"
)
)
return process(df, dsd, processor=region_processor)
return processed_df

0 comments on commit 63bc103

Please sign in to comment.