UGRID Loading (AVD-1656, AVD-1657, AVD-1660)#4058
UGRID Loading (AVD-1656, AVD-1657, AVD-1660)#4058pp-mo merged 23 commits intoSciTools:mesh-data-modelfrom
Conversation
|
@pp-mo I've responded to your suggestions from our offline conversations. Still got some more tests to add (see main description). |
|
I consider this now done
|
* LFRic UGRID 2D file. Twin commit: SciTools/iris@828ca49 * Advance version number.
|
Ready to go @pp-mo. There's a single broken link check but having looked I think that might come back if re-run later. |
pp-mo
left a comment
There was a problem hiding this comment.
Not much to worry about here.
I'm sending this now, and I think that is mostly it for the main code.
But I haven't checked out any much of the tests yet, so I intend to add another review after.
pp-mo
left a comment
There was a problem hiding this comment.
Hi @trexfeathers here's my remaining suggestions, all about the testing this time.
Nothing major, as you might expect !
In addition though, I must say I am rather dispirited at the extent of boilerplate copying in the tests for the new ugrid-specific CFVariable dataclasses, specifically the various 'identify' methods.
But after some reflection, I have thoroughly convinced myself that this is just not your "fault" (!), and this is not the time to address it.
There are several reasons for this IMHO :
So, I was just generally "complaining" about that really, and I don't think it is appropriate to ask for any further improvements here as it would mean a lot of refactoring. |
@pp-mo I appreciate what you're saying. IMO it's a problem that the existing I would have preferred a more abstracted solution, but my implementation has been driven by three things:
Anyway I'll stop moaning since it sounds like you agree with me 😆 |
|
Fabulous, thanks @pp-mo! |
🚀 Pull Request
Description
This PR implements correct parsing of UGRID content in NetCDF files, creating our new data model objects and attaching the resulting
MeshCoords to the loaded cube(s).The functionality is provided in
iris.experimental.ugrid, making it an optional alternative to the standard functionality, and making it clear that it is subject to rapid change.How it works
The user accesses the alternative functionality by wrapping their loading calls in a context manager -
experimental.ugrid.parse_ugrid_on_load()- which instructs the loading internals to not usenetcdf.load_cubes(), but instead use an enhanced UGRID-aware version -experimental.ugrid.load_cubes().This allows us to offer all the existing loading goodness without needing to write UGRID-versions of most of the code. I can confirm from rough testing that users can still use constraints and callbacks on the non-UGRID elements of the file. If there are elements that don't work with the UGRID file elements (e.g. a constraint on latitude), that's fine since it's still
experimentaland we haven't yet promised such functionality.Re-integration
To achieve good isolation in
experimental.ugrid, I have sub-classed/replicated elements fromfileformats.netcdfandfileformats.cf. But I originally wrote my code within the existing structure as a PoC, so I hope this means there should be little trouble when we eventually foldexperimental.ugridinto Iris' standard functionality.To do
Mesh.toMeshCoord()unit testsnetcdf.load_cubes()unit testsConsult Iris pull request check list