-
Notifications
You must be signed in to change notification settings - Fork 44
Add preprocessor align_metadata
#2789
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
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2789 +/- ##
==========================================
+ Coverage 95.42% 95.44% +0.02%
==========================================
Files 260 260
Lines 15426 15470 +44
==========================================
+ Hits 14720 14766 +46
+ Misses 706 704 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Thanks @schlunma ! This is fantastic! For most variables, this works like a charm. For lwp, I ran into the following problem:
In case of the custom variable lwp, some datasets such as the new ESACCI-CLOUD version, lwp does not need to be derived and the data provided specifies a standard_name for lwp, which should be fine. For some other datasets, lwp needs to be derived (e.g. MODIS, tier3). In this case, the custom table for lwp is applied. All custom variables have an empty standard_name. I guess this is the reason for the following error:
ValueError: Multi-model statistics failed to merge input cubes into a single array:
0: atmosphere_mass_content_of_cloud_liquid_water / (kg m-2) (time: 444)
1: Liquid Water Path / (kg m-2) (time: 444)
2: Liquid Water Path / (kg m-2) (time: 444)
3: Liquid Water Path / (kg m-2) (time: 444)
4: Liquid Water Path / (kg m-2) (time: 444)
cube.standard_name differs: 'atmosphere_mass_content_of_cloud_liquid_water' != ''
I tested this with the following example recipe:
# ESMValTool
---
documentation:
title: Reasonable variable ranges for sanity checks (OBS)
description: >
Calculate reasonable variable ranges for sanity checks.
authors:
- lauer_axel
- bock_lisa
maintainer:
- lauer_axel
preprocessors:
pp_max:
custom_order: true
align_metadata:
target_project: CMIP5
strict: false
area_statistics:
operator: mean
multi_model_statistics:
ignore_scalar_coords: true
span: full
statistics:
- operator: max
keep_input_datasets: false
climate_statistics:
operator: max
diagnostics:
lwp:
description: Calculate range of reasonable monthly values for cloud liquid water path.
variables:
lwp_max:
short_name: lwp
derive: true
preprocessor: pp_max
mip: Amon
additional_datasets:
- {dataset: ESACCI-CLOUD, project: OBS6, type: sat,
version: v3.0-AVHRR-AMPM, tier: 2,
start_year: 1982, end_year: 2016}
- {dataset: CLARA-AVHRR, project: OBS, type: sat,
version: V002-01, tier: 3,
start_year: 1982, end_year: 2018}
- {dataset: CLOUDSAT-L2, project: OBS, type: sat,
version: P1-R05-gridbox-average-noprecip,
start_year: 2006, end_year: 2017, tier: 3}
- {dataset: MAC-LWP, project: OBS, type: sat, version: v1,
tier: 3, start_year: 1988, end_year: 2016}
- {dataset: MODIS, project: OBS, type: sat, version: MYD08-M3,
tier: 3, start_year: 2003, end_year: 2018}
scripts: null
|
Can you try with |
|
We might also want to add the |
If I do so, I run into the following error: I guess the way to go would be to add the |
|
Are you 100% you changed to Changing the table unfortunately would not help, since you need a project that is not defined as CMOR-strict. |
|
It now works also for |
I guess with #2791 you could omit the preprocessor |
|
When changing |
axel-lauer
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.
Everything works now. Yay! Thumbs up for getting this merged!
|
@valeriupredoi would you be available for a brief technical review of this? This fixes a long-standing issue, and I would love to see this merged before my leave! Thanks 🍻 |
valeriupredoi
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.
thanks, Manu! Looks good and very useful! The only thing I'm concerned about is what's the margin of overloading this functionality and the chances of people trying to use it in all manners of weird used cases, replace eg air pressure cube metadata with eg depth metadata, and iris allowing it. I might have missed it, but do you do anything with the lower importance attributes, or you preserve them? 🍺
|
Well, if people abuse this feature one could overwrite the But for this, you need to specify a custom |
that's what I thought too, perfect - fire at will, Manu, I mean push at will 😁 |
Description
This PR adds the preprocessor
align_metadatawhich aligns cube metadata with a specific target project. This is useful to perform multi-model analysis across different projects (e.g., CMIP5 and CMIP6).Example recipe:
Closes #1985
Link to documentation: https://esmvaltool--2789.org.readthedocs.build/projects/ESMValCore/en/2789/recipe/preprocessor.html#align-metadata
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: