<p>Figured out my error: I was assuming that I needed to alter the filename endings / type in order to save as a genuine .grb or .grib2 file. The files are already in grib2 format despite the ending in .f000 so you should be able to leave them as that.</p>

<p>My other error was not double checking the exact filename and path when dealing with multiple grib files across the GFS datasets. Some have slight differences in the naming convention, and when loading on pygrib it will throw the same generic "import error" as if the file couldn't be read.</p>

CC BY-SA 3.0
2017-06-22T00:54:01.687Z
2017-06-22T00:54:01.687Z
abe732
<p>I've been working with GFS data in Python using pygrib, and have been able to download and process data stored in .grb and .grib2 file formats from the NCEP archive ftp site. When I switch over to try to open grib files from the real time analysis, however, I'm not able to. I've tried downloading manually and changing the ending of the file to .grib2 and .grb, but neither has worked. Here's the ftp site that I'm trying to access for reference: <a href="http://nomads.ncep.noaa.gov/pub/data/nccf/com/gfs/prod/gfs.2017061300/" rel="nofollow noreferrer">http://nomads.ncep.noaa.gov/pub/data/nccf/com/gfs/prod/gfs.2017061300/</a></p>

CC BY-SA 3.0
2017-06-13T21:16:06.540Z
Are you sure you are using the .f000 files, and not the .f000.idx files? Also did you check if the file is blank?
BarocliniCplusplus
CC BY-SA 3.0
2017-06-13T21:30:37.927Z
Yeah I just tried again for the .f000 files to make sure I wasn't pulling the .idx, and get the same problem of not being able to access with pygrib.open(file.f000). The files are each ~60MB, so not blank.
abe732
CC BY-SA 3.0
2017-06-13T21:33:15.910Z
Can you show what the error is?
BarocliniCplusplus
CC BY-SA 3.0
2017-06-13T21:33:55.597Z
got it to work! there was a minor change in the file naming convention that I didn't pick up between the historical and real time sites. pygrib is able to open the file as .f000, doesn't need to be renamed to .grib2
abe732
CC BY-SA 3.0
2017-06-15T08:28:23.383Z
@abe732 Maybe you could post your findings as an answer? This could help other people facing the same problem.
FuzzyLeapfrog
CC BY-SA 3.0
2017-06-22T00:54:37.010Z
@FuzzyLeapfrog just posted, thanks for suggesting to
abe732
CC BY-SA 3.0
2017-06-22T05:45:50.110Z
... and you can also accept your own answer, to indicate that it successfully solved your problem. You'll have to [wait two days](https://meta.stackoverflow.com/q/277960/6947739) to do it, though.
Pont
<ncep>
Not able to open .f000 file formats in pygrib
abe732
# Not able to open .f000 file formats in pygrib

(Asked by: username_0 on 2017-06-13)

I've been working with GFS data in Python using pygrib, and have been able to download and process data stored in .grb and .grib2 file formats from the NCEP archive ftp site. When I switch over to try to open grib files from the real time analysis, however, I'm not able to. I've tried downloading manually and changing the ending of the file to .grib2 and .grb, but neither has worked. Here's the ftp site that I'm trying to access for reference: <http://nomads.ncep.noaa.gov/pub/data/nccf/com/gfs/prod/gfs.2017061300/>

**Tags:** ncep

> **Comments:**
> **username_1**: Are you sure you are using the .f000 files, and not the .f000.idx files? Also did you check if the file is blank?  
> **username_0**: Yeah I just tried again for the .f000 files to make sure I wasn't pulling the .idx, and get the same problem of not being able to access with pygrib.open(file.f000). The files are each ~60MB, so not blank.  
> **username_1**: Can you show what the error is?  
> **username_0**: got it to work! there was a minor change in the file naming convention that I didn't pick up between the historical and real time sites. pygrib is able to open the file as .f000, doesn't need to be renamed to .grib2  
> **username_2**: @username_0 Maybe you could post your findings as an answer? This could help other people facing the same problem.  
> **username_0**: @username_2 just posted, thanks for suggesting to  
> **username_3**: ... and you can also accept your own answer, to indicate that it successfully solved your problem. You'll have to [wait two days](https://meta.stackoverflow.com/q/277960/6947739) to do it, though.  

---

## 1 answers

### Answer by username_0 on 2017-06-22. Score: 4 | Accepted answer

Figured out my error: I was assuming that I needed to alter the filename endings / type in order to save as a genuine .grb or .grib2 file. The files are already in grib2 format despite the ending in .f000 so you should be able to leave them as that.

My other error was not double checking the exact filename and path when dealing with multiple grib files across the GFS datasets. Some have slight differences in the naming convention, and when loading on pygrib it will throw the same generic "import error" as if the file couldn't be read.


---

