-
Notifications
You must be signed in to change notification settings - Fork 286
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
Remove iris.experimental.fieldsfiles module #2640
Conversation
We have a use case that wasn't catered for with the structured loading, described here: #2083 (comment) Does structured loading now allow a callback call per field, or is it still a single callback call after all the fields have loaded? To be clear, I'm not saying "don't remove the unstructured loading", I'm just aiming to understand for our own planning whether this change will require us to adapt or not. |
In my view, yes (I think I probably did it ?) |
Structured loading does not implement per-field callbacks in the usual way, because a 'normal' Iris callback is called with a field and the corresponding "raw cube", and the whole point of structured loading is not to make a raw cube for each input field. In your linked issue, it is never actually explained exactly what you want to do with each field ? We could reasonably work on this to make it more flexible, as we did for other file formats when we added |
For reference,
|
@pp-mo There's an uncanny coincidence in your previous comments:
Yes, our use case is pseudo levels. We've opted for the approach of keeping the order of the pseudo levels in the source file intact in the output file. We use a callback to add a "pseudo level order" coordinate to each field which we use to ensure the same order is used on save (at the same time, we remove the additional coordinate at save). The devil is in the detail here though: we need to keep track of the pseudo levels we've seen to add the correct value of the "pseudo level order" coordinate to each field. This can't be done after all the fields are loaded, since the information we need - the order of the fields as they are being read in - is lost by the time a single callback is run. It's possible our fix is obsolete now. I hadn't seen #2274 before, and our fix for this issue pre-dates it by about 6 months. I'll test out a more recent iris without our pseudo level fix and see if we can remove our callback completely. |
For completeness, discussed offline yesterday.
I think the existing callback approach will still be be needed, as the the key problem is not with structured load per se : Structured-load itself does preserve file order, dividing the input into adjacent groups with the same stash, lbproc and pseudo-level : it is the PP rules and merge operation which make pseudo-level into a dimension, so then the values get sorted @marqh pointed out that we can potentially change the PP rules (?selectively) in some way, to retain or record the original order of pseudo-levels. Another possible temporary fix could be to use Meanwhile, on a broader view, I think it "ought" to be possible to support field-level callbacks within structured loading, as the code structure does allow it : structured-load works from an iterable of fields, so you can potentially get field-level access that way. |
Confirmed offline : |
@@ -1,325 +0,0 @@ | |||
# (C) British Crown Copyright 2014 - 2015, Met Office |
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.
We seem to have missed a trick here.
This function still exists, in a slightly enhanced form, as iris.fileformats.um._fast_load.convert_collation
So this could usefully be re-purposed to that, rather than discarded
I.E. --> iris.tests.unit.fileformats.um.fast_load.test__convert_collation.py
I checked + it did work, unmodified : just change the import "... as convert_collation".
@@ -1,65 +0,0 @@ | |||
# (C) British Crown Copyright 2014 - 2016, Met Office |
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 think it could be worthwhile to retain this as a totally-simple integration test.
- change
from iris.experimental.fieldsfile import load
-->from iris.fileformats.um import load_cubes as load
- and then rename -->
iris.tests.integration.um.test_ff_load
or somesuch ?
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.
@dkillick Pending passing tests, I am happy with this one. |
@dkillick Some licence headers need updating, and the little test changes are playing up. |
@dkillick You'll be pleased to hear that the cml chaos appears to be spreading. |
Won't I just 😒 Maybe now is the time to just remove cml tests entirely. |
Oh hangabout, the cml failures here are actually expected - the removed functionality and the replaced functionality do not have quite the same return type, but I didn't get around to fixing yesterday... |
Well that's positive. Would still be nice to just get rid of cml tests though. |
@dkillick So close... |
@corinnebosley and a merge conflict 😱 |
Seriously, the difference is outside of the printed precision 😠 I'll change the CML test type. |
Just triggerin' the tests... |
I've updated the result files for the outstanding failing tests. The loader that produces that cube to be compared has changed and does not quite have equivalent functionality; specifically the replacement loader produces a list of cubes while the replaced loader produced a single cube. Somehow merging to create a single cube produces one |
Remove deprecated module iris.experimental.fieldsfiles which has been replaced
Side note: I thought that if something was experimental it didn't need to be deprecated? Was this a special case because we knew a lot of people used it and want to be clear that they should replace it with
iris.fileformats.um.structured_um_loading
?