Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simple proposed fix for #289 #291

Merged
merged 1 commit into from
Aug 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions xcdat/temporal.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import numpy as np
import pandas as pd
import xarray as xr
from dask.array.core import Array
from xarray.core.groupby import DataArrayGroupBy

from xcdat import bounds # noqa: F401
Expand Down Expand Up @@ -968,6 +969,8 @@ def _get_weights(self) -> xr.DataArray:
# only select the general DType and not details such as the byte order
# or time unit (with rare exceptions see release notes). To avoid this
# warning please use the scalar types `np.float64`, or string notation.`
if type(time_lengths.values == Array):
time_lengths.load()
time_lengths = time_lengths.astype(np.float64)

grouped_time_lengths = self._group_data(time_lengths)
Expand Down