How to get water tabler on FloPy

212 views
Skip to first unread message

Phoenix Floyd

unread,
Apr 16, 2021, 4:30:16 AM4/16/21
to MODFLOW Users Group
Hi everyone,

This is a very short question/post...I've been coding on Python a bit and been using FloPy for groundwater modelling of course, but I can't seem to find yet how to get the water table of my model...
Is there any FloPy package for that (which I can't seem to find)? Can someone please help me out on how to get that info on Python/FloPy for my model?

Any help is very much appreciated! Thanks in advance.

Christian Langevin

unread,
Apr 16, 2021, 12:04:52 PM4/16/21
to MODFLOW Users Group
How about this one?  flopy.utils.postprocessing.get_water_table

Zeinab Mahmoodi

unread,
Apr 18, 2021, 11:50:02 AM4/18/21
to mod...@googlegroups.com
HI
I'm looking for a portable version of the Modflow model. Can anyone  help me?
I should be able to
In the Python programming environment, link the Modflow model to a surface water model

--
You received this message because you are subscribed to the Google Groups "MODFLOW Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to modflow+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/modflow/8382440a-7493-43bc-a61b-6dca7ccd8fc3n%40googlegroups.com.


--
Kind Regards
Zeinab Mahmoodi
PHD  student of Watershed Management engineering
Departement of  Watershed Management engineering, gorgan University, gorgan, Iran

blazer....@gmail.com

unread,
Apr 19, 2021, 12:09:14 AM4/19/21
to MODFLOW Users Group
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:
  • The simulation object:
heads = sim.simulation_data.mfdata[model.name,'HDS','HEAD']
  • The binary hds file:
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
Reply all
Reply to author
Forward
0 new messages