pyinterp.backends.xarray.DatasetAccessor.regrid

pyinterp.backends.xarray.DatasetAccessor.regrid#

DatasetAccessor.regrid(coords=None, method='conservative', **coords_kwargs)[source]#

Regrid the variables of the dataset, conserving their integrals.

The variables defined on both regridded dimensions are regridded as with DataArrayAccessor.regrid(); their other dimensions are kept. The variables that depend on neither are kept as they are. The others, such as the bounds of the source cells, are dropped.

The CF bounds variables of the source coordinates, named by their bounds attribute, give the bounds of the source cells. The result holds the bounds of the target cells, under the same name (or <dimension>_bnds), referenced by the bounds attribute of the target coordinates.

Parameters:
  • coords (Mapping[Hashable, Any] | None) – Mapping from dimension names to the target cells.

  • method (RegriddingMethods) – Regridding method, only "conservative" for now.

  • **coords_kwargs (Any) – The target cells, for keyword arguments named after a dimension of the dataset, or options of the regridding (see DataArrayAccessor.regrid()).

Returns:

A dataset holding the regridded variables, the variables kept and the bounds of the target cells, with the attributes of the dataset.

Raises:

ValueError – If no variable is defined on the regridded dimensions.

Return type:

xr.Dataset