Skip to content

Grid cell area calculation breaks with CF-Python version 3.14.0 and above #98

@mattjbr123

Description

@mattjbr123

The refactor of the CF-Python regridding code for dask implementation in v3.14.0 (NCAS-CMS/cf-python#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 the ESMF.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 the cf-python.field.regrids function returns a cf.RegridOperator object via the regrid_create_operator function in cf-python/regrid/utils. The cf.RegridOperator object has a 'regrid' attribute which is the ESMF.Regrid operator object associated with the regrid requested.

This behaviour changes in v3.14.0. cf-python.regrids and regridc now call the regrid worker function in a new regrid/regrid file and the cf.RegridOperator object returned by it no longer has a regrid attribute from which to access the ESMF.Regrid operator object. Instead, this functionality is separated out from the cf.RegridOperator object and incorporated into the regrid worker function/subfunctions, which will return the ESMF.Regrid operator if a return_esmpy_regrid_operator=True kwarg is passed to it. However, neither regrids or regridc define this kwarg, so the only way to access the ESMF.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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions