Skip to content

Commit

Permalink
Github Actions On Only Ubuntu-latest (#245)
Browse files Browse the repository at this point in the history
* Updating requirements.txt.
Testing only linux github actions ci build.
Small fixes to get two CI tests passing.
 - more explicit path name for forcing_analysis_assim
 - adding compose_dir deepdiff warnings back in

* fixing issues reported by linter
  • Loading branch information
scrasmussen authored Dec 20, 2023
1 parent c5e674a commit 0aff0ed
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 17 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest", "macos-latest", "windows-latest" ]
# os: [ "ubuntu-latest", "macos-latest", "windows-latest" ]
# for debugging purposes run github actions only on ubuntu-latest until its passing
os: [ "ubuntu-latest" ]
python-version: [ "3.10" ]
steps:
- name: Checkout repo
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ deepdiff>=6.2.3
f90nml>=1.2
importlib-metadata==4.13.0
netCDF4>=1.5.3
numpy==1.21.0
numpy==1.22.4
pandas>=1.3.5
properscoring==0.1
pytest>=5.4.1
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
'f90nml>=1.2',
'importlib-metadata==4.13.0',
'netCDF4>=1.5.3',
'numpy==1.21.0',
'numpy==1.22.4',
'pandas>=1.3.5',
'properscoring==0.1',
'pytest>=5.4.1',
Expand Down
23 changes: 12 additions & 11 deletions wrfhydropy/core/outputdiffs.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,9 @@ def _compare_nc_xrcmp(

nccmp_out = pd.read_table(log_file_path, delim_whitespace=True, header=0)
return nccmp_out
except:
except Exception as e:
warnings.warn('Problem reading xrcmp output to pandas dataframe,'
'returning error code')
'returning error code: {e}')
return ret
else:
return open(log_file_path, 'r').read()
Expand Down Expand Up @@ -371,9 +371,9 @@ def _compare_nc_nccmp(

nccmp_out = pd.read_table(output, delim_whitespace=True, header=0)
return nccmp_out
except:
except Exception as e:
warnings.warn('Problem reading nccmp output to pandas dataframe,'
'returning as subprocess object')
'returning as subprocess object: {e}')
return proc
else:
return proc.stderr.decode('utf-8') + proc.stdout.decode('utf-8')
Expand Down Expand Up @@ -424,6 +424,7 @@ def _check_file_lists(candidate_files: list, reference_files: list) -> tuple:

return valid_can_files, valid_ref_files


def check_unprocessed_diffs(unexpected_diffs: list):
"""Function to the unexpected_diffs of DeepDiff
Args:
Expand All @@ -432,15 +433,15 @@ def check_unprocessed_diffs(unexpected_diffs: list):
None
"""
for diff_str in unexpected_diffs:
diff_key = diff_str.split(':',1)[0].strip()
diff = diff_str.split(':',1)[1].strip()
diff_parts = diff.split(' and ')# .strip()
diff_key = diff_str.split(':', 1)[0].strip()
diff = diff_str.split(':', 1)[1].strip()
diff_parts = diff.split(' and ') # .strip()
if (diff_parts[0] != diff_parts[1]):
# commenting out this section for now to check if CI tests pass
# if ('_compose_dir' in diff_key):
# warnings.warn(UserWarning("deepdiff _compose_dirs were different:",
# diff_key, ":", diff_parts[0], " != ", diff_parts[1]))
# return
if ('_compose_dir' in diff_key):
warnings.warn(UserWarning("deepdiff _compose_dirs were different:",
diff_key, ":", diff_parts[0], " != ", diff_parts[1]))
return

# if difference isn't in _compose_dir raise error
raise ValueError(
Expand Down
6 changes: 3 additions & 3 deletions wrfhydropy/tests/test_ioutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def test_open_wh_dataset_no_forecast(ds_timeseries):
)

the_ref_times = np.array(
['1970-01-01T00:00:00.000000000'],dtype='datetime64[ns]')
['1970-01-01T00:00:00.000000000'], dtype='datetime64[ns]')
assert (the_ds['reference_time'].values == the_ref_times).all()

the_ds['time'].values.sort()
Expand Down Expand Up @@ -151,10 +151,10 @@ def url_index_anchor_regex(url, regex=''):
version_dict = {
# 'para': para_url,
'prod': prod_url}

for version_name, model_version in version_dict.items():

forcing_dirs = url_index_anchor_regex(model_version, r'^forcing_')
forcing_dirs = url_index_anchor_regex(model_version, r'^forcing_analysis_assim/$')
for forcing_range in forcing_dirs:

forcing_files = url_index_anchor_regex(forcing_range, r'\.nc$')
Expand Down

0 comments on commit 0aff0ed

Please sign in to comment.