|
1 |
| -Adds zarr-specific data type classes. This replaces the internal use of numpy data types for zarr |
2 |
| -v2 and a fixed set of string enums for zarr v3. This change is largely internal, but it does |
3 |
| -change the type of the ``dtype`` and ``data_type`` fields on the ``ArrayV2Metadata`` and |
4 |
| -``ArrayV3Metadata`` classes. It also changes the JSON metadata representation of the |
5 |
| -variable-length string data type, but the old metadata representation can still be |
6 |
| -used when reading arrays. The logic for automatically choosing the chunk encoding for a given data |
7 |
| -type has also changed, and this necessitated changes to the ``config`` API. |
| 1 | +Adds zarr-specific data type classes. |
| 2 | + |
| 3 | +This change adds a ``ZDType`` base class for Zarr V2 and Zarr V3 data types. Child classes are |
| 4 | +defined for each NumPy data type. Each child class defines routines for ``JSON`` serialization. |
| 5 | +New data types can be created and registered dynamically. |
| 6 | + |
| 7 | +Prior to this change, Zarr Python had two streams for handling data types. For Zarr V2 arrays, |
| 8 | +we used NumPy data type identifiers. For Zarr V3 arrays, we used a fixed set of string enums. Both |
| 9 | +of these systems proved hard to extend. |
| 10 | + |
| 11 | +This change is largely internal, but it does change the type of the ``dtype`` and ``data_type`` |
| 12 | +fields on the ``ArrayV2Metadata`` and ``ArrayV3Metadata`` classes. Previously, ``ArrayV2Metadata.dtype`` |
| 13 | +was a NumPy ``dtype`` object, and ``ArrayV3Metadata.data_type`` was an internally-defined ``enum``. |
| 14 | +After this change, both ``ArrayV2Metadata.dtype`` and ``ArrayV3Metadata.data_type`` are instances of |
| 15 | +``ZDType``. A NumPy data type can be generated from a ``ZDType`` via the ``ZDType.to_native_dtype()`` |
| 16 | +method. The internally-defined Zarr V3 ``enum`` class is gone entirely, but the ``ZDType.to_json(zarr_format=3)`` |
| 17 | +method can be used to generate either a string, or dictionary that has a string ``name`` field, that |
| 18 | +represents the string value previously associated with that ``enum``. |
8 | 19 |
|
9 | 20 | For more on this new feature, see the `documentation </user-guide/data_types.html>`_
|
0 commit comments