xarray.Dataset.regridder.horizontal_xesmf#

Dataset.regridder.horizontal_xesmf(data_var, output_grid, **options)#

Extends the xESMF library for horizontal regridding between structured rectilinear and curvilinear grids.

This method extends xESMF by automatically constructing the xe.XESMFRegridder object, preserving source bounds, and generating missing bounds. It regrids data_var in the dataset to output_grid.

Option documentation xcdat.regridder.xesmf.XESMFRegridder()

Parameters
  • data_var (str) – Name of the variable in the xr.Dataset to regrid.

  • output_grid (xr.Dataset) – Dataset containing output grid.

  • options (Dict[str, Any]) – Dictionary with extra parameters for the regridder.

Returns

xr.Dataset – With the data_var variable on the grid defined in output_grid.

Raises

ValueError – If tool is not supported.

Examples

Generate output grid:

>>> output_grid = xcdat.create_gaussian_grid(32)

Regrid data to output grid using xesmf:

>>> ds.regridder.horizontal_xesmf("ts", output_grid)