From b6f1b982b06fb2568fa6ee2121967e679b99e08f Mon Sep 17 00:00:00 2001 From: jkikstra Date: Wed, 9 Jul 2025 19:35:42 +0200 Subject: [PATCH] Drop "Carbon Removal" (without CO2) variables These are not necessary for the global workflow and not in the recognised variable set. --- .../pre_processing/pre_processor.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/gcages/cmip7_scenariomip/pre_processing/pre_processor.py b/src/gcages/cmip7_scenariomip/pre_processing/pre_processor.py index 402b09c9..196e248e 100644 --- a/src/gcages/cmip7_scenariomip/pre_processing/pre_processor.py +++ b/src/gcages/cmip7_scenariomip/pre_processing/pre_processor.py @@ -356,9 +356,22 @@ def species_in_variable(variable: str, species: str, ls: str) -> bool: # Can't use these yet # TODO: implement support for baskets global_workflow_emissions_not_from_gridding_emissions = global_workflow_emissions_not_from_gridding_emissions.loc[ # noqa: E501 - ~global_workflow_emissions_not_from_gridding_emissions.index.get_level_values( - unit_level - ).str.contains("equiv") + ( + # baskets, like Kyoto Gases (or F-Gases): + ~global_workflow_emissions_not_from_gridding_emissions.index.get_level_values( + unit_level + ).str.contains("equiv") + ) + & ( + # Carbon Removal|* may have been renamed to Carbon Removal|CO2|*, + # - that's why the variable may still be here (as it is not gridded) + # - but we still do not want it in the global workflow (that + # ... would be double-counting) so we drop it here + # TODO: drop this earlier already + ~global_workflow_emissions_not_from_gridding_emissions.index.get_level_values( + variable_level + ).str.contains("Carbon Removal") + ) ] global_workflow_emissions_raw_names = pd.concat(