cf.RegridOperator¶

class
cf.
RegridOperator
(weights=None, row=None, col=None, coord_sys=None, method=None, src_shape=None, dst_shape=None, src_cyclic=None, dst_cyclic=None, src_mask=None, dst_mask=None, src_coords=None, src_bounds=None, start_index=0, src_axes=None, dst_axes=None, dst=None, weights_file=None, src_mesh_location=None, dst_mesh_location=None, src_featureType=None, dst_featureType=None, dimensionality=None, src_z=None, dst_z=None, ln_z=False)[source]¶ Bases:
cf.mixin_container.Container
,cfdm.abstract.container.Container
A regridding operator between two grids.
Regridding is the process of interpolating from one grid resolution to a different grid resolution.
The regridding operator stores the regridding weights; auxiliary information, such as the grid shapes; the CF metadata for the destination grid; and the source grid coordinates.
New in version 3.10.0.
Initialisation
 Parameters
 weights: array_like
The 1d array of regridding weights for locations in the 2d dense weights matrix. The locations are defined by the row and col parameters.
 row, col: array_like, array_like
The 1d arrays of the row and column indices of the regridding weights in the dense weights matrix, which has J rows and I columns, where J and I are the total number of cells in the destination and source grids respectively. See the start_index parameter.
 coord_sys:
str
The name of the coordinate system of the source and destination grids. Either
'spherical'
or'Cartesian'
. method:
str
The name of the regridding method.
 src_shape: sequence of
int
The shape of the source grid.
 dst_shape: sequence of
int
The shape of the destination grid.
 src_cyclic:
bool
For spherical regridding, specifies whether or not the source grid longitude axis is cyclic.
 dst_cyclic:
bool
For spherical regridding, specifies whether or not the destination grid longitude axis is cyclic.
 src_mask:
numpy.ndarray
orNone
, optional If a
numpy.ndarray
with shape src_shape then this is the source grid mask that was used during the creation of the weights. If src_mask is a scalar array with valueFalse
, then this is equivalent to a source grid mask with shape src_shape entirely populated withFalse
.If
None
(the default), then the weights are assumed to have been created assuming no source grid masked cells. dst_mask:
numpy.ndarray
orNone
, optional A destination grid mask to be applied to the weights matrix, in addition to those destination grid cells that have no nonzero weights. If
None
(the default) then no additional destination grid cells are masked. If a Booleannumpy
array then it must have shape dst_shape, and a value ofTrue
signifies a masked destination grid cell. start_index:
int
, optional Specify whether the row and col parameters use 0 or 1based indexing. By default 0based indexing is used.
If row and col are to be read from a weights file and their netCDF variables have
start_index
attributes, then these will be used in preference to start_index. parameters: Deprecated at version 3.14.0
Use keyword parameters instead.
 dst:
Field
orDomain
The definition of the destination grid.
 dst_axes:
dict
or sequence orNone
, optional The destination grid axes to be regridded.
 src_axes:
dict
or sequence orNone
, optional The source grid axes to be regridded.
 weights_file:
str
orNone
, optional Path to a netCDF file that contained the regridding weights. If
None
, the default, then the weights were computed rather than read from a file.New in version 3.15.2.
 src_mesh_location:
str
, optional The UGRID mesh element of the source grid (e.g.
'face'
).New in version 3.16.0.
 dst_mesh_location:
str
, optional The UGRID mesh element of the destination grid (e.g.
'face'
).New in version 3.16.2.
 src_featureType:
str
, optional The discrete sampling geometry (DSG) featureType of the source grid (e.g.
'trajectory'
).New in version 3.16.2.
 dst_featureType:
str
, optional The DSG featureType of the destination grid (e.g.
'trajectory'
).New in version 3.16.2.
 src_z: optional
The identity of the source grid vertical coordinates used to calculate the weights. If
None
then no source grid vertical axis is identified.New in version 3.16.2.
 dst_z: optional
The identity of the destination grid vertical coordinates used to calculate the weights. If
None
then no destination grid vertical axis is identified.New in version 3.16.2.
 ln_z:
bool
, optional Whether or not the weights were calculated with the natural logarithm of vertical coordinates.
New in version 3.16.2.
 dimensionality:
int
, optional The number of physical regridding dimensions. This may differ from the corresponding number of storage dimensions in the source or destination grids, if either has an unstructured mesh or a DSG featureType.
New in version 3.16.2.
Methods
Return a deep copy. 

A full description of the regrid operator. 

Convert the weights to 
Attributes
The 1d array of the column indices of the regridding weights. 

The name of the regridding coordinate system. 

The number of physical regridding dimensions. 

The definition of the destination grid. 

The destination grid axes to be regridded. 

Whether or not the destination grid longitude axis is cyclic. 

The DSG featureType of the destination grid. 

A destination grid mask to be applied to the weights matrix. 

The UGRID mesh element of the destination grid. 

The shape of the destination grid. 

The identity of the destination grid vertical coordinates. 

Whether or not vertical weights are based on ln(z). 

The name of the regridding method. 

The name of the regridding method. 

The 1d array of the row indices of the regridding weights. 

The source grid axes to be regridded. 

The bounds of the source grid cells. 

The coordinates of the source grid cells. 

Whether or not the source grid longitude axis is cyclic. 

The DSG featureType of the source grid. 

The source grid mask that was applied during the weights creation. 

The shape of the source grid. 

The UGRID mesh element of the source grid. 

The identity of the source grid vertical coordinates. 

The start index of the row and column indices. 

The 1d array of the regridding weights, or 

The file which contains the weights, or 
Deprecated¶
Methods
Return a regrid operation parameter. 

Get the CF metadata parameters for the destination grid. 
Special¶
Methods