Skip to content
A Python package to create, run, and post-process MODFLOW-based models.
Python Other
  1. Python 99.9%
  2. Other 0.1%
Branch: develop
Clone or download

Latest commit

mwtoews feat(netcdf): use modern features from pyproj>=2.2.0 (#840)
* For newer pyproj, use CRS and Transformer classes, to take advantage
  of modern transformation pipelines to convert coordinates
* For older pyproj, use Proj class, which has limitations
* Remove a few unnecessary try/except blocks and repeated log messages
Latest commit fb942b4 Mar 31, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
autotest Merge pull request #841 from etiennebresciani/vtk_exp1 Mar 31, 2020
binder Release 3.3.0 (#762) Dec 14, 2019
docs release: update develop to preliminary status Dec 15, 2019
examples fix:(#830): handling 'none' cellids in SFR package (#834) Mar 25, 2020
flopy feat(netcdf): use modern features from pyproj>=2.2.0 (#840) Mar 31, 2020
release Release 3.3.0 (#762) Dec 14, 2019
travis feat(zb netcdf): zonebudget netcdf export support added (#781) Jan 17, 2020
.flake8 Release3.2.13 (#725) Nov 17, 2019
.gitignore Release 3.3.0 (#762) Dec 14, 2019
.travis.yml Release 3.3.0 (#762) Dec 14, 2019
CODE_OF_CONDUCT.md Updates for code.usgs.gov May 22, 2018
CONTRIBUTING.md docs(README.md and CONTRIBUTING.md): fix a few instruction issues (#814) Feb 18, 2020
DISCLAIMER.md refactor(autotests): update build_exe.py to use pymake updates (#484) Mar 16, 2019
LICENSE Initial commit Dec 14, 2014
LICENSE.md Updates for code.usgs.gov May 22, 2018
MANIFEST.in fixed issue with default settings for SUB dp dataset. Also removed cr… Jan 8, 2018
README.md docs(README.md and CONTRIBUTING.md): fix a few instruction issues (#814) Feb 18, 2020
_config.yml Set theme jekyll-theme-minimal May 22, 2018
code.json release: update develop to preliminary status Dec 15, 2019
requirements.travis.txt feat(zb netcdf): zonebudget netcdf export support added (#781) Jan 17, 2020
setup.py Release 3.3.0 (#762) Dec 14, 2019

README.md

flopy3

Version 3.3.1 — release candidate

Build Status Anaconda-Server Badge Anaconda-Server Badge PyPI Version Coverage Status Codacy Badge Binder

Introduction

FloPy includes support for MODFLOW 6, MODFLOW-2005, MODFLOW-NWT, MODFLOW-USG, and MODFLOW-2000. Other supported MODFLOW-based models include MODPATH (version 6 and 7), MT3DMS, MT3D-USGS, and SEAWAT.

For general modeling issues, please consult a modeling forum, such as the MODFLOW Users Group. Other MODFLOW resources are listed in the MODFLOW Resources section.

Contributing

Bug reports, code contributions, or improvements to the documentation are welcome from the community. Prior to contributing, please read up on our guidelines for contributing and then check out one of our issues in the hotlist: community-help.

Documentation

FloPy code documentation is available at http://modflowpy.github.io/flopydoc/

Getting Started

MODFLOW 6 Quick Start

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')

plot

Frequently asked questions

Tutorials

Additional jupyter Notebook Examples

Python Script Examples

If You Get Stuck

FloPy usage has been growing rapidly, and as the number of users has increased, so has the number of questions about how to use FloPy. We ask our users to carefully consider the nature of their problem and seek help in the appropriate manner.

Questions

For questions related to how to do something with FloPy, we ask our users to submit the question to Stack Overflow and assign the flopy tag. Many of our recent questions have been related to MODFLOW or Python, and the Flopy developers cannot always respond to these inquiries.

Bugs

If you think you have discovered a bug in FloPy in which you feel that the program does not work as intended, then we ask you to submit a Github issue.

FloPy Supported Packages

A list of supported packages in FloPy is available in docs/supported_packages.md on the github repo.

FloPy Model Checks

A table of the supported and proposed model checks implemented in FloPy is available in docs/model_checks.md on the github repo.

FloPy Changes

A summary of changes in each FloPy version is available in docs/version_changes.md on the github repo.

Installation

Python versions:

FloPy requires Python 3.5 (or higher).

Dependencies:

FloPy requires NumPy 1.9 (or higher).

For base and Anaconda Python distributions:

To install FloPy type:

pip install flopy

or

conda install -c conda-forge flopy

To update FloPy type:

pip install flopy --upgrade

or

conda update -c conda-forge flopy

To uninstall FloPy type:

pip uninstall flopy

or

conda uninstall flopy

Installing from the git repository:

Current Version of FloPy:

To install the current version of FloPy from the git repository type:

pip install https://github.com/modflowpy/flopy/zipball/master

To update your version of FloPy with the current version from the git repository type:

pip install https://github.com/modflowpy/flopy/zipball/master --upgrade

Development version of FloPy:

To install the latest development version of FloPy from the git repository type:

pip install https://github.com/modflowpy/flopy/zipball/develop

To update your version of FloPy with the latest development version from the git repository type:

pip install https://github.com/modflowpy/flopy/zipball/develop --upgrade

Optional Method Dependencies:

Additional dependencies to use optional FloPy helper methods are listed below.

Method Python Package
.PlotMapView() in flopy.plot matplotlib >= 1.4
.PlotCrossSection() in flopy.plot matplotlib >= 1.4
.plot() matplotlib >= 1.4
.plot_shapefile() matplotlib >= 1.4 and Pyshp >= 1.2
.to_shapefile() Pyshp >= 1.2
.export(*.shp) Pyshp >= 1.2
.export(*.nc) netcdf4 >= 1.1 and python-dateutil >= 2.4
.export(*.tif) rasterio
.export(*.asc) in flopy.utils.reference SpatialReference class scipy.ndimage
.interpolate() in flopy.utils.reference SpatialReference class scipy.interpolate
.interpolate() in flopy.mf6.utils.reference StructuredSpatialReference class scipy.interpolate
._parse_units_from_proj4() in flopy.utils.reference SpatialReference class pyproj
.get_dataframes() in flopy.utils.mflistfile ListBudget class pandas >= 0.15
.get_dataframes() in flopy.utils.observationfile ObsFiles class pandas >= 0.15
.get_dataframes() in flopy.utils.sfroutputfile ModflowSfr2 class pandas >= 0.15
.get_dataframes() in flopy.utils.util_list MfList class pandas >= 0.15
.get_dataframes() in flopy.utils.zonebud ZoneBudget class pandas >= 0.15
.pivot_keyarray() in flopy.mf6.utils.arrayutils AdvancedPackageUtil class pandas >= 0.15
._get_vertices() in flopy.mf6.utils.binaryfile_utils MFOutputRequester class pandas >= 0.15
.get_dataframe() in flopy.mf6.utils.mfobservation Observations class pandas >= 0.15
.df() in flopy.modflow.mfsfr2 SfrFile class pandas >= 0.15
.time_coverage() in flopy.export.metadata acc class - used if available pandas >= 0.15
.loadtxt() in flopy.utils.flopyio - used if available pandas >= 0.15
.generate_classes() in flopy.mf6.utils pymake
.intersect() in flopy.discretization.VertexGrid matplotlib >= 1.4
GridIntersect() in flopy.utils.gridintersect shapely
GridIntersect().plot_polygon() in flopy.utils.gridintersect shapely and descartes
Raster() in flopy.utils.Raster rasterio, affine, and scipy
Raster().sample_polygon() in flopy.utils.Raster shapely
Raster().crop() in flopy.utils.Raster shapely

How to Cite

Citation for FloPy:

Bakker, M., Post, V., Langevin, C. D., Hughes, J. D., White, J. T., Starn, J. J. and Fienen, M. N., 2016, Scripting MODFLOW Model Development Using Python and FloPy: Groundwater, v. 54, p. 733–739, doi:10.1111/gwat.12413.

Software/Code citation for FloPy:

Bakker, M., Post, V., Langevin, C. D., Hughes, J. D., White, J. T., Leaf, A. T., Paulinski, S. R., Larsen, J. D., Toews, M. W., Morway, E. D., Bellino, J. C., Starn, J. J., and Fienen, M. N., 2019, FloPy v3.3.1 — release candidate: U.S. Geological Survey Software Release, 15 December 2019, http://dx.doi.org/10.5066/F7BK19FH

MODFLOW Resources

Disclaimer

This software is preliminary or provisional and is subject to revision. It is being provided to meet the need for timely best science. The software has not received final approval by the U.S. Geological Survey (USGS). No warranty, expressed or implied, is made by the USGS or the U.S. Government as to the functionality of the software and related material nor shall the fact of release constitute any such warranty. The software is provided on the condition that neither the USGS nor the U.S. Government shall be held liable for any damages resulting from the authorized or unauthorized use of the software.

You can’t perform that action at this time.