Skip to content

abczarr.metadata.v3.dtypes

Classes

DTypeConfig

DTypeConfig(*, extra_items: Iterable[tuple[str | bytes, Any]] | Mapping[str | bytes, Any] = FrozenDict({}))

Bases: TypedConfig

This class is the base for a v3 data type's own configuration parameters.

Methods:

DType

DType(name: str | bytes = '', configuration: DTypeConfig | JsonDict = DTypeConfig(extra_items=FrozenDict({})), must_understand: Literal[True] = True)

Bases: MustUnderstandExtension

A Zarr v3 data type: a name and that type's own configuration.

A core data type, such as float32, has no configuration and is written as a bare name. An extension data type, such as a struct or a fixed-bit-width raw type, carries its parameters in configuration.

Attributes

configuration instance-attribute
configuration: DTypeConfig

The data type's own parameters. Empty for a core data type.

numpy property
numpy: dtype

The equivalent numpy.dtype.

Methods:

to_json
to_json() -> str | JsonDict

Serialize this data type to its JSON representation.

A core data type with no configuration is written as a bare name, such as "float32", as the Zarr v3 specification requires. An extension data type keeps the full object form.

Returns:

Type Description
str or dict

The bare name for a core data type, or the JSON-compatible object form for an extension data type.

to_version
to_version(version: ZarrVersion) -> Any

Convert this data type to another Zarr version.

Parameters:

Name Type Description Default
version ZarrVersion

The target Zarr format version: 1, 2 or 3.

required

Returns:

Type Description
object

This data type unchanged for version 3, or the equivalent v1 or v2 data type otherwise.

Raises:

Type Description
ValueError

If version is not 1, 2 or 3.

DTypeBuiltin

DTypeBuiltin(name: str | bytes = '', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeImpl

This class is the base for a core Zarr v3 data type, one every implementation must support.

Methods:

Raw

Raw(name: str | bytes = 'r8', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeBuiltin

An opaque sequence of bits, with a fixed number of bits per element.

Attributes

name class-attribute instance-attribute
name: Annotated[str, ToRegexMatch(RE_RAW)] = 'r8'

The bit width, spelled as "r" followed by the number of bits, such as "r8" for one byte per element.

Methods:

DTypeExtra

DTypeExtra(name: str | bytes = '', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeImpl

This class is the base for a Zarr v3 extension data type, one registered outside the core spec.

Methods:

StructField

StructField(name: str | bytes = '', data_type: DType | JsonDict | str = Raw(name='r8', configuration=DTypeConfigImpl()))

Bases: DTypeConfigImpl

Represents one named field of a struct data type: its name and its data type.

Attributes

name instance-attribute
name: str

The field's name.

data_type instance-attribute
data_type: DType

The field's data type.

Methods:

StructConfig

StructConfig(fields: Iterable[StructField | JsonDict | str] = ())

Bases: DTypeConfigImpl

Holds the struct data type's parameters: the ordered list of fields.

Attributes

fields instance-attribute
fields: tuple[StructField, ...]

The struct's fields, in record order.

Methods:

Struct

Struct(name: Literal['struct', 'structured'] = 'struct', configuration: StructConfig | JsonDict | tuple[StructField, ...] = StructConfig(fields=()), must_understand: Literal[True] = True)

Bases: DTypeExtra

Represents a structured data type: a fixed, ordered sequence of named fields.

Each element is a record combining every field's value, mirroring numpy's structured dtype.

Attributes

name instance-attribute
name: Literal['struct', 'structured']

Either "struct" or "structured".

configuration instance-attribute
configuration: StructConfig

The struct's fields.

Methods:

NumpyTimeConfig

NumpyTimeConfig(unit: Literal['Y', 'M', 'W', 'D', 'h', 'm', 's', 'ms', 'us', 'μs', 'ns', 'ps', 'fs', 'as', 'generic'] = 'Y', scale_factor: Integral | integer | bool = 0)

Bases: DTypeConfigImpl

Holds the datetime/timedelta parameters: the time unit and its scale factor.

A value counts scale_factor multiples of unit. A scale_factor of 10 with unit "s" counts in tens of seconds, matching numpy's datetime64/timedelta64 resolution.

Attributes

unit instance-attribute
unit: Literal['Y', 'M', 'W', 'D', 'h', 'm', 's', 'ms', 'us', 'μs', 'ns', 'ps', 'fs', 'as', 'generic']

The base time unit, such as "s" or "ns".

scale_factor instance-attribute
scale_factor: int

The number of units one increment counts.

Methods:

NumpyDatetime64

NumpyDatetime64(name: Literal['numpy.datetime64'] = 'numpy.datetime64', configuration: NumpyTimeConfig | JsonDict | Literal['Y', 'M', 'W', 'D', 'h', 'm', 's', 'ms', 'us', 'μs', 'ns', 'ps', 'fs', 'as', 'generic'] = NumpyTimeConfig(unit='Y', scale_factor=0), must_understand: Literal[True] = True)

Bases: DTypeExtra

Represents a point in time, at the resolution configuration names.

Mirrors numpy's datetime64: an integer count of the configured time unit since the Unix epoch.

Attributes

name instance-attribute
name: Literal['numpy.datetime64']

Always "numpy.datetime64".

configuration instance-attribute
configuration: NumpyTimeConfig

The time unit and scale factor.

Methods:

NumpyTimedelta64

NumpyTimedelta64(name: Literal['numpy.timedelta64'] = 'numpy.timedelta64', configuration: NumpyTimeConfig | JsonDict | Literal['Y', 'M', 'W', 'D', 'h', 'm', 's', 'ms', 'us', 'μs', 'ns', 'ps', 'fs', 'as', 'generic'] = NumpyTimeConfig(unit='Y', scale_factor=0), must_understand: Literal[True] = True)

Bases: DTypeExtra

Represents a duration, at the resolution configuration names.

Mirrors numpy's timedelta64: an integer count of the configured time unit.

Attributes

name instance-attribute
name: Literal['numpy.timedelta64']

Always "numpy.timedelta64".

configuration instance-attribute
configuration: NumpyTimeConfig

The time unit and scale factor.

Methods:

FixedLengthConfig

FixedLengthConfig(length_bytes: Integral | integer | bool = 0)

Bases: DTypeConfigImpl

Holds the fixed-length data type's parameters: the element's size in bytes.

Attributes

length_bytes instance-attribute
length_bytes: int

The size, in bytes, of one element.

Methods:

FixedLengthUtf32

FixedLengthUtf32(name: Literal['fixed_length_utf32'] = 'fixed_length_utf32', configuration: FixedLengthConfig | JsonDict | int = FixedLengthConfig(length_bytes=0), must_understand: Literal[True] = True)

Bases: DTypeExtra

Represents a fixed-length UTF-32 string, mirroring numpy's <U{n} dtype.

configuration.length_bytes is four times the character count.

Attributes

name instance-attribute
name: Literal['fixed_length_utf32']

Always "fixed_length_utf32".

configuration instance-attribute
configuration: FixedLengthConfig

The element's size in bytes.

Methods:

NullTerminatedBytes

NullTerminatedBytes(name: Literal['null_terminated_bytes'] = 'null_terminated_bytes', configuration: FixedLengthConfig | JsonDict | int = FixedLengthConfig(length_bytes=0), must_understand: Literal[True] = True)

Bases: DTypeExtra

Represents a fixed-length byte string, mirroring numpy's S{n} dtype.

Attributes

name instance-attribute
name: Literal['null_terminated_bytes']

Always "null_terminated_bytes".

configuration instance-attribute
configuration: FixedLengthConfig

The element's size in bytes.

Methods:

Bool

Bool(name: Literal['bool'] = 'bool', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeBuiltin

The bool data type.

Attributes

name
name: Literal['bool'] = 'bool'

Always "bool".

Methods:

Int8

Int8(name: Literal['int8'] = 'int8', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeBuiltin

The int8 data type.

Attributes

name
name: Literal['int8'] = 'int8'

Always "int8".

Methods:

Int16

Int16(name: Literal['int16'] = 'int16', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeBuiltin

The int16 data type.

Attributes

name
name: Literal['int16'] = 'int16'

Always "int16".

Methods:

Int32

Int32(name: Literal['int32'] = 'int32', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeBuiltin

The int32 data type.

Attributes

name
name: Literal['int32'] = 'int32'

Always "int32".

Methods:

Int64

Int64(name: Literal['int64'] = 'int64', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeBuiltin

The int64 data type.

Attributes

name
name: Literal['int64'] = 'int64'

Always "int64".

Methods:

Uint8

Uint8(name: Literal['uint8'] = 'uint8', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeBuiltin

The uint8 data type.

Attributes

name
name: Literal['uint8'] = 'uint8'

Always "uint8".

Methods:

Uint16

Uint16(name: Literal['uint16'] = 'uint16', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeBuiltin

The uint16 data type.

Attributes

name
name: Literal['uint16'] = 'uint16'

Always "uint16".

Methods:

Uint32

Uint32(name: Literal['uint32'] = 'uint32', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeBuiltin

The uint32 data type.

Attributes

name
name: Literal['uint32'] = 'uint32'

Always "uint32".

Methods:

Uint64

Uint64(name: Literal['uint64'] = 'uint64', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeBuiltin

The uint64 data type.

Attributes

name
name: Literal['uint64'] = 'uint64'

Always "uint64".

Methods:

Float16

Float16(name: Literal['float16'] = 'float16', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeBuiltin

The float16 data type.

Attributes

name
name: Literal['float16'] = 'float16'

Always "float16".

Methods:

Float32

Float32(name: Literal['float32'] = 'float32', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeBuiltin

The float32 data type.

Attributes

name
name: Literal['float32'] = 'float32'

Always "float32".

Methods:

Float64

Float64(name: Literal['float64'] = 'float64', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeBuiltin

The float64 data type.

Attributes

name
name: Literal['float64'] = 'float64'

Always "float64".

Methods:

Complex64

Complex64(name: Literal['complex64'] = 'complex64', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeBuiltin

The complex64 data type.

Attributes

name
name: Literal['complex64'] = 'complex64'

Always "complex64".

Methods:

Complex128

Complex128(name: Literal['complex128'] = 'complex128', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeBuiltin

The complex128 data type.

Attributes

name
name: Literal['complex128'] = 'complex128'

Always "complex128".

Methods:

Bytes

Bytes(name: Literal['bytes'] = 'bytes', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeExtra

The bytes data type.

Attributes

name
name: Literal['bytes'] = 'bytes'

Always "bytes".

Methods:

Bfloat16

Bfloat16(name: Literal['bfloat16'] = 'bfloat16', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeExtra

The bfloat16 data type.

Attributes

name
name: Literal['bfloat16'] = 'bfloat16'

Always "bfloat16".

Methods:

Float4E2m1fn

Float4E2m1fn(name: Literal['float4_e2m1fn'] = 'float4_e2m1fn', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeExtra

The float4_e2m1fn data type.

Attributes

name
name: Literal['float4_e2m1fn'] = 'float4_e2m1fn'

Always "float4_e2m1fn".

Methods:

Float6E2m3fn

Float6E2m3fn(name: Literal['float6_e2m3fn'] = 'float6_e2m3fn', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeExtra

The float6_e2m3fn data type.

Attributes

name
name: Literal['float6_e2m3fn'] = 'float6_e2m3fn'

Always "float6_e2m3fn".

Methods:

Float6E3m2fn

Float6E3m2fn(name: Literal['float6_e3m2fn'] = 'float6_e3m2fn', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeExtra

The float6_e3m2fn data type.

Attributes

name
name: Literal['float6_e3m2fn'] = 'float6_e3m2fn'

Always "float6_e3m2fn".

Methods:

Float8E3m4

Float8E3m4(name: Literal['float8_e3m4'] = 'float8_e3m4', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeExtra

The float8_e3m4 data type.

Attributes

name
name: Literal['float8_e3m4'] = 'float8_e3m4'

Always "float8_e3m4".

Methods:

Float8E4m3

Float8E4m3(name: Literal['float8_e4m3'] = 'float8_e4m3', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeExtra

The float8_e4m3 data type.

Attributes

name
name: Literal['float8_e4m3'] = 'float8_e4m3'

Always "float8_e4m3".

Methods:

Float8E4m3b11fnuz

Float8E4m3b11fnuz(name: Literal['float8_e4m3b11fnuz'] = 'float8_e4m3b11fnuz', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeExtra

The float8_e4m3b11fnuz data type.

Attributes

name
name: Literal['float8_e4m3b11fnuz'] = 'float8_e4m3b11fnuz'

Always "float8_e4m3b11fnuz".

Methods:

Float8E4m3fnuz

Float8E4m3fnuz(name: Literal['float8_e4m3fnuz'] = 'float8_e4m3fnuz', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeExtra

The float8_e4m3fnuz data type.

Attributes

name
name: Literal['float8_e4m3fnuz'] = 'float8_e4m3fnuz'

Always "float8_e4m3fnuz".

Methods:

Float8E5m2

Float8E5m2(name: Literal['float8_e5m2'] = 'float8_e5m2', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeExtra

The float8_e5m2 data type.

Attributes

name
name: Literal['float8_e5m2'] = 'float8_e5m2'

Always "float8_e5m2".

Methods:

Float8E5m2fnuz

Float8E5m2fnuz(name: Literal['float8_e5m2fnuz'] = 'float8_e5m2fnuz', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeExtra

The float8_e5m2fnuz data type.

Attributes

name
name: Literal['float8_e5m2fnuz'] = 'float8_e5m2fnuz'

Always "float8_e5m2fnuz".

Methods:

Float8E8m0fnu

Float8E8m0fnu(name: Literal['float8_e8m0fnu'] = 'float8_e8m0fnu', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeExtra

The float8_e8m0fnu data type.

Attributes

name
name: Literal['float8_e8m0fnu'] = 'float8_e8m0fnu'

Always "float8_e8m0fnu".

Methods:

ComplexBfloat16

ComplexBfloat16(name: Literal['complex_bfloat16'] = 'complex_bfloat16', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeExtra

The complex_bfloat16 data type.

Attributes

name
name: Literal['complex_bfloat16'] = 'complex_bfloat16'

Always "complex_bfloat16".

Methods:

ComplexFloat16

ComplexFloat16(name: Literal['complex_float16'] = 'complex_float16', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeExtra

The complex_float16 data type.

Attributes

name
name: Literal['complex_float16'] = 'complex_float16'

Always "complex_float16".

Methods:

ComplexFloat32

ComplexFloat32(name: Literal['complex_float32'] = 'complex_float32', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeExtra

The complex_float32 data type.

Attributes

name
name: Literal['complex_float32'] = 'complex_float32'

Always "complex_float32".

Methods:

ComplexFloat64

ComplexFloat64(name: Literal['complex_float64'] = 'complex_float64', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeExtra

The complex_float64 data type.

Attributes

name
name: Literal['complex_float64'] = 'complex_float64'

Always "complex_float64".

Methods:

ComplexFloat4E2m1fn

ComplexFloat4E2m1fn(name: Literal['complex_float4_e2m1fn'] = 'complex_float4_e2m1fn', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeExtra

The complex_float4_e2m1fn data type.

Attributes

name
name: Literal['complex_float4_e2m1fn'] = 'complex_float4_e2m1fn'

Always "complex_float4_e2m1fn".

Methods:

ComplexFloat6E2m3fn

ComplexFloat6E2m3fn(name: Literal['complex_float6_e2m3fn'] = 'complex_float6_e2m3fn', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeExtra

The complex_float6_e2m3fn data type.

Attributes

name
name: Literal['complex_float6_e2m3fn'] = 'complex_float6_e2m3fn'

Always "complex_float6_e2m3fn".

Methods:

ComplexFloat6E3m2fn

ComplexFloat6E3m2fn(name: Literal['complex_float6_e3m2fn'] = 'complex_float6_e3m2fn', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeExtra

The complex_float6_e3m2fn data type.

Attributes

name
name: Literal['complex_float6_e3m2fn'] = 'complex_float6_e3m2fn'

Always "complex_float6_e3m2fn".

Methods:

ComplexFloat8E3m4

ComplexFloat8E3m4(name: Literal['complex_float8_e3m4'] = 'complex_float8_e3m4', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeExtra

The complex_float8_e3m4 data type.

Attributes

name
name: Literal['complex_float8_e3m4'] = 'complex_float8_e3m4'

Always "complex_float8_e3m4".

Methods:

ComplexFloat8E4m3

ComplexFloat8E4m3(name: Literal['complex_float8_e4m3'] = 'complex_float8_e4m3', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeExtra

The complex_float8_e4m3 data type.

Attributes

name
name: Literal['complex_float8_e4m3'] = 'complex_float8_e4m3'

Always "complex_float8_e4m3".

Methods:

ComplexFloat8E4m3b11fnuz

ComplexFloat8E4m3b11fnuz(name: Literal['complex_float8_e4m3b11fnuz'] = 'complex_float8_e4m3b11fnuz', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeExtra

The complex_float8_e4m3b11fnuz data type.

Attributes

name
name: Literal['complex_float8_e4m3b11fnuz'] = 'complex_float8_e4m3b11fnuz'

Always "complex_float8_e4m3b11fnuz".

Methods:

ComplexFloat8E4m3fnuz

ComplexFloat8E4m3fnuz(name: Literal['complex_float8_e4m3fnuz'] = 'complex_float8_e4m3fnuz', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeExtra

The complex_float8_e4m3fnuz data type.

Attributes

name
name: Literal['complex_float8_e4m3fnuz'] = 'complex_float8_e4m3fnuz'

Always "complex_float8_e4m3fnuz".

Methods:

ComplexFloat8E5m2

ComplexFloat8E5m2(name: Literal['complex_float8_e5m2'] = 'complex_float8_e5m2', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeExtra

The complex_float8_e5m2 data type.

Attributes

name
name: Literal['complex_float8_e5m2'] = 'complex_float8_e5m2'

Always "complex_float8_e5m2".

Methods:

ComplexFloat8E5m2fnuz

ComplexFloat8E5m2fnuz(name: Literal['complex_float8_e5m2fnuz'] = 'complex_float8_e5m2fnuz', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeExtra

The complex_float8_e5m2fnuz data type.

Attributes

name
name: Literal['complex_float8_e5m2fnuz'] = 'complex_float8_e5m2fnuz'

Always "complex_float8_e5m2fnuz".

Methods:

ComplexFloat8E8m0fnu

ComplexFloat8E8m0fnu(name: Literal['complex_float8_e8m0fnu'] = 'complex_float8_e8m0fnu', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeExtra

The complex_float8_e8m0fnu data type.

Attributes

name
name: Literal['complex_float8_e8m0fnu'] = 'complex_float8_e8m0fnu'

Always "complex_float8_e8m0fnu".

Methods:

String

String(name: Literal['string'] = 'string', configuration: DTypeConfigImpl | JsonDict = DTypeConfigImpl(), must_understand: Literal[True] = True)

Bases: DTypeExtra

The string data type.

Attributes

name
name: Literal['string'] = 'string'

Always "string".

Methods: