-
Notifications
You must be signed in to change notification settings - Fork 43
Fix ERA5 native6 fix to handle single monthly-averaged NetCDF files. #2512
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
base: main
Are you sure you want to change the base?
Conversation
|
Hi @schlunma, @valeriupredoi, Could someone please take a moment to review this for me? Thanks! R |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2512 +/- ##
==========================================
- Coverage 95.46% 95.42% -0.04%
==========================================
Files 260 260
Lines 15526 15513 -13
==========================================
- Hits 14822 14804 -18
- Misses 704 709 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
for more information, see https://pre-commit.ci
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.
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.
This currently breaks support for daily ERA5 data that has been added in #2178.
|
In order to maintain a backlog of relevant pull requests, we automatically label them as stale after 180 days of inactivity. If this pull request is still important to you, please comment below to remove the stale label. Otherwise, this pull request will be automatically closed in 60 days. If this pull request only suffers from a lack of reviewers, please tag the @ESMValGroup/technical-lead-development-team so they can help you find a suitable reviewer. |
|
I will look into this again to fix the single monthly files |
|
@schlunma @valeriupredoi @ESMValGroup/esmvaltool-developmentteam |
|
We discussed this feature in the associated issue, and there I suggested #2511 (comment). Does that not work? |
Ah I missed that sorry, I'll test it out and found that it still runs the
ESMValCore/esmvalcore/cmor/_fixes/native6/era5.py Lines 585 to 587 in 9ef036a
I can change this part in this PR |
|
@bouweandela I've updated, let me know what you think. thanks! |
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 fine now. I wonder if we could completely get rid of the get_frequency function?
It would be nice to add a unit test, could you do that?
| def _fix_monthly_time_coord(cube, frequency): | ||
| """Set the monthly time coordinates to the middle of the month.""" | ||
| if get_frequency(cube) == "monthly": | ||
| if frequency in ("monthly", "mon", "mo"): |
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.
Maybe "mo" is not needed, as it looks like monthly frequency will be either "monthly" as returned by the get_frequency function or "mon" from the CMOR table:
ESMValCore/esmvalcore/cmor/tables/cmip6/Tables/CMIP6_CV.json
Lines 2460 to 2477 in 9ef036a
| "frequency":{ | |
| "1hr":"sampled hourly", | |
| "1hrCM":"monthly-mean diurnal cycle resolving each day into 1-hour means", | |
| "1hrPt":"sampled hourly, at specified time point within an hour", | |
| "3hr":"sampled every 3 hours", | |
| "3hrPt":"sampled 3 hourly, at specified time point within the time period", | |
| "6hr":"sampled every 6 hours", | |
| "6hrPt":"sampled 6 hourly, at specified time point within the time period", | |
| "day":"daily mean samples", | |
| "dec":"decadal mean samples", | |
| "fx":"fixed (time invariant) field", | |
| "mon":"monthly mean samples", | |
| "monC":"monthly climatology computed from monthly mean samples", | |
| "monPt":"sampled monthly, at specified time point within the time period", | |
| "subhrPt":"sampled sub-hourly, at specified time point within an hour", | |
| "yr":"annual mean samples", | |
| "yrPt":"sampled yearly, at specified time point within the time period" | |
| }, |
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 @bouweandela, I'm not sure I can speak to the get_frequency function.. it was added for some use cases?
I have added a test for "mon" frequency repeating one for "monthly"
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.
I have added a test for "mon" frequency repeating one for "monthly"
Great!
Thanks @bouweandela, I'm not sure I can speak to the get_frequency function.. it was added for some use cases?
It was added before we passed all the facets and their values from the recipe to the fix functions. I've thought about it some more, and it can be removed. In rare cases where the frequency is wrongly inferred from the mip, the user can specify the right frequency value in the recipe.
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.
ah ok, should I create a new issue/PR to discuss specifically or I can just change here?
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.
You can just change it here
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.
Removing get_frequency I had to parse the frequency to fix_hourly_time_coordinate and fix_accumulated_units which I think works, similar to _fix_monthly_time_coord but the tests are failing, not sure what i'm missing? the fixes aren't applied? @bouweandela
This reverts commit 4948f38.
|
I have reverted the changes of removing the |
Description
Modifies the
get_frequencyfunction in ERA5 native6 fix to handle case where monthly-averaged data are stored in single NetCDF file (one file per month) and have thus a time dimension length of 1.Closes #2511
Link to documentation:
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: