-
-
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
error for apply_ufunc with exclude_dims and vectorize #3890
Comments
In xarray/xarray/core/computation.py Line 995 in 009aa66
and xarray/xarray/core/computation.py Lines 1013 to 1015 in 009aa66
Thus, for the given example: signature = xr.core.computation._UFuncSignature(input_core_dims=[["time"], ["time"]])
signature.to_gufunc_string() returns So I assume |
Not very elegant... from collections import Counter
input_core_dims = [["time"], ["time", "foo"], ["bar"]]
exclude_dims = set(["time"])
c = Counter()
for dims in input_core_dims:
for d in dims:
if d in exclude_dims:
d_new = f"{d}_{c[d]}"
c.update([d])
else:
d_new = d
print(d_new) |
I tried to use
apply_ufunc
for a function that takes input of unequal length and requiresvectorize=True
which resulted in aValueError
. I think the problem stems from the waynp.vectorize
is called.MCVE Code Sample
Returns
Note: the error stems from numpy.
Expected Output
A DataArray.
Problem Description
I can reproduce the problem in pure numpy:
The correct result is returned when the
signature
is changed:So I think the signature needs to be changed when
exclude_dims
are present.Versions
Output of `xr.show_versions()`
This is my development environment, so i think xarray should be 'master'.
**PNC:/home/mathause/conda/envs/xarray_devel/lib/python3.7/site-packages/PseudoNetCDF/pncwarn.py:24:UserWarning:
pyproj could not be found, so IO/API coordinates cannot be converted to lat/lon; to fix, install pyproj or basemap (e.g.,
pip install pyproj)
INSTALLED VERSIONS
commit: None
python: 3.7.3 | packaged by conda-forge | (default, Jul 1 2019, 21:52:21)
[GCC 7.3.0]
python-bits: 64
OS: Linux
OS-release: 4.15.0-91-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
libhdf5: 1.10.5
libnetcdf: 4.7.1
xarray: 0.11.1+335.gb0c336f6
pandas: 0.25.3
numpy: 1.17.3
scipy: 1.3.1
netCDF4: 1.5.3
pydap: installed
h5netcdf: 0.7.4
h5py: 2.10.0
Nio: None
zarr: 2.3.2
cftime: 1.0.4.2
nc_time_axis: None
PseudoNetCDF: installed
rasterio: 1.1.0
cfgrib: 0.9.5.4
iris: None
bottleneck: 1.2.1
dask: 2.6.0
distributed: 2.6.0
matplotlib: 3.1.2
cartopy: None
seaborn: 0.9.0
numbagg: None
setuptools: 41.6.0.post20191101
pip: 19.3.1
conda: installed
pytest: 5.2.2
IPython: 7.9.0
sphinx: None
The text was updated successfully, but these errors were encountered: