Description
I recently upgraded to xarray 0.14.0. When running code that used to work in 0.13, I get a TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
in 0.14 when running code similar to the MCVE below. The code should return the GroupBy bins instead of the error.
MCVE Code Sample
import xarray as xr
import pandas as pd
import numpy as np
ts = pd.date_range(start='2010-08-01', end='2010-08-15', freq='24.8H')
ds = xr.Dataset()
ds['time'] = xr.DataArray(pd.date_range('2010-08-01', '2010-08-15', freq='15min'), dims='time')
ds['val'] = xr.DataArray(np.random.rand(*ds['time'].shape), dims='time')
ds.groupby_bins('time', ts) #error thrown here
Full error details below.
~/miniconda3/lib/python3.7/site-packages/xarray/core/common.py in groupby_bins(self, group, bins, right, labels, precision, include_lowest, squeeze, restore_coord_dims)
727 "labels": labels,
728 "precision": precision,
--> 729 "include_lowest": include_lowest,
730 },
731 )
~/miniconda3/lib/python3.7/site-packages/xarray/core/groupby.py in init(self, obj, group, squeeze, grouper, bins, restore_coord_dims, cut_kwargs)
322
323 if bins is not None:
--> 324 if np.isnan(bins).all():
325 raise ValueError("All bin edges are NaN.")
326 binned = pd.cut(group.values, bins, **cut_kwargs)
TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
Output of xr.show_versions()
INSTALLED VERSIONS
commit: None
libhdf5: 1.10.4
libnetcdf: 4.6.2
xarray: 0.14.0
pandas: 0.25.1
numpy: 1.17.2
scipy: 1.3.0
netCDF4: 1.5.1.2
pydap: installed
h5netcdf: None
h5py: None
Nio: None
zarr: None
cftime: 1.0.3.4
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: None
dask: 2.2.0
distributed: 2.5.2
matplotlib: 3.1.1
cartopy: 0.17.0
seaborn: 0.9.0
numbagg: None
setuptools: 41.4.0
pip: 19.3
conda: 4.7.12
pytest: 5.1.1
IPython: 7.8.0
sphinx: None