Skip to content

Commit

Permalink
release(1.2.8): update mf6 version (#132)
Browse files Browse the repository at this point in the history
* Add latest version of mfusg_gsi (v2.1.1).
* Update test_request.py::test_latest_assets with latest asset list
* Update pymake calls in GH Actions workflows to use working-directory
  • Loading branch information
jdhughes-usgs authored Jul 5, 2023
1 parent 6a93306 commit cde7860
Show file tree
Hide file tree
Showing 10 changed files with 165 additions and 29 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: pymake continuous integration

on:
schedule:
- cron: '0 3 * * 3' # run at 3 AM UTC every Wednesday
- cron: '0 7 * * *' # run at 7 AM UTC every day
push:
branches: [ master ]
pull_request:
Expand Down Expand Up @@ -47,25 +47,29 @@ jobs:
- name: test on Linux
if: runner.os == 'Linux'
working-directory: ./autotest
run: |
pytest -v -n=auto --dist=loadfile -m="base or regression" --durations=0 --cov=pymake --cov-report=xml autotest/
pytest -v -n=auto --dist=loadfile -m="base or regression" --durations=0 --cov=pymake --cov-report=xml
- name: test on MacOS
if: runner.os == 'macOS'
working-directory: ./autotest
run: |
pytest -v -n=auto --dist=loadfile -m="base" --durations=0 --cov=pymake --cov-report=xml autotest/
pytest -v -n=auto --dist=loadfile -m="base" --durations=0 --cov=pymake --cov-report=xml
- name: test on Windows
if: runner.os == 'Windows'
working-directory: ./autotest
shell: cmd
run: |
pytest -v -m="base" --durations=0 --cov=pymake --cov-report=xml autotest/
pytest -v -m="base" --durations=0 --cov=pymake --cov-report=xml
- name: Print coverage report before upload
working-directory: ./autotest
run: |
coverage report
- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
file: ./coverage.xml
file: ./autotest/coverage.xml
14 changes: 9 additions & 5 deletions .github/workflows/pymake-gcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: pymake gcc build

on:
schedule:
- cron: '0 3 * * 3' # run at 3 AM UTC every Wednesday
- cron: '0 7 * * *' # run at 7 AM UTC every day
push:
branches: [ master ]
pull_request:
Expand Down Expand Up @@ -46,17 +46,19 @@ jobs:
.github/common/download-examples.sh
- name: Run pytest
working-directory: ./autotest
run: |
pytest -v --dist=loadfile -n=auto -m="base or regression" --durations=0 --cov=pymake --cov-report=xml autotest/
pytest -v --dist=loadfile -n=auto -m="base or regression" --durations=0 --cov=pymake --cov-report=xml
- name: Print coverage report before upload
working-directory: ./autotest
run: |
coverage report
- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
file: ./coverage.xml
file: ./autotest/coverage.xml

pymakeCI-gcc-prev:
name: pymake CI GCC 9 and 8
Expand Down Expand Up @@ -102,17 +104,19 @@ jobs:
.github/common/download-examples.sh
- name: Run pytest
working-directory: ./autotest
run: |
pytest -v --dist=loadfile -n=auto -m="base" --durations=0 --cov=pymake --cov-report=xml autotest/
pytest -v --dist=loadfile -n=auto -m="base" --durations=0 --cov=pymake --cov-report=xml
- name: Print coverage report before upload
working-directory: ./autotest
run: |
coverage report
- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
file: ./coverage.xml
file: ./autotest/coverage.xml

pymakeCI-python-prev:
name: pymake CI with previous python versions
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/pymake-requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: pymake requests

on:
schedule:
- cron: '0 3 * * 3' # run at 3 AM UTC every Wednesday
- cron: '0 7 * * *' # run at 7 AM UTC every day
push:
branches: [ master ]
pull_request:
Expand Down Expand Up @@ -31,19 +31,22 @@ jobs:
.github/common/install-python.sh
- name: Run pytest
working-directory: ./autotest
run: |
pytest -v -n=auto -m requests --durations=0 --cov=pymake --cov-report=xml autotest/
pytest -v -n=auto -m requests --durations=0 --cov=pymake --cov-report=xml
- name: Run scheduled tests
if: ${{ github.event_name == 'schedule' }}
working-directory: ./autotest
run: |
pytest -v -m="schedule" --durations=0 --cov=pymake --cov-report=xml autotest/
pytest -v -m="schedule" --durations=0 --cov=pymake --cov-report=xml
- name: Print coverage report before upload
working-directory: ./autotest
run: |
coverage report
- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
file: ./coverage.xml
file: ./autotest/coverage.xml
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Python package for building MODFLOW-based programs from source files.

### Version 1.2.7
### Version 1.2.8

![pymake continuous integration](https://github.com/modflowpy/pymake/workflows/pymake%20continuous%20integration/badge.svg)
[![codecov](https://codecov.io/gh/modflowpy/pymake/branch/master/graph/badge.svg)](https://codecov.io/gh/modflowpy/pymake)
Expand Down
1 change: 0 additions & 1 deletion autotest/test_cli_cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import pathlib as pl
import shutil
import subprocess
import sys

import pytest

Expand Down
2 changes: 0 additions & 2 deletions autotest/test_mf6_existing_meson.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import contextlib
import os
import shutil
import sys
import time

import flopy
import pytest
Expand Down
2 changes: 1 addition & 1 deletion autotest/test_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ def test_latest_assets():
keys = assets.keys()
test_keys = [
"code.json",
"code.md",
"mac.zip",
"linux.zip",
"win32.zip",
"win64.zip",
]
for key in keys:
Expand Down
4 changes: 2 additions & 2 deletions pymake/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
__author__ = "Joseph D. Hughes"
__date__ = "December 8, 2022"
__version__ = "1.2.7"
__date__ = "July 5, 2023"
__version__ = "1.2.8"
__maintainer__ = "Joseph D. Hughes"
__email__ = "[email protected]"
__status__ = "Production"
Expand Down
132 changes: 130 additions & 2 deletions pymake/utils/_usgs_src_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import shutil
import sys
import types
from typing import Union

from .usgsprograms import usgs_program_data

Expand Down Expand Up @@ -65,8 +66,7 @@ def _build_replace(targets):

# remove exe extension from targets
for idx, target in enumerate(targets):
if ".exe" in target.lower():
targets[idx] = target[:-4]
targets[idx] = pl.Path(target).with_suffix("").name

# get a dictionary of update functions
funcs = _get_function_names(sys.modules[__name__], select_name="_update_")
Expand Down Expand Up @@ -432,6 +432,11 @@ def _update_mfusg_gsi_files(srcdir, fc, cc, arch, double):
"FMTARG = 'BINARY'": "FMTARG = 'UNFORMATTED'\n ACCARG = 'STREAM'",
",SHARED,ACCESS='SEQUENTIAL'": ",ACCESS='SEQUENTIAL'",
"FORM=FMTARG,SHARED,": "FORM=FMTARG,",
",BUFFERED='YES',": ",",
", BUFFERED='NO')": ")",
",SHARE = 'DENYNONE'": ",",
", SHARE = 'DENYNONE',": ",",
"FORM='FORMATTED',ACCESS='SEQUENTIAL',": "FORM='FORMATTED',ACCESS='SEQUENTIAL'",
}

fpth = pl.Path(srcdir) / "glo2basu1.f"
Expand All @@ -446,6 +451,20 @@ def _update_mfusg_gsi_files(srcdir, fc, cc, arch, double):
f.write(line)
f.close()

tags = {",share='DENYNONE',": ","}

fpth = pl.Path(srcdir) / "UpdtSt.for"
if fpth.exists():
with open(fpth) as f:
lines = f.readlines()
f = open(fpth, "w")
for idx, line in enumerate(lines):
for key, value in tags.items():
if key in line:
line = line.replace(key, value)
f.write(line)
f.close()

tag = "DEALLOCATE(ITHFLG)"
tag2 = "DEALLOCATE(LAYTYP)"
fpth = pl.Path(srcdir) / "gwf2bcf-lpf-u1.f"
Expand Down Expand Up @@ -829,7 +848,116 @@ def _update_vs2dt_files(srcdir, fc, cc, arch, double):
return


def _update_mf6_files(
srcdir: Union[str, os.PathLike],
fc: str,
cc: str,
arch: str,
double: bool,
) -> None:
"""
Update MODFLOW 6 source files to remove files with external dependencies.
This was required for releases >= 6.4.2
Parameters
----------
srcdir : str
path to directory with source files
fc : str
fortran compiler
cc : str
c/c++ compiler
arch : str
architecture
double : bool
boolean indicating if compiler switches are used to build a
double precision target
Returns
-------
"""
_update_mf6_external_dependencies(srcdir)
return


def _update_libmf6_files(
srcdir: Union[str, os.PathLike],
fc: str,
cc: str,
arch: str,
double: bool,
) -> None:
"""
Update MODFLOW 6 shared object source files to remove files with external
dependencies. This was required for releases >= 6.4.2
Parameters
----------
srcdir : str
path to directory with source files
fc : str
fortran compiler
cc : str
c/c++ compiler
arch : str
architecture
double : bool
boolean indicating if compiler switches are used to build a
double precision target
Returns
-------
"""
_update_mf6_external_dependencies(srcdir, target="libmf6")
return


# common source file replacement functions
def _update_mf6_external_dependencies(
srcdir: Union[str, os.PathLike],
target: str = "mf6",
) -> None:
"""
Remove MODFLOW 6 files with external library dependencies (PETSc, MPI).
Parameters
----------
srcdir : os.PathLike
path to directory with source files
target: str
target to create (Default is mf6)
Returns
-------
None
"""
if not isinstance(srcdir, pl.Path):
srcdir = pl.Path(srcdir)
if target == "libmf6":
srcdir = srcdir.parent / "src"
parallel_files = (
"Utilities/Vector/PetscVector.F90",
"Utilities/Matrix/PetscMatrix.F90",
"Solution/PETSc/PetscSolver.F90",
"Solution/PETSc/PetscConvergence.F90",
"Distributed/MpiMessageBuilder.f90",
"Distributed/MpiRouter.f90",
"Distributed/MpiRunControl.F90",
"Distributed/MpiWorld.f90",
"Solution/ParallelSolution.f90",
)
for file in parallel_files:
path = srcdir / file
if path.is_file():
print(f'Removing..."{path}"')
os.remove(path)
return


def _update_utl7(srcdir):
"""Update utl7.f source file
Expand Down
12 changes: 6 additions & 6 deletions pymake/utils/usgsprograms.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
target , version, current, url , dirname , srcdir , standard_switch, double_switch, shared_object
mf6 , 6.4.1 , True , https://github.com/MODFLOW-USGS/modflow6/releases/download/6.4.1/mf6.4.1_linux.zip , mf6.4.1_linux , src , True , False , False
zbud6 , 6.4.1 , True , https://github.com/MODFLOW-USGS/modflow6/releases/download/6.4.1/mf6.4.1_linux.zip , mf6.4.1_linux , utils/zonebudget/src, True , False , False
libmf6 , 6.4.1 , True , https://github.com/MODFLOW-USGS/modflow6/releases/download/6.4.1/mf6.4.1_linux.zip , mf6.4.1_linux , srcbmi , True , False , True
mf6 , 6.4.2 , True , https://github.com/MODFLOW-USGS/modflow6/releases/download/6.4.2/mf6.4.2_linux.zip , mf6.4.2_linux , src , True , False , False
zbud6 , 6.4.2 , True , https://github.com/MODFLOW-USGS/modflow6/releases/download/6.4.2/mf6.4.2_linux.zip , mf6.4.2_linux , utils/zonebudget/src, True , False , False
libmf6 , 6.4.2 , True , https://github.com/MODFLOW-USGS/modflow6/releases/download/6.4.2/mf6.4.2_linux.zip , mf6.4.2_linux , srcbmi , True , False , True
mp7 , 7.2.001, True , https://water.usgs.gov/water-resources/software/MODPATH/modpath_7_2_001.zip , modpath_7_2_001 , source , True , False , False
mt3dms , 5.3.0 , True , https://hydro.geo.ua.edu/mt3d/mt3dms_530.exe , mt3dms5.3.0 , src/true-binary , True , False , False
mt3dusgs , 1.1.0 , True , https://water.usgs.gov/water-resources/software/MT3D-USGS/mt3dusgs1.1.0.zip , mt3dusgs1.1.0 , src , True , False , False
Expand All @@ -18,6 +18,6 @@ swtv4 , 4.00.05, True , https://water.usgs.gov/water-resources/software
mp6 , 6.0.1 , True , https://water.usgs.gov/water-resources/software/MODPATH/modpath.6_0_01.zip , modpath.6_0 , src , True , False , False
mflgr , 2.0.0 , True , https://water.usgs.gov/ogw/modflow-lgr/modflow-lgr-v2.0.0/mflgrv2_0_00.zip , mflgr.2_0 , src , True , True , False
zonbud3 , 3.01 , True , https://water.usgs.gov/water-resources/software/ZONEBUDGET/zonbud3_01.exe , Zonbud.3_01 , Src , True , False , False
mfnwt1.1.4 , 1.1.4 , False , https://water.usgs.gov/water-resources/software/MODFLOW-NWT/MODFLOW-NWT_1.1.4.zip , MODFLOW-NWT_1.1.4 , src , True , False , False
mfnwt , 1.3.0 , True , https://water.usgs.gov/water-resources/software/MODFLOW-NWT/MODFLOW-NWT_1.3.0.zip , MODFLOW-NWT , src , True , True , False
mfusg_gsi , 2.01.0 , True , https://www.gsienv.com/wp-content/uploads/2023/01/USG-Transport-V_2.1.0-1.zip , . , Source , True , True , False
mfnwt1.1.4 , 1.1.4 , False , https://water.usgs.gov/water-resources/software/MODFLOW-NWT/MODFLOW-NWT_1.1.4.zip , MODFLOW-NWT_1.1.4 , src , True , False , False
mfnwt , 1.3.0 , True , https://water.usgs.gov/water-resources/software/MODFLOW-NWT/MODFLOW-NWT_1.3.0.zip , MODFLOW-NWT , src , True , True , False
mfusg_gsi , 2.1.1 , True , https://www.gsienv.com/wp-content/uploads/2023/04/USG-Transport-V_2.1.1.zip , USGT-v2-1-1-source , . , True , False , False

0 comments on commit cde7860

Please sign in to comment.