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
andY
coordinates. It usesESMF
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 whilemdtol=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
totgt_grid
.- Parameters
src_grid (
iris.cube.Cube
) – TheCube
defining the source grid.tgt_grid (
iris.cube.Cube
) – TheCube
defining the target grid.
- Returns
- A callable instance of a regridder with the interface:
regridder(cube)
… where
cube
is aCube
with the same grid assrc_grid
that is to be regridded to the grid oftgt_grid
.
- A callable instance of a regridder with the interface:
- Return type
- 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
andtgt_grid
.- Parameters
src_grid (
iris.cube.Cube
) – The rectilinearCube
providing the source grid.tgt_grid (
iris.cube.Cube
) – The rectilinearCube
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 whilemdtol=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
withdata
values calculated using the area weighted mean ofdata
values fromsrc_cube
regridded onto the horizontal grid ofgrid_cube
.- Parameters
src_cube (
iris.cube.Cube
) – A rectilinear instance ofCube
that supplies the data, metadata and coordinates.grid_cube (
iris.cube.Cube
) – A rectilinear instance ofCube
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
\ ‘sdata
array will be masked if the fraction of masked data in the overlapping cells ofsrc_cube
exceedsmdtol
. This fraction is calculated based on the area of masked cells within each target cell.mdtol=0
means no missing data is tolerated whilemdtol=1
will mean the resulting element will be masked if and only if all the overlapping cells ofsrc_cube
are masked.
- Returns
A new
Cube
instance.- Return type