Typed metadata for a Zarr array node. Knows everything needed to read/write chunks — shape, data type, chunk layout, codec pipeline configuration. No OME-Zarr knowledge here.
More...
Typed metadata for a Zarr array node. Knows everything needed to read/write chunks — shape, data type, chunk layout, codec pipeline configuration. No OME-Zarr knowledge here.
◆ FromDocument()
57 {
58 if (doc.NodeType != "array")
59 throw new InvalidOperationException(
60 $"Expected node_type 'array', got '{doc.NodeType}'.");
61
62 if (doc.
Shape is
null)
63 throw new InvalidOperationException("Array zarr.json is missing 'shape'.");
64
65 if (doc.DataType is null)
66 throw new InvalidOperationException("Array zarr.json is missing 'data_type'.");
67
68 var shape = doc.
Shape;
70 var chunkShape = ResolveChunkShape(doc);
71 var separator = doc.ChunkKeyEncoding?.Configuration?.Separator ?? "/";
72 var codecs = ResolveCodecs(doc);
73
75 shape,
76 chunkShape,
77 dataType,
78 separator,
79 codecs,
80 doc.DimensionNames,
82 zarrVersion: 3);
83 }
Typed representation of a Zarr v3 data type string (e.g. "uint8", "float32"). Resolves element size i...
Definition ZarrDataType.cs:9
long?[] Shape
Present on array nodes. Null on group nodes.
Definition ZarrJsonDocument.cs:23
JsonElement? Attributes
Freeform attributes — this is where OME-Zarr metadata lives. Kept as a raw JsonElement so the OME lay...
Definition ZarrJsonDocument.cs:48
◆ FromV2Document()
Creates array metadata from a Zarr v2 .zarray document.
- Parameters
-
| arrayDoc | Parsed .zarray contents. |
| attributes | Parsed .zattrs contents (optional). |
| separatorOverride | If provided, overrides the dimension separator regardless of what .zarray declares. Used by the chunk-key probing logic when .zarray omits dimension_separator and the store is found to use "/" (nested) chunk keys. |
103 {
104 if (arrayDoc.ZarrFormat != 2)
105 throw new InvalidOperationException(
106 $"Expected zarr_format 2, got {arrayDoc.ZarrFormat}.");
107
108 var (dataType, byteOrder) = NumpyDtypeParser.Parse(arrayDoc.
Dtype);
109
110 var separator = separatorOverride
111 ?? arrayDoc.DimensionSeparator
112 ?? ".";
113
114 var codecs = CodecFactory.BuildV2CodecPipeline(arrayDoc.
Compressor, byteOrder);
115
117 arrayDoc.Shape,
118 arrayDoc.Chunks,
119 dataType,
120 separator,
121 codecs,
122 dimensionNames: null,
123 attributes,
124 zarrVersion: 2);
125 }
string Dtype
Numpy-style dtype string, e.g. "<u2" (little-endian uint16), ">f4" (big-endian float32).
Definition ZarrV2Document.cs:29
ZarrV2CompressorDocument? Compressor
Compressor configuration. Null means no compression. Example: { "id": "gzip", "level": 5 }...
Definition ZarrV2Document.cs:36
◆ ChunkKeySeparator
| string ZarrNET.ZarrArrayMetadata.ChunkKeySeparator |
|
get |
◆ ChunkShape
| int [] ZarrNET.ZarrArrayMetadata.ChunkShape |
|
get |
◆ Codecs
| CodecInfo [] ZarrNET.ZarrArrayMetadata.Codecs |
|
get |
◆ DataType
◆ DimensionNames
| string? [] ZarrNET.ZarrArrayMetadata.DimensionNames |
|
get |
◆ RawAttributes
| JsonElement? ZarrNET.ZarrArrayMetadata.RawAttributes |
|
get |
◆ Shape
| long [] ZarrNET.ZarrArrayMetadata.Shape |
|
get |
◆ Sharding
Non-null when the codec pipeline contains a sharding_indexed codec. In this case, the outer ChunkShape represents the shard shape and actual data chunks are the inner chunks within each shard.
◆ ZarrVersion
| int ZarrNET.ZarrArrayMetadata.ZarrVersion |
|
get |
The documentation for this class was generated from the following file:
- ZarrNET/ZarrNodeMetadata.cs