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 thexe.XESMFRegridder
object, preserving source bounds, and generating missing bounds. It regridsdata_var
in the dataset tooutput_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 thedata_var
variable on the grid defined inoutput_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)