Skip to content

Commit

Permalink
black format
Browse files Browse the repository at this point in the history
  • Loading branch information
alcoat committed Mar 1, 2024
1 parent c2714ca commit 23b9c86
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions herbie/models/ecmwf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@

from datetime import datetime


class ifs:
def template(self):
# Allow a user to select the deprecated 0p4-beta resolution,
# but default to the 0p25 product if resolution is not specified.
# Sounds like the 0p4-beta product will be deprecated in May 2024.
if not hasattr(self, "resolution") or self.resolution is None:
self.resolution = "0p25"
if self.date < datetime(2024,2,1):
if self.date < datetime(2024, 2, 1):
self.resolution = "0p4-beta"

self.DESCRIPTION = "ECMWF Open Data - Integrated Forecast System"
Expand All @@ -50,7 +51,7 @@ def template(self):
else:
product_suffix = "fc"

if self.date < datetime(2024,2,28,6):
if self.date < datetime(2024, 2, 28, 6):
post_root = (
f"{self.date:%Y%m%d/%Hz}/{self.resolution}/{self.product}"
f"/{self.date:%Y%m%d%H%M%S}-{self.fxx}h-{self.product}-{product_suffix}.grib2"
Expand Down
7 changes: 5 additions & 2 deletions tests/test_ecmwf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
today_str = yesterday.strftime("%Y-%m-%d %H:%M")
save_dir = "$TMPDIR/Herbie-Tests/"


def test_ifs_old_0p4():
H = Herbie(
datetime(2024,1,31),
datetime(2024, 1, 31),
model="ifs",
product="oper",
save_dir=save_dir,
Expand All @@ -30,9 +31,10 @@ def test_ifs_old_0p4():
H.xarray(":10(?:u|v):", remove_grib=False)
assert H.get_localFilePath(":10(?:u|v):").exists()


def test_ifs_old_0p25():
H = Herbie(
datetime(2024,2,26),
datetime(2024, 2, 26),
model="ifs",
product="oper",
save_dir=save_dir,
Expand All @@ -51,6 +53,7 @@ def test_ifs_old_0p25():
H.xarray(":10(?:u|v):", remove_grib=False)
assert H.get_localFilePath(":10(?:u|v):").exists()


def test_ifs():
H = Herbie(
yesterday,
Expand Down

0 comments on commit 23b9c86

Please sign in to comment.