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, pixels_per_tile: int = 128, other_chunks: dict | None = None, resampling: Literal['bilinear', 'nearest'] | dict = 'bilinear', clear_attrs: bool = False) DataTree#

Create a multiscale pyramid of a dataset via resampling.

Parameters#

dsxarray.Dataset

The dataset to create a multiscale pyramid of.

ystring

name of the variable to use as y axis of the CF area definition

xstring

name of the variable to use as x axis of the CF area definition

projectionstr, optional

The projection to use. Default is web-mercator.

levelsint, optional

The number of levels to create. If None, the number of levels is determined by the number of tiles in the dataset.

pixels_per_tileint, optional

Number of pixels per tile, by default 128

other_chunksdict

Chunks for non-spatial dims to pass to chunk(). Default is None

resamplingstr 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_attrsbool, False

Clear the attributes of the DataArrays within the multiscale pyramid. Default is False.

Returns#

dt.DataTree

The multiscale pyramid.

Warnings#

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