Skip to content

Commit

Permalink
Merge pull request #64 from OCHA-DAP/hotfix/seas5-year
Browse files Browse the repository at this point in the history
Account for 2025 year
  • Loading branch information
hannahker authored Jan 6, 2025
2 parents 4f6ee56 + 52bb124 commit 5d7fd5a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/pipelines/seas5_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(self, mode, is_update, start_year, end_year, log_level, **kwargs):
self.bbox = kwargs["bbox"][mode]

def _generate_raw_filename(self, year, issued_month=None, fc_month=None):
if year == 2024:
if year >= 2024:
return f"T8L{issued_month:02}010000{fc_month:02}______1.grib"
else:
return f"tprate_{year}.grib"
Expand All @@ -40,7 +40,7 @@ def _generate_processed_filename(self, issued_date, leadtime):
return f"precip_em_i{issued_date}_lt{leadtime}.tif"

def query_api(self, year, issued_month=None, fc_month=None):
if year == 2024:
if year >= 2024:
filename = self._generate_raw_filename(year, issued_month, fc_month)
aws_filename = filename.split(".")[0] # File on AWS doesn't have `.grib`
s3_path = f"s3://{self.aws_bucket_name}/ecmwf/{aws_filename}"
Expand Down Expand Up @@ -105,7 +105,7 @@ def process_data(self, raw_filename, year, issued_month=None, fc_month=None):
# 2024 data from AWS source will just have `number``, `latitude``, and `longitude`` dimensions
# The month and fc_month are in the filename. Whereas the archived data pre 2024
# will also contain `forecastMonth` and `time` dimensions that need to be parsed.
if year == 2024:
if year >= 2024:
ds = xr.open_dataset(
raw_file_path,
engine="cfgrib",
Expand All @@ -127,7 +127,7 @@ def process_data(self, raw_filename, year, issued_month=None, fc_month=None):
ds_mean = ds_mean.rename(
{"tprate": "total precipitation", "latitude": "y", "longitude": "x"}
)
if year == 2024:
if year >= 2024:
leadtime = leadtime_utils.to_leadtime(issued_month, fc_month)
self.metadata["month_issued"] = issued_month
self.metadata["year_valid"] = leadtime_utils.to_fc_year(
Expand Down

0 comments on commit 5d7fd5a

Please sign in to comment.