-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
TypeError: Expected label or tuple of labels since switching to 0.19.0 #5651
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
Comments
Please could you post the stack trace @georgbuechner ? |
|
Thanks @georgbuechner . It looks like that error is coming from the pandas call — is that correct? It's possible the xarray output changed between versions; understanding what changed would help here. One suggestion for these sorts of issues — reducing the error down to a minimal example — and only including external data if unavoidable — makes diagnosing it an order of magnitude easier. |
Here is the xarray output for the different version and resolution levels (0.18.2, 0.19.0, high, low).
As we can see for v0.19.0 and high-resolution the xarray output has changed, moving the column "step" to the front. This makes it neccessary to add 'step', when accessing the values: However, the data-set is still the same, independant of the xarry-version, with the only change being the order of the dimensions (
|
Thanks for tracking that down @georgbuechner . We'd need to find the source of the different ordering — is it the file or is there a problem with xarray? |
FYI the important line is
unlike the That said, I checked your file (or rather, a new file from that server) and can reproduce this issue, which appears to have been introduced in #4753. Not sure if that's a bug, though: as If you want a specific order, I'd recommend passing that to the |
Sounds like this is largely working as intended, or at least we don't have an MCVE to show that it's not, so will close. Folks should feel free to open with an MCVE if there are outstanding issues. (I haven't been loving the defaults of |
What happened:
Since upgrading to
xarray==0.19.0
we are experiencing the following error:TypeError: Expected label or tuple of labels, got (56.580000000002094, 0.38000000000000383))
(output of MCVE using high_resolution.grib2.bz2)What you expected to happen:
Using
xarray==0.18.2
getting values from grib-files works as expected:[[[186.25311279296875], [185.88555908203125], [185.44927978515625], [184.66273498535156]]]
(output of MCVE using high_resolution.grib2.bz2)Minimal Complete Verifiable Example:
Anything else we need to know?:
Use
wget -O high_resolution.grib2.bz2 https://opendata.dwd.de/weather/nwp/icon-d2/grib/09/aswdifd_s/icon-d2_germany_regular-lat-lon_single-level_2021073009_019_2d_aswdifd_s.grib2.bz2
or
wget -O low_resolution.grib2.bz2 https://opendata.dwd.de/weather/nwp/icon-d2/grib/09/ps/icon-d2_germany_regular-lat-lon_single-level_2021073009_030_2d_ps.grib2.bz2
to get two example files for testing the above code.The low-resolution files work with the older and the newer version, only when using the high resolution file(s), we are experiencing the described error.
Environment:
Output of xr.show_versions()
commit: None python: 3.9.6 (default, Jun 29 2021, 06:20:32) [Clang 12.0.0 (clang-1200.0.32.29)] python-bits: 64 OS: Darwin OS-release: 19.6.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: None LANG: None LOCALE: (None, 'UTF-8') libhdf5: None libnetcdf: Nonexarray: 0.18.2
pandas: 1.3.1
numpy: 1.21.1
scipy: None
netCDF4: None
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: None
cftime: None
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: 0.9.9.0
iris: None
bottleneck: None
dask: None
distributed: None
matplotlib: None
cartopy: None
seaborn: None
numbagg: None
pint: None
setuptools: 57.0.0
pip: 21.2.1
conda: None
pytest: 6.2.4
IPython: None
sphinx: None
The text was updated successfully, but these errors were encountered: