Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: self-contained example scripts #137

Merged
merged 47 commits into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
8229e30
refactor: move single-use utils from common/ to example scripts
wpbonelli Jan 9, 2024
fff5d97
use usgs styles from flopy
wpbonelli Jan 9, 2024
e3e7a22
remove common, move utils into notebooks (todo deduplicate: wexler 3d…
wpbonelli Jan 10, 2024
8071238
consolidate script/notebook testing in autotest dir
wpbonelli Jan 10, 2024
71809d7
create figures and images dirs
wpbonelli Jan 10, 2024
0fc3f8b
fixes, formatting
wpbonelli Jan 10, 2024
5c28ff5
black/isort scripts
wpbonelli Jan 10, 2024
8d3f71c
ci
wpbonelli Jan 10, 2024
c3f25e7
ipython kernel
wpbonelli Jan 10, 2024
88411c3
create tables dir
wpbonelli Jan 11, 2024
c39ccf7
pjg -> png, remove buildModel guards
wpbonelli Jan 11, 2024
92d7aa0
bump
wpbonelli Jan 11, 2024
de16b22
simplify config, always build, drop python 3.8
wpbonelli Jan 11, 2024
f20a577
fix mtd3ms usages, report/pformat
wpbonelli Jan 11, 2024
c7da3b3
fix ex-gwt-uzt-2d
wpbonelli Jan 11, 2024
9665fdf
remove plotModel option, default save and gif to true
wpbonelli Jan 11, 2024
195c6a5
black/isort scripts
wpbonelli Jan 11, 2024
0aac83e
fix ex-gwt-mt3dsupp82, ex-gwt-mt2dms-p10, update .gitignore
wpbonelli Jan 11, 2024
3846ced
debug ex-gwt-mt3dms-p10, try downloading data files in ex-gwf-advtida…
wpbonelli Jan 11, 2024
1b79f11
debug ci
wpbonelli Jan 11, 2024
84a1e97
skip mt3dms-p10 for now
wpbonelli Jan 11, 2024
75a0bc2
download/cache with pooch, eliminate local data/ dependency
wpbonelli Jan 11, 2024
23e2ea3
fix ex-gwf-lgrv for ast parsing
wpbonelli Jan 12, 2024
082a216
debug PDF from LaTeX generation
wpbonelli Jan 12, 2024
cd72c98
fix png path in ex-gwf-advtidal
wpbonelli Jan 12, 2024
29348da
remove debug step
wpbonelli Jan 12, 2024
25e4305
ex-gwf-csub-p02 png path fix
wpbonelli Jan 12, 2024
f49eb1d
ex-gwf-csub-p02 plot fix
wpbonelli Jan 12, 2024
cdf7fd9
use pooch in ex-gwf-bump
wpbonelli Jan 12, 2024
3cde0a2
use pooch everywhere (no more local file access)
wpbonelli Jan 15, 2024
ddd0994
bugfixes
wpbonelli Jan 15, 2024
ef1f9ce
don't exclude ex-gwt-mt3dms-p10, minor test cleanup
wpbonelli Jan 15, 2024
850cd41
restore mf2005 model run in ex-gwt-mt3dms-p10, not converging tho
wpbonelli Jan 16, 2024
0bb3b61
update DEVELOPER.md
wpbonelli Jan 16, 2024
0b9ff2b
test fixup
wpbonelli Jan 16, 2024
6f22e0a
accommodate mf2005 convergence failure in ex-gwt-mt3dms-p10
wpbonelli Jan 16, 2024
bed62ba
fix pytest arg defaults, update DEVELOPER.md
wpbonelli Jan 16, 2024
7e050a3
restore switch to write model, format scripts, add descriptions where…
wpbonelli Jan 17, 2024
bba5efc
minor plot fixes in bcf2ss thru drn-p01
wpbonelli Jan 20, 2024
a4cce8a
fix conditional writing/running
wpbonelli Jan 20, 2024
d728c1b
ci fix
wpbonelli Jan 20, 2024
ae7accf
remove unnecessary runModel guards
wpbonelli Jan 20, 2024
e615d5c
env var switches: use get_env(), add switch for showing plots, variou…
wpbonelli Jan 21, 2024
8336a6b
env var switch fixes, add --init switch to create/write models
wpbonelli Jan 21, 2024
c225ac6
run models in ex-workflow.yml
wpbonelli Jan 21, 2024
1d85d5e
ci fixes
wpbonelli Jan 21, 2024
bb7e8d9
more plot fixes (especially twri)
wpbonelli Jan 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,6 @@
# close the restructured text file
f.close()

# # -- convert the tutorial scripts -------------------------------------------
# if not on_rtd:
# cmd = ("python", "test_build.py")
# print(" ".join(cmd))
# os.system(" ".join(cmd))

# -- Build the example restructured text files -------------------------------
if not on_rtd:
start_dir = os.getcwd()
Expand Down
97 changes: 0 additions & 97 deletions .doc/test_build.py

This file was deleted.

22 changes: 9 additions & 13 deletions .github/workflows/ex-rtd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ jobs:
runs-on: ubuntu-latest
strategy:
fail-fast: false
env:
script-directory: scripts
etc-directory: etc
defaults:
run:
shell: bash
Expand Down Expand Up @@ -57,12 +54,12 @@ jobs:
python-version: 3.9

- name: Install Python packages
working-directory: etc
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements.pip.txt
pip install -r requirements.usgs.txt
python -m ipykernel install --name python_kernel --user
working-directory: ${{env.etc-directory}}

- name: Update flopy MODFLOW 6 classes
run: python -m flopy.mf6.utils.generate_classes --ref develop --no-backup
Expand All @@ -75,21 +72,20 @@ jobs:
with:
repo: modflow6-nightly-build

- name: Run scripts without model runs
run: pytest -v -n=auto --durations=0 ci_build_files.py
working-directory: ${{env.etc-directory}}
- name: Create notebooks and run models
working-directory: autotest
run: pytest -v -n=auto --durations=0 test_notebooks.py --plot

- name: Copy notebooks to RTD directory
run: cp -R notebooks/*.ipynb .doc/_notebooks/

- name: Run processing script
working-directory: scripts
run: python process-scripts.py
working-directory: ${{env.script-directory}}

- name: Run notebooks with jupytext for ReadtheDocs
run: pytest -v -n=auto --durations=0 ci_run_notebooks.py
working-directory: ${{env.etc-directory}}

- name: Create package tables and examples.rst for ReadtheDocs
working-directory: etc
run: python ci_create_examples_rst.py
working-directory: ${{env.etc-directory}}

- name: List example rst files for ReadtheDocs
run: ls -R .doc/_examples/
Expand Down
43 changes: 16 additions & 27 deletions .github/workflows/ex-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ jobs:
zip_files:
name: zip input files
runs-on: ubuntu-latest
strategy:
fail-fast: false
env:
script-directory: scripts
etc-directory: etc
defaults:
run:
shell: bash

steps:
- name: Checkout MODFLOW6 examples repo
Expand All @@ -35,15 +27,16 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.9

- name: Install Python packages
working-directory: etc
run: |
python --version
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements.pip.txt
pip install -r requirements.usgs.txt
working-directory: ${{env.etc-directory}}
python -m ipykernel install --name python_kernel --user

- name: Update flopy MODFLOW 6 classes
run: python -m flopy.mf6.utils.generate_classes --ref develop --no-backup
Expand All @@ -56,9 +49,10 @@ jobs:
with:
repo: modflow6-nightly-build

- name: Run scripts without model runs
run: pytest -v -n=auto --durations=0 ci_build_files.py
working-directory: ${{env.etc-directory}}
- name: Create model
working-directory: autotest
# run the scripts via pytest without running the models, just build input files
run: pytest -v -n=auto --durations=0 test_scripts.py --init

- name: zip input files
run: |
Expand All @@ -78,10 +72,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python: [3.8, 3.9, "3.10", "3.11"]
env:
script-directory: scripts
etc-directory: etc
python: [3.9, "3.10", "3.11", "3.12"]
defaults:
run:
shell: bash
Expand Down Expand Up @@ -111,11 +102,12 @@ jobs:
python-version: ${{ matrix.python }}

- name: Install Python packages
working-directory: etc
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements.pip.txt
pip install -r requirements.usgs.txt
working-directory: ${{env.etc-directory}}
python -m ipykernel install --name python_kernel --user

- name: Update flopy MODFLOW 6 classes
run: python -m flopy.mf6.utils.generate_classes --ref develop --no-backup
Expand All @@ -128,15 +120,14 @@ jobs:
with:
repo: modflow6-nightly-build

- name: Run scripts
run: pytest -v -n=auto --durations=0 --run=True ci_build_files.py
working-directory: ${{env.etc-directory}}
- name: Test example scripts and create input files
working-directory: autotest
run: pytest -v -n=auto --durations=0 test_scripts.py --plot

- name: Run processing script
working-directory: scripts
if: matrix.python == '3.9'
run: |
python process-scripts.py
working-directory: ${{env.script-directory}}
run: python process-scripts.py

- name: Build mf6examples LaTeX document
if: matrix.python == '3.9'
Expand Down Expand Up @@ -181,9 +172,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: current
path: |
./mf6examples.pdf

path: mf6examples.pdf

# make the release if the "build" job was successful
release:
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,7 @@ temp
.nb/

# only version control jupytext-managed python scripts/*.py
notebooks/
notebooks/

**.DS_Store
**.zip
Loading