docs(readme.md): add quick start code snippet to readme file (#568)
* Adding a quick start code snippet to the main readme.md file. * trying a relative path * Further simplifying and using consistent namesdevelop
parent
145938a5bd
commit
e6eafcb11f
35
README.md
35
README.md
|
@ -30,6 +30,41 @@ FloPy code documentation is available at [http://modflowpy.github.io/flopydoc/](
|
|||
Getting Started
|
||||
-----------------------------------------------
|
||||
|
||||
### MODFLOW 6 Quick Start
|
||||
```python
|
||||
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 = flopy.utils.HeadFile(os.path.join(ws, head_file)).get_data()
|
||||
bud = flopy.utils.CellBudgetFile(os.path.join(ws, budget_file),
|
||||
precision='double')
|
||||
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')
|
||||
```
|
||||
<img src="examples/images/quickstart.png" alt="plot" style="width:30;height:30">
|
||||
|
||||
### [Frequently asked questions](docs/flopyFAQ.md)
|
||||
|
||||
### [Tutorials](http://modflowpy.github.io/flopydoc/tutorials.html)
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 45 KiB |
Loading…
Reference in New Issue