-
Notifications
You must be signed in to change notification settings - Fork 38
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
Allow grouping input cubes by date (instead of filename) for fix_metadata
#2551
base: main
Are you sure you want to change the base?
Conversation
Here's a small recipe to test this for rsut (I also included rsdt to ensure that this still works fine): # ESMValTool
---
documentation:
title: test
description: test
authors:
- schlund_manuel
datasets:
- {project: native6, dataset: ERA5, type: reanaly, version: v1, tier: 3, timerange: 2000/2001}
diagnostics:
test:
variables:
rsut:
mip: Amon
rsdt:
mip: Amon
scripts:
null Input files need to be arranged like this:
@bouweandela do you think this approach is a reasonable solution to this problem? As mentioned in the description, it doesn't solve the problem for all cases, but a different grouping will be necessary for all of them. And it is fully sufficient for the ERA5 netCDF case. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2551 +/- ##
==========================================
- Coverage 94.91% 94.83% -0.08%
==========================================
Files 251 251
Lines 14261 14282 +21
==========================================
+ Hits 13536 13545 +9
- Misses 725 737 +12 ☔ View full report in Codecov by Sentry. |
Description
This PR allows grouping the input cubes for our
fix_metadata
functions by date, i.e., all files with the same data range are passed to the fix simultaneously). This can be enabled by setting the class variableGROUP_CUBES_BY_DATE = True
in the corresponding fix class. This allows implementing fixes where variables from multiple input files are necessary (for example, to derive rsut for ERA5).This solution only works for projects where the input files are located in the same directory, and the input file pattern is flexible enough to find all files. This is fine for the native ERA5 data in netCDF format (that we need to manually download and put into the corresponding directories). For other projects where files are stored in different directories, further changes are necessary (potentially in
local.py
). However, this PR is a prerequisite to make these other cases work.By default, input cubes are grouped by filename for
fix_metadata
(i.e., eachfix_metadata
call operates only on a single file):ESMValCore/esmvalcore/cmor/fix.py
Lines 197 to 204 in fd82b43
Note that this is fully backwards-compatible since the new functionality needs to be explicitly enabled.
Closes #1806
Link to documentation: TBA
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: