-
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
demote time coordinate in climate_statistics #1097
Conversation
@valeriupredoi "you're my only hope" 🚀 |
Unfortunately I don't know why the original I personally like your change (i.e., keeping the However, I think once #968 is merged this change shouldn't be necessary anymore, since #968 generalized |
Thanks @schlunma for having a look a this! Certainly some testing will be a healthy step! So far, only About #968 it is my understanding that in ESMValCore/esmvalcore/preprocessor/_multimodel.py Lines 393 to 395 in 99159ac
|
I certainly hope that's not the case, we already have lots of issues that describe the problem (e.g., #890, #891) and I think they are considered in #968. Maybe @Peter9192 or @stefsmeets can briefly clarify that for us? |
#890 is not resolved with the #968. It's not the goal of the PR, but it may be tackled in a follow-up PR, since #968 already simplifies the time implementation. At the moment multimodel statistics function fails because iris cannot guess the bounds of a cube with no time coordinate. |
All right, then I misunderstood this, sorry. As I said, I'm in favor for merging this PR (once it has been tested and some unit tests), but I think we need some more discussion about this, especially about the original purpose of the removal of the |
To add to Stef's comment: making mmstats independent of time is a bit of a challenge since we have the span argument that is explicitly about time atm. So to do that you'd have to reinterpret this argument. |
Is the time coordinate that comes out of @tomaslovato, if you look at the demoted time coordinate in the output, does the information make sense? |
Thanks @stefsmeets @Peter9192 for the clarification about the need to have I tried the aggregation with a recipe that I had (btw, falling into another issue) and to the
Note that time boundaries are so wide as the aggregation considers for the whole time period, which is coherent for the climate statistics operation ... @zklaus comments? |
Hm. Iris has gained the ability to deal with climatological bounds relatively recently. I think it would be worthwhile to checkout how we might leverage that, but it seems to me the problem here really is #890, i.e. a bug in multimodel statistics, that really should not depend on the time axis. So my suggestion is to not change climate_statistics for now, but rather fix #890 and open a feature request to include proper treatment of climatologies in the future. That might be as simple as saying |
@zklaus As I see it by now the time (and bounds) are revised within multi-model stats by |
Oh definitely. It just shouldn't depend on a time axis. That is simply a bug in multimodel statistics. |
See #744 |
@zklaus Given that the issue with time dependency in |
Now that #1150 has been merged, I think this is no longer needed. Could you please check @tomaslovato? |
@bouweandela I made a test with the recipe detailed here below and it fails with the following It is my guess that the code is crashing in the check for aligned cubes here
that goes directly into the check for time coordsESMValCore/esmvalcore/preprocessor/_multimodel.py Lines 69 to 72 in f9481e5
I frankly don't see why it is so terrible in demoting the documentation:
description: test
authors:
- lovato_tomas
datasets:
- {dataset: CMCC-ESM2, grid: gn, project: CMIP6, exp: historical, ensemble: r1i1p1f1, start_year: 2000, end_year: 2014}
- {dataset: UKESM1-0-LL, grid: gn, project: CMIP6, exp: historical, ensemble: r1i1p1f2, start_year: 2001, end_year: 2004}
preprocessors:
prep_test:
custom_order: true
extract_time:
{ start_year: 2000, start_month: 1, start_day: 1, end_year: 2001, end_month: 12, end_day: 31 }
regrid:
target_grid: 2x2
scheme: linear
climate_statistics:
operator: mean
period: month
multi_model_statistics:
span: overlap
statistics: [mean]
exclude: ['WOA']
diagnostics:
test:
variables:
tos:
preprocessor: prep_test
mip: Omon
scripts: ```
</details> |
@bouweandela there is one thing that I forgot to add in my previous comment,
|
I doubt whether that works correctly with the current implementation. What is needed, is a bit of code in the multimodel statistics preprocessor function to align the time coordinate from all the input models in case that coordinate has only 1 value, so the cubes from all models can be merged and collapsed along the new model dimension. This is needed regardless of whether the time coordinate is a dimension coordinate or an auxiliary coordinate.
I agree that there should be a single consistent behaviour. Probably it would be best to just keep the time coordinate as it is after the statistics operation, because that is how the iris authors thought it made most sense. Note that some more work on multimodel statistics is under way in #968, but as I said before, code to handle a time coordinate with just a single point is still missing. |
Now that I know this I feel kind of lucky since I always tried with monthly climatological stats !!
I fully support the consistent behaviour toward iris philosophy, so if we agree on that I can at least give a try in modifying |
@bouweandela I commited a modification to the code of |
I suspect that the time coordinate on the resulting multmodel statistic cube is completely wrong if you try to fix it like this. Because we're actively working on fixing the multimodel statistics preprocessor, I think it would be best to complete that work before starting to modify others just so they work with the omissions in the current implementation of the multimodel statistics. If you need a workaround for now, you could also compute the multimodel statistics before the climate statistics using a custom preprocessor order. |
Actually it should not, as there is the alignement of cubes ESMValCore/esmvalcore/preprocessor/_multimodel.py Lines 77 to 91 in f9481e5
which is indeed at the origin of this issue (see my comments above) since there is the missing
I tested the option you suggest, but it works at the cost of a larger computational burden... |
@bouweandela based on the previous comment and on recent discussions in #1221 on default preprocessors order I will close this PR and #1018 as won't be a problem unless the processor order will be changed in the future |
Description
The construction of a preprocessor that computes, e.g., first
climate_statistics
and thenmultimodel_statistics
fails with a missing time coordinate error from the latter because the time coordinate is removed from the cube inESMValCore/esmvalcore/preprocessor/_time.py
Lines 537 to 539 in 7f8406b
The proposed changes aims to demote the time coordinate instead of removing it (see details in #1018)
Closes #1018
Link to documentation:
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: