-
Notifications
You must be signed in to change notification settings - Fork 39
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
Add basic support for variable mappings #1124
Conversation
I think this is functionally ready. It is still missing documentation and tests, plus the checks fail. On the failing checks, I think all of them are spurious. In detail: Codacy complains about two things, namely that The commit checks fail as follows:
Questions: |
This looks like #876. I think the test could be improved so it uses the actual date instead of a string formatted version. |
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.
Looks good @zklaus!
I inserted one comment as a review (see above). I also suggested (maybe in your private repository's branch) to make a change in cmor/_fixes/fix.py, to write
in order to add a capacity to this function (with backward compatibility), which allows fix method to easily access cubes using project's specific variable name (by providing project's specific key for this variable name) |
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.
That's look fine, except for the review comment below and maybe an extended version of get_cube_from_list (see other comment)
I was able to run a basic test with a recipe using simultaneously IPSL data in its two formats (mono-var and multi-var files) by defining two projects for that. For the time being, I cannot use project native6 for such a simultaneous use of two data formats (as long as the DRS cannot be chosen on a dataset instance basis)
@stefsmeets, to make the tests work, I had to add validation for a new option in |
@senesis, I have added your suggestion for a mapping_key to the get_cube_from_list method. I have also implemented a config option for the extra_facets_dir, see discussion above. Do you have any other comments? |
Perhaps it is not necessary to copy the entire function, see my comment for a possible different approach! Can you also add some tests for the new function?
That depends on what is needed from the config. |
Just a concept question. ¿Why you decided to keep the |
I just see that this is indeed what you are doing, but then why have the extra parameter for the fix function? |
@jvegasbsc, thanks for looking at this. I'm sorry, but I am not sure I understand. I see no |
This also fixes the related test for the experimental config system.
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.
Quickly scanned the PR now, just two more comments on the documentation. I noticed that several of the tests are failing, but that looks unrelated to this pull requests. Trying to fix that in the fix-tests branch now..
Ideally all tests would need to be green before merging this. |
Assuming the fixes coming in from main took care of the circleci stuff (as yet to be seen), this leaves us with a couple of codacy issues. They are:
|
* Add basic support for variable mappings * Add first era5 mapping * Find files for CMIP6 DCPP startdates (#771) * First attempte * Do not require start and end years, add them later * Correct condition * Avoid key error in fx variables * Consider two possible paths * Fix function name * Fix variable name * Avoid duplicates in filename * Add test for startdate expansion * Add test for the replace tags method * Rename tag * Add documentation * Allow to load subexps per timerange or as a whole * Fix condition * Remove 'all_years' functionality * Fix conditions * Fix flake * Remove whitespace Co-authored-by: Javier Vegas-Regidor <javier.vegas@bsc.es> * Skip regridding if the target grid is almost identical to the source grid (#507) Co-authored-by: Bouwe Andela <b.andela@esciencecenter.nl> Co-authored-by: Stef Smeets <s.smeets@esciencecenter.nl> * Fixes for sos and siconc of BCC models (#1090) * sos and siconc fixed * tests added * test fixed * fix flake8 * fix flake8 * fix codacy issue * Pin cf-units and fix tests (cf-units>=2.1.5) (#1140) * pin cf-units * pin cf-units * fix test * fix test * Handle IPSL-CM6 (the feature won't actually work without #1124) * class Huss inherits from cass Tas. Also : Fix codacy diags. * Replace os.system() by subprocess.run() * Fix flake8 diags * var_mapping -> extra_facets * Rename _config/variable_details to _config/extra_facets * Fix doc re. lack of 'output_file as a dict', and choice of native6 * Fix codacy diags in ipsl_cm6.py * Use project IPSLCM to handle IPSL-CM6 * Implement changes according to Bouwe's review, 2021/06/07 (except unit tests) * Add unit tests for _fixes/ipslcm/ipsl_cm6.py * delete esmvalcore/cmor/_fixes/native6/ipsl_cm6.py * Delete old file esmvalcore/_config/extra_facets/native6-ipsl-cm6-mappings.yml * Restore main versions for _recipe.py and cmor_fixes/fix.py * Restore main version for _recipe.py * Delete extraneous era5-mappings.yml * Avoid using mapping_key when calling fix.get_cube_from_list() * Empty change in fix.py for forcing codacy to re-scan it * Polish doc * Polish doc again * Again... * and again ... * Fix typo in comment * Fixes according to @zklaus review * Reduce formatting changes * Update doc/develop/fixing_data.rst Co-authored-by: Klaus Zimmermann <klaus.zimmermann@smhi.se> * Update doc/develop/fixing_data.rst Co-authored-by: Klaus Zimmermann <klaus.zimmermann@smhi.se> * Update doc/develop/fixing_data.rst Co-authored-by: Klaus Zimmermann <klaus.zimmermann@smhi.se> * Update doc/develop/fixing_data.rst Co-authored-by: Klaus Zimmermann <klaus.zimmermann@smhi.se> * Update doc/develop/fixing_data.rst Co-authored-by: Klaus Zimmermann <klaus.zimmermann@smhi.se> * Update doc/develop/fixing_data.rst Co-authored-by: Klaus Zimmermann <klaus.zimmermann@smhi.se> * Update doc/develop/fixing_data.rst Co-authored-by: Klaus Zimmermann <klaus.zimmermann@smhi.se> * Update doc/quickstart/find_data.rst Co-authored-by: Klaus Zimmermann <klaus.zimmermann@smhi.se> * Update doc/quickstart/find_data.rst Co-authored-by: Klaus Zimmermann <klaus.zimmermann@smhi.se> * Minor formatting improvements * Organize mapping file in each realm in two sections (CMIP6 and IPSL) Co-authored-by: Klaus Zimmermann <klaus.zimmermann@smhi.se> Co-authored-by: sloosvel <45196700+sloosvel@users.noreply.github.com> Co-authored-by: Javier Vegas-Regidor <javier.vegas@bsc.es> Co-authored-by: Benjamin Müller <b.mueller@iggf.geo.uni-muenchen.de> Co-authored-by: Bouwe Andela <b.andela@esciencecenter.nl> Co-authored-by: Stef Smeets <s.smeets@esciencecenter.nl> Co-authored-by: Rémi Kazeroni <70641264+remi-kazeroni@users.noreply.github.com> Co-authored-by: Valeriu Predoi <valeriu.predoi@gmail.com>
Description
Closes #1157
Link to documentation: https://esmvaltool--1124.org.readthedocs.build/projects/ESMValCore/en/1124/develop/extra_facets.html#
Before 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: