Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: MODFLOW 6 support #12

Merged
merged 48 commits into from
May 25, 2021
Merged

Feature: MODFLOW 6 support #12

merged 48 commits into from
May 25, 2021

Conversation

mwtoews
Copy link
Owner

@mwtoews mwtoews commented Mar 31, 2021

The plan is to implement this feature independent of older MF support (for now) to get this feature going.

mwtoews and others added 5 commits March 18, 2021 16:59
- Move MfSfrNetwork to _legacy.py -- this may be removed later
- Move _core.py to _base.py, for base abstract class, shared logic
- Use SwnModflow for classic MODFLOW
- Use SwnMf6 for MODFLOW 6
@mwtoews mwtoews mentioned this pull request Mar 31, 2021
@mwtoews mwtoews added the enhancement New feature or request label Mar 31, 2021
- Split 'other_from_swn_flopy' into two parts, with the second
  content going to 'set_sfr_data'
- Start of 'packagedata' property, which depends on data in reaches
@mwtoews
Copy link
Owner Author

mwtoews commented Apr 8, 2021

some pseudo code on how this should work is as follows:

n = SurfaceWaterNetwork
m = ModflowGwf

nm = SwnMf6.some_class_method(n, m)

# gets containter of grid cells
# and assign reach data

# Use should set reach data
nm.set_reach_data('rtp')
nm.set_reach_data('man', 3.e-5)
nm.set_reach_data('rwid', 10.)  # or next line
nm.set_reach_data('rwid', n.segments.width)

# propery to pandas data frame for MF6 (of flopy)
nm.package_data
nm.connection_data
nm.period_data

nm.build_sfr_data()  # prepare flopy object -- do later

mwtoews and others added 20 commits April 12, 2021 16:28
… reaches df

Still not sure what to do with 'set_sfr_data'...

Work on test_modflow6.py test suite...
 - rename class properties
 - fix __repr__
 - rename 'from_rno' to plural 'from_rnos'
 - fix last from_rnos
 - Rename to_* methods to internal _* methods
 - Add flopy_* method properties
 - Fix repr
 - When setting model property, check tdis
 - Fix geotransform_from_flopy
 - Check over tests, discard some, now only 1 xfail (for diversions)
- Re-integrate diversions
- Diversions use 'divid', and not 'segnum' with iupseg!=0
- Update __repr__
Move min_slope out of set_sfr_data methods
SwnMf6 - segment_data not used, so drop set_segment_data
mwtoews added 18 commits May 10, 2021 20:11
Move plot() method to base class too.

Start test_modflow_base.py for generic tests
* Merge plot() to base, show diversions and inflow points too
* Use base class (via super()) for __iter__ and __setstate__
* Create _get_segments_inflow() to gather external flow
* Change set_reach_slope() method "linestringz_ab" to "zcoord_ab"
* Add misc function transform_data_to_series_or_frame() to help
  read and check segment or diversion data.
* Add _set_stationary_tsvar_data() to help set_* methods that set
  a data frame of stationary data and a dict of time-varying data

SwnModflow changes (too many, but a list is attempted here):

* Add property segment_data_ts to data model as a dict of tsvar frames
* Remove set_sfr_data(), as it was too high-level
* Also remove set_segment_data(), as it's also too high level
* Add new_segment_data() to generate a basic segment_data frame
* Add set_segment_data_from_scalar()
* Add set_segment_data_from_segments(), data indexed by segments
* Add set_segment_data_from_diversions(), data indexed by diversions
* Add set_segment_data_inflow(), data indexed by segments in/out of model
* Add flopy_segment_data property method to create dict of rec.array
* Add default_segment_data() to set high-level data and defaults
* Add set_sfr_obj() to create and set a flopy sfr object to the model

Tests:

* Use get_basic_swn() and get_basic_modflow() helper functions
was part of the segments frame.

Start clean-up of MF6 logic for default_packagedata
Start of SwnMf6 logic to handle time-varying data as "tsvar"
Prefer tmp_path fixture over tmpdir_factory

Clean-up unused parts
Fix set_sfr_obj(), remove perioddata keyword but allow packagedata and
connectiondata.

Update tests to use default_packagedata() and set_sfr_obj()
A version of these may come back later
Show warning that MfSfrNetwork is legacy code when initialized
@mwtoews mwtoews marked this pull request as ready for review May 25, 2021 22:39
@mwtoews mwtoews merged commit 56a30ee into main May 25, 2021
@mwtoews mwtoews deleted the feat_mf6sfr branch May 25, 2021 23:58
@mwtoews mwtoews added this to the 0.4 milestone Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants