refactor(autotests): update build_exe.py to use pymake updates (#484)
update build_exe.py to use pymake updates. Define environments so notebooks and scripts are run in a separate environment with python 3.7 to prevent travis timeouts.develop
parent
835cb39e33
commit
ac526a0d6b
27
.travis.yml
27
.travis.yml
|
@ -8,14 +8,21 @@ services:
|
|||
|
||||
matrix:
|
||||
include:
|
||||
- python: 2.7
|
||||
- python: 3.5
|
||||
- python: 3.6
|
||||
- python: 3.7
|
||||
- python: "3.7-dev"
|
||||
- env: TVER=PY27
|
||||
python: 2.7
|
||||
- env: TVER=PY35
|
||||
python: 3.5
|
||||
- env: TVER=PY36
|
||||
python: 3.6
|
||||
- env: TVER=PY37
|
||||
python: 3.7
|
||||
- env: TVER=PY37N
|
||||
python: 3.7
|
||||
- env: TVER=PY37D
|
||||
python: "3.7-dev"
|
||||
|
||||
allow_failures:
|
||||
- python: "3.7-dev"
|
||||
- env: TVER=PY37D
|
||||
|
||||
cache:
|
||||
pip: true
|
||||
|
@ -82,15 +89,15 @@ script:
|
|||
- echo jupyter runtime directory; jupyter --runtime-dir
|
||||
- echo pylint version; pylint --version
|
||||
- nosetests -v build_exes.py --with-id --with-timer -w ./autotest
|
||||
- if [[ $TRAVIS_PYTHON_VERSION == 3.6 ]]; then
|
||||
- if [[ $TVER == PY37N ]]; then
|
||||
nosetests -v autotest_scripts.py --with-id --with-timer -w ./autotest --with-coverage --cover-package=flopy;
|
||||
elif [[ $TRAVIS_PYTHON_VERSION == 3.7 ]]; then
|
||||
nosetests -v autotest_notebooks.py --with-id --with-timer -w ./autotest --with-coverage --cover-package=flopy;
|
||||
else
|
||||
nosetests -v --with-id --with-timer -w ./autotest --with-coverage --cover-package=flopy;
|
||||
fi
|
||||
- nosetests -v --with-id --with-timer -w ./autotest --with-coverage --cover-package=flopy
|
||||
|
||||
after_success:
|
||||
- coveralls
|
||||
- if [[ $TRAVIS_PYTHON_VERSION == 3.5 ]]; then
|
||||
pylint --errors-only ./flopy;
|
||||
pylint --errors-only ./flopy;
|
||||
fi
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
Disclaimer
|
||||
----------
|
||||
|
||||
This software has been approved for release by the U.S. Geological Survey
|
||||
(USGS). Although the software has been subjected to rigorous review, the USGS
|
||||
reserves the right to update the software as needed pursuant to further analysis
|
||||
and review. No warranty, expressed or implied, is made by the USGS or the U.S.
|
||||
Government as to the functionality of the software and related material nor
|
||||
shall the fact of release constitute any such warranty. Furthermore, the
|
||||
software is released on condition that neither the USGS nor the U.S. Government
|
||||
shall be held liable for any damages resulting from its authorized or
|
||||
unauthorized use.
|
||||
This software is preliminary or provisional and is subject to revision. It is
|
||||
being provided to meet the need for timely best science. The software has not
|
||||
received final approval by the U.S. Geological Survey (USGS). No warranty,
|
||||
expressed or implied, is made by the USGS or the U.S. Government as to the
|
||||
functionality of the software and related material nor shall the fact of release
|
||||
constitute any such warranty. The software is provided on the condition that
|
||||
neither the USGS nor the U.S. Government shall be held liable for any damages
|
||||
resulting from the authorized or unauthorized use of the software.
|
||||
|
|
25
README.md
25
README.md
|
@ -1,10 +1,10 @@
|
|||
|
||||
<img src="https://raw.githubusercontent.com/modflowpy/flopy/master/examples/images/flopy3.png" alt="flopy3" style="width:50;height:20">
|
||||
|
||||
### Version 3.2.10
|
||||
[![Build Status](https://travis-ci.org/modflowpy/flopy.svg?branch=release3.2.10)](https://travis-ci.org/modflowpy/flopy)
|
||||
### Version 3.2.10 develop — build 60
|
||||
[![Build Status](https://travis-ci.org/modflowpy/flopy.svg?branch=develop)](https://travis-ci.org/modflowpy/flopy)
|
||||
[![PyPI Version](https://img.shields.io/pypi/v/flopy.png)](https://pypi.python.org/pypi/flopy)
|
||||
[![Coverage Status](https://coveralls.io/repos/github/modflowpy/flopy/badge.svg?branch=release3.2.10)](https://coveralls.io/github/modflowpy/flopy?branch=release3.2.10)
|
||||
[![Coverage Status](https://coveralls.io/repos/github/modflowpy/flopy/badge.svg?branch=develop)](https://coveralls.io/github/modflowpy/flopy?branch=develop)
|
||||
|
||||
|
||||
Introduction
|
||||
|
@ -172,7 +172,7 @@ How to Cite
|
|||
|
||||
##### ***Software/Code citation for FloPy:***
|
||||
|
||||
[Bakker, M., Post, V., Langevin, C.D., Hughes, J.D., White, J.T., Starn, J.J., and Fienen, M.N., 2018, FloPy v3.2.10: U.S. Geological Survey Software Release, 19 October 2018, http://dx.doi.org/10.5066/F7BK19FH](http://dx.doi.org/10.5066/F7BK19FH)
|
||||
[Bakker, M., Post, V., Langevin, C.D., Hughes, J.D., White, J.T., Starn, J.J., and Fienen, M.N., 2019, FloPy v3.2.10 — develop: U.S. Geological Survey Software Release, 15 March 2019, http://dx.doi.org/10.5066/F7BK19FH](http://dx.doi.org/10.5066/F7BK19FH)
|
||||
|
||||
|
||||
MODFLOW Resources
|
||||
|
@ -187,13 +187,12 @@ MODFLOW Resources
|
|||
Disclaimer
|
||||
----------
|
||||
|
||||
This software has been approved for release by the U.S. Geological Survey
|
||||
(USGS). Although the software has been subjected to rigorous review, the USGS
|
||||
reserves the right to update the software as needed pursuant to further analysis
|
||||
and review. No warranty, expressed or implied, is made by the USGS or the U.S.
|
||||
Government as to the functionality of the software and related material nor
|
||||
shall the fact of release constitute any such warranty. Furthermore, the
|
||||
software is released on condition that neither the USGS nor the U.S. Government
|
||||
shall be held liable for any damages resulting from its authorized or
|
||||
unauthorized use.
|
||||
This software is preliminary or provisional and is subject to revision. It is
|
||||
being provided to meet the need for timely best science. The software has not
|
||||
received final approval by the U.S. Geological Survey (USGS). No warranty,
|
||||
expressed or implied, is made by the USGS or the U.S. Government as to the
|
||||
functionality of the software and related material nor shall the fact of release
|
||||
constitute any such warranty. The software is provided on the condition that
|
||||
neither the USGS nor the U.S. Government shall be held liable for any damages
|
||||
resulting from the authorized or unauthorized use of the software.
|
||||
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
# Build the executables that are used in the flopy autotests
|
||||
import os
|
||||
import sys
|
||||
import shutil
|
||||
import platform
|
||||
import subprocess
|
||||
import flopy
|
||||
|
||||
try:
|
||||
import pymake
|
||||
|
@ -12,541 +6,29 @@ except:
|
|||
print('pymake is not installed...will not build executables')
|
||||
pymake = None
|
||||
|
||||
fc = 'gfortran'
|
||||
cc = 'gcc'
|
||||
dbleprec = False
|
||||
# bindir should be in the user path to run flopy tests with appropriate
|
||||
# executables
|
||||
#
|
||||
# by default bindir will be in user directory
|
||||
# On windows will be C:\\Users\\username\\.local\\bin
|
||||
# On linux and osx will be /Users/username/.local/bin
|
||||
bindir = os.path.join(os.path.expanduser('~'), '.local', 'bin')
|
||||
bindir = os.path.abspath(bindir)
|
||||
# pass --bindir path/to/directory to define a different bin dir
|
||||
for ipos, arg in enumerate(sys.argv):
|
||||
if arg.lower() == '--bindir':
|
||||
bindir = sys.argv[ipos + 1]
|
||||
elif arg.lower() == '--dryrun':
|
||||
print('will perform dryrun and not build executables')
|
||||
pymake = None
|
||||
print(bindir)
|
||||
if not os.path.exists(bindir):
|
||||
os.makedirs(bindir, exist_ok=True)
|
||||
|
||||
def get_targets():
|
||||
targets = pymake.usgs_prog_data().get_keys(current=True)
|
||||
targets.sort()
|
||||
targets.remove('vs2dt')
|
||||
return targets
|
||||
|
||||
|
||||
def update_mt3dfiles(srcdir):
|
||||
# Replace the getcl command with getarg
|
||||
f1 = open(os.path.join(srcdir, 'mt3dms5.for'), 'r')
|
||||
f2 = open(os.path.join(srcdir, 'mt3dms5.for.tmp'), 'w')
|
||||
for line in f1:
|
||||
f2.write(line.replace('CALL GETCL(FLNAME)', 'CALL GETARG(1,FLNAME)'))
|
||||
f1.close()
|
||||
f2.close()
|
||||
os.remove(os.path.join(srcdir, 'mt3dms5.for'))
|
||||
shutil.move(os.path.join(srcdir, 'mt3dms5.for.tmp'),
|
||||
os.path.join(srcdir, 'mt3dms5.for'))
|
||||
|
||||
# Need to initialize the V array in SADV5B
|
||||
# see here: https://github.com/MODFLOW-USGS/mt3d-usgs/pull/46
|
||||
f1 = open(os.path.join(srcdir, 'mt_adv5.for'), 'r')
|
||||
f2 = open(os.path.join(srcdir, 'mt_adv5.for.tmp'), 'w')
|
||||
sfind = 'C--SET DT TO NEGATIVE FOR BACKWARD TRACKING'
|
||||
sreplace = 'C--INITIALIZE\n V(:)=0.\nC\n' + sfind
|
||||
for line in f1:
|
||||
f2.write(line.replace(sfind, sreplace))
|
||||
f1.close()
|
||||
f2.close()
|
||||
os.remove(os.path.join(srcdir, 'mt_adv5.for'))
|
||||
shutil.move(os.path.join(srcdir, 'mt_adv5.for.tmp'),
|
||||
os.path.join(srcdir, 'mt_adv5.for'))
|
||||
|
||||
# Replace filespec with standard fortran
|
||||
l = '''
|
||||
CHARACTER*20 ACCESS,FORM,ACTION(2)
|
||||
DATA ACCESS/'STREAM'/
|
||||
DATA FORM/'UNFORMATTED'/
|
||||
DATA (ACTION(I),I=1,2)/'READ','READWRITE'/
|
||||
'''
|
||||
fn = os.path.join(srcdir, 'FILESPEC.INC')
|
||||
f = open(fn, 'w')
|
||||
f.write(l)
|
||||
f.close()
|
||||
def build_target(target):
|
||||
if pymake is not None:
|
||||
pymake.build_apps(targets=target)
|
||||
|
||||
return
|
||||
|
||||
|
||||
def update_seawatfiles(srcdir):
|
||||
# rename all source files to lower case so compilation doesn't
|
||||
# bomb on case-sensitive operating systems
|
||||
srcfiles = os.listdir(srcdir)
|
||||
for filename in srcfiles:
|
||||
src = os.path.join(srcdir, filename)
|
||||
dst = os.path.join(srcdir, filename.lower())
|
||||
os.rename(src, dst)
|
||||
return
|
||||
|
||||
|
||||
def update_mf2000files(srcdir):
|
||||
# Remove six src folders
|
||||
dlist = ['beale2k', 'hydprgm', 'mf96to2k', 'mfpto2k', 'resan2k', 'ycint2k']
|
||||
for d in dlist:
|
||||
dname = os.path.join(srcdir, d)
|
||||
if os.path.isdir(dname):
|
||||
print('Removing ', dname)
|
||||
shutil.rmtree(os.path.join(srcdir, d))
|
||||
|
||||
# Move src files and serial src file to src directory
|
||||
tpth = os.path.join(srcdir, 'mf2k')
|
||||
files = [f for f in os.listdir(tpth) if
|
||||
os.path.isfile(os.path.join(tpth, f))]
|
||||
for f in files:
|
||||
shutil.move(os.path.join(tpth, f), srcdir)
|
||||
tpth = os.path.join(srcdir, 'mf2k', 'serial')
|
||||
files = [f for f in os.listdir(tpth) if
|
||||
os.path.isfile(os.path.join(tpth, f))]
|
||||
for f in files:
|
||||
shutil.move(os.path.join(tpth, f), srcdir)
|
||||
|
||||
# Remove mf2k directory in source directory
|
||||
tpth = os.path.join(srcdir, 'mf2k')
|
||||
shutil.rmtree(tpth)
|
||||
|
||||
|
||||
def update_mp6files(srcdir):
|
||||
fname1 = os.path.join(srcdir, 'MP6Flowdata.for')
|
||||
f = open(fname1, 'r')
|
||||
|
||||
fname2 = os.path.join(srcdir, 'MP6Flowdata_mod.for')
|
||||
f2 = open(fname2, 'w')
|
||||
for line in f:
|
||||
line = line.replace('CD.QX2', 'CD%QX2')
|
||||
f2.write(line)
|
||||
f.close()
|
||||
f2.close()
|
||||
os.remove(fname1)
|
||||
|
||||
fname1 = os.path.join(srcdir, 'MP6MPBAS1.for')
|
||||
f = open(fname1, 'r')
|
||||
|
||||
fname2 = os.path.join(srcdir, 'MP6MPBAS1_mod.for')
|
||||
f2 = open(fname2, 'w')
|
||||
for line in f:
|
||||
line = line.replace('MPBASDAT(IGRID)%NCPPL=NCPPL',
|
||||
'MPBASDAT(IGRID)%NCPPL=>NCPPL')
|
||||
f2.write(line)
|
||||
f.close()
|
||||
f2.close()
|
||||
os.remove(fname1)
|
||||
|
||||
|
||||
def update_mp7files(srcdir):
|
||||
fpth = os.path.join(srcdir, 'StartingLocationReader.f90')
|
||||
with open(fpth) as f:
|
||||
lines = f.readlines()
|
||||
f = open(fpth, 'w')
|
||||
for line in lines:
|
||||
if 'pGroup%Particles(n)%InitialFace = 0' in line:
|
||||
continue
|
||||
f.write(line)
|
||||
f.close()
|
||||
|
||||
|
||||
def run_cmdlist(cmdlist, cwd='.'):
|
||||
proc = subprocess.Popen(cmdlist, shell=False,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT,
|
||||
cwd=cwd)
|
||||
stdout_data, stderr_data = proc.communicate()
|
||||
if proc.returncode != 0:
|
||||
if isinstance(stdout_data, bytes):
|
||||
stdout_data = stdout_data.decode('utf-8')
|
||||
if isinstance(stderr_data, bytes):
|
||||
stderr_data = stderr_data.decode('utf-8')
|
||||
msg = '{} failed\n'.format(cmdlist) + \
|
||||
'status code:\n{}\n'.format(proc.returncode) + \
|
||||
'stdout:\n{}\n'.format(stdout_data) + \
|
||||
'stderr:\n{}\n'.format(stderr_data)
|
||||
assert False, msg
|
||||
else:
|
||||
if isinstance(stdout_data, bytes):
|
||||
stdout_data = stdout_data.decode('utf-8')
|
||||
print(stdout_data)
|
||||
|
||||
return
|
||||
|
||||
|
||||
def test_build_mf2005():
|
||||
if pymake is None:
|
||||
return
|
||||
starget = 'MODFLOW-2005'
|
||||
exe_name = 'mf2005'
|
||||
dirname = 'MF2005.1_12u'
|
||||
url = "https://water.usgs.gov/ogw/modflow/MODFLOW-2005_v1.12.00/MF2005.1_12u.zip"
|
||||
|
||||
build_target(starget, exe_name, url, dirname)
|
||||
|
||||
return
|
||||
|
||||
|
||||
def test_build_mfnwt():
|
||||
if pymake is None:
|
||||
return
|
||||
starget = 'MODFLOW-NWT'
|
||||
exe_name = 'mfnwt'
|
||||
dirname = 'MODFLOW-NWT_1.1.4'
|
||||
url = "http://water.usgs.gov/ogw/modflow-nwt/{0}.zip".format(dirname)
|
||||
|
||||
build_target(starget, exe_name, url, dirname)
|
||||
|
||||
return
|
||||
|
||||
|
||||
def test_build_mfusg():
|
||||
if pymake is None:
|
||||
return
|
||||
starget = 'MODFLOW-USG'
|
||||
exe_name = 'mfusg'
|
||||
dirname = 'mfusg1_5'
|
||||
url = 'https://water.usgs.gov/water-resources/software/MODFLOW-USG/{0}.zip'.format(dirname)
|
||||
|
||||
build_target(starget, exe_name, url, dirname)
|
||||
return
|
||||
|
||||
|
||||
def test_build_mf6():
|
||||
if pymake is None:
|
||||
return
|
||||
starget = 'MODFLOW6'
|
||||
exe_name = 'mf6'
|
||||
dirname = 'mf6.0.4'
|
||||
url = 'https://water.usgs.gov/water-resources/software/MODFLOW-6/{0}.zip'.format(dirname)
|
||||
|
||||
build_target(starget, exe_name, url, dirname, include_subdirs=True)
|
||||
return
|
||||
|
||||
|
||||
def test_build_mflgr():
|
||||
if pymake is None:
|
||||
return
|
||||
starget = 'MODFLOW-LGR'
|
||||
exe_name = 'mflgr'
|
||||
dirname = 'mflgr.2_0'
|
||||
url = "https://water.usgs.gov/ogw/modflow-lgr/modflow-lgr-v2.0.0/mflgrv2_0_00.zip"
|
||||
|
||||
build_target(starget, exe_name, url, dirname)
|
||||
return
|
||||
|
||||
|
||||
def test_build_mf2000():
|
||||
if pymake is None:
|
||||
return
|
||||
starget = 'MODFLOW-2000'
|
||||
exe_name = 'mf2000'
|
||||
dirname = 'mf2k.1_19'
|
||||
url = "https://water.usgs.gov/nrp/gwsoftware/modflow2000/mf2k1_19_01.tar.gz"
|
||||
|
||||
build_target(starget, exe_name, url, dirname,
|
||||
replace_function=update_mf2000files)
|
||||
return
|
||||
|
||||
|
||||
def test_build_mt3dusgs():
|
||||
if pymake is None:
|
||||
return
|
||||
starget = 'MT3D-USGS'
|
||||
exe_name = 'mt3dusgs'
|
||||
dirname = 'mt3dusgs1.0.1'
|
||||
url = 'https://water.usgs.gov/water-resources/software/MT3D-USGS/mt3dusgs1.0.1.zip'
|
||||
|
||||
build_target(starget, exe_name, url, dirname)
|
||||
return
|
||||
|
||||
|
||||
def test_build_mt3dms():
|
||||
if pymake is None:
|
||||
return
|
||||
starget = 'MT3DMS'
|
||||
exe_name = 'mt3dms'
|
||||
dirname = '.'
|
||||
url = "http://hydro.geo.ua.edu/mt3d/mt3dms_530.exe"
|
||||
|
||||
build_target(starget, exe_name, url, dirname,
|
||||
srcname=os.path.join('src', 'standard'),
|
||||
verify=False,
|
||||
replace_function=update_mt3dfiles)
|
||||
return
|
||||
|
||||
|
||||
def test_build_seawat():
|
||||
if pymake is None:
|
||||
return
|
||||
starget = 'SEAWAT'
|
||||
exe_name = 'swt_v4'
|
||||
dirname = 'swt_v4_00_05'
|
||||
url = "https://water.usgs.gov/ogw/seawat/{0}.zip".format(dirname)
|
||||
|
||||
build_target(starget, exe_name, url, dirname,
|
||||
srcname='source',
|
||||
replace_function=update_seawatfiles,
|
||||
dble=True, keep=True)
|
||||
return
|
||||
|
||||
|
||||
def test_build_modpath6():
|
||||
if pymake is None:
|
||||
return
|
||||
starget = 'MODPATH 6'
|
||||
exe_name = 'mp6'
|
||||
dirname = 'modpath.6_0'
|
||||
url = "https://water.usgs.gov/ogw/modpath/archive/modpath_v6.0.01/modpath.6_0_01.zip"
|
||||
|
||||
build_target(starget, exe_name, url, dirname,
|
||||
replace_function=update_mp6files,
|
||||
keep=True)
|
||||
return
|
||||
|
||||
|
||||
def test_build_modpath7():
|
||||
if pymake is None:
|
||||
return
|
||||
starget = 'MODPATH 7'
|
||||
exe_name = 'mp7'
|
||||
dirname = 'modpath_7_2_001'
|
||||
url = "https://water.usgs.gov/ogw/modpath/modpath_7_2_001.zip"
|
||||
|
||||
build_target(starget, exe_name, url, dirname, srcname='source',
|
||||
replace_function=update_mp7files,
|
||||
keep=True)
|
||||
return
|
||||
|
||||
|
||||
def test_build_gridgen(keep=True):
|
||||
if pymake is None:
|
||||
return
|
||||
starget = 'GRIDGEN'
|
||||
exe_name = 'gridgen'
|
||||
dirname = 'gridgen.1.0.02'
|
||||
url = "https://water.usgs.gov/ogw/gridgen/{}.zip".format(dirname)
|
||||
|
||||
print('Determining if {} needs to be built'.format(starget))
|
||||
if platform.system().lower() == 'windows':
|
||||
exe_name += '.exe'
|
||||
|
||||
exe_exists = flopy.which(exe_name)
|
||||
if exe_exists is not None and keep:
|
||||
print('No need to build {}'.format(starget) +
|
||||
' since it exists in the current path')
|
||||
return
|
||||
|
||||
# get current directory
|
||||
cpth = os.getcwd()
|
||||
|
||||
# create temporary path
|
||||
dstpth = os.path.join('tempbin')
|
||||
print('create...{}'.format(dstpth))
|
||||
if not os.path.exists(dstpth):
|
||||
os.makedirs(dstpth)
|
||||
os.chdir(dstpth)
|
||||
|
||||
pymake.download_and_unzip(url)
|
||||
|
||||
# clean
|
||||
print('Cleaning...{}'.format(exe_name))
|
||||
apth = os.path.join(dirname, 'src')
|
||||
cmdlist = ['make', 'clean']
|
||||
run_cmdlist(cmdlist, apth)
|
||||
|
||||
# build with make
|
||||
print('Building...{}'.format(exe_name))
|
||||
apth = os.path.join(dirname, 'src')
|
||||
cmdlist = ['make', exe_name]
|
||||
run_cmdlist(cmdlist, apth)
|
||||
|
||||
# move the file
|
||||
src = os.path.join(apth, exe_name)
|
||||
dst = os.path.join(bindir, exe_name)
|
||||
try:
|
||||
shutil.move(src, dst)
|
||||
except:
|
||||
print('could not move {}'.format(exe_name))
|
||||
|
||||
# change back to original path
|
||||
os.chdir(cpth)
|
||||
|
||||
# Clean up downloaded directory
|
||||
print('delete...{}'.format(dstpth))
|
||||
if os.path.isdir(dstpth):
|
||||
shutil.rmtree(dstpth)
|
||||
|
||||
# make sure the gridgen was built
|
||||
msg = '{} does not exist.'.format(os.path.relpath(dst))
|
||||
assert os.path.isfile(dst), msg
|
||||
|
||||
return
|
||||
|
||||
|
||||
def test_build_triangle(keep=True):
|
||||
if pymake is None:
|
||||
return
|
||||
starget = 'TRIANGLE'
|
||||
exe_name = 'triangle'
|
||||
dirname = 'triangle'
|
||||
url = "http://www.netlib.org/voronoi/{}.zip".format(dirname)
|
||||
|
||||
print('Determining if {} needs to be built'.format(starget))
|
||||
if platform.system().lower() == 'windows':
|
||||
exe_name += '.exe'
|
||||
|
||||
exe_exists = flopy.which(exe_name)
|
||||
if exe_exists is not None and keep:
|
||||
print('No need to build {}'.format(starget) +
|
||||
' since it exists in the current path')
|
||||
return
|
||||
|
||||
# get current directory
|
||||
cpth = os.getcwd()
|
||||
|
||||
# create temporary path
|
||||
dstpth = os.path.join('tempbin', 'triangle')
|
||||
print('create...{}'.format(dstpth))
|
||||
if not os.path.exists(dstpth):
|
||||
os.makedirs(dstpth)
|
||||
os.chdir(dstpth)
|
||||
|
||||
pymake.download_and_unzip(url)
|
||||
|
||||
srcdir = 'src'
|
||||
os.mkdir(srcdir)
|
||||
shutil.move('triangle.c', 'src/triangle.c')
|
||||
shutil.move('triangle.h', 'src/triangle.h')
|
||||
|
||||
fct, cct = set_compiler(starget)
|
||||
pymake.main(srcdir, 'triangle', fct, cct)
|
||||
|
||||
# move the file
|
||||
src = os.path.join('.', exe_name)
|
||||
dst = os.path.join(bindir, exe_name)
|
||||
try:
|
||||
shutil.move(src, dst)
|
||||
except:
|
||||
print('could not move {}'.format(exe_name))
|
||||
|
||||
# change back to original path
|
||||
os.chdir(cpth)
|
||||
|
||||
# Clean up downloaded directory
|
||||
print('delete...{}'.format(dstpth))
|
||||
if os.path.isdir(dstpth):
|
||||
shutil.rmtree(dstpth)
|
||||
|
||||
# make sure the gridgen was built
|
||||
msg = '{} does not exist.'.format(os.path.relpath(dst))
|
||||
assert os.path.isfile(dst), msg
|
||||
|
||||
return
|
||||
|
||||
|
||||
def set_compiler(starget):
|
||||
fct = fc
|
||||
cct = cc
|
||||
# parse command line arguments to see if user specified options
|
||||
# relative to building the target
|
||||
msg = ''
|
||||
for idx, arg in enumerate(sys.argv):
|
||||
if arg.lower() == '--ifort':
|
||||
if len(msg) > 0:
|
||||
msg += '\n'
|
||||
msg += '{} - '.format(arg.lower()) + \
|
||||
'{} will be built with ifort.'.format(starget)
|
||||
fct = 'ifort'
|
||||
elif arg.lower() == '--cl':
|
||||
if len(msg) > 0:
|
||||
msg += '\n'
|
||||
msg += '{} - '.format(arg.lower()) + \
|
||||
'{} will be built with cl.'.format(starget)
|
||||
cct = 'cl'
|
||||
elif arg.lower() == '--clang':
|
||||
if len(msg) > 0:
|
||||
msg += '\n'
|
||||
msg += '{} - '.format(arg.lower()) + \
|
||||
'{} will be built with clang.'.format(starget)
|
||||
cct = 'clang'
|
||||
if len(msg) > 0:
|
||||
print(msg)
|
||||
|
||||
return fct, cct
|
||||
|
||||
|
||||
def build_target(starget, exe_name, url, dirname, srcname='src',
|
||||
replace_function=None, verify=True, keep=True,
|
||||
dble=dbleprec, include_subdirs=False):
|
||||
print('Determining if {} needs to be built'.format(starget))
|
||||
if platform.system().lower() == 'windows':
|
||||
exe_name += '.exe'
|
||||
|
||||
exe_exists = flopy.which(exe_name)
|
||||
if exe_exists is not None and keep:
|
||||
print('No need to build {}'.format(starget) +
|
||||
' since it exists in the current path')
|
||||
return
|
||||
|
||||
fct, cct = set_compiler(starget)
|
||||
|
||||
# set up target
|
||||
target = os.path.abspath(os.path.join(bindir, exe_name))
|
||||
|
||||
# get current directory
|
||||
cpth = os.getcwd()
|
||||
|
||||
# create temporary path
|
||||
dstpth = os.path.join('tempbin')
|
||||
print('create...{}'.format(dstpth))
|
||||
if not os.path.exists(dstpth):
|
||||
os.makedirs(dstpth)
|
||||
os.chdir(dstpth)
|
||||
|
||||
# Download the distribution
|
||||
pymake.download_and_unzip(url, verify=verify)
|
||||
|
||||
# Set srcdir name
|
||||
srcdir = os.path.join(dirname, srcname)
|
||||
|
||||
if replace_function is not None:
|
||||
replace_function(srcdir)
|
||||
|
||||
# compile code
|
||||
print('compiling... {}'.format(target))
|
||||
print(' relative path: {}'.format(os.path.relpath(target)))
|
||||
print(' absolute path: {}'.format(os.path.abspath(target)))
|
||||
pymake.main(srcdir, target, fct, cct, makeclean=True,
|
||||
expedite=False, dryrun=False, double=dble, debug=False,
|
||||
include_subdirs=include_subdirs)
|
||||
|
||||
# change back to original path
|
||||
os.chdir(cpth)
|
||||
|
||||
msg = '{} does not exist.'.format(os.path.relpath(target))
|
||||
assert os.path.isfile(target), msg
|
||||
|
||||
# Clean up downloaded directory
|
||||
print('delete...{}'.format(dstpth))
|
||||
if os.path.isdir(dstpth):
|
||||
shutil.rmtree(dstpth)
|
||||
|
||||
def test_build_all_apps():
|
||||
targets = get_targets()
|
||||
for target in targets:
|
||||
yield build_target, target
|
||||
return
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
test_build_mf6()
|
||||
test_build_mf2005()
|
||||
test_build_mfnwt()
|
||||
test_build_mfusg()
|
||||
test_build_mflgr()
|
||||
test_build_mt3dms()
|
||||
test_build_mt3dusgs()
|
||||
test_build_seawat()
|
||||
test_build_gridgen()
|
||||
test_build_triangle()
|
||||
test_build_modpath6()
|
||||
test_build_modpath7()
|
||||
targets = get_targets()
|
||||
for target in targets:
|
||||
build_target(target)
|
||||
|
|
|
@ -12,7 +12,7 @@ workspace = os.path.join('temp', 't026')
|
|||
if not os.path.isdir(workspace):
|
||||
os.makedirs(workspace)
|
||||
|
||||
seawat_exe = 'swt_v4'
|
||||
seawat_exe = 'swtv4'
|
||||
isseawat = flopy.which(seawat_exe)
|
||||
|
||||
# Setup problem parameters
|
||||
|
@ -48,7 +48,7 @@ ssm_data[0] = ssm_sp1
|
|||
def test_seawat_henry():
|
||||
# SEAWAT model from a modflow model and an mt3d model
|
||||
modelname = 'henry'
|
||||
mf = flopy.modflow.Modflow(modelname, exe_name='swt_v4',
|
||||
mf = flopy.modflow.Modflow(modelname, exe_name='swtv4',
|
||||
model_ws=workspace)
|
||||
# shortened perlen to 0.1 to make this run faster -- should be about 0.5
|
||||
dis = flopy.modflow.ModflowDis(mf, nlay, nrow, ncol, nper=1, delr=delr,
|
||||
|
@ -74,7 +74,7 @@ def test_seawat_henry():
|
|||
|
||||
# Create the SEAWAT model structure
|
||||
mswt = flopy.seawat.Seawat(modelname, 'nam_swt', mf, mt,
|
||||
model_ws=workspace, exe_name='swt_v4')
|
||||
model_ws=workspace, exe_name='swtv4')
|
||||
vdf = flopy.seawat.SeawatVdf(mswt, iwtable=0, densemin=0, densemax=0,
|
||||
denseref=1000., denseslp=0.7143, firstdt=1e-3)
|
||||
|
||||
|
@ -94,7 +94,7 @@ def test_seawat2_henry():
|
|||
# SEAWAT model directly by adding packages
|
||||
modelname = 'henry2'
|
||||
m = flopy.seawat.swt.Seawat(modelname, 'nam', model_ws=workspace,
|
||||
exe_name='swt_v4')
|
||||
exe_name='swtv4')
|
||||
dis = flopy.modflow.ModflowDis(m, nlay, nrow, ncol, nper=1, delr=delr,
|
||||
delc=delc, laycbd=0, top=henry_top,
|
||||
botm=henry_botm, perlen=0.1, nstp=15)
|
||||
|
|
|
@ -7,7 +7,7 @@ newpth = os.path.join('.', 'temp', 't028')
|
|||
# make the directory if it does not exist
|
||||
if not os.path.isdir(newpth):
|
||||
os.makedirs(newpth)
|
||||
swtv4_exe = 'swt_v4'
|
||||
swtv4_exe = 'swtv4'
|
||||
isswtv4 = flopy.which(swtv4_exe)
|
||||
runmodel = False
|
||||
verbose = False
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[
|
||||
{
|
||||
"status": "Production",
|
||||
"status": "Release Candidate",
|
||||
"languages": [
|
||||
"python"
|
||||
],
|
||||
|
@ -29,9 +29,9 @@
|
|||
"downloadURL": "https://code.usgs.gov/usgs/modflow/flopy/archive/master.zip",
|
||||
"vcs": "git",
|
||||
"laborHours": -1,
|
||||
"version": "3.2.10",
|
||||
"version": "3.2.10.60",
|
||||
"date": {
|
||||
"metadataLastUpdated": "2018-10-19"
|
||||
"metadataLastUpdated": "2019-03-15"
|
||||
},
|
||||
"organization": "U.S. Geological Survey",
|
||||
"permissions": {
|
||||
|
|
|
@ -27,30 +27,29 @@ How to Cite
|
|||
|
||||
*Software/Code citation for FloPy:*
|
||||
|
||||
[Bakker, M., Post, V., Langevin, C.D., Hughes, J.D., White, J.T., Starn, J.J., and Fienen, M.N., 2018, FloPy v3.2.10: U.S. Geological Survey Software Release, 19 October 2018, http://dx.doi.org/10.5066/F7BK19FH](http://dx.doi.org/10.5066/F7BK19FH)
|
||||
[Bakker, M., Post, V., Langevin, C.D., Hughes, J.D., White, J.T., Starn, J.J., and Fienen, M.N., 2019, FloPy v3.2.10 — develop: U.S. Geological Survey Software Release, 15 March 2019, http://dx.doi.org/10.5066/F7BK19FH](http://dx.doi.org/10.5066/F7BK19FH)
|
||||
|
||||
|
||||
Disclaimer
|
||||
----------
|
||||
|
||||
This software has been approved for release by the U.S. Geological Survey
|
||||
(USGS). Although the software has been subjected to rigorous review, the USGS
|
||||
reserves the right to update the software as needed pursuant to further analysis
|
||||
and review. No warranty, expressed or implied, is made by the USGS or the U.S.
|
||||
Government as to the functionality of the software and related material nor
|
||||
shall the fact of release constitute any such warranty. Furthermore, the
|
||||
software is released on condition that neither the USGS nor the U.S. Government
|
||||
shall be held liable for any damages resulting from its authorized or
|
||||
unauthorized use.
|
||||
This software is preliminary or provisional and is subject to revision. It is
|
||||
being provided to meet the need for timely best science. The software has not
|
||||
received final approval by the U.S. Geological Survey (USGS). No warranty,
|
||||
expressed or implied, is made by the USGS or the U.S. Government as to the
|
||||
functionality of the software and related material nor shall the fact of release
|
||||
constitute any such warranty. The software is provided on the condition that
|
||||
neither the USGS nor the U.S. Government shall be held liable for any damages
|
||||
resulting from the authorized or unauthorized use of the software.
|
||||
|
||||
Installation
|
||||
-----------------------------------------------
|
||||
To install FloPy version 3.2.10:
|
||||
To install FloPy version 3.2.10 — refactor-buildexes:
|
||||
```
|
||||
pip install flopy
|
||||
```
|
||||
|
||||
To update to FloPy version 3.2.10:
|
||||
To update to FloPy version 3.2.10 — refactor-buildexes:
|
||||
```
|
||||
pip install flopy --upgrade
|
||||
```
|
||||
|
|
|
@ -17,9 +17,9 @@ header-includes:
|
|||
- \fancyhf{{}}
|
||||
- \fancyhead[LE, LO, RE, RO]{}
|
||||
- \fancyhead[CE, CO]{FloPy Release Notes}
|
||||
- \fancyfoot[LE, RO]{FloPy version 3.2.10}
|
||||
- \fancyfoot[LE, RO]{FloPy version 3.2.10 — refactor-buildexes}
|
||||
- \fancyfoot[CO, CE]{\thepage\ of \pageref{LastPage}}
|
||||
- \fancyfoot[RE, LO]{10/19/2018}
|
||||
- \fancyfoot[RE, LO]{03/15/2019}
|
||||
geometry: margin=0.75in
|
||||
---
|
||||
|
||||
|
@ -52,30 +52,29 @@ How to Cite
|
|||
|
||||
##### ***Software/Code citation for FloPy:***
|
||||
|
||||
[Bakker, M., Post, V., Langevin, C.D., Hughes, J.D., White, J.T., Starn, J.J., and Fienen, M.N., 2018, FloPy v3.2.10: U.S. Geological Survey Software Release, 19 October 2018, http://dx.doi.org/10.5066/F7BK19FH](http://dx.doi.org/10.5066/F7BK19FH)
|
||||
[Bakker, M., Post, V., Langevin, C.D., Hughes, J.D., White, J.T., Starn, J.J., and Fienen, M.N., 2019, FloPy v3.2.10 — develop: U.S. Geological Survey Software Release, 15 March 2019, http://dx.doi.org/10.5066/F7BK19FH](http://dx.doi.org/10.5066/F7BK19FH)
|
||||
|
||||
|
||||
Disclaimer
|
||||
----------
|
||||
|
||||
This software has been approved for release by the U.S. Geological Survey
|
||||
(USGS). Although the software has been subjected to rigorous review, the USGS
|
||||
reserves the right to update the software as needed pursuant to further analysis
|
||||
and review. No warranty, expressed or implied, is made by the USGS or the U.S.
|
||||
Government as to the functionality of the software and related material nor
|
||||
shall the fact of release constitute any such warranty. Furthermore, the
|
||||
software is released on condition that neither the USGS nor the U.S. Government
|
||||
shall be held liable for any damages resulting from its authorized or
|
||||
unauthorized use.
|
||||
This software is preliminary or provisional and is subject to revision. It is
|
||||
being provided to meet the need for timely best science. The software has not
|
||||
received final approval by the U.S. Geological Survey (USGS). No warranty,
|
||||
expressed or implied, is made by the USGS or the U.S. Government as to the
|
||||
functionality of the software and related material nor shall the fact of release
|
||||
constitute any such warranty. The software is provided on the condition that
|
||||
neither the USGS nor the U.S. Government shall be held liable for any damages
|
||||
resulting from the authorized or unauthorized use of the software.
|
||||
|
||||
Installation
|
||||
-----------------------------------------------
|
||||
To install FloPy version 3.2.10 from the USGS FloPy website:
|
||||
To install FloPy version 3.2.10 — refactor-buildexes from the USGS FloPy website:
|
||||
```
|
||||
pip install https://water.usgs.gov/ogw/flopy/flopy-3.2.10.zip
|
||||
```
|
||||
|
||||
To update to FloPy version 3.2.10 from the USGS FloPy website:
|
||||
To update to FloPy version 3.2.10 — refactor-buildexes from the USGS FloPy website:
|
||||
```
|
||||
pip install https://water.usgs.gov/ogw/flopy/flopy-3.2.10.zip --upgrade
|
||||
```
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
"source": [
|
||||
"# Create the basic MODFLOW model structure\n",
|
||||
"modelname = 'henry'\n",
|
||||
"swt = flopy.seawat.Seawat(modelname, exe_name='swt_v4', model_ws=workspace)\n",
|
||||
"swt = flopy.seawat.Seawat(modelname, exe_name='swtv4', model_ws=workspace)\n",
|
||||
"print(swt.namefile)\n",
|
||||
"\n",
|
||||
"# save cell fluxes to unit 53\n",
|
||||
|
@ -154,7 +154,7 @@
|
|||
"ssm = flopy.mt3d.Mt3dSsm(swt, stress_period_data=ssm_data)\n",
|
||||
"\n",
|
||||
"# Create the SEAWAT model structure\n",
|
||||
"#mswt = flopy.seawat.Seawat(modelname, 'nam_swt', mf, mt, model_ws=workspace, exe_name='swt_v4')\n",
|
||||
"#mswt = flopy.seawat.Seawat(modelname, 'nam_swt', mf, mt, model_ws=workspace, exe_name='swtv4')\n",
|
||||
"vdf = flopy.seawat.SeawatVdf(swt, iwtable=0, densemin=0, densemax=0,\n",
|
||||
" denseref=1000., denseslp=0.7143, firstdt=1e-3)"
|
||||
]
|
||||
|
|
|
@ -199,7 +199,7 @@
|
|||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"swt_model = swt.Seawat(name, 'nam_swt', mf_model, mt_model, exe_name='swt_v4') # Coupled to modflow model mf and mt3dms model mt\n",
|
||||
"swt_model = swt.Seawat(name, 'nam_swt', mf_model, mt_model, exe_name='swtv4') # Coupled to modflow model mf and mt3dms model mt\n",
|
||||
"vdf = swt.SeawatVdf(swt_model, firstdt = 0.1, denseslp = .7)\n",
|
||||
"swt_model.write_input()"
|
||||
]
|
||||
|
|
|
@ -38,7 +38,7 @@ def run():
|
|||
|
||||
# Create the basic MODFLOW model data
|
||||
modelname = 'henry'
|
||||
m = flopy.seawat.Seawat(modelname, exe_name="swt_v4", model_ws=workspace)
|
||||
m = flopy.seawat.Seawat(modelname, exe_name="swtv4", model_ws=workspace)
|
||||
|
||||
# Add DIS package to the MODFLOW model
|
||||
dis = flopy.modflow.ModflowDis(m, nlay, nrow, ncol, nper=1, delr=delr,
|
||||
|
|
|
@ -167,7 +167,7 @@ def run():
|
|||
zetavd2 = zobj.get_data(kstpkper=zkstpkper[-1], text='ZETASRF 2')[0]
|
||||
#
|
||||
# seawat model
|
||||
swtexe_name = 'swt_v4'
|
||||
swtexe_name = 'swtv4'
|
||||
modelname = 'swiex2_swt'
|
||||
print('creating...', modelname)
|
||||
swt_xmax = 300.0
|
||||
|
|
|
@ -306,7 +306,7 @@ def run():
|
|||
|
||||
# Define model name for SEAWAT model
|
||||
modelname = 'swi2ex5_swt'
|
||||
swtexe_name = 'swt_v4'
|
||||
swtexe_name = 'swtv4'
|
||||
# Create the MODFLOW model data
|
||||
if not skipRuns:
|
||||
m = flopy.seawat.Seawat(modelname, exe_name=swtexe_name,
|
||||
|
|
|
@ -40,7 +40,7 @@ class Seawat(BaseModel):
|
|||
Version of SEAWAT to use (the default is 'seawat').
|
||||
exe_name : string, optional
|
||||
The name of the executable to use (the default is
|
||||
'swt_v4.exe').
|
||||
'swtv4.exe').
|
||||
listunit : integer, optional
|
||||
Unit number for the list file (the default is 2).
|
||||
model_ws : string, optional
|
||||
|
@ -77,7 +77,7 @@ class Seawat(BaseModel):
|
|||
|
||||
def __init__(self, modelname='swttest', namefile_ext='nam',
|
||||
modflowmodel=None, mt3dmodel=None,
|
||||
version='seawat', exe_name='swt_v4',
|
||||
version='seawat', exe_name='swtv4',
|
||||
structured=True, listunit=2, model_ws='.', external_path=None,
|
||||
verbose=False, load=True, silent=0):
|
||||
|
||||
|
@ -366,7 +366,7 @@ class Seawat(BaseModel):
|
|||
return
|
||||
|
||||
@staticmethod
|
||||
def load(f, version='seawat', exe_name='swt_v4', verbose=False,
|
||||
def load(f, version='seawat', exe_name='swtv4', verbose=False,
|
||||
model_ws='.', load_only=None):
|
||||
"""
|
||||
Load an existing model.
|
||||
|
@ -382,7 +382,7 @@ class Seawat(BaseModel):
|
|||
|
||||
exe_name : string
|
||||
The name of the executable to use if this loaded model is run.
|
||||
(default is swt_v4.exe)
|
||||
(default is swtv4.exe)
|
||||
|
||||
verbose : bool
|
||||
Write information on the load process if True.
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# flopy version file automatically created using...pre-commit.py
|
||||
# created on...October 19, 2018 18:28:49
|
||||
# created on...March 15, 2019 16:43:51
|
||||
|
||||
major = 3
|
||||
minor = 2
|
||||
micro = 10
|
||||
build = 0
|
||||
commit = 2892
|
||||
build = 60
|
||||
commit = 2954
|
||||
|
||||
__version__ = '{:d}.{:d}.{:d}'.format(major, minor, micro)
|
||||
__build__ = '{:d}.{:d}.{:d}.{:d}'.format(major, minor, micro, build)
|
||||
|
|
Loading…
Reference in New Issue