| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Converts a zip with MODFLOW input files to a zip containing Flopy script in different formats. This Flopy (Python) script can generate the intitial MODFLOW input files.
It should work for all packages of MODFLOW, MT3D, and SEAWAT. For a complete list, see the Packages with default values and the load supported packages on the Flopy website.
No money is to be made by the author with this package. The author has absolutely no convidense in that this script is correct and is not responsible for the content and consequences of malicious scripts. I you find it useful, please consider donating to charity (be creative in choosing which one) and send me a note (or create and close an issue). Thanks! The author is not affiliated with the modflow family nor with Flopy. This converter/generator uses the Flopy load function. Any errors/mistakes in the Flopy load functions propagate to the generated script.
Enter in the terminal,
$ pip install flopymetascriptThe $-sign should be omitted, and only refers to that the command is to be entered in the bash-commandline. The flopymetascript package added to system's $PATH and is reachable from any directory. Check if everything works by typing in any directory,
$ flopymetascript --helpUninstall with,
$ pip uninstall flopymetascriptTry this first,
$ flopymetascript --outbytesfile output.zip --inbytesfile input.zip --logfile log.txtinput.zip is a zip-file that contains MODFLOW input files and a single .nam file. Its content is processed and written to output.zip. Some logging is written to log.txt.
Might be of interest when using flopymetascript as webservice of in docker containers.
$ openssl base64 -in input.zip -out input.zip.b64
$ flopymetascript --outbytesfile output.zip --inbase64file input.zip.b64input.zip is encoded to base64 and is used as input file for flopymetascript
$ flopymetascript --outbytesfile output.zip --inbase64file - < input.zip.b64The content of input.zip.b64 is streamed/piped to flopymetascript
$ openssl base64 -in input.zip | flopymetascript --outbytesfile output.zip --inbase64file -The same as what is done previously, however input.zip is encoded and instead of writing it to a file, it is passed as stdin to the inbase64file argument of flopymetascript.
$ openssl base64 -in input.zip | flopymetascript --outbase64file utput.zip --inbase64file - --logfile -The log file is printed to stdout.
You cannot send both outbase64file and logfile to stdout. They will be mixed and the resulting output file is not readable.
from flopymetascript.flopymetascript import process
# fn = 'input.zip.b64'
# inbase64file = open(fn, 'r')
# fn = 'output.zip.b64'
# outbase64file = open(fn, 'w')
fn = 'input.zip'
inbytesfile = open(fn, 'rb') # Dont forget the b
fn = 'output.zip'
outbytesfile = open(fn, 'wb') # Dont forget the b
fn = 'log.txt'
logfile = open(fn, 'w')
process(inbytesfile=inbytesfile, outbytesfile=outbytesfile, logfile=logfile)
inbytesfile.close()
outbytesfile.close()
logfile.close()or as a module,
from flopymetascript.model import Model
import nbformat
mp = Model(load_nam='path_to_namfile.nam', add_pack=['dis', 'bas6'])
nb = mp.script_model2nb(use_yapf=False, print_descr=True)
fn = 'jupyter_notebook.ipynb'
with open(fn, 'w') as f:
f.write(nbformat.writes(nb))| Back | FazBrowse Home | New Git URL |