Dataset.regridder.horizontal(data_var, output_grid, tool='xesmf', **options)#

Transform data_var to output_grid.

When might Regrid2 be preferred over xESMF?

If performing conservative regridding from a high/medium resolution lat/lon grid to a coarse lat/lon target, Regrid2 may provide better results as it assumes grid cells with constant latitudes and longitudes while xESMF assumes the cells are connected by Great Circles [1].

Supported tools, methods and grids:

  • 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.


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


ValueError – If tool is not supported.



Import xCDAT:

>>> import xcdat

Open a dataset:

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

Create output grid:

>>> output_grid = xcdat.create_uniform_grid(-90, 90, 4.0, -180, 180, 5.0)

Regrid variable using “xesmf”:

>>> output_data = ds.regridder.horizontal("ts", output_grid, tool="xesmf", method="bilinear")

Regrid variable using “regrid2”:

>>> output_data = ds.regridder.horizontal("ts", output_grid, tool="regrid2")