Cannot apply sum
to custom object arrays with min_count=1
if n_dims <= sum_dims
#9755
Labels
sum
to custom object arrays with min_count=1
if n_dims <= sum_dims
#9755
What happened?
I'm storing Pyomo objects in xarray arrays to allow for vectorised operations with named arrays. E.g., I might have an array of Pyomo variables indexed over the
costs
dimension and I want to sum them. Before v2024.6.0 this was possible without any issues. Now, if I include themin_count
argument in my summation then it fails when trying to apply numpy type promotion to the Pyomo object.What did you expect to happen?
The
xarray.core.array_api_compat.result_type
method should fall back tonumpy.object_
when objects are present.Minimal Complete Verifiable Example
MVCE confirmation
Relevant log output
Anything else we need to know?
No response
Environment
INSTALLED VERSIONS
commit: None
python: 3.12.4 | packaged by conda-forge | (main, Jun 17 2024, 10:13:44) [Clang 16.0.6 ]
python-bits: 64
OS: Darwin
OS-release: 23.2.0
machine: arm64
processor: arm
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: ('en_US', 'UTF-8')
libhdf5: 1.14.3
libnetcdf: 4.9.2
xarray: 2024.10.0
pandas: 2.2.2
numpy: 2.0.2
scipy: 1.14.0
netCDF4: 1.6.5
pydap: None
h5netcdf: None
h5py: None
zarr: 2.18.2
cftime: 1.6.4
nc_time_axis: None
iris: None
bottleneck: 1.4.0
dask: 2024.8.1
distributed: None
matplotlib: None
cartopy: None
seaborn: None
numbagg: None
fsspec: 2024.6.1
cupy: None
pint: None
sparse: 0.15.4
flox: 0.9.8
numpy_groupies: 0.11.1
setuptools: 70.0.0
pip: 24.0
conda: None
pytest: 8.2.2
mypy: None
IPython: 8.25.0
The text was updated successfully, but these errors were encountered: