DataSet.regrid(self, grid=None, method='bil', recycle=False, one_grid=False, \*\*kwargs)#

regrid: Regrid a dataset to a target grid

Horizontal interpolation

  • grid (nctoolkit.DataSet, pandas data frame or netCDF file) – The grid to remap to

  • method (str) – Remapping method. Defaults to “bil”. Methods available are: bilinear - “bil”; nearest neighbour - “nn” - “nearest neighbour” bicubic interpolation - “bic” Distance-weighted average - “dis” First order conservative remapping - “con” Second order conservative remapping - “con2” Large area fraction remapping - “laf”

  • recycle (bool) – Set to True if you want to re-use the remapping weights when you are regridding another dataset.

  • one_grid (bool) – Set to True if all files in multi-file dataset have the same grid, to speed things up.

  • kwargs (optional method to generate grid) – Instead of supplying a grid using ‘grid’, you can supply lon and lat. These must be equally lengthed lists or arrays that will be used to generate the grid. If you want to regrid to a single location you can just supply a float to lon and lat.


Regrid to a grid defined by a pandas data frame:

>>> ds.regrid(grid=grid_df)

Regrid to a grid defined by a netCDF file:

>>> ds.regrid(grid="")

Regrid to a grid defined by a nctoolkit.DataSet:

>>> ds.regrid(grid=grid_ds)

Regrid to a grid defined by a pandas data frame using nearest neighbour:

>>> ds.regrid(grid=grid_df, method="nn")