Skip to content

Commit 1b62c4c

Browse files
authored
Merge branch 'main' into refactor/metadata-package
2 parents 0ae8db9 + 866aa8d commit 1b62c4c

4 files changed

Lines changed: 4 additions & 3 deletions

File tree

changes/3920.bugfix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use the unit associated with the `Datetime64` data type when creating the default `Nat` scalar value.

examples/custom_dtype/custom_dtype.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# requires-python = ">=3.12"
33
# dependencies = [
44
# "zarr @ git+https://github.com/zarr-developers/zarr-python.git@main",
5-
# "ml_dtypes==0.5.1",
5+
# "ml_dtypes==0.5.4",
66
# "pytest==8.4.1"
77
# ]
88
# ///

src/zarr/core/dtype/npy/time.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ def default_scalar(self) -> np.datetime64:
851851
The default scalar value, which is a 'Not-a-Time' (NaT) value
852852
"""
853853

854-
return np.datetime64("NaT")
854+
return np.datetime64("NaT", self.unit)
855855

856856
def from_json_scalar(self, data: JSON, *, zarr_format: ZarrFormat) -> np.datetime64:
857857
"""

tests/test_dtype/test_npy/test_time.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class TestDateTime64(_TestTimeBase):
6666
cast_value_params = (
6767
(DateTime64(unit="Y", scale_factor=1), "1", np.datetime64("1", "Y")),
6868
(DateTime64(unit="s", scale_factor=1), "2005-02-25", np.datetime64("2005-02-25", "s")),
69-
(DateTime64(unit="ns", scale_factor=1), "NaT", np.datetime64("NaT")),
69+
(DateTime64(unit="ns", scale_factor=1), "NaT", np.datetime64("NaT", "ns")),
7070
)
7171
invalid_scalar_params = (
7272
(DateTime64(unit="Y", scale_factor=1), 1.3),

0 commit comments

Comments
 (0)