API Reference

This page provides an auto-generated summary of esmlab’s API. For more details and examples, refer to the relevant chapters in the main part of the documentation.

Regridder(name_grid_src, name_grid_dst[, …])

Class to enable regridding between named grids.

class esmlab_regrid.core.Regridder(name_grid_src, name_grid_dst, method='bilinear', overwrite_existing=False)

Class to enable regridding between named grids.

__init__(name_grid_src, name_grid_dst, method='bilinear', overwrite_existing=False)
Parameters
name_grid_srcstring

Name of source grid.

name_grid_dststring

Name of destination grid.

methodstring, optional

Regridding method. Options are:

  • ‘bilinear’

  • ‘conservative’

  • ‘patch’

  • ‘nearest_s2d’

  • ‘nearest_d2s’

overwrite_existingbool, optional [Default=False]

Overwrite previously generated weight files.

__call__(data_in, renormalize=True, apply_mask=True)

Perform regridding on an xarray.DataArray or xarray.Dataset.

Parameters
data_inxr.DataArray or xr.Dataset

The data to regrid

renormalizebool, optional [default=True]

Logical flag to trigger renormalization of the remapping weights. This is useful if the remapping weight-file was computed with a different missing value mask than da_in. For instance, in regridding 3D ocean data, it is possible to use a mapping file computed at the surface at each successive depth level: setting renormalize=True will ensure correct handling of missing values.

apply_maskbool, optional [default=False]

Apply a missing-values mask after regridding operations.

Returns
data_outxr.DataArray or xr.Dataset

The dataarray or dataset regridded to the destination grid.