On the current main branch, a Field after a regrids can return with Field.cyclic() a (cyclic) domain axes which no longer exists on the Field because it has been removed via the regridding operation. I believe this is the underlying reason that we see the issue of #756, though I think adding in a tweak to the logic there as suggested in #757 makes it more robust, so think it would be good to add regardless and will leave that PR open for consideration.
We may want to prioritise a fix for this to put in before our imminent release, because it is probably a issue with the new feature of "Added ... the option to regrid the vertical axis in logarithmic coordinates to cf.Field.regrids and cf.Field.regridc " (since it shows up in a vertical regrid, as per the details below).
Example case and behaviour
I've spent a lot of time trying to get a minimal (or at least, pared down) working example of this to share here, but I am struggling to find something so have nearly given up on a small reproducer, in favour of moving onto getting a fix since I feel like I have isolated the problem enough to do that now.
But, for detail and context, the issue has emerged as part of the breaking of our VISION end-to-end script recently as noticed during https://github.com/NCAS-CMS/cf-python/issues/756 (see the report there for the underlying error emerging). So I'll share relevant details of that here now which can hopefully shine sufficient light on the problem, since I am unsure whether I'll have time before going on leave after tomorrow to get the reduced example up.
Before the regridding we have a field a with print(a, a.constructs(), a.cyclic()) being (I added spaces between lines for clarity):
On the current
main
branch, a Field after aregrids
can return withField.cyclic()
a (cyclic) domain axes which no longer exists on the Field because it has been removed via the regridding operation. I believe this is the underlying reason that we see the issue of #756, though I think adding in a tweak to the logic there as suggested in #757 makes it more robust, so think it would be good to add regardless and will leave that PR open for consideration.We may want to prioritise a fix for this to put in before our imminent release, because it is probably a issue with the new feature of "Added ... the option to regrid the vertical axis in logarithmic coordinates to cf.Field.regrids and cf.Field.regridc " (since it shows up in a vertical regrid, as per the details below).
Example case and behaviour
I've spent a lot of time trying to get a minimal (or at least, pared down) working example of this to share here, but I am struggling to find something so have nearly given up on a small reproducer, in favour of moving onto getting a fix since I feel like I have isolated the problem enough to do that now.
But, for detail and context, the issue has emerged as part of the breaking of our VISION end-to-end script recently as noticed during https://github.com/NCAS-CMS/cf-python/issues/756 (see the report there for the underlying error emerging). So I'll share relevant details of that here now which can hopefully shine sufficient light on the problem, since I am unsure whether I'll have time before going on leave after tomorrow to get the reduced example up.
Before the regridding we have a field
a
withprint(a, a.constructs(), a.cyclic())
being (I added spaces between lines for clarity):and with a field
b
of:after an operation of:
we get, for
print(c, c.constructs(), c.cyclic())
:Notice how
'domainaxis3'
is no longer a construct on the Fieldc
, but it remains listed inc.cyclic()
, when it should have been removed.