# 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)[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.

Initialization

Parameters
weights: array_like

The 1-d array of regridding weights for locations in the 2-d dense weights matrix. The locations are defined by the row and col parameters.

row, col: array_like, array_like

The 1-d 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 or None, 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 value False, then this is equivalent to a source grid mask with shape src_shape entirely populated with False.

If None (the default), then the weights are assumed to have been created assuming no source grid masked cells.

dst_mask: numpy.ndarray or None, optional

A destination grid mask to be applied to the weights matrix, in addition to those destination grid cells that have no non-zero weights. If None (the default) then no additional destination grid cells are masked. If a Boolean numpy array then it must have shape dst_shape, and a value of True signifies a masked destination grid cell.

start_index: int, optional

Specify whether the row and col parameters use 0- or 1-based indexing. By default 0-based indexing is used.

parameters: Deprecated at version 3.14.0

dst: Field or Domain

The definition of the destination grid.

dst_axes: dict or sequence or None, optional

The destination grid axes to be regridded.

src_axes: dict or sequence or None, optional

The source grid axes to be regridded.

Methods

 copy Return a deep copy. dump A full description of the regrid operator. get_parameter Return a regrid operation parameter. parameters Get the CF metadata parameters for the destination grid. todense Return the weights in dense format. tosparse Return the weights in sparse COOrdinate format.

Attributes

 col The 1-d array of the column indices of the regridding weights. coord_sys The name of the regridding coordinate system. dst The definition of the destination grid. dst_axes The destination grid axes to be regridded. dst_cyclic Whether or not the destination grid longitude axis is cyclic. dst_mask A destination grid mask to be applied to the weights matrix. dst_shape The shape of the destination grid. method The name of the regridding method. name The name of the regridding method. row The 1-d array of the row indices of the regridding weights. src_axes The source grid axes to be regridded. src_bounds The bounds of the source grid cells. src_coords The coordinates of the source grid cells. src_cyclic Whether or not the source grid longitude axis is cyclic. src_mask The source grid mask that was applied during the weights creation. src_shape The shape of the source grid. start_index The start index of the row and column indices. weights The 1-d array of the regridding weights.

Methods