Hello guys! I have not found any other discussion group specific for Flopy, so I will try here.
I just started with MODFLOW but I have experience in Python, so I am trying to use the Flopy library. I ran the "Quick start" example on flopy's Github page:
import os
import flopy
ws = './mymodel'
name = 'mymodel'
sim = flopy.mf6.MFSimulation(sim_name=name, sim_ws=ws, exe_name='mf6')
tdis = flopy.mf6.ModflowTdis(sim)
ims = flopy.mf6.ModflowIms(sim)
gwf = flopy.mf6.ModflowGwf(sim, modelname=name, save_flows=True)
dis = flopy.mf6.ModflowGwfdis(gwf, nrow=10, ncol=10)
ic = flopy.mf6.ModflowGwfic(gwf)
npf = flopy.mf6.ModflowGwfnpf(gwf, save_specific_discharge=True)
chd = flopy.mf6.ModflowGwfchd(gwf, stress_period_data=[[(0, 0, 0), 1.],
[(0, 9, 9), 0.]])
budget_file = name + '.bud'
head_file = name + '.hds'
oc = flopy.mf6.ModflowGwfoc(gwf,
budget_filerecord=budget_file,
head_filerecord=head_file,
saverecord=[('HEAD', 'ALL'), ('BUDGET', 'ALL')])
sim.write_simulation()
sim.run_simulation()
head = gwf.output.head().get_data()
bud = gwf.output.budget()
spdis = bud.get_data(text='DATA-SPDIS')[0]
pmv = flopy.plot.PlotMapView(gwf)
pmv.plot_array(head)
pmv.plot_grid(colors='white')
pmv.contour_array(head, levels=[.2, .4, .6, .8], linewidths=3.)
pmv.plot_specific_discharge(spdis, color='white')
But got the following error when I run it:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-1-8e7554ad25d5> in <module>
21 sim.run_simulation()
22
---> 23 head = gwf.output.head().get_data()
24 bud = gwf.output.budget()
25
~\Anaconda3\lib\site-packages\flopy\mf6\mfmodel.py in __getattr__(self, item)
216 if package is not None:
217 return package
--> 218 raise AttributeError(item)
219
220 def __repr__(self):
AttributeError: output
Did anyone get something similar before? Is it a version issue? My floppy version is
3.3.3
Cheers!