-
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
added fix for WACCM ua time coordinate #200
Conversation
@jvegasbsc can you please review this? |
|
||
|
||
def test_ua_fix_metadata(ua_cubes): | ||
expected_coord = iris.coords.AuxCoord( |
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.
expected_coord = iris.coords.AuxCoord( | |
expected_coord = iris.coords.DimCoord( |
[1.0, 2.0, 3.0], standard_name='time', units='days since 1850-01-01', | ||
bounds=None) | ||
expected_cube = iris.cube.Cube([7.0, 9.0, 8.0], var_name='ua', | ||
aux_coords_and_dims=[(expected_coord, 0)]) |
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.
aux_coords_and_dims=[(expected_coord, 0)]) | |
dim_coords_and_dims=[(expected_coord, 0)]) |
idx_sorted = np.argsort(coord.points) | ||
coord.points = coord.points[idx_sorted] | ||
coord.bounds = None | ||
# coord.guess_bounds('time') # fails for coordinate 'time' |
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.
What is failing exactly?
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.
Agree with @bouweandela question. @hb326, note that coord
already refers to time, so I am not sure why there is another mention of time in the args. Certainly guess_bounds
works with time coordinates in general.
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 like time
could be only AuxCoord
in some cases and the time points are mangled - but if the data has enough dimensions to account for a (pseudo)time coordinate then what's in DimCoords
that replaces time?
@hb326 can you have a look at the comments above? Then we can probably merge this. |
Co-authored-by: Bouwe Andela <[email protected]>
OK I started committing stuff that @bouweandela suggested (I know, I'm nasty - changing code in a PR that has nothing to do with meself heh, but was trying to see if we can get this through to the 2.2 release) but I stopped coz it looks like we really need @hb326 to have a look and comment/commit 👍 |
I am looking at it now. Sorry, took a while. Hopefully we can get it sorted for release 2.3! |
cool stuff! just ping me here if you need a review 🍺 |
@valeriupredoi: it seems like the problem vanished! I just now ran a recipe where I try to read the WACCM data without any fix, in different variations (historical, amip, piControl), and it seems like everything is read correctly. Could you please check if you can read the following data, no need for a script, just reading the data with the ESMValTool:
Maybe some update to the Core has fixed the problem without the dataset fix? |
I should add that I am using the current master branch for the ESMValTool and the ESMValCore for this test. |
@valeriupredoi: did you check yet if WACCM would run for you without fix as well? |
@valeriupredoi: this was one of the PR I wanted you to check on. |
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.
@hb326 I understand the special case but I think it's best you add a note (in-line comment) about this particular case (it was visible to me from the test case, cheers for adding it!). But my question is - what sort of DimCoord does the cube have to account for the time axis, if time itself is an AuxCoord
idx_sorted = np.argsort(coord.points) | ||
coord.points = coord.points[idx_sorted] | ||
coord.bounds = None | ||
# coord.guess_bounds('time') # fails for coordinate 'time' |
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 like time
could be only AuxCoord
in some cases and the time points are mangled - but if the data has enough dimensions to account for a (pseudo)time coordinate then what's in DimCoords
that replaces time?
ta_cube = iris.cube.Cube([1.0], var_name='ta') | ||
time_coord = iris.coords.AuxCoord( | ||
[1.0, 3.0, 2.0], standard_name='time', units='days since 1850-01-01', | ||
bounds=[[0.5, 1.5], [2.5, 3.5], [1.5, 2.5]]) |
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 yes, this is accounted for in this test case @bouweandela and @zklaus
@hb326 could you pls do a mergy merge of |
@valeriupredoi, my thinking is that we can just forget this pull request since it seems to me that some change in the ESMValCore actually fixed the problem for which I had written the fix. Did you try to read in the WACCM ua data with the current master branch of ESMValCore and ESMValTool? Because for me it works like a charm, WITHOUT using the fix. |
I'll have a looksee now 👍 |
the file on JASMIN which is version 27-Feb-2019 I get after a raw CMOR check (just by importing the checker and running it):
so all fine, no issues with time 👍 |
Ok, it does seem like the problem that this PR was supposed to fix was fixed with an update to the ESMValCore recently. So this PR is redundant. |
fairly sure it's the data that got updated @hb326 |
Can the branch be deleted? |
@bouweandela, I would say yes, it can be deleted. |
brancho deletado, cheers @hb326 |
Time was not monotonic for a WACCM ua file, so we fixed it.
Fixing the bounds did not work. We assume because
iris.guess_bounds()
does not work for coordinate time.