File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
src/nwp_consumer/internal
repositories/raw_repositories Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -303,11 +303,10 @@ def _convert(path: pathlib.Path) -> ResultE[list[xr.DataArray]]:
303303 )
304304
305305 if len (processed_das ) == 0 :
306- # Some files do not have data for the relevant area, so don't error here
307- log .warning (
306+ return Failure (ValueError (
308307 f"Skipped { num_skipped } /{ len (dss )} datasets from '{ path } '. "
309308 "File may not contain the expected parameters and geographic bounds." ,
310- )
309+ ))
311310
312311 return Success (processed_das )
313312
Original file line number Diff line number Diff line change @@ -74,20 +74,24 @@ def _fold_dataarrays_generator(
7474 for value in generator :
7575 if isinstance (value , Failure ):
7676 results .extend ([value ])
77+ elif len (value .unwrap ()) == 0 :
78+ continue
7779 else :
7880 results .extend ([store .write_to_region (da = da ) for da in value .unwrap ()])
7981 successes , failures = partition (results )
8082 # TODO: Define the failure threshold for number of write attempts properly
83+ # ECMWF Realtime for instance needs a bit of tolerance because of some files not containing
84+ # data for all geographic regions.
8185 log .info (f"Processed { len (successes )} DataArrays successfully with { len (failures )} errors." )
82- if len (failures ) > 0 :
86+ if len (failures )/ len ( results ) > 0.06 :
8387 for i , exc in enumerate (failures ):
8488 if i < 5 :
8589 log .error (str (exc ))
8690 else :
8791 break
8892 return Failure (OSError (
8993 "Error threshold exceeded: "
90- f"{ len (failures )} errors (>0 ) occurred during processing." ,
94+ f"{ len (failures )/ len ( results ) } errors (>6% ) occurred during processing." ,
9195 ))
9296 else :
9397 return Success (sum (successes ))
You can’t perform that action at this time.
0 commit comments