flopy/examples/FAQ/mf2005_does_not_exist.ipynb

155 lines
4.4 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"3.8.6 | packaged by conda-forge | (default, Oct 7 2020, 18:42:56) \n",
"[Clang 10.0.1 ]\n",
"flopy version: 3.3.3\n"
]
}
],
"source": [
"%matplotlib inline\n",
"import os\n",
"import sys\n",
"\n",
"try:\n",
" import flopy\n",
"except:\n",
" fpth = os.path.abspath(os.path.join('..', '..'))\n",
" sys.path.append(fpth)\n",
" import flopy\n",
" \n",
"print(sys.version)\n",
"print('flopy version: {}'.format(flopy.__version__))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In order for you to run a model you have created or loaded using FloPy the model executable must be available in your path. You can test if the model is available using:"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'/Users/jdhughes/.local/bin/mf2005'"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"flopy.which('mf2005')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The path to the executable is returned if the executable exists in your path or the current working directory. An empty string is passed if the executable does not exist in your path or the current working directory. Next we will test if a non-existent executable (`no-exist.exe`) is available."
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"flopy.which('no-exist.exe')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Nothing is written when `no-exist.exe` is passed to `flopy.which()`. This means the executable does not exist.\n",
"\n",
"If this happens you should:\n",
"1. Check the that you have spelled the executable correctly.\n",
"2. If you have spelled the executable correctly then you need to move the executable into your working directory or into a directory in your path.\n",
"3. If you have spelled the executable correctly but don't have the executable. Your options are:\n",
" * Download a precompiled version of the executable. Precompiled versions of MODFLOW-based codes are available from the U.S. Geological Survey for the Windows operating system. \n",
" * Compile the source code (available from the U.S. Geological Survey) for the Windows, OS X, Linux, and UNIX operating systems and place the compiled executable in the working directory or a directory contained in your path (for example, `/Users/jdhughes/.local/bin/` as indicated above)."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can get a list of the directories in your system path using:"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'/Users/jdhughes/anaconda3/bin:/Users/jdhughes/anaconda3/condabin:/anaconda3/bin:/Users/jdhughes/.local/bin://Users/jdhughes/Documents/Development/bin/mac:/opt/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/Library/TeX/texbin:/usr/local/share/dotnet:/opt/X11/bin:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands'"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"os.getenv('PATH')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"After you download/compile the executable put it in the current working directory or one of the directories in your system path."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
}