esmf_regrid.schemes module#

Provides an iris interface for regridding.

class esmf_regrid.schemes.ESMFAreaWeighted(mdtol=0)[source]#

Bases: object

A scheme which can be recognised by iris.cube.Cube.regrid().

This class describes an area-weighted regridding scheme for regridding between horizontal grids with separated X and Y coordinates. It uses ESMF to be able to handle grids in different coordinate systems.

Area-weighted scheme for regridding between rectilinear grids.

Parameters

mdtol (float, default=0) – Tolerance of missing data. The value returned in each element of the returned array will be masked if the fraction of missing data exceeds mdtol. This fraction is calculated based on the area of masked cells within each target cell. mdtol=0 means no masked data is tolerated while mdtol=1 will mean the resulting element will be masked if and only if all the overlapping elements of the source grid are masked.

regridder(src_grid, tgt_grid)[source]#

Create regridder to perform regridding from src_grid to tgt_grid.

Parameters
Returns

A callable instance of a regridder with the interface: regridder(cube)

… where cube is a Cube with the same grid as src_grid that is to be regridded to the grid of tgt_grid.

Return type

ESMFAreaWeightedRegridder

class esmf_regrid.schemes.ESMFAreaWeightedRegridder(src_grid, tgt_grid, mdtol=0)[source]#

Bases: object

Regridder class for unstructured to rectilinear Cube\ s.

Create regridder for conversions between src_grid and tgt_grid.

Parameters
  • src_grid (iris.cube.Cube) – The rectilinear Cube providing the source grid.

  • tgt_grid (iris.cube.Cube) – The rectilinear Cube providing the target grid.

  • mdtol (float, default=0) – Tolerance of missing data. The value returned in each element of the returned array will be masked if the fraction of masked data exceeds mdtol. mdtol=0 means no missing data is tolerated while mdtol=1 will mean the resulting element will be masked if and only if all the contributing elements of data are masked.

esmf_regrid.schemes.regrid_rectilinear_to_rectilinear(src_cube, grid_cube, mdtol=0)[source]#

Regrid rectilinear Cube onto another rectilinear grid.

Return a new Cube with data values calculated using the area weighted mean of data values from src_cube regridded onto the horizontal grid of grid_cube.

Parameters
  • src_cube (iris.cube.Cube) – A rectilinear instance of Cube that supplies the data, metadata and coordinates.

  • grid_cube (iris.cube.Cube) – A rectilinear instance of Cube that supplies the desired horizontal grid definition.

  • mdtol (float, default=0) – Tolerance of missing data. The value returned in each element of the returned Cube\ ‘s data array will be masked if the fraction of masked data in the overlapping cells of src_cube exceeds mdtol. This fraction is calculated based on the area of masked cells within each target cell. mdtol=0 means no missing data is tolerated while mdtol=1 will mean the resulting element will be masked if and only if all the overlapping cells of src_cube are masked.

Returns

A new Cube instance.

Return type

iris.cube.Cube