Skip to content
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

Bug: Opening GRIB2 file with accompanying index file ignores index file. #328

Open
JimBiardClimateAI opened this issue Feb 8, 2023 · 3 comments

Comments

@JimBiardClimateAI
Copy link

I first open a GRIB2 file named d2m.grib with cfgrib.open_file(), which produces the index file d2m.grib.923a8.idx. In a different application I open the same GRIB2 file with cfgrib.open_dataset(). I receive the message Ignoring index file 'd2m.grib.923a8.idx' incompatible with GRIB file.

I am running with cfgrib 0.9.10.3 and xarray 2022.12.0 on MacOS Ventura 13.2.

@JimBiardClimateAI
Copy link
Author

JimBiardClimateAI commented Feb 8, 2023

On deeper inspection, it appears that the issue is due to the index file having the absolute path to the GRIB2 file embedded within the file. I am moving the GRIB2 and .idx file pair to a new location before attempting to open the GRIB2 file. Is there any way that I can address this issue? I don't have the option of recreating the file path on the computer where I am using the files.

@JimBiardClimateAI
Copy link
Author

Opening the GRIB2 file the first time with a relative path stores the relative path to the GRIB2 file in the .idx file, but the .idx file is still ignored if the current working directory is not set so that the relative path works. That is quite awkward for a large number of use cases.

@Metamess
Copy link
Contributor

Hey Jim, I encountered your issue as well and made a larger write-up about the issue and potential ways to fix it (#350 ). Depending on the feedback I might try to write a PR to address it. If this is still relevant to you, you might be interested in any potential progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants