-
Notifications
You must be signed in to change notification settings - Fork 279
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
Meshcoord metadata follows face/edge coords where present. #5020
Conversation
Ping @schlunma This code should give an idea of whether the idea works. Please note
The currently-proposed code is allowing matches where one of the two coords is missing a standard/long-name or units property. And it makes no requirement for attributes to match. |
Thanks @pp-mo for these changes! I fully agree with your suggestions here that iris cannot accept node and face/edge coordinate metadata to be different. The main problem I'm having right now and described in #4860 is that currently they can differ (which even can lead to wrong results when the units differ!), so not allowing these to differ in first place also solves my problem. Three comments on this:
Unfortunately I probably won't have the chance to actually test this before the ESMValTool workshop, but the code changes look really good already. I am happy to focus on this during the workshop. Cheers, and thanks again for all your work on this! 🚀 |
Some initial answers on your points ...
The iris ".var_name" carries the original file identity of an Iris object which was loaded from a variable in a netcdf file -- and it likewise determines variable name on writing out to netcdf.
I think we rejected this because of concerns about performance costs with large meshes. The UGRID checker only checks it if the arrays are "small enough", with a user-defined memory size threshold. Which I think works OK for a command utility, but is not really appropriate for Iris. Though ... the ugrid-checker position is a bit different, since unlike Iris it is intended to cover all UGRID (**). (**) with the rather notable exception of 3d meshes / volumes ! |
This one is maybe a bit trickier ...
As the meaning of the 'coordinate' metadata in UGRID is nowhere explicitly stated, I'm not confident that there is a solid logic to determine on this. So I wanted to be very tolerant of what we find in a file, since in the past Iris loading code has often proved too strict, and we have had to install extra workarounds + issue warnings so that it can cope with "incorrect" non-CF input rather than failing to load it altogether. Details... in this case, I reckon that we could+should cope if one or other of the "face/edge" and "node" coordinates does not have a usable identity at all (i.e. a name or units). (maybe this could be seen like a regular bounds-variable, getting its identity from the parent variable). I am also allowing the other to be missing a name or units, so that only a definite conflict will cause an error. However, I now see that when something does go wrong by this definition, it will cause a load failure. N.B. at present, this is rather undermined by the Mesh class, which currently requires coordinates to have names that identify an axis. |
From offline discussion with @bjlittle @schlunma ..
@bjlittle standing ready to merge ! |
4e79981
to
c383c49
Compare
Replaced earlier code with much simpler implementation (and tests likewise), |
The new, intended behaviour, is that:
|
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 for all these changes @pp-mo ! I just tested this within ESMValTool and it indeed solves our problems 🎉
I didn't test this in too much detail (e.g., if it successfully fails the metadata of the nodes and faces differs), but the code looks fine to me 👍 Cheers, thanks for all your help on this!!
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.
@pp-mo This looks really good to me 🤩
Just a minor comment to service, otherwise let's get this banked 👍
@pp-mo Do you fancy also adding a |
Thanks @bjlittle hope that does ok |
Addresses #4860