Skip to main content

initZarrDataset()

function initZarrDataset(
store,
root,
variable,
dimensions,
levelMetadata,
levelCache,
zarrVersion,
multiscaleLevel?): Promise<{
attrs: Record<string, any>;
dimIndices: DimIndicesProps;
levelInfos: string[];
multiscaleLevel?: number;
zarrArray: Array<any>;
}>;

Opens a Zarr variable (single-scale or multiscale pyramid) and prepares its metadata.

  • Detects and loads multiscale dataset levels (if present).
  • Computes per-level dimension sizes and stores them in levelMetadata.
  • Scans coordinate variables from _ARRAY_DIMENSIONS or consolidated metadata.
  • Detects CF/alias-based dimension names (lat/lon/time/elevation).

Parameters

ParameterTypeDescription
storeFetchStoreZarr store (e.g., FetchStore).
rootLocation<FetchStore>Root Zarr group location.
variablestringVariable name within the Zarr group.
dimensionsDimensionNamesPropsOptional explicit dimension name mapping. See DimensionNamesProps.
levelMetadataMap<number, ZarrLevelMetadata>Map to populate with per-level metadata (width/height).
levelCacheMap<number, any>Cache for opened multiscale level arrays.
zarrVersion2 | 3 | nullZarr version (2 or 3).
multiscaleLevel?numberOptional initial multiscale level to open.

Returns

Promise<{ attrs: Record<string, any>; dimIndices: DimIndicesProps; levelInfos: string[]; multiscaleLevel?: number; zarrArray: Array<any>; }>

  • zarrArray — the opened array for the selected multiscale level.
    • levelInfos — all multiscale level paths.
    • dimIndices — discovered dimension index mapping. See DimIndicesProps.
    • attrs — variable or group attributes.
    • multiscaleLevel — updated level if adjusted due to missing levels.