Skip to content

Commit 6acd92f

Browse files
committed
Remove NAT_TYPES and silence warning
1 parent 7649a09 commit 6acd92f

3 files changed

Lines changed: 1 addition & 10 deletions

File tree

xarray/computation/nanops.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def _maybe_null_out(result, axis, mask, min_count=1):
2929
dtype, fill_value = dtypes.maybe_promote(result.dtype)
3030
result = where(null_mask, fill_value, astype(result, dtype))
3131

32-
elif getattr(result, "dtype", None) not in dtypes.NAT_TYPES:
32+
elif hasattr(result, "dtype") and result.dtype.kind not in "mM":
3333
null_mask = mask.size - duck_array_ops.sum(mask)
3434
result = where(null_mask < min_count, np.nan, result)
3535

xarray/core/dtypes.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,6 @@ def maybe_promote(dtype: T_dtype) -> tuple[T_dtype, Any]:
108108
return dtype_out, fill_value
109109

110110

111-
NAT_TYPES = {np.datetime64("NaT").dtype, np.timedelta64("NaT").dtype}
112-
113-
114111
def get_fill_value(dtype):
115112
"""Return an appropriate fill value for this dtype.
116113

xarray/tests/test_dtypes.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,6 @@ def test_maybe_promote(kind, expected) -> None:
123123
assert str(actual[1]) == expected[1]
124124

125125

126-
def test_nat_types_membership() -> None:
127-
assert np.datetime64("NaT").dtype in dtypes.NAT_TYPES
128-
assert np.timedelta64("NaT").dtype in dtypes.NAT_TYPES
129-
assert np.float64 not in dtypes.NAT_TYPES
130-
131-
132126
@pytest.mark.parametrize(
133127
["dtype", "kinds", "xp", "expected"],
134128
(

0 commit comments

Comments
 (0)