Skip to content

Commit

Permalink
allow missing HRRR dates to pass
Browse files Browse the repository at this point in the history
  • Loading branch information
bbuzz31 committed Jul 21, 2023
1 parent 166b6c4 commit c02d2d2
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
8 changes: 6 additions & 2 deletions tools/RAiDER/cli/raider.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,12 @@ def calcDelays(iargs=None):
continue

if len(wfiles)==0:
logger.error('No weather model data was successfully obtained.')
raise RuntimeError
logger.error('No weather model data was successfully obtained.')
if len(params['date_list']) == 1:
raise RuntimeError
# skip date if mnultiple are requested
else:
continue

# nearest weather model time
elif len(wfiles)==1 and len(times)==1:
Expand Down
7 changes: 6 additions & 1 deletion tools/RAiDER/models/hrrr.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ def download_hrrr_file(ll_bounds, DATE, out, model='hrrr', product='prs', fxx=0,
)

# Iterate through the list of datasets
ds_list = H.xarray(":(SPFH|PRES|TMP|HGT):", verbose=verbose)
try:
ds_list = H.xarray(":(SPFH|PRES|TMP|HGT):", verbose=verbose)
except ValueError as E:
logger.error (E)
raise ValueError

ds_out = None
for ds in ds_list:
if ('isobaricInhPa' in ds._coord_names) or ('levels' in ds._coord_names):
Expand Down
7 changes: 5 additions & 2 deletions tools/RAiDER/models/weatherModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,12 @@ def fetch(self, out, time):
# write the error raised by the weather model API to the log
try:
self._fetch(out)
err = False

except Exception as E:
logger.error(E)
except Exception:
err = True

return err


@abstractmethod
Expand Down
5 changes: 4 additions & 1 deletion tools/RAiDER/processWM.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ def prepareWeatherModel(

# if no weather model files supplied, check the standard location
else:
weather_model.fetch(path_wm_raw, time)
E = weather_model.fetch(path_wm_raw, time)
if E:
print ('raise runtimeerror')
raise RuntimeError

# If only downloading, exit now
if download_only:
Expand Down

0 comments on commit c02d2d2

Please sign in to comment.