Skip to content

Commit

Permalink
Merge pull request #18 from bbuzz31/jlmaurer-elim_dloads_from_unittests
Browse files Browse the repository at this point in the history
Fix test_intersect
  • Loading branch information
jlmaurer authored Aug 8, 2023
2 parents 591a7ca + a94416d commit 97a2e4d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
10 changes: 4 additions & 6 deletions test/test_intersect.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_cube_intersect(wm):
'time_group': {'time': time, 'interpolate_time': False},
'weather_model': wm,
'aoi_group': {
'lat_file': os.path.join(SCENARIO_DIR, 'lat.rdr'),
'lat_file': os.path.join(SCENARIO_DIR, 'lat.rdr'),
'lon_file': os.path.join(SCENARIO_DIR, 'lon.rdr')
},
'runtime_group': {
Expand Down Expand Up @@ -64,9 +64,7 @@ def test_cube_intersect(wm):
@pytest.mark.parametrize('wm', 'ERA5'.split())
def test_gnss_intersect(wm):
SCENARIO_DIR = os.path.join(TEST_DIR, 'scenario_6')
WM_DIR = os.path.join(SCENARIO_DIR, 'weather_files')

gnss_file = os.path.join(SCENARIO_DIR, 'stations.csv')
gnss_file = os.path.join(SCENARIO_DIR, 'stations.csv')
id = 'TORP'

date = 20200130
Expand All @@ -93,8 +91,8 @@ def test_gnss_intersect(wm):
proc = subprocess.run(cmd.split(), stdout=subprocess.PIPE, universal_newlines=True)
assert proc.returncode == 0, 'RAiDER Failed.'

gold = {'ERA5': 2.3466, 'GMAO': np.nan, 'HRRR': np.nan}
df = pd.read_csv(os.path.join(SCENARIO_DIR, f'{wm}_Delay_{date}T{time.replace(":", "")}.csv'))
gold = {'ERA5': 2.34514, 'GMAO': np.nan, 'HRRR': np.nan}
df = pd.read_csv(os.path.join(SCENARIO_DIR, f'{wm}_Delay_{date}T{time.replace(":", "")}_ztd.csv'))
td = df['totalDelay'][df['ID']==id].values

# test for equality with golden data
Expand Down
4 changes: 2 additions & 2 deletions tools/RAiDER/models/weatherModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ def fetch(self, out, time):
self._fetch(out)
err = False

except Exception:
err = True
except Exception as E:
err = E

return err

Expand Down
2 changes: 1 addition & 1 deletion tools/RAiDER/processWM.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def prepareWeatherModel(
else:
E = weather_model.fetch(path_wm_raw, time)
if E:
print ('raise runtimeerror')
logger.warning (E)
raise RuntimeError

# If only downloading, exit now
Expand Down

0 comments on commit 97a2e4d

Please sign in to comment.