Regrid

class ESMF.api.regrid.Regrid(*args, **kwargs)

The Regrid object represents a regridding operator between two Fields. The creation of this object is analogous to ESMF_FieldRegridStore(), and calling this object corresponds to ESMF_FieldRegrid(). ESMF_FieldRegridRelease() is called when the Regrid object goes out of scope (this only happens when the Manager goes out of scope, there is a destroy() call for explicit deallocation of the Regrid).

For more information about the ESMF Regridding functionality, please see the ESMF Regrid documentation.

The following arguments are used to create a handle to a Regridding operation between two Fields.

REQUIRED:

Parameters:
  • srcfield (Field) – source Field associated with an underlying Grid, Mesh or LocStream.
  • dstfield (Field) – destination Field associated with an underlying Grid, Mesh or LocStream. The data in this Field may be overwritten by this call.

OPTIONAL:

Parameters:
  • src_mask_values (ndarray) – a numpy array of values that should be considered masked value on the source Field.
  • dst_mask_values (ndarray) – a numpy array of values that should be considered masked value on the destination Field.
  • regrid_method (RegridMethod) – specifies which RegridMethod to use. If None, defaults to BILINEAR.
  • pole_method (PoleMethod) – specifies which type of artificial pole to construct on the source Grid for regridding. If None, defaults to: NONE for regridmethod == CONSERVE, or ALLAVG for regridmethod != CONSERVE.
  • regrid_pole_npoints (int) – specifies how many points to average over if polemethod == ALLAVG.
  • line_type (LineType) – select the path of the line that connects two points on the surface of a sphere. This in turn controls the path along which distances are calculated and the shape of the edges that make up a cell. If None, defaults to: GREAT_CIRCLE for regridmethod == CONSERVE, or CART for regridmethod != CONSERVE.
  • norm_type (NormType) – control which type of normalization to do when generating conservative regridding weights. If None, defaults to DSTAREA.
  • unmapped_action (UnmappedAction) – specifies which action to take if a destination point is found which does not map to any source point. If None, defaults to ERROR.
  • ignore_degenerate (bool) – Ignore degenerate cells when checking the input Grids or Meshes for errors. If this is set to True, then the regridding proceeds, but degenerate cells will be skipped. If set to False, a degenerate cell produces an error. This currently only applies to CONSERVE, other regrid methods currently always skip degenerate cells. If None, defaults to False.
  • src_frac_field (ndarray) – return a numpy array of values containing weights corresponding to the amount of each Field value which contributes to the total mass of the Field.
  • dst_frac_field (ndarray) – return a numpy array of values containing weights corresponding to the amount of each Field value which contributes to the total mass of the Field.
__call__(srcfield, dstfield, zero_region=None)

Call a regridding operation from srcfield to dstfield.

REQUIRED:

Parameters:
  • srcfield (Field) – the Field of source data to regrid.
  • dstfield (Field) – the Field to hold the regridded data.

OPTIONAL:

Parameters:zero_region (Region) – specify which region of the field indices will be zeroed out before adding the values resulting from the interpolation. If None, defaults to TOTAL.
Returns:dstfield
copy()

Copy a Regrid in an ESMF-safe manner.

Returns:A Regrid shallow copy.
destroy()

Release the memory associated with a Regrid.