Skip to content

Commit

Permalink
Merge pull request #313 from karlwx/graphcast
Browse files Browse the repository at this point in the history
Add GFS GraphCast AI Model
  • Loading branch information
blaylockbk authored May 15, 2024
2 parents 4498b3f + c19d56d commit 92a7b36
Show file tree
Hide file tree
Showing 3 changed files with 504 additions and 151 deletions.
619 changes: 468 additions & 151 deletions docs/user_guide/tutorial/model_notebooks/gfs.ipynb

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions herbie/models/gfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,21 @@ def template(self):
self.IDX_SUFFIX = [".idx"]
self.LOCALFILE = f"{self.get_remoteFileName}"

class graphcast:
def template(self):
self.DESCRIPTION = "GraphCast Global Forecast System (EXPERIMENTAL)"
self.DETAILS = {
"aws document": "https://registry.opendata.aws/noaa-nws-graphcastgfs-pds/",
}
self.PRODUCTS = {
"pgrb2.0p25": "common fields, 0.25 degree resolution",
}
self.SOURCES = {
"aws": f"https://noaa-nws-graphcastgfs-pds.s3.amazonaws.com/graphcastgfs.{self.date:%Y%m%d/%H}/forecasts_13_levels/graphcastgfs.t{self.date:%H}z.{self.product}.f{self.fxx:03d}",
}
self.IDX_SUFFIX = [".idx"]
self.LOCALFILE = f"{self.get_remoteFileName}"


class gfs_wave:
def template(self):
Expand Down
21 changes: 21 additions & 0 deletions tests/test_gfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,24 @@ def test_gfs():
f.unlink()

H.xarray(filter)

def test_graphcast():
H = Herbie(
today-timedelta(hours=12),
priority="aws",
product="pgrb2.0p25",
model="graphcast",
fxx=6,
save_dir=save_dir,
overwrite=True,
)

assert H.grib, "GFS grib2 file not found"
assert H.idx, "GFS index file not found"

filter = "HGT:500 mb"
f = H.download(filter)
assert H.get_localFilePath(filter).exists(), "File doesn't exist!"
f.unlink()

H.xarray(filter)

0 comments on commit 92a7b36

Please sign in to comment.