Skip to content

Commit

Permalink
fix(multiple): miscellanous fixes/enhancements (#1614)
Browse files Browse the repository at this point in the history
* fix(ci/defaults): fix CI config and hnoflo/hdry default values
* fix(ci): use bash -l {0} with micromamba, otherwise bash
  • Loading branch information
wpbonelli authored Nov 3, 2022
1 parent 5a9bec2 commit e20ea05
Show file tree
Hide file tree
Showing 9 changed files with 107 additions and 57 deletions.
31 changes: 22 additions & 9 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: FloPy benchmarks

on:
push:
schedule:
- cron: '0 8 * * *' # run at 8 AM UTC (12 am PST)

Expand All @@ -19,7 +20,7 @@ jobs:
- python-version: '3.8.0'
defaults:
run:
shell: bash -l {0}
shell: bash
timeout-minutes: 90

steps:
Expand All @@ -37,9 +38,9 @@ jobs:
- name: Install Python dependencies
if: runner.os != 'Windows'
run: |
python -m pip install --upgrade pip
pip3 install .
pip3 install ".[test, optional]"
pip install --upgrade pip
pip install .
pip install ".[test, optional]"
- name: Setup Micromamba
if: runner.os == 'Windows'
Expand All @@ -54,16 +55,28 @@ jobs:

- name: Install extra Python dependencies
if: runner.os == 'Windows'
shell: bash -l {0}
run: |
python -m pip install --upgrade pip
pip3 install https://github.com/modflowpy/pymake/zipball/master
pip3 install xmipy
pip3 install .
pip install --upgrade pip
pip install https://github.com/modflowpy/pymake/zipball/master
pip install xmipy
pip install .
- name: Install Modflow executables
uses: modflowpy/install-modflow-action@v1

- name: Run benchmarks
if: runner.os != 'Windows'
working-directory: ./autotest
run: |
mkdir -p .benchmarks
pytest -v --durations=0 --benchmark-only --benchmark-json .benchmarks/${{ matrix.os }}_python${{ matrix.python-version }}.json --keep-failed=.failed
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run benchmarks
if: runner.os == 'Windows'
shell: bash -l {0}
working-directory: ./autotest
run: |
mkdir -p .benchmarks
Expand Down Expand Up @@ -109,7 +122,7 @@ jobs:

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade pip
pip install numpy pandas matplotlib seaborn
- name: Download all artifacts
Expand Down
42 changes: 25 additions & 17 deletions .github/workflows/commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:
branches:
- master
- develop
- 'release*'
- 'ci-diagnose'
- release*
- ci-diagnose*
pull_request:
branches:
- master
Expand All @@ -31,7 +31,7 @@ jobs:

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade pip
pip install build twine
pip install .
python -c "import flopy; print(f'{flopy.__version__}')"
Expand Down Expand Up @@ -120,7 +120,7 @@ jobs:

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade pip
pip install .
pip install ".[test, optional]"
Expand Down Expand Up @@ -157,7 +157,7 @@ jobs:
- python-version: '3.8.0'
defaults:
run:
shell: bash -l {0}
shell: bash
timeout-minutes: 45
steps:

Expand All @@ -175,9 +175,9 @@ jobs:
- name: Install Python dependencies
if: runner.os != 'Windows'
run: |
python -m pip install --upgrade pip
pip3 install .
pip3 install ".[test, optional]"
pip install --upgrade pip
pip install .
pip install ".[test, optional]"
- name: Setup Micromamba
if: runner.os == 'Windows'
Expand All @@ -191,20 +191,33 @@ jobs:
cache-env: true

- name: Install Python dependencies
shell: bash -l {0}
if: runner.os == 'Windows'
run: |
python -m pip install --upgrade pip
pip3 install https://github.com/modflowpy/pymake/zipball/master
pip3 install xmipy
pip3 install .
pip install --upgrade pip
pip install https://github.com/modflowpy/pymake/zipball/master
pip install xmipy
pip install .
- name: Install Modflow executables
uses: modflowpy/install-modflow-action@v1

- name: Run tests
if: runner.os != 'Windows'
working-directory: ./autotest
run: |
pytest -v -m="not example and not regression" -n=auto --cov=flopy --cov-report=xml --durations=0 --keep-failed=.failed
coverage report
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run tests
if: runner.os == 'Windows'
shell: bash -l {0}
working-directory: ./autotest
run: |
pytest -v -m="not example and not regression" -n=auto --cov=flopy --cov-report=xml --durations=0 --keep-failed=.failed
coverage report
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -216,11 +229,6 @@ jobs:
path: |
./autotest/.failed/**
- name: Print coverage
working-directory: ./autotest
run: |
coverage report
- name: Upload coverage
if:
github.repository_owner == 'modflowpy' && (github.event_name == 'push' || github.event_name == 'pull_request')
Expand Down
28 changes: 20 additions & 8 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: FloPy example script & notebook tests

on:
push:
schedule:
- cron: '0 8 * * *' # run at 8 AM UTC (12 am PST)

Expand All @@ -19,7 +20,7 @@ jobs:
- python-version: '3.8.0'
defaults:
run:
shell: bash -l {0}
shell: bash
timeout-minutes: 90
steps:
- name: Checkout repo
Expand All @@ -36,9 +37,9 @@ jobs:
- name: Install Python dependencies
if: runner.os != 'Windows'
run: |
python -m pip install --upgrade pip
pip3 install .
pip3 install ".[test, optional]"
pip install --upgrade pip
pip install .
pip install ".[test, optional]"
- name: Setup Micromamba
if: runner.os == 'Windows'
Expand All @@ -53,16 +54,27 @@ jobs:

- name: Install extra Python dependencies
if: runner.os == 'Windows'
shell: bash -l {0}
run: |
python -m pip install --upgrade pip
pip3 install https://github.com/modflowpy/pymake/zipball/master
pip3 install xmipy
pip3 install .
pip install --upgrade pip
pip install https://github.com/modflowpy/pymake/zipball/master
pip install xmipy
pip install .
- name: Install Modflow executables
uses: modflowpy/install-modflow-action@v1

- name: Run example tests
if: runner.os != 'Windows'
working-directory: ./autotest
run: |
pytest -v -m="example" -n=auto --durations=0 --keep-failed=.failed
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run example tests
if: runner.os == 'Windows'
shell: bash -l {0}
working-directory: ./autotest
run: |
pytest -v -m="example" -n=auto --durations=0 --keep-failed=.failed
Expand Down
17 changes: 10 additions & 7 deletions .github/workflows/mf6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ on:
branches:
- master
- develop
- 'release*'
- release*
- ci-diagnose*
pull_request:
branches: [master, develop]
branches:
- master
- develop

jobs:

Expand All @@ -35,11 +38,11 @@ jobs:

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip3 install https://github.com/modflowpy/pymake/zipball/master
pip3 install https://github.com/Deltares/xmipy/zipball/develop
pip3 install https://github.com/MODFLOW-USGS/modflowapi/zipball/develop
pip3 install .[test,optional]
pip install --upgrade pip
pip install https://github.com/modflowpy/pymake/zipball/master
pip install https://github.com/Deltares/xmipy/zipball/develop
pip install https://github.com/MODFLOW-USGS/modflowapi/zipball/develop
pip install .[test,optional]
- name: Install gfortran
uses: modflowpy/install-gfortran-action@v1
Expand Down
28 changes: 20 additions & 8 deletions .github/workflows/regression.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: FloPy regression tests

on:
push:
schedule:
- cron: '0 8 * * *' # run at 8 AM UTC (12 am PST)

Expand All @@ -19,7 +20,7 @@ jobs:
- python-version: '3.8.0'
defaults:
run:
shell: bash -l {0}
shell: bash
timeout-minutes: 90
steps:
- name: Checkout repo
Expand All @@ -36,9 +37,9 @@ jobs:
- name: Install Python dependencies
if: runner.os != 'Windows'
run: |
python -m pip install --upgrade pip
pip3 install .
pip3 install ".[test, optional]"
pip install --upgrade pip
pip install .
pip install ".[test, optional]"
- name: Setup Micromamba
if: runner.os == 'Windows'
Expand All @@ -53,16 +54,27 @@ jobs:

- name: Install extra Python dependencies
if: runner.os == 'Windows'
shell: bash -l {0}
run: |
python -m pip install --upgrade pip
pip3 install https://github.com/modflowpy/pymake/zipball/master
pip3 install xmipy
pip3 install .
pip install --upgrade pip
pip install https://github.com/modflowpy/pymake/zipball/master
pip install xmipy
pip install .
- name: Install Modflow executables
uses: modflowpy/install-modflow-action@v1

- name: Run regression tests
if: runner.os != 'Windows'
working-directory: ./autotest
run: |
pytest -v -m="regression" -n=auto --durations=0 --keep-failed=.failed
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run regression tests
if: runner.os == 'Windows'
shell: bash -l {0}
working-directory: ./autotest
run: |
pytest -v -m="regression" -n=auto --durations=0 --keep-failed=.failed
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/rtd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ on:
branches:
- master
- develop
- 'release*'
- 'ci-pytest'
- release*
- ci-diagnose*
pull_request:
branches: [master, develop]
branches:
- master
- develop

jobs:

Expand Down Expand Up @@ -41,7 +43,7 @@ jobs:

- name: Upgrade pip
run: |
python -m pip install --upgrade pip
pip install --upgrade pip
- name: Install prerequisites
run: |
Expand Down
4 changes: 2 additions & 2 deletions flopy/mbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,15 +480,15 @@ def hdry(self):
return self.get_package("BCF6").hdry
if self.get_package("UPW") is not None:
return self.get_package("UPW").hdry
return None
return -1e30

@property
def hnoflo(self):
try:
bas6 = self.get_package("BAS6")
return bas6.hnoflo
except AttributeError:
return None
return 1e30

@property
def laycbd(self):
Expand Down
2 changes: 1 addition & 1 deletion flopy/plot/crosssection.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def __init__(
self._polygons = {}

if model is None:
self._masked_values = [1e30, -1e-30]
self._masked_values = [1e30, -1e30]
else:
self._masked_values = [model.hnoflo, model.hdry]

Expand Down
2 changes: 1 addition & 1 deletion flopy/plot/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def __init__(
self._extent = None

if model is None:
self._masked_values = [1e30, -1e-30]
self._masked_values = [1e30, -1e30]
else:
self._masked_values = [model.hnoflo, model.hdry]

Expand Down

0 comments on commit e20ea05

Please sign in to comment.