Quickstart ========== ``xarray-regrid`` allows you to regrid xarray Datasets or DataArrays to a new resolution. You can install xarray-regrid with pip: .. code:: shell pip install xarray-regrid To use the package, import ``xarray_regrid``. This will register the ``.regrid`` 'accessor' so it can be used. Next load in the data you want to regrid, and the data with a grid you want to regrid to: .. code:: python import xarray_regrid import xarray ds = xr.open_dataset("input_data.nc") ds_grid = xr.open_dataset("target_grid.nc") ds = ds.regrid.linear(ds_grid) # or, for example: ds = ds.regrid.conservative(ds_grid, latitude_coord="lat") Multiple regridding methods are available: * `linear interpolation `_ (``.regrid.linear``) * `nearest-neighbor `_ (``.regrid.nearest``) * `cubic interpolation `_ (``.regrid.cubic``) * `conservative regridding `_ (``.regrid.conservative``) * `zonal statistics `_ (``.regrid.stat``) is available to compute statistics such as the maximum value, or variance. Additionally, there are separate methods available to compute the `most common value `_ (``.regrid.most_common``) and `least common value `_ (``.regrid.least_common``). This can be used to upscale very fine categorical data to a more course resolution.