xarray.Dataset.regridder.vertical

xarray.Dataset.regridder.vertical#

Dataset.regridder.vertical(data_var, output_grid, tool='xgcm', **options)#

Transform data_var to output_grid.

Supported tools:

Parameters:
  • data_var (str) – Name of the variable to transform.

  • output_grid (xr.Dataset) – Grid to transform data_var to.

  • tool (str) – Name of the tool to use.

  • **options (Any) – These options are passed directly to the tool. See specific regridder for available options.

Returns:

xr.Dataset – With the data_var transformed to the output_grid.

Raises:

ValueError – If tool is not supported.

Examples

Import xCDAT:

>>> import xcdat

Open a dataset:

>>> ds = xcdat.open_dataset("...")

Create output grid:

>>> output_grid = xcdat.create_grid(lev=np.linspace(1000, 1, 20))

Regrid variable using “xgcm”:

>>> output_data = ds.regridder.vertical("so", output_grid, method="linear")