-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Flox can't handle cftime objects #6613
Closed
4 tasks done
Labels
Comments
aulemahal
added
bug
needs triage
Issue that has not been reviewed by xarray team member
labels
May 16, 2022
7 tasks
dcherian
added
upstream issue
and removed
needs triage
Issue that has not been reviewed by xarray team member
labels
May 16, 2022
Nice find! Yeah we could either skip these arrays using or refact this type of logic to a helper function and use that in xarray/xarray/core/duck_array_ops.py Lines 534 to 555 in e712270
|
Update: |
dcherian
added a commit
to xarray-contrib/flox
that referenced
this issue
Jun 2, 2022
Copy over a bunch of xarray code. Closes pydata/xarray#6613
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What happened?
I use resampling to count the number of timesteps within time periods. So the simple way is to :
da.time.resample(time='YS').count()
. With the current master, a non-standard calendar and withflox
installed, this fails :flox
can't handle the cftime objects of the time coordinate.What did you expect to happen?
I expected the count of elements for each period to be returned.
Minimal Complete Verifiable Example
MVCE confirmation
Relevant log output
Anything else we need to know?
I was able to resolve this by modifying
xarray.core.utils.contains_only_dask_or_numpy
as to return False if the input's dtype is 'O'. This check seems to only be used when choosing betweenflox
and the old algos. Does this make sense?Environment
INSTALLED VERSIONS
commit: None
python: 3.9.6 | packaged by conda-forge | (default, Jul 11 2021, 03:39:48)
[GCC 9.3.0]
python-bits: 64
OS: Linux
OS-release: 5.17.5-arch1-2
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: fr_CA.utf8
LOCALE: ('fr_CA', 'UTF-8')
libhdf5: 1.12.0
libnetcdf: 4.7.4
xarray: 2022.3.1.dev16+g3ead17ea
pandas: 1.4.2
numpy: 1.21.6
scipy: 1.7.1
netCDF4: 1.5.7
pydap: None
h5netcdf: 0.11.0
h5py: 3.4.0
Nio: None
zarr: 2.10.0
cftime: 1.5.0
nc_time_axis: 1.3.1
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: 1.3.2
dask: 2022.04.1
distributed: 2022.4.1
matplotlib: 3.4.3
cartopy: None
seaborn: None
numbagg: None
fsspec: 2021.07.0
cupy: None
pint: 0.18
sparse: None
flox: 0.5.1
numpy_groupies: 0.9.16
setuptools: 57.4.0
pip: 21.2.4
conda: None
pytest: 6.2.5
IPython: 8.2.0
sphinx: 4.1.2
The text was updated successfully, but these errors were encountered: