In [1]:
import os
import numpy as np
import flopy
First, we need to create a model for test
In [4]:
base_dir = "base_model_dir"
nlay, nrow, ncol = 1, 1, 10
#ml = flopy.modflow.Modflow(modelname="base", model_ws=base_dir,
# external_path="ref")
ml = flopy.modflow.Modflow(modelname="base", model_ws=base_dir,external_path="ref")
dis = flopy.modflow.ModflowDis(ml, nrow=1, ncol=10,
nlay=nlay, nper=2, perlen=[1,1],
steady=[True,True])
bas = flopy.modflow.ModflowBas(ml, ibound=1)
hk = np.zeros((nlay, nrow, ncol))+2.5
#the full relative path to the external hk array
#np.savetxt(os.path.join(base_dir,"hk.ref"),hk.flatten(),fmt="%15.6E",delimiter='')
# but we have to pass on the filename as the namefile sees it
lpf = flopy.modflow.ModflowLpf(ml, hk=hk,vka=hk)
well_data = {}
well_data[0] = [0, 0, 9, 0.5]
well_data[1] = [0, 0, 9, 1.0]
wel = flopy.modflow.ModflowWel(ml, stress_period_data=well_data)
ghb_data = {}
ghb_data[0] = [0, 0, 0, 0.5, 1000.0]
ghb = flopy.modflow.ModflowGhb(ml, stress_period_data=ghb_data)
print ghb.stress_period_data.data
ml.write_input()
In [2]:
Now, lets load the base
model
In [3]:
ml_loaded = flopy.modflow.Modflow.load("base.nam",model_ws=base_dir)
In [ ]: