healpix_convert.PyramidSettings#
- class healpix_convert.PyramidSettings(*, derived_levels, subgroup_name=None, reduce='mean', codecs=None, coarsen_from='nearest')[source]#
Settings for generating a pyramid of coarser HEALPix refinement levels in a multiscale group.
The derived levels given by
derived_levelsare aggregated from the levels converted from the input data (the native levels of the multiscale group).The derived levels are written in the multiscale group, next to the native levels or in a child group of its own (see
subgroup_name).Every child group of the multiscale group must be converted with the
healpix_cell_densechunk method: the cells of such a chunk are all the children of one HEALPix cell, which is what lets the derived levels be aggregated by position (seegenerate_pyramids()).- derived_levels#
HEALPix refinement levels to derive, e.g.
[18, 16].Each of them must be coarser than the finest native level of the multiscale group and must not be one of its native levels (which are converted from the input data).
- subgroup_name#
Name of a new group, direct child of the multiscale group, where the derived levels are written, e.g. “pyramids”:
reflectance (multiscale group) ├── 20 (native level) ├── 19 (native level) ├── 17 (native level) └── pyramids ├── 18 (derived level) └── 16 (derived level)If None (default), the derived levels are written next to the native levels, as direct children of the multiscale group:
reflectance (multiscale group) ├── 20 (native level) ├── 19 (native level) ├── 18 (derived level) ├── 17 (native level) └── 16 (derived level)
Either way the multiscale group holds every level of the pyramid, and its multiscales metadata describes them all.
- reduce#
How the values of the children cells are aggregated.
Missing (NaN) values are skipped. The mean does not suit categorical data (masks, classifications): aggregate those with “mode”, the most frequent value of the cells of a block (the smallest of them in case of a tie).
- codecs#
Zarr codecs of the aggregated data variables of every derived level (Zarr’s defaults if None), e.g. a serializer that codes the cells of one HEALPix cell per chunk, which the chunks of the derived levels are.
As for the
codecsgroup setting, each codec is looked up by name in Zarr’s codec registry where the settings are created. The converted levels keep the codecs they were written with.
- coarsen_from#
Which native level a variable converted at several levels is aggregated from: the nearest level at or finer than the derived level (default), i.e., the copies resampled by the data provider are kept and reused, or always its finest native level, i.e., those copies are ignored.