-
-
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
nbytes not available for lazy loaded array and so can't print(ds) #9185
Comments
Thanks for opening your first issue here at xarray! Be sure to follow the issue template! |
Thanks for the issue. We should definitely have a try/except for the bytes given that can fail... |
as far as I can tell, the reason for this is that |
* addresses the nbytes problem described in pydata#9185
I tried to fix in grib2io replacing |
you'd have to replace it with the dtype instance, |
This issue was supposed to be closed when I closed the #9191, but it wasn't. So closing... As mentioned in the pull request, comments here and in the pull request were helpful to me tracking down how to fix in grib2io. |
What happened?
We use the grib2io backend to read GRIB2 formatted files. Started to have problem printing the summary of the dataset to the screen with the v2024.02.0 release. I suspect the problem is from #8702
Trying to print a dataset will fail trying to find nbytes.
The grib2io backend opens the file lazily, which means you are printing the summary of a MemoryCachedArray which doesn't have nbytes, nor is able to calculate.
Loading the data into memory and then the print(ds1) works fine.
You can force loading the data and then printing works:
What did you expect to happen?
Want print(ds1) to print the summary of the dataset.
Minimal Complete Verifiable Example
MVCE confirmation
Relevant log output
No response
Anything else we need to know?
No response
Environment
xarray: 2024.6.0
pandas: 2.2.1
numpy: 1.26.4
scipy: 1.12.0
netCDF4: 1.6.5
pydap: None
h5netcdf: None
h5py: None
zarr: 2.17.1
cftime: 1.6.3
nc_time_axis: None
iris: None
bottleneck: None
dask: 2024.3.1
distributed: 2024.3.1
matplotlib: 3.8.4
cartopy: 0.22.0
seaborn: None
numbagg: None
fsspec: 2024.3.1
cupy: None
pint: 0.23
sparse: None
flox: None
numpy_groupies: None
setuptools: 69.2.0
pip: 24.0
conda: 24.3.0
pytest: 8.1.1
mypy: None
IPython: 8.22.2
sphinx: 7.3.7
The text was updated successfully, but these errors were encountered: