Class CoveragePyramidBuilder
Builds an in-memory CoveragePyramid from a base grid by iteratively applying an IPyramidReducer in non-overlapping 2×2 windows (S-100 Part 10c HDF5 grids; issue #486).
public static class CoveragePyramidBuilder
- Inheritance
-
CoveragePyramidBuilder
- Inherited Members
Remarks
The builder is spec-agnostic. Per-product coverage sources
(S-102, S-104, S-111) call it with a field-name → base-array
map, a per-field reducer + NODATA sentinel, and a level cap.
The builder emits one flat row-major float[] per (level,
field) pair.
Window semantics: level L+1 cell (r, c) pools the 2×2 base window at level L rows {2r, 2r+1} and columns {2c, 2c+1}. Grids with odd dimensions produce short (1- or 2-cell) windows on the trailing row / column; the reducer contract accepts variable-length spans to handle this.
Levels are added as long as either dimension is > 1 and the caller-supplied cap has not been reached. Recommended cap for S-102-sized grids is 6 (64× reduction; 2048×2048 → 32×32).
Methods
Build(int, int, double, double, IReadOnlyDictionary<string, (float[] BaseCells, IPyramidReducer Reducer, float NoDataValue)>, int)
Builds a pyramid from a base grid.
public static CoveragePyramid Build(int baseRows, int baseCols, double baseSpacingLat, double baseSpacingLon, IReadOnlyDictionary<string, (float[] BaseCells, IPyramidReducer Reducer, float NoDataValue)> fields, int maxLevels = 6)
Parameters
baseRowsintRows in the base grid (level 0).
baseColsintColumns in the base grid (level 0).
baseSpacingLatdoubleLatitudinal spacing of the base grid (native CRS units).
baseSpacingLondoubleLongitudinal spacing of the base grid (native CRS units).
fieldsIReadOnlyDictionary<string, (float[] BaseCells, IPyramidReducer Reducer, float NoDataValue)>Per-field descriptors: field name → (base cells as flat row-major
float[baseRows*baseCols], reducer, NODATA sentinel).maxLevelsintUpper bound on the number of levels including the base. Must be ≥ 1. Building stops early if a level shrinks to 1×1.
Returns
- CoveragePyramid
A CoveragePyramid whose level 0 is described but not stored (the caller's
fieldsarrays remain the source of truth for the base).