Note

This page was generated from FAQ/load_existing_model_wAUX.ipynb.
Interactive online version: Binder badge

Loading an existing MODFLOW-2005 model with auxiliary variables

[1]:
import os
import sys

try:
    import flopy
except:
    fpth = os.path.abspath(os.path.join("..", ".."))
    sys.path.append(fpth)
    import flopy

print(sys.version)
print("flopy version: {}".format(flopy.__version__))
3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
flopy version: 3.3.7

Load an existing MODFLOW-2005 model with auxiliary variables

[2]:
model_ws = os.path.join("..", "..", "examples", "data", "mp6")
ml = flopy.modflow.Modflow.load(
    "EXAMPLE.nam",
    model_ws=model_ws,
    verbose=False,
    version="mf2005",
    check=False,
)

Auxiliary IFACE data are in the river package

[3]:
riv = ml.riv.stress_period_data[0]

You can confirm that the iface auxiliary data have been read by looking at the dtype.

[4]:
riv.dtype
[4]:
dtype((numpy.record, [('k', '<i8'), ('i', '<i8'), ('j', '<i8'), ('stage', '<f4'), ('cond', '<f4'), ('rbot', '<f4'), ('iface', '<f4')]))

You can access the iface data from the recarray

[5]:
riv["iface"]
[5]:
array([6., 6., 6., 6., 6., 6., 6., 6., 6., 6., 6., 6., 6., 6., 6., 6., 6.,
       6., 6., 6., 6., 6., 6., 6., 6.], dtype=float32)
[ ]: