Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] authored and kmuehlbauer committed May 8, 2023
1 parent 274dde8 commit b304aa0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions xarray/coding/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import numpy as np
import pandas as pd

from xarray.coding import times
from xarray.core import dtypes, duck_array_ops, indexing
from xarray.core.pycompat import is_duck_dask_array
from xarray.core.variable import Variable
Expand Down Expand Up @@ -286,11 +285,11 @@ def decode(self, variable: Variable, name: T_Name = None):
units = attrs.get("units", None)
# try to cast to correct dtypes for data and fill_value
# GH 7817
if ((
if (
isinstance(units, str)
and "since" in units
and np.issubdtype(data.dtype, np.integer)) or np.issubdtype(data.dtype, np.datetime64)
):
and np.issubdtype(data.dtype, np.integer)
) or np.issubdtype(data.dtype, np.datetime64):
dtype, decoded_fill_value = data.dtype, np.datetime64("NaT").astype(
data.dtype
)
Expand Down

0 comments on commit b304aa0

Please sign in to comment.