issues: 1217543476
This data as json
id | node_id | number | title | user | state | locked | assignee | milestone | comments | created_at | updated_at | closed_at | author_association | active_lock_reason | draft | pull_request | body | reactions | performed_via_github_app | state_reason | repo | type |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1217543476 | I_kwDOAMm_X85Ikj00 | 6526 | xr.polyval first arg requires name attribute | 43316012 | closed | 0 | 2 | 2022-04-27T15:47:02Z | 2022-05-05T19:15:58Z | 2022-05-05T19:15:58Z | COLLABORATOR | What happened?I have some polynomial coefficients and want to evaluate them at some values using As described in the docstring/docu I created a 1D coordinate DataArray and pass it to What did you expect to happen?I expected that the polynomial would be evaluated at the given points. Minimal Complete Verifiable Example```Python import xarray as xr coeffs = xr.DataArray([1, 2, 3], dims="degree") With a "handmade" coordinate it fails:coord = xr.DataArray([0, 1, 2], dims="x") xr.polyval(coord, coeffs) raises:Traceback (most recent call last):File "<stdin>", line 1, in <module>File "xarray/core/computation.py", line 1847, in polyvalx = get_clean_interp_index(coord, coord.name, strict=False)File "xarray/core/missing.py", line 252, in get_clean_interp_indexindex = arr.get_index(dim)File "xarray/core/common.py", line 404, in get_indexraise KeyError(key)KeyError: NoneIf one adds a name to the coord that is called like the dimension:coord2 = xr.DataArray([0, 1, 2], dims="x", name="x") xr.polyval(coord2, coeffs) works``` Relevant log outputNo response Anything else we need to know?I assume that the "standard" workflow is to obtain the It could be that the problem will be solved by replacing the coord DataArray argument by an explicit Index in the future. Environment
INSTALLED VERSIONS
------------------
commit: None
python: 3.9.10 (main, Mar 15 2022, 15:56:56)
[GCC 7.5.0]
python-bits: 64
OS: Linux
OS-release: 3.10.0-1160.49.1.el7.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: ('en_US', 'UTF-8')
libhdf5: 1.12.0
libnetcdf: 4.7.4
xarray: 2022.3.0
pandas: 1.4.2
numpy: 1.22.3
scipy: None
netCDF4: 1.5.8
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: None
cftime: 1.6.0
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: None
dask: None
distributed: None
matplotlib: 3.5.1
cartopy: 0.20.2
seaborn: None
numbagg: None
fsspec: None
cupy: None
pint: None
sparse: None
setuptools: 58.1.0
pip: 22.0.4
conda: None
pytest: None
IPython: 8.2.0
sphinx: None
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/6526/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |