flopy/examples/FAQ/load_existing_model_wAUX.ipynb

153 lines
3.1 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": [
"**Load an existing MODFLOW-2005 model with auxiliary variables**"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"model_ws = os.path.join('..', 'data', 'mp6')\n",
"ml = flopy.modflow.Modflow.load('EXAMPLE.nam', model_ws=model_ws, verbose=False,\n",
" version='mf2005', check=False)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Auxiliary IFACE data are in the river package**"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"riv = ml.riv.stress_period_data[0]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can confirm that the `iface` auxiliary data have been read by looking at the `dtype`."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"dtype((numpy.record, [('k', '<i8'), ('i', '<i8'), ('j', '<i8'), ('stage', '<f4'), ('cond', '<f4'), ('rbot', '<f4'), ('iface', '<f4')]))"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"riv.dtype"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can access the `iface` data from the recarray"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([6., 6., 6., 6., 6., 6., 6., 6., 6., 6., 6., 6., 6., 6., 6., 6., 6.,\n",
" 6., 6., 6., 6., 6., 6., 6., 6.], dtype=float32)"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"riv['iface']"
]
},
{
"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
}