-
Notifications
You must be signed in to change notification settings - Fork 309
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(generate_classes): add docs for generate_classes() (#1844)
* add generate_classes.md docs for generate_classes() * link to generate_classes.md from DEVELOPER.md
- Loading branch information
Showing
2 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Generating FloPy classes | ||
|
||
MODFLOW 6 input continues to evolve as new models, packages, and options are developed, updated, and supported. All MODFLOW 6 input is described by DFN (definition) files, which are simple text files that describe the blocks and keywords in each input file. These definition files are used to build the input and output guide for MODFLOW 6. These definition files are also used to automatically generate FloPy classes for creating, reading and writing MODFLOW 6 models, packages, and options. FloPy and MODFLOW 6 are kept in sync by these DFN (definition) files, and therefore, it may be necessary for a user to update FloPy using a custom set of definition files, or a set of definition files from a previous release. | ||
|
||
The FloPy classes for MODFLOW 6 are largely generated by a utility which converts DFN files in a modflow6 repository on GitHub or on the local machine into Python source files in your local FloPy install. For instance (output much abbreviated): | ||
|
||
```python | ||
>>> from flopy.mf6.utils import generate_classes | ||
>>> generate_classes() | ||
|
||
|
||
|
||
************************************************************************ | ||
Updating the flopy MODFLOW 6 classes | ||
Updating the MODFLOW 6 classes using MODFLOW-USGS/modflow6/master | ||
Downloading MODFLOW 6 repository from https://github.com/MODFLOW-USGS/modflow6/archive/master.zip | ||
Downloading https://github.com/MODFLOW-USGS/modflow6/archive/master.zip | ||
file size: 15,821,180 bytes | ||
|
||
total download time: 0.88 seconds | ||
Uncompressing: C:\Users\***\AppData\Local\Temp\***\master.zip | ||
Deleting zipfile C:\Users\***\AppData\Local\Temp\***\master.zip | ||
Done downloading and extracting master.zip to C:\Users\***\AppData\Local\Temp\*** | ||
Backup existing definition files in: C:\Users\***\flopy\flopy\mf6\data\dfn | ||
Replacing existing definition files with new ones. | ||
removing...common.dfn | ||
removing...exg-gwfgwf.dfn | ||
... | ||
copying..common.dfn | ||
copying..exg-gwfgwf.dfn | ||
... | ||
Deleting existing mf6 classes. | ||
removing...mfgnc.py | ||
removing...mfgwf.py | ||
... | ||
Create mf6 classes using the downloaded definition files. | ||
LIST OF FILES IN C:\Users\***\flopy\flopy\mf6\modflow | ||
1 - mfgnc.py | ||
2 - mfgwf.py | ||
... | ||
``` | ||
|
||
The `generate_classes()` function has several optional arguments. | ||
|
||
```python | ||
# use the develop branch instead | ||
generate_classes(branch="develop") | ||
|
||
# use a fork of modflow6 | ||
generate_classes(owner="your-username", branch="your-branch") | ||
|
||
# local copy of the repo | ||
generate_classes(dfnpath="../your/dfn/path")) | ||
``` | ||
|
||
By default, a backup is made of FloPy's package classes before rewriting them. To disable backups, use `backup=False`. |