You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I am reading some GRIB2 data from ECMWF MARS archive and cannot diff("step") unless I load the data previously. I am seeing the problem only after upgrading from xarray v2025.3.1 to v2025.10.1
xr.open_dataset("/path/to/tp_2025052500.grb").load().diff("step") works well. xr.open_dataset("/path/to/tp_2025052500.grb").diff("step") fails with alignment problems.
An addition: xr.open_dataset("/path/to/tp_2025052500.grb", chunks='auto').diff("step") also works well.
So the problem is narrowed down to xarray Lazy Indexing classes (used when chunks=None).
The data.grib2 will contain two steps.
Note: this particular files will only be available for a few days, but some recent ones are always there.
Those files contain many parameters, might be useful to restrict to a single parameter to simplify. In my case I was testing total precipitation, but I don't think the particular parameter matters.
This means that the slices are not normalized anymore if we're indexing the entire dimension, and apparently cfgrib's backend array does not support unnormalized slices? The fix is change the second line to
Activity
lluritu commentedon Nov 21, 2025
An addition:
xr.open_dataset("/path/to/tp_2025052500.grb", chunks='auto').diff("step")also works well.So the problem is narrowed down to xarray Lazy Indexing classes (used when chunks=None).
Llorenç
keewis commentedon Nov 21, 2025
can you share a link to the file (if it is public), so we can try to reproduce this? Also, could you please share the traceback?
lluritu commentedon Nov 21, 2025
You can get some sample data from ECMWF open data archive for two different steps using wget and concat them together:
The data.grib2 will contain two steps.
Note: this particular files will only be available for a few days, but some recent ones are always there.
Those files contain many parameters, might be useful to restrict to a single parameter to simplify. In my case I was testing total precipitation, but I don't think the particular parameter matters.
lluritu commentedon Nov 21, 2025
Traceback:
dcherian commentedon Nov 21, 2025
Can you show us the repr for
xr.open_dataset("[/path/to/cat.grib2]")please?lluritu commentedon Nov 24, 2025
This is the repr:
keewis commentedon Nov 24, 2025
the problem is this:
xarray/xarray/core/indexing.py
Lines 366 to 368 in 42669f9
This means that the slices are not normalized anymore if we're indexing the entire dimension, and apparently
cfgrib's backend array does not support unnormalized slices? The fix is change the second line to