Skip to content

Commit

Permalink
V0.1.0 (#15)
Browse files Browse the repository at this point in the history
* Fix typo in README (#4)
* modflowapi interface (#8)
* update package: manual variable address assembly updated to use xmipy get_variable_addr()
* update additional manual variable address assembly statements
* Refactor code and added functionality:
* add stress_period_start, stress_period_end Callbacks
* fix ApiModel __repr__
* added Exchanges, TDIS, ATS, and SLN support
* added ScalarInput and ScalarPackage support
* update autotests
* added parallel testing support through pytest-xdist
* updated markers and split the extensions tests from the mf6 examples tests
* added a test for ATS
* update setup.cfg
* update ci.yml
* update(ListInput): add auxvar to stress_period_data when auxiliary variables are used
* Allow None to be passed to stress_period_data.values to disable stresses for a package
* updates: ApiModel, ApiSimulation, run_simulation
* added a `totim` property on `ApiSimulation` and `ApiModel`
* added docstrings to ApiModel property methods
* updated termination message in run_simulation
* added a finalize callback to Callbacks and run_simulation
* add support for AUXNAME_CST
* add(Head Monitor Example): Add a head monitor example application
* ApiModel: adjust X based on nodetouser
* ApiPackage: enforce lower cased variable names in get_advanced_var
* ArrayPointer: trap for arrays that are not adjusted by reduced node numbers (ex. idomain)
* update setup.cfg
* try reformatting the xmipy installation instructions
* fix(get value): fixed error handling when modflowapi fails to get a pointer to a value from the API (#9)
Co-authored-by: scottrp <[email protected]>
* update(rhs, hcof, AdvancedInput): bug fixes for setting variable values for advanced inputs
* update rhs and hcof to copy values to pointer instead of overwriting the pointer
* add a check for AdvancedInput variables that do not have pointer support in xmipy
* update setting routine for AdvancedInput
* refactor(EOL): change CRLF to LF line endings for source files (#12)
* Use pyproject.toml for project metadata, add citation info (#11)
* add(test_rhs_hcof_advanced): add additional test  (#13)
* added test for getting and setting rhs, hcof, and advanced variable values
* update project to use unix line separators
* use np.testing.assert_allclose() instead of AssertionError
* Add missing RIV support to modflowapi (#16)
* add(test_rhs_hcof_advanced): add additional test
* added test for getting and setting rhs, hcof, and advanced variable values
* update project to use unix line separators
* use np.testing.assert_allclose() instead of AssertionError
* Add missing riv package to modflowapi
* release: v0.1.0
---------

Co-authored-by: Hofer-Julian <[email protected]>
Co-authored-by: Joshua Larsen <[email protected]>
Co-authored-by: spaulins-usgs <[email protected]>
Co-authored-by: scottrp <[email protected]>
Co-authored-by: Mike Taves <[email protected]>
  • Loading branch information
6 people authored Apr 19, 2023
1 parent 612dd11 commit 400780e
Show file tree
Hide file tree
Showing 100 changed files with 9,065 additions and 112 deletions.
41 changes: 18 additions & 23 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,24 @@ exclude =
autotest
ignore =
# https://flake8.pycqa.org/en/latest/user/error-codes.html
F401, # 'module' imported but unused
# 'module' imported but unused
F401,
# https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes
E121, # continuation line under-indented for hanging indent
E122, # continuation line missing indentation or outdented
E126, # continuation line over-indented for hanging indent
E127, # continuation line over-indented for visual indent
E128, # continuation line under-indented for visual indent
E203, # whitespace before
E221, # multiple spaces before operator
E222, # multiple spaces after operator
E226, # missing whitespace around arithmetic operator
E231, # missing whitespace after ','
E241, # multiple spaces after ','
E402, # module level import not at top of file
E501, # line too long (> 79 characters)
E502, # backslash is redundant between brackets
E722, # do not use bare 'except'
E741, # ambiguous variable name
W291, # trailing whitespace
W292, # no newline at end of file
W293, # blank line contains whitespace
W391, # blank line at end of file
W503, # line break before binary operator
W504 # line break after binary operator
# E1: Indentation
E121, E122, E126, E127, E128,
# E2: Whitespace
E203, E221, E222, E226, E231, E241,
# E4: Import
E402,
# E5: Line length
E501, E502,
# E7: Statement
E722, E741,
# W2: Whitespace warning
W291, W292, W293,
# W3: Blank line warning
W391,
# W5: Line break warning
W503, W504

statistics = True
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@

# Do not modify the model data in various directories
examples/data/** binary
examples/groundwater_paper/uspb/** binary
123 changes: 106 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- develop
- 'release*'
pull_request:
branches: [master, develop]
branches: [main, develop]

jobs:

Expand All @@ -26,28 +26,28 @@ jobs:

# check out repo
- name: Checkout repo
uses: actions/checkout@v2.3.4
uses: actions/checkout@v3

- name: Setup Python 3.8
uses: actions/setup-python@v2
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.x

- name: Upgrade pip
run: |
python -m pip install --upgrade pip
- name: Base installation
run: |
pip install . --use-feature=in-tree-build
pip install -e .
- name: Print version
run: |
python -c "import modflowapi; print(modflowapi.__version__)"
lint:
name: linting
name: lint
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -59,31 +59,31 @@ jobs:
steps:
# check out repo
- name: Checkout repo
uses: actions/checkout@v2.3.4
uses: actions/checkout@v3

# Standard python fails on windows without GDAL installation. Using
# Standard python fails on Windows without GDAL installation. Using
# standard python here since only linting on linux.
# Use standard bash shell with standard python
- name: Setup Python 3.8
uses: actions/setup-python@v2
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.x

- name: Print python version
run: |
python --version
- name: Install Python 3.8 packages
- name: Install Python packages
run: |
python -m pip install --upgrade pip
pip install -r etc/requirements.pip.txt
pip install -e .[lint]
- name: Run black
run: |
echo "if black check fails run"
echo " black --line-length 79 ./modflowapi"
echo " black ./modflowapi"
echo "and then commit the changes."
black --check --line-length 79 ./modflowapi
black --check ./modflowapi
- name: Run flake8
run: |
Expand All @@ -93,3 +93,92 @@ jobs:
run: |
pylint --jobs=2 --errors-only --exit-zero ./modflowapi
autotest_extensions:
name: modflowapi extensions autotests
needs: lint
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ 3.8, 3.9, "3.10", "3.11" ]
defaults:
run:
shell: bash

steps:
# check out repo
- name: Checkout repo
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: pyproject.toml

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install git+https://[email protected]/Deltares/xmipy@develop
pip install git+https://[email protected]/MODFLOW-USGS/modflow-devtools@develop
pip install .[test]
- name: Install modflow executables
uses: modflowpy/install-modflow-action@v1
with:
path: ~/work/modflowapi/modflowapi/autotest
repo: modflow6-nightly-build

- name: Run autotests
working-directory: ./autotest
shell: bash -l {0}
run: |
# chmod a+x libmf6*
pytest -n auto -m "not mf6"
autotest_mf6_examples:
name: modflowapi mf6 examples autotests
needs: lint
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ 3.8, 3.9, "3.10", "3.11" ]
defaults:
run:
shell: bash

steps:
# check out repo
- name: Checkout repo
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: pyproject.toml

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install git+https://[email protected]/Deltares/xmipy@develop
pip install git+https://[email protected]/MODFLOW-USGS/modflow-devtools@develop
pip install .[test]
- name: Install modflow executables
uses: modflowpy/install-modflow-action@v1
with:
path: ~/work/modflowapi/modflowapi/autotest
repo: modflow6-nightly-build

- name: Run autotests
working-directory: ./autotest
shell: bash -l {0}
run: |
# chmod a+x libmf6*
pytest -n auto -m "mf6 and not extensions"
61 changes: 61 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
cff-version: 1.2.0
message: If you use this software, please cite both the article from preferred-citation
and the software itself.
type: software
title: MODFLOW API
version: 0.1.0
date-released: '2023-04-19'
abstract: An extension to xmipy for the MODFLOW API.
repository-artifact: https://pypi.org/project/modflowapi
repository-code: https://github.com/MODFLOW-USGS/modflowapi
license: CC0-1.0
authors:
- family-names: Hughes
given-names: Joseph D.
alias: jdhughes-usgs
affiliation: U.S. Geological Survey
orcid: https://orcid.org/0000-0003-1311-2354
- family-names: Russcher
given-names: Martijn
alias: mjr-deltares
affiliation: Deltares
orcid: https://orcid.org/0000-0001-8799-6514
- family-names: Langevin
given-names: Christian D.
alias: langevin-usgs
affiliation: U.S. Geological Survey
orcid: https://orcid.org/0000-0001-5610-9759
- family-names: Hofer
given-names: Julian
alias: Hofer-Julian
affiliation: Deltares
- family-names: Larsen
given-names: Joshua D.
alias: jlarsen-usgs
affiliation: U.S. Geological Survey
orcid: https://orcid.org/0000-0002-1218-800X
preferred-citation:
type: article
authors:
- family-names: Hughes
given-names: Joseph D.
orcid: https://orcid.org/0000-0003-1311-2354
- family-names: Russcher
given-names: Martijn J.
orcid: https://orcid.org/0000-0001-8799-6514
- family-names: Langevin
given-names: Christian D.
orcid: https://orcid.org/0000-0001-5610-9759
- family-names: Morway
given-names: Eric D.
orcid: https://orcid.org/0000-0002-8553-6140
- family-names: McDonald
given-names: Richard R.
orcid: https://orcid.org/0000-0002-0703-0638
title: The MODFLOW Application Programming Interface for simulation control and software interoperability
doi: 10.1016/j.envsoft.2021.105257
journal: Environmental Modelling & Software
volume: 138
start: 105257
year: 2022
month: 2
21 changes: 18 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
# modflowapi

`modflowapi` is an extension to [xmiipy](https://pypi.org/project/xmipy/) for the MODFLOW API.
`modflowapi` is an extension to [xmipy](https://pypi.org/project/xmipy/) for the MODFLOW API.

The `modflowapi` can be used to access functionality in the eXtended Model Interface (XMI) wrapper (XmiWrapper)
and additional functionality specific to the MODFLOW API. Currently it is a joint development of the USGS and Deltares.

Use of modflowapi and modflowapi extensions can be found in the [Quickstart](examples/notebooks/Quickstart.ipynb) and the [Extensions](examples/notebooks/MODFLOW-API_extensions_objects.ipynb) Notebooks. An example of using the MODFLOW API to monitor heads during a simulation can be found in the [Head Monitor Example](examples/notebooks/Head_Monitor_Example.ipynb) Notebook.

The `modflowapi` can be used to access functionality in the eXtended Model Interface (XMI) wrapper (XmiWrapper) and additional functionality specific to the MODFLOW API. Currently it is a joint development of the USGS and Deltares.

`modflowapi` can be installed by running

```
pip install modflowapi
```
```

or

```
conda install -c conda-forge modflowapi
```

### Citation

Hughes, Joseph D., Russcher, M. J., Langevin, C. D., Morway, E. D. and McDonald, R. R., 2022, The MODFLOW Application Programming Interface for simulationcontrol and software interoperability: Environmental Modelling & Software, v. 148, p. 105257, [doi:10.1016/j.envsoft.2021.105257](https://doi.org/10.1016/j.envsoft.2021.105257).
1 change: 1 addition & 0 deletions autotest/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# init file for pytest
Loading

0 comments on commit 400780e

Please sign in to comment.