Closed mattjbr123 closed 3 weeks ago
I'm currently unsure why this only occurs for spherical grids and not cartesian grids... Will investigate.
Because a different method is used to calculate area of cartesian grids: https://github.com/unifhy-org/unifhy/blob/0e16755d40ec4dd7da7212b0579ff1172faf6364/unifhy/space.py#L4782
This will be fixed in CF-Python v3.16.2, and I have made changes to unifhy to accomodate the slight change in syntax required, hence the requirement for CF-Python for unifhy is now v3.16.2.
The refactor of the CF-Python regridding code for dask implementation in v3.14.0 (https://github.com/NCAS-CMS/cf-python/pull/438) causes the calculation of grid cell area to fail for unifhy.space grids with spherical coordinates. The
_compute_cell_area
function in unifhy.space uses theESMF.Regrid
operator calculated as part of a regridding operation initiated through CF-Python.In CF-Python v3.13.1 (the version immediately prior to v3.14.0) the
return_operator
kwarg to thecf-python.field.regrids
function returns acf.RegridOperator
object via theregrid_create_operator
function in cf-python/regrid/utils. Thecf.RegridOperator
object has a 'regrid' attribute which is theESMF.Regrid
operator object associated with the regrid requested.This behaviour changes in v3.14.0.
cf-python.regrids
andregridc
now call theregrid
worker function in a new regrid/regrid file and thecf.RegridOperator
object returned by it no longer has aregrid
attribute from which to access theESMF.Regrid
operator object. Instead, this functionality is separated out from thecf.RegridOperator
object and incorporated into theregrid
worker function/subfunctions, which will return theESMF.Regrid
operator if areturn_esmpy_regrid_operator=True
kwarg is passed to it. However, neitherregrids
orregridc
define this kwarg, so the only way to access theESMF.Regrid
operator is by calling the regrid worker function directly, which is probably not good practice, but might be a necessary workaround for now to get UnifHy working again.