Skip to content

Commit f773869

Browse files
authored
Merge pull request #272 from EC-USGS/v1.0.0
Release 1.0.0
2 parents 8503ca7 + f883c8d commit f773869

File tree

267 files changed

+8554
-468407
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

267 files changed

+8554
-468407
lines changed

.flake8

+2-36
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,10 @@ exclude =
55
build
66
dist
77
examples
8-
# autotest
98
ignore =
109
# https://flake8.pycqa.org/en/latest/user/error-codes.html
11-
# F401 # 'module' imported but unused
12-
# https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes
13-
# continuation line under-indented for hanging indent
14-
E121,
15-
# continuation line missing indentation or outdented
16-
E122,
17-
# continuation line over-indented for hanging indent
18-
E126,
19-
# continuation line over-indented for visual indent
20-
E127,
21-
# continuation line under-indented for visual indent
22-
E128,
23-
# whitespace before
24-
E203,
25-
# multiple spaces before operator
26-
E221,
27-
# multiple spaces after operator
28-
E222,
29-
# missing whitespace around arithmetic operator
30-
E226,
31-
# E231 # missing whitespace after ','
32-
# E241 # multiple spaces after ','
33-
# E402 # module level import not at top of file
34-
# E501 # line too long (> 79 characters)
35-
# E502 # backslash is redundant between brackets
36-
# E722 # do not use bare 'except'
37-
# ambiguous variable name
38-
E741,
39-
# W291 # trailing whitespace
40-
# W292 # no newline at end of file
41-
# W293 # blank line contains whitespace
42-
# blank line at end of file
43-
W391,
4410
# line break before binary operator
4511
W503,
46-
# line break after binary operator
47-
W504,
12+
# space before colon
13+
E203,
4814
statistics = True

.github/scripts/symlink_gfortran_mac.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# get full gfortran version string
44
# assumes installed via brew as by
5-
# https://github.com/awvwgk/setup-fortran
5+
# https://github.com/fortran-lang/setup-fortran
66
#
77
# sed not head for first line, avoid ruby broken pipe issues
88
# (https://stackoverflow.com/a/2845541/6514033)

.github/scripts/update_version.py

+14-5
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ def get_authors():
2929

3030

3131
def update_version_py(timestamp: datetime, version: Version):
32-
lines = open(_version_py_path, "r").readlines() if _version_py_path.exists() else []
32+
lines = (
33+
open(_version_py_path, "r").readlines()
34+
if _version_py_path.exists()
35+
else []
36+
)
3337
authors = get_authors()
3438
with open(_version_py_path, "w") as f:
3539
f.write(
@@ -39,13 +43,18 @@ def update_version_py(timestamp: datetime, version: Version):
3943
f.write(f'__version__ = "{version}"\n')
4044
f.writelines(
4145
[
42-
f"__pakname__ = \"{_project_name}\"\n",
46+
f'__pakname__ = "{_project_name}"\n',
4347
"\n",
4448
"author_dict = {\n",
45-
] + [f" \"{a['given-names']} {a['family-names']}\": \"{a['email']}\",\n" for a in authors] + [
49+
]
50+
+ [
51+
f" \"{a['given-names']} {a['family-names']}\": \"{a['email']}\",\n"
52+
for a in authors
53+
]
54+
+ [
4655
"}\n",
47-
"__author__ = \", \".join(author_dict.keys())\n",
48-
"__author_email__ = \", \".join(s for _, s in author_dict.items())\n",
56+
'__author__ = ", ".join(author_dict.keys())\n',
57+
'__author_email__ = ", ".join(s for _, s in author_dict.items())\n',
4958
]
5059
)
5160
f.close()

.github/workflows/ci.yaml

+78-17
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ on:
99
- "*"
1010
- "!v[0-9]+.[0-9]+.[0-9]+*"
1111

12+
workflow_dispatch:
13+
inputs:
14+
debug_enabled:
15+
type: boolean
16+
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
17+
required: false
18+
default: false
19+
1220
jobs:
1321

1422
pyws_setup:
@@ -101,7 +109,7 @@ jobs:
101109
pylint --jobs=2 --errors-only --exit-zero ./pywatershed ./autotest
102110
103111
test:
104-
name: ${{ matrix.os}} py${{ matrix.python-version }}
112+
name: ${{ matrix.os }} py${{ matrix.python-version }}
105113
runs-on: ${{ matrix.os }}
106114
defaults:
107115
run:
@@ -112,9 +120,14 @@ jobs:
112120
os: [ "ubuntu-latest", "macos-latest", "windows-latest" ]
113121
python-version: ["3.9", "3.10"]
114122
steps:
123+
115124
- name: Checkout repo
116125
uses: actions/checkout@v3
117126

127+
- name: Setup tmate session
128+
uses: mxschmitt/action-tmate@v3
129+
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
130+
118131
- name: Set environment variables
119132
run: |
120133
echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV
@@ -134,11 +147,11 @@ jobs:
134147
if [[ "$MF6_REMOTE" != "$req_remote" ]]; then exit 1; fi
135148
136149
- name: Setup gfortran
137-
uses: awvwgk/setup-fortran@main
150+
uses: fortran-lang/setup-fortran@v1
138151
with:
139152
compiler: gcc
140153
version: 11
141-
154+
142155
- name: Link gfortran dylibs on Mac
143156
if: runner.os == 'macOS'
144157
run: .github/scripts/symlink_gfortran_mac.sh
@@ -174,39 +187,87 @@ jobs:
174187
pip -V
175188
pip list
176189
177-
- name: Run available domains with PRMS and convert csv output to NetCDF
178-
working-directory: test_data/scripts
190+
- name: hru_1 - generate and manage test data domain, run PRMS and convert csv output to NetCDF
191+
working-directory: autotest
192+
run: |
193+
python generate_test_data.py \
194+
-n=auto --domain=hru_1 --remove_prms_csvs --remove_prms_output_dirs
195+
196+
- name: hru_1 - list netcdf input files
197+
working-directory: test_data
198+
run: |
199+
find hru_1/output/ -name '*.nc'
200+
201+
- name: hru_1 - pywatershed tests
202+
working-directory: autotest
203+
run: pytest
204+
-vv
205+
-n=auto
206+
--domain_yaml=../test_data/hru_1/hru_1.yaml
207+
--durations=0
208+
--cov=pywatershed
209+
--cov-report=xml
210+
--junitxml=pytest_hru_1.xml
211+
212+
213+
- name: drb_2yr - generate and manage test data
214+
working-directory: autotest
215+
run: |
216+
python generate_test_data.py \
217+
-n=auto --domain=drb_2yr --remove_prms_csvs --remove_prms_output_dirs
218+
219+
- name: drb_2yr - list netcdf input files
220+
working-directory: test_data
221+
run: |
222+
find drb_2yr/output/ -name '*.nc'
223+
224+
- name: drb_2yr - pywatershed tests
225+
working-directory: autotest
226+
run: pytest
227+
-vv
228+
-n=auto
229+
--domain_yaml=../test_data/drb_2yr/drb_2yr.yaml
230+
--durations=0
231+
--cov=pywatershed
232+
--cov-report=xml
233+
--junitxml=pytest_drb_2yr.xml
234+
235+
- name: ucb_2yr - generate and manage test data
236+
working-directory: autotest
179237
run: |
180-
pytest -v -n=auto --durations=0 test_run_domains.py
181-
pytest -v -n=auto --durations=0 test_nc_domains.py
238+
python generate_test_data.py \
239+
-n=auto --domain=ucb_2yr --remove_prms_csvs --remove_prms_output_dirs
182240
183-
- name: List all NetCDF files in test_data directory
241+
- name: ucb_2yr - list netcdf input files
184242
working-directory: test_data
185243
run: |
186-
find . -name "*.nc"
244+
find ucb_2yr/output/ -name '*.nc'
187245
188-
- name: Run tests
246+
- name: ucb_2yr - pywatershed tests
189247
working-directory: autotest
190248
run: pytest
191-
-v
249+
-vv
192250
-n=auto
251+
--domain_yaml=../test_data/ucb_2yr/ucb_2yr.yaml
193252
--durations=0
194-
--all_domains
195253
--cov=pywatershed
196254
--cov-report=xml
197-
--junitxml=pytest.xml
255+
--junitxml=pytest_ucb_2yr.xml
198256

199257
- name: Upload test results
200258
if: always()
201-
uses: actions/upload-artifact@v2
259+
uses: actions/upload-artifact@v3
202260
with:
203261
name: Test results for ${{ runner.os }}-${{ matrix.python-version }}
204-
path: ./autotest/pytest.xml
262+
path: |
263+
./autotest/pytest_hru_1.xml
264+
./autotest/pytest_drb_2yr.xml
265+
./autotest/pytest_ucb_2yr.xml
205266
206267
- name: Upload code coverage to Codecov
207-
uses: codecov/codecov-action@v2.1.0
268+
uses: codecov/codecov-action@v3
208269
with:
209-
file: ./autotest/coverage.xml
270+
file: ./autotest/coverage.xml # should be just the ucb result
210271
# flags: unittests
211272
env_vars: RUNNER_OS,PYTHON_VERSION
212273
# name: codecov-umbrella

.github/workflows/ci_examples.yaml

+5-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@ jobs:
3131
- name: Checkout repo
3232
uses: actions/[email protected]
3333

34-
- name: Install gfortran
35-
uses: modflowpy/install-gfortran-action@v1
34+
- name: Setup gfortran
35+
uses: fortran-lang/setup-fortran@v1
36+
with:
37+
compiler: gcc
38+
version: 11
3639

3740
- name: Download GIS files
3841
working-directory: examples

.github/workflows/release.yaml

+70-12
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,41 @@ jobs:
2525
with:
2626
fetch-depth: 0
2727

28+
- name: Setup gfortran
29+
uses: fortran-lang/setup-fortran@v1
30+
with:
31+
compiler: gcc
32+
version: 11
33+
2834
- name: Install Dependencies via Micromamba
2935
uses: mamba-org/setup-micromamba@v1
3036
with:
3137
environment-file: environment.yml
3238
cache-environment: true
3339
cache-downloads: true
3440
create-args: >-
35-
python=3.9
41+
python=3.10
3642
conda
3743
3844
- name: Checkout MODFLOW 6
3945
uses: actions/checkout@v3
4046
with:
4147
repository: MODFLOW-USGS/modflow6
42-
ref: master
48+
ref: develop
4349
path: modflow6
4450

4551
- name: Update flopy MODFLOW 6 classes
4652
working-directory: modflow6/autotest
4753
run: |
4854
python update_flopy.py
4955
56+
- name: Set environment variables
57+
run: |
58+
echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV
59+
echo "PYWS_FORTRAN=true" >> $GITHUB_ENV
60+
echo 'SETUPTOOLS_ENABLE_FEATURES="legacy-editable"' >> $GITHUB_ENV
61+
cat .mf6_ci_ref_remote >> $GITHUB_ENV
62+
5063
- name: Install pywatershed
5164
run: |
5265
pip install .
@@ -56,27 +69,72 @@ jobs:
5669
pip -V
5770
pip list
5871
59-
- name: Run available domains with PRMS and convert csv output to NetCDF
60-
working-directory: test_data/scripts
72+
- name: hru_1 - generate and manage test data domain, run PRMS and convert csv output to NetCDF
73+
working-directory: autotest
74+
run: |
75+
python generate_test_data.py \
76+
-n=auto --domain=hru_1 --remove_prms_csvs --remove_prms_output_dirs
77+
78+
- name: hru_1 - list netcdf input files
79+
working-directory: test_data
80+
run: |
81+
find hru_1/output/ -name '*.nc'
82+
83+
- name: hru_1 - pywatershed tests
84+
working-directory: autotest
85+
run: pytest
86+
-vv
87+
-n=auto
88+
--domain_yaml=../test_data/hru_1/hru_1.yaml
89+
--durations=0
90+
--cov=pywatershed
91+
--cov-report=xml
92+
--junitxml=pytest_hru_1.xml
93+
94+
95+
- name: drb_2yr - generate and manage test data
96+
working-directory: autotest
97+
run: |
98+
python generate_test_data.py \
99+
-n=auto --domain=drb_2yr --remove_prms_csvs --remove_prms_output_dirs
100+
101+
- name: drb_2yr - list netcdf input files
102+
working-directory: test_data
103+
run: |
104+
find drb_2yr/output/ -name '*.nc'
105+
106+
- name: drb_2yr - pywatershed tests
107+
working-directory: autotest
108+
run: pytest
109+
-vv
110+
-n=auto
111+
--domain_yaml=../test_data/drb_2yr/drb_2yr.yaml
112+
--durations=0
113+
--cov=pywatershed
114+
--cov-report=xml
115+
--junitxml=pytest_drb_2yr.xml
116+
117+
- name: ucb_2yr - generate and manage test data
118+
working-directory: autotest
61119
run: |
62-
pytest -v -n=auto --durations=0 test_run_domains.py
63-
pytest -v -n=auto --durations=0 test_nc_domains.py
120+
python generate_test_data.py \
121+
-n=auto --domain=ucb_2yr --remove_prms_csvs --remove_prms_output_dirs
64122
65-
- name: List all NetCDF files in test_data directory
123+
- name: ucb_2yr - list netcdf input files
66124
working-directory: test_data
67125
run: |
68-
find . -name "*.nc"
126+
find ucb_2yr/output/ -name '*.nc'
69127
70-
- name: Run tests
128+
- name: ucb_2yr - pywatershed tests
71129
working-directory: autotest
72130
run: pytest
73-
-v
131+
-vv
74132
-n=auto
133+
--domain_yaml=../test_data/ucb_2yr/ucb_2yr.yaml
75134
--durations=0
76-
--all_domains
77135
--cov=pywatershed
78136
--cov-report=xml
79-
--junitxml=pytest.xml
137+
--junitxml=pytest_ucb_2yr.xml
80138

81139
- name: Update version
82140
id: version

0 commit comments

Comments
 (0)