Skip to content

Commit 4f03dee

Browse files
authored
Merge pull request #446 from vieramercado/feature/ncei-historical-analysis
Added GFS NCEI historical analysis source
2 parents 2dceaba + af0c492 commit 4f03dee

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

src/herbie/models/gfs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ def template(self):
8585
"ncei_analysis": f"https://www.ncei.noaa.gov/data/global-forecast-system/access/grid-{grid_num:03d}-{self.product}/analysis/{self.date:%Y%m/%Y%m%d}/gfs_{grid_num}_{self.date:%Y%m%d_%H%M}_{self.fxx:03d}.grb2",
8686
"ncei_forecast": f"https://www.ncei.noaa.gov/data/global-forecast-system/access/grid-{grid_num:03d}-{self.product}/forecast/{self.date:%Y%m/%Y%m%d}/gfs_{grid_num}_{self.date:%Y%m%d_%H%M}_{self.fxx:03d}.grb2",
8787
"ncar_rda": f"https://data.rda.ucar.edu/d084001/{self.date:%Y/%Y%m%d}/gfs.0p25.{self.date:%Y%m%d%H}.f{self.fxx:03d}.grib2",
88+
"ncei_historical_analysis": f"https://www.ncei.noaa.gov/data/global-forecast-system/access/historical/analysis/{self.date:%Y%m/%Y%m%d}/gfsanl_{grid_num}_{self.date:%Y%m%d_%H%M}_{self.fxx:03d}.grb2",
8889
}
89-
self.IDX_SUFFIX = [".grb2.inv", ".idx"]
90+
self.IDX_SUFFIX = [".grb2.inv", ".idx", ".inv"]
9091
self.LOCALFILE = f"{self.get_remoteFileName}"
9192

9293

tests/test_gfs.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,25 @@ def test_graphcast():
5353
assert H.get_localFilePath(filter).exists(), "File doesn't exist!"
5454
f.unlink()
5555

56-
H.xarray(filter)
56+
H.xarray(filter)
57+
58+
def test_gfs_ncei_historical_anl():
59+
H = Herbie(
60+
datetime(2015, 1, 15),
61+
priority="ncei_historical_analysis",
62+
product="0.5-degree",
63+
model="gfs",
64+
fxx=0,
65+
save_dir=save_dir,
66+
overwrite=True,
67+
)
68+
69+
assert H.grib, "GFS NCEI Historical Analysis grib2 file not found"
70+
assert H.idx, "GFS NCEI Historical Analysis index file not found"
71+
72+
filter = "TMP:900 mb"
73+
f = H.download(filter)
74+
assert H.get_localFilePath(filter).exists(), "File doesn't exist!"
75+
f.unlink()
76+
77+
H.xarray(filter)

0 commit comments

Comments
 (0)