Field.regridc(dst, axes, method, use_src_mask=True, use_dst_mask=False, fracfield=False, axis_order=None, ignore_degenerate=True, inplace=False, i=False, _compute_field_mass=None)[source]

Return the field with the specified Cartesian axes regridded onto a new grid.

Between 1 and 3 dimensions may be regridded.

Regridding, also called remapping or interpolation, is the process of changing the grid underneath field data values while preserving the qualities of the original data.

The regridding method must be specified. First-order conservative interpolation conserves the global spatial integral of the field, but may not give approximations to the values as good as (multi)linear interpolation. Second-order conservative interpolation also takes into account the gradient across the source cells, so in general gives a smoother, more accurate representation of the source field especially when going from a coarser to a finer grid. (Multi)linear interpolation is available. The latter method is particular useful for cases when the latitude and longitude coordinate cell boundaries are not known nor inferable. Higher order patch recovery is available as an alternative to (multi)linear interpolation. This typically results in better approximations to values and derivatives compared to the latter, but the weight matrix can be larger than the linear matrix, which can be an issue when regridding close to the memory limit on a machine. It is only available in 2D. Nearest neighbour interpolation is also available. Nearest source to destination is particularly useful for regridding integer fields such as land use.


The field construct’s domain must have axes matching those specified in src_axes. The same is true for the destination grid, if it provided as part of another field. Optionally the axes to use from the destination grid may be specified separately in dst_axes.

The output field construct’s coordinate objects which span the specified axes are replaced with those from the destination grid. Any fields contained in coordinate reference objects will also be regridded, if possible.


The data array mask of the field is automatically taken into account, such that the regridded data array will be masked in regions where the input data array is masked. By default the mask of the destination grid is not taken into account. If the destination field data has more dimensions than the number of axes specified then, if used, its mask is taken from the 1-3 dimensional section of the data where the indices of all axes other than X and Y are zero.


The interpolation is carried out using the ESMPy package, a Python interface to the Earth System Modeling Framework (ESMF) regridding utility.


Whether ESMF logging is enabled or not is determined by cf.regrid_logging. If it is logging takes place after every call. By default logging is disabled.

See also


dst: Field or dict

The field containing the new grid or a dictionary with the axes specifiers as keys referencing dimension coordinates. If dst is a field list the first field in the list is used.


Select dimension coordinates from the source and destination fields for regridding. See cf.Field.axes TODO for options for selecting specific axes. However, the number of axes returned by cf.Field.axes TODO must be the same as the number of specifiers passed in.

method: str

Specify the regridding method. The method parameter must be one of the following:




Linear interpolation in the number of dimensions being regridded.

For two dimensional regridding this is bilinear interpolation, and for three dimensional regridding this is trilinear interpolation.Bilinear interpolation.


Deprecated alias for 'linear'.


First order conservative interpolation.

Preserve the area integral of the data across the interpolation from source to destination. It uses the proportion of the area of the overlapping source and destination cells to determine appropriate weights.

In particular, the weight of a source cell is the ratio of the area of intersection of the source and destination cells to the area of the whole destination cell.

It does not account for the field gradient across the source cell, unlike the second-order conservative method (see below).


Second-order conservative interpolation.

As with first order (see above), preserves the area integral of the field between source and destination using a weighted sum, with weights based on the proportionate area of intersection.

Unlike first-order, the second-order method incorporates further terms to take into consideration the gradient of the field across the source cell, thereby typically producing a smoother result of higher accuracy.


Alias for 'conservative_1st'


Higher-order patch recovery interpolation.

A second degree polynomial regridding method, which uses a least squares algorithm to calculate the polynomial.

This method gives better derivatives in the resulting destination data than the linear method.


Nearest neighbour interpolation for which each destination point is mapped to the closest source point.

Useful for extrapolation of categorical data.


Nearest neighbour interpolation for which each source point is mapped to the destination point.

Useful for extrapolation of categorical data.

A given destination point may receive input from multiple source points, but no source point will map to more than one destination point.

use_src_mask: bool, optional

For all methods other than ‘nearest_stod’, this must be True as it does not make sense to set it to False. For the

‘nearest_stod’ method if it is True then points in the result that are nearest to a masked source point are masked. Otherwise, if it is False, then these points are interpolated to the nearest unmasked source points.

use_dst_mask: bool, optional

By default the mask of the data on the destination grid is not taken into account when performing regridding. If this option is set to True then it is.

fracfield: bool, optional

If the method of regridding is conservative the fraction of each destination grid cell involved in the regridding is returned instead of the regridded data if this is True. Otherwise this is ignored.

axis_order: sequence, optional

A sequence of items specifying dimension coordinates as retrieved by the dim method. These determine the order in which to iterate over the other axes of the field when regridding slices. The slowest moving axis will be the first one specified. Currently the regridding weights are recalculated every time the mask of a slice changes with respect to the previous one, so this option allows the user to minimise how frequently the mask changes.

ignore_degenerate: bool, optional

True by default. Instructs ESMPy to ignore degenerate cells when checking the grids for errors. Regridding will proceed and degenerate cells will be skipped, not producing a result, when set to True. Otherwise an error will be produced if degenerate cells are found. This will be present in the ESMPy log files if cf.regrid_logging is set to True. As of ESMF 7.0.0 this only applies to conservative regridding. Other methods always skip degenerate cells.

inplace: bool, optional

If True then do the operation in-place and return None.

i: deprecated at version 3.0.0

Use the inplace parameter instead.

_compute_field_mass: dict, optional

If this is a dictionary then the field masses of the source and destination fields are computed and returned within the dictionary. The keys of the dictionary indicates the lat/long slice of the field and the corresponding value is a tuple containing the source field construct’s mass and the destination field construct’s mass. The calculation is only done if conservative regridding is being performed. This is for debugging purposes.

Field or None

The regridded field construct, or None if the operation was in-place.


Regrid the time axes of field f conservatively onto a grid contained in field g:

>>> h = f.regridc(g, axes='T', 'conservative')

Regrid the T axis of field f conservatively onto the grid specified in the dimension coordinate t:

>>> h = f.regridc({'T': t}, axes=('T'), 'conservative_1st')

Regrid the T axis of field f using linear interpolation onto a grid contained in field g:

>>> h = f.regridc(g, axes=('T'), method='linear')

Regrid the X and Y axes of field f conservatively onto a grid contained in field g:

>>> h = f.regridc(g, axes=('X','Y'), 'conservative_1st')

Regrid the X and T axes of field f conservatively onto a grid contained in field g using the destination mask:

>>> h = f.regridc(g, axes=('X','Y'), use_dst_mask=True, method='linear')