NCAS-CMS / cf-python

A CF-compliant Earth Science data analysis library
http://ncas-cms.github.io/cf-python
MIT License
119 stars 19 forks source link

Addition of return_esmpy_regrid_operator to regrids and regridc? #766

Closed mattjbr123 closed 4 months ago

mattjbr123 commented 4 months ago

Hiya, I've noticed that between v3.13.1 and v3.14.0, when the regridding code was refactored as part of the dask implentation (#438), the behaviour of the return_operatorkwarg to regrids and regridc changed. In v3.13.1 the cf.RegridOperator it returned could be used to access the ESMF.Regrid object via the regrid attribute. In v3.14.0 and beyond this is no longer the case, but a return_esmpy_regrid_operator kwarg has been added to the new regrid worker function which allows access to the ESMF.Regrid object. However this is not a kwarg available in regrids and regridc, which call regrid, so I would have to call regriddirectly to access the ESMF.Regrid object, which is probably not recommended/ideal etc.

To my relatively untrained eye it looks like there should not be a problem adding the return_esmpy_regrid_operatorkwarg to regridsand regridcand passing it to regrid, and am happy to put together a very simple PR to add this in if so, but you might be able to advise better!

More details on the issue this is causing here: https://github.com/unifhy-org/unifhy/issues/98

davidhassell commented 4 months ago

Hi Matt,

Thanks for this, and sorry that we confounded things for you! I'm sure that we can put this back, and we'd welcome a PR - thank you.

If you're really, really quick, it just might (no promises) get in to 3.16.2, due to be released later this week.

All the best, David

davidhassell commented 4 months ago

Closed by merging #768