Skip to content

Commit cde7860

Browse files
authored
release(1.2.8): update mf6 version (#132)
* 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
1 parent 6a93306 commit cde7860

File tree

10 files changed

+165
-29
lines changed

10 files changed

+165
-29
lines changed

.github/workflows/main.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: pymake continuous integration
22

33
on:
44
schedule:
5-
- cron: '0 3 * * 3' # run at 3 AM UTC every Wednesday
5+
- cron: '0 7 * * *' # run at 7 AM UTC every day
66
push:
77
branches: [ master ]
88
pull_request:
@@ -47,25 +47,29 @@ jobs:
4747
4848
- name: test on Linux
4949
if: runner.os == 'Linux'
50+
working-directory: ./autotest
5051
run: |
51-
pytest -v -n=auto --dist=loadfile -m="base or regression" --durations=0 --cov=pymake --cov-report=xml autotest/
52+
pytest -v -n=auto --dist=loadfile -m="base or regression" --durations=0 --cov=pymake --cov-report=xml
5253
5354
- name: test on MacOS
5455
if: runner.os == 'macOS'
56+
working-directory: ./autotest
5557
run: |
56-
pytest -v -n=auto --dist=loadfile -m="base" --durations=0 --cov=pymake --cov-report=xml autotest/
58+
pytest -v -n=auto --dist=loadfile -m="base" --durations=0 --cov=pymake --cov-report=xml
5759
5860
- name: test on Windows
5961
if: runner.os == 'Windows'
62+
working-directory: ./autotest
6063
shell: cmd
6164
run: |
62-
pytest -v -m="base" --durations=0 --cov=pymake --cov-report=xml autotest/
65+
pytest -v -m="base" --durations=0 --cov=pymake --cov-report=xml
6366
6467
- name: Print coverage report before upload
68+
working-directory: ./autotest
6569
run: |
6670
coverage report
6771
6872
- name: Upload coverage to Codecov
6973
uses: codecov/[email protected]
7074
with:
71-
file: ./coverage.xml
75+
file: ./autotest/coverage.xml

.github/workflows/pymake-gcc.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: pymake gcc build
22

33
on:
44
schedule:
5-
- cron: '0 3 * * 3' # run at 3 AM UTC every Wednesday
5+
- cron: '0 7 * * *' # run at 7 AM UTC every day
66
push:
77
branches: [ master ]
88
pull_request:
@@ -46,17 +46,19 @@ jobs:
4646
.github/common/download-examples.sh
4747
4848
- name: Run pytest
49+
working-directory: ./autotest
4950
run: |
50-
pytest -v --dist=loadfile -n=auto -m="base or regression" --durations=0 --cov=pymake --cov-report=xml autotest/
51+
pytest -v --dist=loadfile -n=auto -m="base or regression" --durations=0 --cov=pymake --cov-report=xml
5152
5253
- name: Print coverage report before upload
54+
working-directory: ./autotest
5355
run: |
5456
coverage report
5557
5658
- name: Upload coverage to Codecov
5759
uses: codecov/[email protected]
5860
with:
59-
file: ./coverage.xml
61+
file: ./autotest/coverage.xml
6062

6163
pymakeCI-gcc-prev:
6264
name: pymake CI GCC 9 and 8
@@ -102,17 +104,19 @@ jobs:
102104
.github/common/download-examples.sh
103105
104106
- name: Run pytest
107+
working-directory: ./autotest
105108
run: |
106-
pytest -v --dist=loadfile -n=auto -m="base" --durations=0 --cov=pymake --cov-report=xml autotest/
109+
pytest -v --dist=loadfile -n=auto -m="base" --durations=0 --cov=pymake --cov-report=xml
107110
108111
- name: Print coverage report before upload
112+
working-directory: ./autotest
109113
run: |
110114
coverage report
111115
112116
- name: Upload coverage to Codecov
113117
uses: codecov/[email protected]
114118
with:
115-
file: ./coverage.xml
119+
file: ./autotest/coverage.xml
116120

117121
pymakeCI-python-prev:
118122
name: pymake CI with previous python versions

.github/workflows/pymake-requests.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: pymake requests
22

33
on:
44
schedule:
5-
- cron: '0 3 * * 3' # run at 3 AM UTC every Wednesday
5+
- cron: '0 7 * * *' # run at 7 AM UTC every day
66
push:
77
branches: [ master ]
88
pull_request:
@@ -31,19 +31,22 @@ jobs:
3131
.github/common/install-python.sh
3232
3333
- name: Run pytest
34+
working-directory: ./autotest
3435
run: |
35-
pytest -v -n=auto -m requests --durations=0 --cov=pymake --cov-report=xml autotest/
36+
pytest -v -n=auto -m requests --durations=0 --cov=pymake --cov-report=xml
3637
3738
- name: Run scheduled tests
3839
if: ${{ github.event_name == 'schedule' }}
40+
working-directory: ./autotest
3941
run: |
40-
pytest -v -m="schedule" --durations=0 --cov=pymake --cov-report=xml autotest/
42+
pytest -v -m="schedule" --durations=0 --cov=pymake --cov-report=xml
4143
4244
- name: Print coverage report before upload
45+
working-directory: ./autotest
4346
run: |
4447
coverage report
4548
4649
- name: Upload coverage to Codecov
4750
uses: codecov/[email protected]
4851
with:
49-
file: ./coverage.xml
52+
file: ./autotest/coverage.xml

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

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

5-
### Version 1.2.7
5+
### Version 1.2.8
66

77
![pymake continuous integration](https://github.com/modflowpy/pymake/workflows/pymake%20continuous%20integration/badge.svg)
88
[![codecov](https://codecov.io/gh/modflowpy/pymake/branch/master/graph/badge.svg)](https://codecov.io/gh/modflowpy/pymake)

autotest/test_cli_cmds.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import pathlib as pl
33
import shutil
44
import subprocess
5-
import sys
65

76
import pytest
87

autotest/test_mf6_existing_meson.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
import contextlib
21
import os
32
import shutil
43
import sys
5-
import time
64

75
import flopy
86
import pytest

autotest/test_requests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ def test_latest_assets():
107107
keys = assets.keys()
108108
test_keys = [
109109
"code.json",
110+
"code.md",
110111
"mac.zip",
111112
"linux.zip",
112-
"win32.zip",
113113
"win64.zip",
114114
]
115115
for key in keys:

pymake/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
__author__ = "Joseph D. Hughes"
2-
__date__ = "December 8, 2022"
3-
__version__ = "1.2.7"
2+
__date__ = "July 5, 2023"
3+
__version__ = "1.2.8"
44
__maintainer__ = "Joseph D. Hughes"
55
__email__ = "[email protected]"
66
__status__ = "Production"

pymake/utils/_usgs_src_update.py

Lines changed: 130 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import shutil
88
import sys
99
import types
10+
from typing import Union
1011

1112
from .usgsprograms import usgs_program_data
1213

@@ -65,8 +66,7 @@ def _build_replace(targets):
6566

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

7171
# get a dictionary of update functions
7272
funcs = _get_function_names(sys.modules[__name__], select_name="_update_")
@@ -432,6 +432,11 @@ def _update_mfusg_gsi_files(srcdir, fc, cc, arch, double):
432432
"FMTARG = 'BINARY'": "FMTARG = 'UNFORMATTED'\n ACCARG = 'STREAM'",
433433
",SHARED,ACCESS='SEQUENTIAL'": ",ACCESS='SEQUENTIAL'",
434434
"FORM=FMTARG,SHARED,": "FORM=FMTARG,",
435+
",BUFFERED='YES',": ",",
436+
", BUFFERED='NO')": ")",
437+
",SHARE = 'DENYNONE'": ",",
438+
", SHARE = 'DENYNONE',": ",",
439+
"FORM='FORMATTED',ACCESS='SEQUENTIAL',": "FORM='FORMATTED',ACCESS='SEQUENTIAL'",
435440
}
436441

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

454+
tags = {",share='DENYNONE',": ","}
455+
456+
fpth = pl.Path(srcdir) / "UpdtSt.for"
457+
if fpth.exists():
458+
with open(fpth) as f:
459+
lines = f.readlines()
460+
f = open(fpth, "w")
461+
for idx, line in enumerate(lines):
462+
for key, value in tags.items():
463+
if key in line:
464+
line = line.replace(key, value)
465+
f.write(line)
466+
f.close()
467+
449468
tag = "DEALLOCATE(ITHFLG)"
450469
tag2 = "DEALLOCATE(LAYTYP)"
451470
fpth = pl.Path(srcdir) / "gwf2bcf-lpf-u1.f"
@@ -829,7 +848,116 @@ def _update_vs2dt_files(srcdir, fc, cc, arch, double):
829848
return
830849

831850

851+
def _update_mf6_files(
852+
srcdir: Union[str, os.PathLike],
853+
fc: str,
854+
cc: str,
855+
arch: str,
856+
double: bool,
857+
) -> None:
858+
"""
859+
Update MODFLOW 6 source files to remove files with external dependencies.
860+
This was required for releases >= 6.4.2
861+
862+
Parameters
863+
----------
864+
srcdir : str
865+
path to directory with source files
866+
fc : str
867+
fortran compiler
868+
cc : str
869+
c/c++ compiler
870+
arch : str
871+
architecture
872+
double : bool
873+
boolean indicating if compiler switches are used to build a
874+
double precision target
875+
876+
Returns
877+
-------
878+
879+
"""
880+
_update_mf6_external_dependencies(srcdir)
881+
return
882+
883+
884+
def _update_libmf6_files(
885+
srcdir: Union[str, os.PathLike],
886+
fc: str,
887+
cc: str,
888+
arch: str,
889+
double: bool,
890+
) -> None:
891+
"""
892+
Update MODFLOW 6 shared object source files to remove files with external
893+
dependencies. This was required for releases >= 6.4.2
894+
895+
Parameters
896+
----------
897+
srcdir : str
898+
path to directory with source files
899+
fc : str
900+
fortran compiler
901+
cc : str
902+
c/c++ compiler
903+
arch : str
904+
architecture
905+
double : bool
906+
boolean indicating if compiler switches are used to build a
907+
double precision target
908+
909+
Returns
910+
-------
911+
912+
"""
913+
_update_mf6_external_dependencies(srcdir, target="libmf6")
914+
return
915+
916+
832917
# common source file replacement functions
918+
def _update_mf6_external_dependencies(
919+
srcdir: Union[str, os.PathLike],
920+
target: str = "mf6",
921+
) -> None:
922+
"""
923+
Remove MODFLOW 6 files with external library dependencies (PETSc, MPI).
924+
925+
926+
Parameters
927+
----------
928+
srcdir : os.PathLike
929+
path to directory with source files
930+
target: str
931+
target to create (Default is mf6)
932+
933+
Returns
934+
-------
935+
None
936+
937+
"""
938+
if not isinstance(srcdir, pl.Path):
939+
srcdir = pl.Path(srcdir)
940+
if target == "libmf6":
941+
srcdir = srcdir.parent / "src"
942+
parallel_files = (
943+
"Utilities/Vector/PetscVector.F90",
944+
"Utilities/Matrix/PetscMatrix.F90",
945+
"Solution/PETSc/PetscSolver.F90",
946+
"Solution/PETSc/PetscConvergence.F90",
947+
"Distributed/MpiMessageBuilder.f90",
948+
"Distributed/MpiRouter.f90",
949+
"Distributed/MpiRunControl.F90",
950+
"Distributed/MpiWorld.f90",
951+
"Solution/ParallelSolution.f90",
952+
)
953+
for file in parallel_files:
954+
path = srcdir / file
955+
if path.is_file():
956+
print(f'Removing..."{path}"')
957+
os.remove(path)
958+
return
959+
960+
833961
def _update_utl7(srcdir):
834962
"""Update utl7.f source file
835963

pymake/utils/usgsprograms.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
target , version, current, url , dirname , srcdir , standard_switch, double_switch, shared_object
2-
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
3-
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
4-
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
2+
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
3+
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
4+
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
55
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
66
mt3dms , 5.3.0 , True , https://hydro.geo.ua.edu/mt3d/mt3dms_530.exe , mt3dms5.3.0 , src/true-binary , True , False , False
77
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
@@ -18,6 +18,6 @@ swtv4 , 4.00.05, True , https://water.usgs.gov/water-resources/software
1818
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
1919
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
2020
zonbud3 , 3.01 , True , https://water.usgs.gov/water-resources/software/ZONEBUDGET/zonbud3_01.exe , Zonbud.3_01 , Src , True , False , False
21-
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
22-
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
23-
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
21+
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
22+
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
23+
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 commit comments

Comments
 (0)