-
Notifications
You must be signed in to change notification settings - Fork 44
Make CMOR tables configurable through new configuration system and deprecate config-developer.yml #2946
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
2b7ae33 to
f7e0982
Compare
2403e51 to
c2bd443
Compare
c2bd443 to
5ae3e93
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2946 +/- ##
==========================================
+ Coverage 95.61% 95.68% +0.06%
==========================================
Files 266 266
Lines 15584 15718 +134
==========================================
+ Hits 14901 15040 +139
+ Misses 683 678 -5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Hello, this pull request has been marked with the If you won't be able to finish this in time, don't worry - just unassign the milestone |
…ate default config
|
@bouweandela shout if you need a helping hand here, with the missing tests - I can help. Apart from that, it looks great - and a lot of bookkeeping work too, which is not pleasant 🍻 |
|
Thanks for offering V! The tests shouldn't be too much effort, it's mostly the docs that still need to be updated and I want to think about if I can avoid making #2954 worse. I was actually having a go at fixing that, but realized that it's probably best to leave that for another PR. If you could help out with reviewing and testing that would be great. Hopefully I'll have this ready for review by the end of the week. |
|
sure thing, can do! 🍺 |
221c733 to
610c23d
Compare
|
OK @bouweandela - tests as promised:
I am rather happy with the funtionality here, and well done! 🍻 Off to pub now 🍻 |
|
Thanks a lot V, enjoy 🍻 🍻 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
last approval after testing 😀 @schlunma can merge this for 2.14 - you can hold me accountable for any serious issues from it 😆
|
@bouweandela Could you please fix the merge conflict? I'll try to play around with this today, and hopefully merge it very soon. This is the last feature PR that we will include for the release candidate. |
|
Thanks @schlunma, I've addressed the merge conflict. |
schlunma
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of questions/comments on the docs, will continue with testing later.
|
Removing an entry from the custom CMIP6 tables, e.g. the entry for with the following user config file projects:
CMIP5:
cmor_table:
paths:
- cmip5/Tables
- cmip5-custom
- ~/tmp/cmor # <-- this is the problematic linefails with Traceback (most recent call last):
File "/home/b/b309141/micromamba/envs/esm/bin/esmvaltool", line 3, in <module>
from esmvalcore._main import run
File "/home/b/b309141/repos/ESMValCore/esmvalcore/_main.py", line 43, in <module>
from esmvalcore.config._config import warn_if_old_extra_facets_exist
File "/home/b/b309141/repos/ESMValCore/esmvalcore/config/__init__.py", line 20, in <module>
from esmvalcore.config._config_object import CFG, Config, Session
File "/home/b/b309141/repos/ESMValCore/esmvalcore/config/_config_object.py", line 406, in <module>
CFG = _get_global_config()
File "/home/b/b309141/repos/ESMValCore/esmvalcore/config/_config_object.py", line 401, in _get_global_config
config_obj.reload()
~~~~~~~~~~~~~~~~~^^
File "/home/b/b309141/repos/ESMValCore/esmvalcore/config/_config_object.py", line 157, in reload
self.load_from_dirs([USER_CONFIG_DIR])
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
File "/home/b/b309141/repos/ESMValCore/esmvalcore/config/_config_object.py", line 130, in load_from_dirs
self.update(new_config_dict)
~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/home/b/b309141/repos/ESMValCore/esmvalcore/config/_validated_config.py", line 105, in update
self[key] = other[key]
~~~~^^^^^
File "/home/b/b309141/repos/ESMValCore/esmvalcore/config/_validated_config.py", line 74, in __setitem__
cval = self._validate[key](val)
File "/home/b/b309141/repos/ESMValCore/esmvalcore/config/_config_validators.py", line 424, in validate_projects
validate_cmor_tables(mapping)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/home/b/b309141/repos/ESMValCore/esmvalcore/config/_config_validators.py", line 391, in validate_cmor_tables
project: esmvalcore.cmor.table.get_tables(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
session={"projects": value}, # type: ignore[arg-type]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
project=project,
^^^^^^^^^^^^^^^^
)
^
File "/home/b/b309141/repos/ESMValCore/esmvalcore/cmor/table.py", line 389, in get_tables
tables = cls(**kwargs)
File "/home/b/b309141/repos/ESMValCore/esmvalcore/cmor/table.py", line 1281, in __init__
self._load_table(table_file)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^
File "/home/b/b309141/repos/ESMValCore/esmvalcore/cmor/table.py", line 1299, in _load_table
table = self._read_table_file(table_file)
File "/home/b/b309141/repos/ESMValCore/esmvalcore/cmor/table.py", line 1308, in _read_table_file
self._read_line()
~~~~~~~~~~~~~~~^^
File "/home/b/b309141/repos/ESMValCore/esmvalcore/cmor/table.py", line 1346, in _read_line
index = line.index(":")
ValueError: substring not foundSomehow the CMIP5 and CMIP6 projects get mixed up. |
|
Trying to reproduce your issue, I followed these steps:
projects:
CMIP5:
cmor_table:
paths:
- cmip5/Tables
- cmip5-custom
- ~/tmp/cmor # <-- this is the problematic line
Does that describe what you did? Or is there some content in your If I follow the 4 steps above, the run ends with the message: as expected, because I removed the variable from the table file in step 3 above. |
I ran this exact test when I ran tests last week - I am starting to get mildly miffed with the approach towards this PR's review - if we're trying to make any fairly/medium large development completely bulletproof, review will take ad infinitum! 🍺 |
|
@bouweandela you're right, the content of {
"Header": {
"generic_levels": "olevel",
"table_id": "Table custom"
},
"variable_entry": {
"clhmtisccp": {
"cell_measures": "area: areacella",
"cell_methods": "time: mean",
"comment": "at the top of the atmosphere (to be compared with satellite measurements)",
"dimensions": "longitude latitude time",
"long_name": "ISCCP High Level Medium-Thickness Cloud Area Fraction",
"modeling_realm": "atmos",
"out_name": "clhmtisccp",
"standard_name": "",
"type": "real",
"units": "%"
}
}
}I thought the CMIP5 table reader only looks for |
|
@valeriupredoi As release manager of the upcoming release,
Running some tests helps me with both. Apologies if this repeats some of your tests, but for large changes like this it's probably a good idea if more than one person actually runs some tests. I don't plan to perform any bigger (recipe) tests with this, so if @bouweandela clears up my reported issue, than I am happy to merge this asap. |
The CMIP6 reader reads files with the |
Would be great to add a note about that to the respective |
|
Done in b43a466 |
|
Thanks!! My tests were successful, merging this now 🚀 |
brill, very many thanks, Manu 🍺 |
Description
Added features
esmvalcore.preprocessor.align_metadataso it works with branded variablesCloses #2918
Closes #2746
Closes #2364
Links to documentation:
target_branding_suffixtoesmvalcore.preprocessor.align_metadata: https://esmvaltool--2946.org.readthedocs.build/projects/ESMValCore/en/2946/recipe/preprocessor.html#align-metadataDeprecated features
config-developer.ymland the configuration settingconfig_developer_file, upgrade instructions are available here: https://esmvaltool--2946.org.readthedocs.build/projects/ESMValCore/en/2946/quickstart/configure.html#developer-configuration-fileesmvalcore.cmor.table:read_cmor_tableswhich reads the tables based on the deprecated config-developer filecmor_tables_path,default, anddefault_table_prefixarguments to various CMOR table reader classes and the classCustomInfofor reading custom CMOR tables have been deprecated because they are no longer needed with the new configuration formatCMOR_TABLESholding the CMOR tables because of issue Reduce global state and useesmvalcore.config.Sessionobjects instead #2954Before you get started
Checklist
It is the responsibility of the author to make sure the pull request is ready to review. The icons indicate whether the item will be subject to the 🛠 Technical or 🧪 Scientific review.
To help with the number pull requests: