Skip to content

Commit e4b32a8

Browse files
committed
Added GFS NCEI historical analysis source
1 parent fb40c86 commit e4b32a8

2 files changed

Lines changed: 26 additions & 2 deletions

File tree

src/herbie/models/gfs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,9 @@ def template(self):
8686
"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",
8787
"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",
8888
"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",
89+
"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",
8990
}
90-
self.IDX_SUFFIX = [".grb2.inv", ".idx"]
91+
self.IDX_SUFFIX = [".grb2.inv", ".idx", ".inv"]
9192
self.LOCALFILE = f"{self.get_remoteFileName}"
9293

9394

tests/test_gfs.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,27 @@ 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+
print(save_dir)
60+
61+
H = Herbie(
62+
datetime(2007, 4, 5),
63+
priority="ncei_historical_analysis",
64+
product="0.5-degree",
65+
model="gfs",
66+
fxx=0,
67+
save_dir=save_dir,
68+
overwrite=True,
69+
)
70+
71+
assert H.grib, "GFS NCEI Historical Analysis grib2 file not found"
72+
assert H.idx, "GFS NCEI Historical Analysis index file not found"
73+
74+
filter = "TMP:900 mb"
75+
f = H.download(filter)
76+
assert H.get_localFilePath(filter).exists(), "File doesn't exist!"
77+
f.unlink()
78+
79+
H.xarray(filter)

0 commit comments

Comments
 (0)