Skip to content

Commit c42edf6

Browse files
committed
fix docstring
1 parent 5feb937 commit c42edf6

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/zarr/core/dtype/__init__.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,9 @@ def parse_dtype(
232232
directly, or a JSON representation of a ZDType, or a native dtype, or a python object that
233233
can be converted into a native dtype.
234234
zarr_format : ZarrFormat
235-
The Zarr format version.
235+
The Zarr format version. This parameter is required because this function will attempt to
236+
parse the JSON representation of a data type, and the JSON representation of data types
237+
is different between Zarr 2 and Zarr 3.
236238
237239
Returns
238240
-------
@@ -241,6 +243,14 @@ def parse_dtype(
241243
242244
Examples
243245
--------
246+
>>> from zarr.dtype import parse_dtype
247+
>>> import numpy as np
248+
>>> parse_dtype("int32", zarr_format=2)
249+
Int32(endianness='little')
250+
>>> parse_dtype(np.dtype('S10'), zarr_format=2)
251+
NullTerminatedBytes(length=10)
252+
>>> parse_dtype({"name": "numpy.datetime64", "configuration": {"unit": "s", "scale_factor": 10}}, zarr_format=3)
253+
DateTime64(endianness='little', scale_factor=10, unit='s')
244254
>>> parse_dtype("int32", zarr_format=2)
245255
Int32(endianness="little")
246256
"""

0 commit comments

Comments
 (0)