Grib reader not working with windows filenames
Describe the bug
On windows, an error is raised when trying to read data using the grib reader.
To Reproduce
from satpy import Scene
scn = Scene(['C:/some_grib_file.grb'], reader='grib')
Expected behavior A scene to be created with the grib file data.
Actual results An error:
File ~\PycharmProjects\satpy\satpy\readers\grib.py:59, in GRIBFileHandler.__init__(self, filename, filename_info, filetype_info)
57 self._end_time = None
58 try:
---> 59 with pygrib.open(self.filename) as grib_file:
60 first_msg = grib_file.message(1)
61 last_msg = grib_file.message(grib_file.messages)
File src\pygrib\_pygrib.pyx:321, in pygrib._pygrib.open.__cinit__()
TypeError: expected bytes, FSFile found
If I put the grib file in the same directory as the script and load with scn = Scene(['./some_grib_file.grb'], reader='grib') then it works fine. So the issue appears to be coming from the C:/ part of the filename.
Environment Info:
- OS: Windows
- Satpy Version: Latest github
Theoretically this should be broken for all readers with Windows paths, but maybe my guess at where this bug is is wrong.
Not noticed this with any other readers, grib is the only one I've found so far that has the problem.
I'm realizing now this is probably because other readers (at least the ones you would use) support FSFiles, but the grib reader doesn't.