Skip to content

Commit

Permalink
attempt to repair GEFS file discovery for days before 2020-9-23
Browse files Browse the repository at this point in the history
  • Loading branch information
blaylockbk committed Aug 7, 2024
1 parent e1fecf7 commit e47ecba
Showing 1 changed file with 35 additions and 14 deletions.
49 changes: 35 additions & 14 deletions herbie/models/gefs.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
## Added by Brian Blaylock
## March 11, 2022

"""
A Herbie template for the GEFS (2017-Present) and GEFS Reforecast (2000-2019)
GRIB2 products.
"""A Herbie template for the GEFS (2017-Present) and GEFS Re-forecast (2000-2019) GRIB2 products."""

"""
from datetime import datetime


class gefs:
"""Global Ensemble Forecast System (GEFS).
Notes
-----
The NODD program provides GEFS data on all major cloud partners
- aws: Archive begins 2017-01-01
- google: Archive begins 2021-01-01
- azure: Last 30 days?
"""

def template(self):
self.DESCRIPTION = "Global Ensemble Forecast System (GEFS)"
self.DETAILS = {
Expand Down Expand Up @@ -47,14 +54,28 @@ def template(self):
self.member = f"p{self.member:02d}"

filedir = f"gefs.{self.date:%Y%m%d/%H}"
filepaths = {
"atmos.5": f"{filedir}/atmos/pgrb2ap5/ge{self.member}.t{self.date:%H}z.pgrb2a.0p50.f{self.fxx:03d}",
"atmos.5b": f"{filedir}/atmos/pgrb2bp5/ge{self.member}.t{self.date:%H}z.pgrb2b.0p50.f{self.fxx:03d}",
"atmos.25": f"{filedir}/atmos/pgrb2sp25/ge{self.member}.t{self.date:%H}z.pgrb2s.0p25.f{self.fxx:03d}",
"wave": f"{filedir}/wave/gridded/gefs.wave.t{self.date:%H}z.{self.member}.global.0p25.f{self.fxx:03d}.grib2",
"chem.5": f"{filedir}/chem/pgrb2ap25/gefs.chem.t{self.date:%H}z.a2d_0p25.f{self.fxx:03d}.grib2",
"chem.25": f"{filedir}/chem/pgrb2ap25/gefs.chem.t{self.date:%H}z.a2d_0p25.f{self.fxx:03d}.grib2",
}

if self.date < datetime(2018, 7, 27):
filepaths = {
"atmos.5": f"{filedir}/ge{self.member}.t{self.date:%H}z.pgrb2af{self.fxx:03d}",
"atmos.5b": f"{filedir}/ge{self.member}.t{self.date:%H}z.pgrb2bf{self.fxx:03d}",
}
elif self.date < datetime(2020, 9, 23):
# Update to GEFS system to put data in directories. Change in form for lead time to fxx.
filepaths = {
"atmos.5": f"{filedir}/pgrb2a/ge{self.member}.t{self.date:%H}z.pgrb2af{self.fxx:02d}",
"atmos.5b": f"{filedir}/pgrb2b/ge{self.member}.t{self.date:%H}z.pgrb2bf{self.fxx:02d}",
}
else:
# Update to GEFS system with wave and chem products. Change in form for lead time to fxxx.
filepaths = {
"atmos.5": f"{filedir}/atmos/pgrb2ap5/ge{self.member}.t{self.date:%H}z.pgrb2a.0p50.f{self.fxx:03d}",
"atmos.5b": f"{filedir}/atmos/pgrb2bp5/ge{self.member}.t{self.date:%H}z.pgrb2b.0p50.f{self.fxx:03d}",
"atmos.25": f"{filedir}/atmos/pgrb2sp25/ge{self.member}.t{self.date:%H}z.pgrb2s.0p25.f{self.fxx:03d}",
"wave": f"{filedir}/wave/gridded/gefs.wave.t{self.date:%H}z.{self.member}.global.0p25.f{self.fxx:03d}.grib2",
"chem.5": f"{filedir}/chem/pgrb2ap25/gefs.chem.t{self.date:%H}z.a2d_0p25.f{self.fxx:03d}.grib2",
"chem.25": f"{filedir}/chem/pgrb2ap25/gefs.chem.t{self.date:%H}z.a2d_0p25.f{self.fxx:03d}.grib2",
}

valid_members = {
"atmos.5": [f"p{i:02d}" for i in range(1, 31)] + ["c00", "spr", "avg"],
Expand Down Expand Up @@ -89,7 +110,7 @@ def template(self):


class gefs_reforecast:
"""Template for GEFS Reforecast data.
"""Template for GEFS Re-forecast data.
These grib files are organized different from other model types.
The files are grouped into variables and clumped by forecast range.
Expand Down

0 comments on commit e47ecba

Please sign in to comment.