ndpyramid.pyramid_resample

ndpyramid.pyramid_resample#

ndpyramid.pyramid_resample(ds: Dataset, *, x: str, y: str, projection: Literal['web-mercator', 'equidistant-cylindrical'] = 'web-mercator', levels: int | None = None, level_list: Sequence[int] | None = None, pixels_per_tile: int = 128, other_chunks: dict | None = None, resampling: Literal['bilinear', 'nearest'] | dict = 'bilinear', clear_attrs: bool = False) DataTree[source]#

Create a multiscale pyramid of a dataset via resampling.

Parameters:
  • ds (xarray.Dataset) – The dataset to create a multiscale pyramid of.

  • y (string) – name of the variable to use as y axis of the CF area definition

  • x (string) – name of the variable to use as x axis of the CF area definition

  • projection (str, optional) – The projection to use. Default is web-mercator.

  • levels (int, optional) – Number of contiguous levels starting at 0 to create. Mutually exclusive with level_list.

  • level_list (Sequence[int], optional) – Explicit list of zoom levels to build (e.g. [4]). Mutually exclusive with levels.

  • pixels_per_tile (int, optional) – Number of pixels per tile, by default 128

  • other_chunks (dict) – Chunks for non-spatial dims to pass to chunk(). Default is None

  • resampling (str or dict, optional) – Pyresample resampling method to use (bilinear or nearest). Default is bilinear. If a dict, keys are variable names and values are resampling methods.

  • clear_attrs (bool, False) – Clear the attributes of the DataArrays within the multiscale pyramid. Default is False.

Returns:

The multiscale pyramid.

Return type:

xr.DataTree

Warning

  • Pyresample expects longitude ranges between -180 - 180 degrees and latitude ranges between -90 and 90 degrees.

  • 3-D datasets are expected to have a dimension order of (time, y, x).

Ndpyramid and pyresample do not check the validity of these assumptions to improve performance.