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

pygrib open does not allow io.BufferedReader object #259

Open
Tamburasca opened this issue Nov 23, 2024 · 0 comments
Open

pygrib open does not allow io.BufferedReader object #259

Tamburasca opened this issue Nov 23, 2024 · 0 comments

Comments

@Tamburasca
Copy link

According to the version 2.1.5 release

  • allow pygrib.open to take an io.BufferedReader object as an argument

reading BufferedReader objects is supposed to work now. I got version 2.1.6, though, and I reckoned that the following code should work then as well:

import requests
import io
import pygrib

response = requests.get("https://nomads.ncep.noaa.gov/pub/data/nccf/com/gfs/prod/gfs.20241123/00/atmos/gfs.t00z.pgrb2.0p25.f000")
response.raise_for_status()

f = io.BytesIO(response.content)
buffer_io = io.BufferedReader(f)
fsss = pygrib.open(buffer_io)
for item in fsss:
    print(item)

However, I get an error
Traceback (most recent call last):
File "/home/ralf/pycharm-projects/testStuff/gfs/gfs_http_download.py", line 18, in
fsss = pygrib.open(buffer_io)
File "src/pygrib/_pygrib.pyx", line 338, in pygrib._pygrib.open.cinit
io.UnsupportedOperation: fileno

Is there something I may have disregarded?

Thanks.

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

1 participant