Skip to content

Commit 6534763

Browse files
committed
Update docs and add changelog
1 parent 0c01a27 commit 6534763

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

changes/3781.feature.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Updated structured dtype implementation to match the merged zarr-extensions spec for `struct` data types.
2+
3+
Key changes:
4+
- The primary V3 name is now `struct` (previously `structured`)
5+
- Fields use object format: `{"name": "x", "data_type": "int32"}` instead of tuples
6+
- Fill values use dict format: `{"x": 1, "y": 2.0}` instead of base64
7+
- The `bytes` codec requires explicit `endian` for structured types with multi-byte fields
8+
- Legacy `structured` name with tuple format is accepted for backward compatibility when reading

docs/user-guide/data_types.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,37 @@ here, it's possible to create it yourself: see [Adding New Data Types](#adding-n
229229
#### Struct-like
230230
- [Structured][zarr.dtype.Structured]
231231

232+
!!! note "Zarr V3 Structured Data Types"
233+
234+
In Zarr V3, structured data types are specified using the `struct` extension defined in the
235+
[zarr-extensions repository](https://github.com/zarr-developers/zarr-extensions/tree/main/data-types/struct).
236+
The JSON representation uses an object format for fields:
237+
238+
```json
239+
{
240+
"name": "struct",
241+
"configuration": {
242+
"fields": [
243+
{"name": "x", "data_type": "float32"},
244+
{"name": "y", "data_type": "int64"}
245+
]
246+
}
247+
}
248+
```
249+
250+
For backward compatibility, Zarr Python also accepts the legacy `structured` name with
251+
tuple-format fields when reading existing data.
252+
253+
Fill values for structured types are represented as JSON objects mapping field names to values:
254+
255+
```json
256+
{"x": 1.5, "y": 42}
257+
```
258+
259+
When using structured types with multi-byte fields, the `bytes` codec must specify an
260+
explicit `endian` parameter. If omitted, Zarr Python assumes little-endian for legacy
261+
compatibility but emits a warning.
262+
232263
### Example Usage
233264

234265
This section will demonstrates the basic usage of Zarr data types.

0 commit comments

Comments
 (0)