Process CO2 emission forcings for ScenarioMIP - #148
Conversation
Documentation build overview
|
|
I created and ran the u-dq819.scenarios-co2 workflow. Logs are in /scratch/tm70/pcl851/cylc-run/u-dq819.scenarios-co2/run9/log Output is in /g/data/tm70/pcl851/CMIP7/esm1p6_ancil/2026.08.07 The directory name |
|
See the comment in #140 as well as https://input4mips-cvs.readthedocs.io/en/latest/dataset-overviews/anthropogenic-slcf-co2-emissions/#scenariomip_2. The workflow needs to be re-run using |
|
The |
|
The |
blimlim
left a comment
There was a problem hiding this comment.
Thanks @paul-leopardi, I've focused on the code changes in this review which overall look good to me. I've made a couple of suggestions which I think could help with performance and readability.
The suggestions will likely cause roundoff level changes in the produced files, and so
if there's a preference to get the simulations going as soon as possible with the existing files, then it might be best to skip my suggestions
| interpolated = interpolate_monthly( | ||
| cube, CMIP7_SM_BEG_YEAR, CMIP7_SM_END_YEAR | ||
| ) |
There was a problem hiding this comment.
This comment is also relevant to #135, and so I'll add a comment there too in my review there.
It's not crucial, but might be good to move the call to interpolate_monthly out from the lower level load_cmip7_... functions and into the top level processing functions like cmip7_es_co2_anthro_interpolate.
This would allow for the time interpolation to be applied after the data has:
- been regridded onto the ESM1.6 atmosphere grid
- had air and non-air emissions combined together
The regridding onto the atmosphere grid reduces the grid size from 360x720 (259,200 points) to 145x192 (27,8400) points, and so applying the time interpolation afterwards should make it a bit quicker/need less resources.
I think this could also help a with readability. To me I think it's a bit clearer if the load_cmip7_... functions to return the loaded cubes with minimal processing, and for the bulk of the processing to be carried out in the top level processing functions. This would be consistent with how the regridding is applied in the top level processing functions.
There was a problem hiding this comment.
@paul-leopardi, following a bit more discussion - I'd ignore this suggestion. The order probably isn't causing a major bottleneck, and as long as we're happy with the output data as is, it might be better to leave this unchanged
| if cube.coords("altitude"): | ||
| cube = cube.collapsed(["altitude"], iris.analysis.SUM) | ||
| cube.remove_coord("altitude") |
There was a problem hiding this comment.
Related to this comment:
I think it would be clearest for the reduction on "altitude" and "sector" to be moved up to the top-level processing functions like cmip7_es_co2_anthro_interpolate. At the moment the reduction isn't applied at consistent levels for the scenarios and historical CO2, e.g. it's done within the loading functions used for the historical air emissions:
CMIP7-Input/CMIP7/esm1p6/atmosphere/aerosol/cmip7_aerosol_anthro.py
Lines 70 to 73 in d3cd039
but for the non-air historical emissions, it's done in the "top level" processing function cmip7_eh_co2_anthro_interpolate:
CMIP7-Input/CMIP7/esm1p6/atmosphere/co2/cmip7_EH_CO2_interpolate.py
Lines 46 to 48 in d3cd039
As you mentioned in the PR, there are performance reasons for applying the reduction before calling interpolate_monthly, and so as suggested here, it might make sense to move the interpolate_monthly call too.
There was a problem hiding this comment.
Related to my comment here, happy for you to leave this as is and skip the above suggestion


Closes #140
For each scenario, the code in CMIP7/esm1p6/atmosphere/co2/cmip7_ES_CO2_interpolate.py reads both the ScenarioMIP CO2 emission forcing data for CO2 and the ScenarioMIP aircraft CO2 emission forcing data, adds the two, then interpolates the time series and regrids the data to produce an ancillary file.
It turns out that the equivalent code in
CMIP7/esm1p6/atmosphere/co2/cmip7_EH_CO2_interpolate.py for the historical forcings interpolated monthly data from the cubes corresponding the the historical forcing data before collapsing the CO2 emission data by sector and the CO2 aircraft emission data by altitude. When this was tried for ScenarioMIP the task ran out of memory when interpolating the time series. The solution applied to both the EH and ES code is to collapse the respective cubes before interpolating the time series. That is why four files are changed.
The debugging work and a small amount of coding was assisted by Google Antigravity using Gemini 3.6 Flash (high).