File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed
src/nwp_consumer/internal/repositories/raw_repositories Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change 3939from typing import override
4040
4141import cfgrib
42+ import numpy as np
4243import s3fs
4344import xarray as xr
4445from joblib import delayed
@@ -270,14 +271,17 @@ def _convert(path: pathlib.Path) -> ResultE[list[xr.DataArray]]:
270271 num_skipped : int = 0
271272 expected_lons = ECMWFRealTimeS3RawRepository .model ().expected_coordinates .longitude
272273 expected_lats = ECMWFRealTimeS3RawRepository .model ().expected_coordinates .latitude
274+ expected_steps = ECMWFRealTimeS3RawRepository .model ().expected_coordinates .step
273275
274276 for i , ds in enumerate (dss ):
275277 # ECMWF Realtime provides all regions in one set of datasets,
276278 # so distinguish via their coordinates
279+ step = np .timedelta64 (ds .coords ["step" ].values , "h" ).astype (int ) # type: ignore[arg-type]
277280 is_relevant_dataset_predicate : bool = (
278281 (expected_lons is not None and expected_lats is not None )
279282 and (expected_lons [0 ] <= max (ds .coords ["longitude" ].values ) <= expected_lons [- 1 ])
280283 and (expected_lats [- 1 ] <= max (ds .coords ["latitude" ].values ) <= expected_lats [0 ])
284+ and (expected_steps [0 ] <= step <= expected_steps [- 1 ])
281285 )
282286 if not is_relevant_dataset_predicate :
283287 num_skipped += 1
You can’t perform that action at this time.
0 commit comments