Hi Phoenix,
First of all, make sure that heads data will be stored in your head file (OC package).
name = 'flowmodel'
# ---- Modflow simulation package
sim = flopy.mf6.MFSimulation(sim_name= name, exe_name = mf6_exe, version='mf6')
# ---- OC Package
oc_rec_list =[('HEAD', 'LAST'), ('BUDGET', 'LAST')]
printrecord = [('HEAD', 'LAST')]
oc = flopy.mf6.modflow.mfgwfoc.ModflowGwfoc(model, saverecord = oc_rec_list,
head_filerecord = [name + '.hds'],
budget_filerecord = [name +'.cbc'],
printrecord = printrecord,
pname = 'oc' )
Then, after running your wonderful model, you can access your heads data
(with Modflow6)
using:
heads = sim.simulation_data.mfdata[model.name,'HDS','HEAD'] hds = flopy.utils.HeadFile(f'{name}.hds')
heads = hds.get_alldata()
If I remember well, this heads object is a 4D-ndarray:
heads[istep, ilayer, row, col] for structured grid
heads[istep, ilayer, 1, node] for unstructured grid
If you have several layers and want to extract the water table, as suggested by @Christian you can use the get_water_table() method:
wt = flopy.utils.postprocessing.get_water_table(heads)
I hope that help you