transient_2d

The transient_2d class is a collection of util_2d instances that are time-dependent for packages like RCH, EVT, and SSM. It is instantiated similar to mflist in that it can take a dict keyed on kper with value pairs that can be parsed into util_2d instances. It will accept a mixture of filename, ndarrays, and scalars.


In [ ]:
import numpy as np
from flopy.modflow import Modflow
from flopy.utils.util_array import transient_2d

create a model instance - modflow (free format). envoke the external file option


In [ ]:
model = Modflow(external_path='.')
nrow, ncol = 10, 5

build some args for transient_2d


In [ ]:
arr = np.ones((nrow, ncol))
np.savetxt("arr.ref",arr,fmt="%15.6E",delimiter='')

args = {}
args[3] = 1.0
args[8] = np.ones((nrow, ncol))
args[12] = "arr.ref"

instantiate transient_2d


In [ ]:
t2d = transient_2d(model,(nrow, ncol), np.float32, args, name="rch")

print out the kper-based file info


In [ ]:
for kper in xrange(20):
    itmp,file_entry = t2d.get_kper_entry(kper)
    print itmp
    print file_entry

now for a model without free format or external suppport


In [ ]:
model = Modflow()
model.array_free_format = False

for non-freeformat models without external support, locat must be explicitly passed:


In [ ]:
t2d = transient_2d(model,(nrow, ncol), np.float32, args, name="rch",locat=31)

In [ ]:
for kper in xrange(20):
    itmp,file_entry = t2d.get_kper_entry(kper)
    print itmp
    print file_entry

In [ ]: