Skip to main content

calculateElevationSlice()

function calculateElevationSlice(
shapeElevation,
dimInfo,
selectorsElevation,
dimensionValuesWithElevation,
root,
levelInfo,
zarrVersion): Promise<{
dimensionValuesWithElevation: DimensionValues;
elevationSlice: [number, number];
}>;

Determines the index range of the elevation axis to load from a Zarr cube.

Supports two kinds of selectors:

  • { type: "index", selected: [i0, i1] } — direct index slicing
  • { type: "value", selected: [z0, z1] } — find nearest elevation values

Behavior:

  • Loads elevation coordinate values (if not already loaded).
  • Converts value-based ranges into nearest-index ranges.
  • If selected is a single scalar, slices from the lowest elevation to that value.
  • Returns the index bounds as [start, endExclusive].
  • Mutates dimensionValuesWithElevation.elevation by slicing it to the returned range.

Parameters

ParameterTypeDescription
shapeElevationnumberSize of the elevation dimension.
dimInfo{ array: Array<any, Readable> | null; index: number; name: string; }Dimension index info for elevation. See DimIndicesProps.
dimInfo.arrayArray<any, Readable> | null-
dimInfo.indexnumber-
dimInfo.namestring-
selectorsElevationZarrSelectorsProps | undefinedUser-provided elevation selector. See ZarrSelectorsProps.
dimensionValuesWithElevationDimensionValuesCache of already-loaded coordinate arrays (mutated by this function).
rootLocation<FetchStore>Root Zarr group location.
levelInfostring | nullOptional multiscale subpath.
zarrVersion2 | 3 | nullZarr version (2 or 3).

Returns

Promise<{ dimensionValuesWithElevation: DimensionValues; elevationSlice: [number, number]; }>

An object containing:

  • dimensionValuesWithElevation: Possibly updated elevation coordinate array.
  • elevationSlice: Index range [start, endExclusive] for elevation slicing.