Skip to content

Commit fcd31f2

Browse files
committed
fix(ecmwf): NL order allow fewer steps
1 parent 3192d34 commit fcd31f2

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/nwp_consumer/internal/entities/modelmetadata.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,16 @@ def with_running_hours(self, hours: list[int]) -> "ModelMetadata":
144144
"""Returns metadata for the given model with the given running hours."""
145145
return dataclasses.replace(self, running_hours=hours)
146146

147+
def with_max_step(self, max_step: int) -> "ModelMetadata":
148+
"""Returns metadata for the given model with the given max step."""
149+
return dataclasses.replace(
150+
self,
151+
expected_coordinates=dataclasses.replace(
152+
self.expected_coordinates,
153+
step=[s for s in self.expected_coordinates.step if s <= max_step],
154+
),
155+
)
156+
147157
def month_its(self, year: int, month: int) -> list[dt.datetime]:
148158
"""Generate all init times for a given month."""
149159
days = pd.Period(f"{year}-{month}").days_in_month

src/nwp_consumer/internal/repositories/raw_repositories/ecmwf_realtime.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ def repository() -> entities.RawRepositoryMetadata:
8686
"hres-ifs-uk": entities.Models.ECMWF_HRES_IFS_0P1DEGREE.with_region("uk-north60"),
8787
"hres-ifs-india": entities.Models.ECMWF_HRES_IFS_0P1DEGREE.with_region("india")\
8888
.with_chunk_count_overrides({"variable": 1}),
89-
"hres-ifs-nl": entities.Models.ECMWF_HRES_IFS_0P1DEGREE.with_region("nl"),
89+
"hres-ifs-nl": entities.Models.ECMWF_HRES_IFS_0P1DEGREE.with_region("nl")\
90+
.with_max_step(56),
9091
},
9192
)
9293

@@ -320,7 +321,7 @@ def _wanted_file(filename: str, it: dt.datetime, max_step: int) -> bool:
320321
it: The init time of the model run.
321322
max_step: The maximum step in hours to consider.
322323
"""
323-
prefix: str = os.getenv("ECMWF_DISSEMINATION_REALTIME_FILE_PREFIX", "A2")
324+
prefix: str = os.getenv("ECMWF_REALTIME_DISSEMINATION_FILE_PREFIX", "A2")
324325
pattern: str = r"^" + prefix + r"[DS](\d{8})(\d{8})\d$"
325326
match: re.Match[str] | None = re.search(pattern=pattern, string=filename)
326327
if match is None:

0 commit comments

Comments
 (0)