nctoolkit.DataSet.to_latlon#
- DataSet.to_latlon(lon=None, lat=None, res=None, method='bil', recycle=False, one_grid=False)#
to_latlon: Regrid a dataset to a regular latlon grid
- Parameters:
lon (list) – 2 element list giving minimum and maximum longitude of target grid
lat (list) – 2 element list giving minimum and maximum latitude of target grid
res (float, int or list) – If float or int given, this will be the horizontal and vertical resolution of the target grid. If 2 element list is given, the first element is the longitudinal resolution and the second is the latitudinal resolution.
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) – Do you want the grid and weights to be available for recycling and use in regrid? Defaults to False
one_grid (bool) – Set to True if all files in multi-file dataset have the same grid, to speed things up.
Examples
Regrid a dataset to a 0.25 degree latlon grid over the UK: >>> ds.to_latlon(lon=[-10, 10], lat=[50, 60], res=0.25)
Regrid a dataset to a 0.25 degree latlon grid over the UK, using nearest neighbour interpolation:
>>> ds.to_latlon(lon=[-10, 10], lat=[50, 60], res=0.25, method="nn")