xarray.Dataset.regridder.vertical#
- Dataset.regridder.vertical(data_var, output_grid, tool='xgcm', **options)#
Transform
data_vartooutput_grid.Supported tools:
- xgcm (https://xgcm.readthedocs.io/en/latest/index.html)
Methods: Linear, Conservative, Log
Find options at
xcdat.regridder.xgcm.XGCMRegridder()
- Parameters:
data_var (
str) – Name of the variable to transform.output_grid (
xr.Dataset) – Grid to transformdata_varto.tool (
str) – Name of the tool to use.**options (
Any) – These options are passed directly to thetool. See specific regridder for available options.
- Returns:
xr.Dataset– With thedata_vartransformed to theoutput_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")