-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
/vsisubfile reads GRIB2 files inconsistently #10214
Comments
FWIW, these files have a
|
@dbaston 's advice is a good one. Reading of a specific band when the .idx is available should be efficient and not involve reading other parts of the file |
@rouault thank you for the quick fix! For my use case, I am hoping to encode everything I need to read the right subset directly in the |
The
|
Thanks @dbaston, I did not know about the |
What is the bug?
I have been working with some GRIB2 files recently and discovered that I could use
/vsisubfile
to read individual bands using the published byte ranges for each band. This is super useful because these files have hundreds of bands. It works great except for the first band. When I try to read the first band, GDAL interprets it as a multi-band dataset instead of a single-band dataset like all of the other bands.Steps to reproduce the issue
You can run
gdalinfo
on an entire GRIB2 file like this:This properly describes all of the bands!
You can run
gdalinfo
on a slice in the middle of the file like this:When you run
gdalinfo
on the first slice (start byte = 0), GDAL reads it as a dataset with the full number of bands but only loads data for the first (correct) band:The result can be loaded and used, but the structure is not what you expect from the operation.
I don't know a lot about the internal structure of the GRIB files but I assume that this is happening because the full dataset metadata is getting loaded somewhere around byte 0.
Versions and provenance
Linux Ubuntu 24.04
GDAL 3.8.4, released 2024/02/08
Additional context
No response
The text was updated successfully, but these errors were encountered: