File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
src/anemoi/datasets/create/input Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,11 @@ def transform(self, group_of_dates):
7272 end += self .frequency
7373
7474 to_try = sorted (to_try - self .tried )
75+ info = {k : "no-data" for k in to_try }
76+
77+ if not to_try :
78+ LOG .warning (f"No new dates to try for { group_of_dates } in { self .source } " )
79+ # return []
7580
7681 if to_try :
7782 result = self .source .select (
@@ -82,19 +87,32 @@ def transform(self, group_of_dates):
8287 )
8388 )
8489
90+ cnt = 0
8591 for f in result .datasource :
92+ cnt += 1
8693 # We could keep the fields in a dictionary, but we don't want to keep the fields in memory
8794 date = as_datetime (f .metadata ("valid_datetime" ))
8895
8996 if self .skip_all_nans :
9097 if np .isnan (f .to_numpy ()).all ():
9198 LOG .warning (f"Skipping { date } because all values are NaN" )
99+ info [date ] = "all-nans"
92100 continue
93101
102+ info [date ] = "ok"
94103 self .found .add (date )
95104
105+ if cnt == 0 :
106+ raise ValueError (f"No data found for { group_of_dates } in { self .source } " )
107+
96108 self .tried .update (to_try )
97109
110+ if not self .found :
111+ for k , v in info .items ():
112+ LOG .warning (f"{ k } : { v } " )
113+
114+ raise ValueError (f"No matching data found for { asked_dates } in { self .source } " )
115+
98116 new_dates = defaultdict (list )
99117
100118 for date in asked_dates :
You can’t perform that action at this time.
0 commit comments