Repository navigation
Route ocean variables in mixed tables to the ocean CMORiser - #795
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #795 +/- ##
=====================================
Coverage 81.2% 81.2%
=====================================
Files 44 44
Lines 9565 9576 +11
Branches 1779 1782 +3
=====================================
+ Hits 7767 7780 +13
+ Misses 1469 1468 -1
+ Partials 329 328 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #794
Problem
The driver chose the component CMORiser from the CMIP6 table name alone.
Emon,Eday,3hrand the other mixed tables always went toAtmosphere_CMORiser.Ocean variables in these tables (
Emon.expcalc,Emon.osaltpsmadvect,Eday.mlotst,3hr.tos, ...) therefore failed withKeyError: 'lev'. In CMIP7 they would also have been given the atmosphere grid label and cell measures.Changes
utilities.py: addload_variable_component(cmor_name, model_id). It returns the mapping component ("ocean","oceanBgchem", ...) of the entry thatload_variable_entryreturns._find_variable_entry, so they always agree.load_variable_entrybehaves as before.driver.py:oceanoroceanBgchemnow goes toOcean_CMORiser_OM2orOcean_CMORiser_OM3._is_atmosis false for these variables, so the atmosphere grid label and cell-measures overrides are not applied. The ocean CMORiser resolves its own afterinfer_grid_type()._is_atmosinstead of repeating the atmosphere table list.tests/unit/test_driver.py):test_mixed_table_routes_by_mapping_componentchecks which CMORiser is chosen:Emon.expcalc(ESM1-6),Emon.osaltpsmadvect(ESM1-5),Eday.mlotst(ESM1-6) and3hr.tos(ESM1-6) → OM2;Eday.mlotst(OM3) → OM3;Emon.rls(ESM1-6) → still atmosphere.test_cmip7_ocean_variable_in_mixed_table_skips_atmosphere_grid_labelchecks that the CMIP7 grid label stays as theg999placeholder for the ocean CMORiser to resolve.The approach relies on no variable name being in more than one mapping component. That holds today for ESM1-5, ESM1-6, CM3 and OM3.
Validation
main, the 6 new ocean-routing tests fail and the atmosphere case passes.test_driver.pyandtest_utilities.pypass (267 tests), and pre-commit is clean.ocnBgchem.expcalc.tavg-ol-hxy-sea.mon.glb. This variable failed withKeyError: 'lev'in the moppy 1.8.4 pilot.time × lev=50 × j=300 × i=360and grid labelg118(ocean T point).cell_measuresisarea: areacello volume: volcello.