Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Python package for compiling MODFLOW-based programs.


### Version 1.1
[![Build Status](https://travis-ci.org/modflowpy/pymake.svg?branch=master)](https://travis-ci.org/modflowpy/pymake)
[![Coverage Status](https://coveralls.io/repos/github/modflowpy/pymake/badge.svg?branch=master)](https://coveralls.io/github/modflowpy/pymake?branch=master)
### Version 1.1 refactor-examples — build 88
[![Build Status](https://travis-ci.org/modflowpy/pymake.svg?branch=refactor-examples)](https://travis-ci.org/modflowpy/pymake)
[![Coverage Status](https://coveralls.io/repos/github/modflowpy/pymake/badge.svg?branch=refactor-examples)](https://coveralls.io/github/modflowpy/pymake?branch=refactor-examples)


This is a relatively simple python package for compiling MODFLOW-based programs.
Expand Down
20 changes: 9 additions & 11 deletions autotest/t001_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,22 @@

retain = False
key_release = 'mf2005'
key_previous = 'mf2005p'
key_previous = 'mf2005.1.11'
pd_release = pymake.usgs_prog_data().get_target_data(key=key_release)
pd_previous = pymake.usgs_prog_data().get_target_data(key=key_previous)

testdir = 'temp'
testdir_release = os.path.join(testdir, pd_release.dirname)
target_release = os.path.join(testdir, key_release + '_' + pd_release.version)
target_release = os.path.join(testdir, key_release)

testdir_previous = os.path.join(testdir, pd_previous.dirname)
target_previous = os.path.join(testdir,
key_release + '_' + pd_previous.version)
target_previous = os.path.join(testdir, key_previous)

exdir = 'test-run'
testpaths = [os.path.join(testdir, pd_release.dirname, exdir)]
exclude = ('MNW2-Fig28', 'swi2ex4sww', 'testsfr2_tab', 'UZFtest2')



def run_mf2005(namefile, regression=True):
"""
Run the simulation.
Expand Down Expand Up @@ -66,12 +64,15 @@ def run_mf2005(namefile, regression=True):
assert success_reg, 'regression model {} '.format(nam) + 'did not run.'

# compare results
outfile1 = os.path.join(os.path.split(os.path.join(testpth, nam))[0], 'bud.cmp')
outfile2 = os.path.join(os.path.split(os.path.join(testpth, nam))[0], 'hds.cmp')
outfile1 = os.path.join(os.path.split(os.path.join(testpth, nam))[0],
'bud.cmp')
outfile2 = os.path.join(os.path.split(os.path.join(testpth, nam))[0],
'hds.cmp')
success_reg = pymake.compare(os.path.join(testpth, nam),
os.path.join(testpth_reg, nam),
precision='single',
max_cumpd=0.01, max_incpd=0.01, htol=0.001,
max_cumpd=0.01, max_incpd=0.01,
htol=0.001,
outfile1=outfile1, outfile2=outfile2)

# Clean things up
Expand All @@ -89,7 +90,6 @@ def test_compile_prev():
print('Removing folder ' + testdir_previous)
shutil.rmtree(testdir_previous)


pymake.build_program(target=key_previous, fflags='-O3',
download_dir=testdir,
exe_name=target_previous)
Expand All @@ -105,7 +105,6 @@ def test_compile_ref():
print('Removing folder ' + testdir_release)
shutil.rmtree(testdir_release)


pymake.build_program(target=key_release, fflags='-O3 -fbacktrace',
download_dir=testdir,
exe_name=target_release)
Expand All @@ -114,7 +113,6 @@ def test_compile_ref():


def test_mf2005():
namefiles = get_namefiles(testpaths[0], exclude=exclude)
namefiles = get_namefiles(testpaths[0], exclude=exclude)
for namefile in namefiles:
yield run_mf2005, namefile
Expand Down
7 changes: 4 additions & 3 deletions autotest/t002_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import flopy

# define program data
target = 'swt_v4'
target = 'swtv4'
prog_dict = pymake.usgs_prog_data().get_target_data(target)

# set up paths
Expand Down Expand Up @@ -49,11 +49,12 @@ def compile_code():
shutil.rmtree(swtpth)

# compile seawat
replace_function = pymake.build_replace(target)
pymake.build_program(target=target,
double=True,
download_dir=dstpth,
target_dir=dstpth,
replace_function=pymake.update_seawatfiles,
exe_dir=dstpth,
replace_function=replace_function,
modify_exe_name=False)

return
Expand Down
2 changes: 1 addition & 1 deletion autotest/t003_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def compile_code():
# compile MODFLOW-USG
pymake.build_program(target=target,
download_dir=dstpth,
target_dir=dstpth)
exe_dir=dstpth)


def clean_up():
Expand Down
5 changes: 3 additions & 2 deletions autotest/t004_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ def compile_code():
shutil.rmtree(mp6pth)

# download and compile MODPATH 6
replace_function = pymake.build_replace(target)
pymake.build_program(target=target,
download_dir=dstpth,
target_dir=dstpth,
replace_function=pymake.update_mp6files)
exe_dir=dstpth,
replace_function=replace_function)


def get_simfiles():
Expand Down
4 changes: 3 additions & 1 deletion autotest/t005_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ def compile_code():
shutil.rmtree(mflgrpth)

# compile MODFLOW-LGR
replace_function = pymake.build_replace(target)
pymake.build_program(target=target,
download_dir=dstpth,
target_dir=dstpth)
exe_dir=dstpth,
replace_function=replace_function)

return

Expand Down
4 changes: 3 additions & 1 deletion autotest/t006_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ def compile_code():
shutil.rmtree(mfnwtpth)

# compile MODFLOW-NWT
replace_function = pymake.build_replace(target)
pymake.build_program(target=target,
download_dir=dstpth,
makeclean=False,
makefile=True,
target_dir=dstpth)
exe_dir=dstpth,
replace_function=replace_function)


def build_with_makefile():
Expand Down
17 changes: 12 additions & 5 deletions autotest/t007_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,12 @@ def test_compile_mp7():
shutil.rmtree(mp7pth)

# download and compile MODPATH 6
replace_function = pymake.build_replace(target)
pymake.build_program(target=target,
fflags='-ffree-line-length-512',
download_dir=dstpth,
target_dir=dstpth,
replace_function=pymake.update_mp7files)
exe_dir=dstpth,
replace_function=replace_function)
return


Expand All @@ -191,9 +192,11 @@ def test_compile_mf2005():
shutil.rmtree(mf2005pth)

# download and compile MODFLOW-2005
replace_function = pymake.build_replace(mf2005_target)
pymake.build_program(target=mf2005_target,
download_dir=dstpth,
target_dir=dstpth)
exe_dir=dstpth,
replace_function=replace_function)
return


Expand All @@ -203,9 +206,11 @@ def test_compile_mfusg():
shutil.rmtree(mfusgpth)

# download and compile MODFLOW-USG
replace_function = pymake.build_replace(mfusg_target)
pymake.build_program(target=mfusg_target,
download_dir=dstpth,
target_dir=dstpth)
exe_dir=dstpth,
replace_function=replace_function)
return


Expand All @@ -215,10 +220,12 @@ def test_compile_mf6():
shutil.rmtree(mf6pth)

# download and compile MODFLOW 6
replace_function = pymake.build_replace(mf6_target)
pymake.build_program(target=mf6_target,
include_subdirs=True,
download_dir=dstpth,
target_dir=dstpth)
exe_dir=dstpth,
replace_function=replace_function)
return


Expand Down
5 changes: 4 additions & 1 deletion autotest/t008_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@ def compile_code():
shutil.rmtree(mf6pth)

# compile MODFLOW 6
pymake.usgs_prog_data().list_targets(current=True)
replace_function = pymake.build_replace(target)
pymake.build_program(target=target,
include_subdirs=True,
download_dir=dstpth)
download_dir=dstpth,
replace_function=replace_function)


def clean_up():
Expand Down
4 changes: 2 additions & 2 deletions autotest/t009_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def test_compile_mt3dusgs():
# download and compile MT3D-USGS
pymake.build_program(target=target,
download_dir=dstpth,
target_dir=dstpth)
exe_dir=dstpth)
return


Expand All @@ -110,7 +110,7 @@ def test_compile_mfnwt():
# compile MODFLOW-NWT
pymake.build_program(target=mfnwt_target,
download_dir=dstpth,
target_dir=dstpth)
exe_dir=dstpth)


def test_mt3dusgs():
Expand Down
Loading