feat: optional replacement semantics for stress period data
Add an optional parameter replace=False to the .set_data() methods on the stress period data model. Setting this True resets the data before setting provided keys, i.e. clears all preexisting entries rather than leaving them in place.
Since stress period configuration is not stored solely in the underlying data model but also in package block headers, a trap is necessary in MFBlock.write() to sync block headers to the keys existing in the period data, to avoid writing empty/spurious period blocks.
Suggested in https://github.com/modflowpy/flopy/issues/2663#issuecomment-3633333267
Codecov Report
:x: Patch coverage is 97.67442% with 1 line in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 72.6%. Comparing base (556c088) to head (37dd348).
:warning: Report is 91 commits behind head on develop.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| flopy/mf6/data/mfdataarray.py | 90.0% | 1 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## develop #2664 +/- ##
===========================================
+ Coverage 55.5% 72.6% +17.1%
===========================================
Files 644 667 +23
Lines 124135 129426 +5291
===========================================
+ Hits 68947 94065 +25118
+ Misses 55188 35361 -19827
| Files with missing lines | Coverage Δ | |
|---|---|---|
| flopy/mf6/data/mfdatalist.py | 66.3% <100.0%> (-3.0%) |
:arrow_down: |
| flopy/mf6/data/mfdataplist.py | 74.1% <100.0%> (-4.8%) |
:arrow_down: |
| flopy/mf6/mfpackage.py | 68.7% <100.0%> (-12.9%) |
:arrow_down: |
| flopy/mf6/data/mfdataarray.py | 59.4% <90.0%> (-7.6%) |
:arrow_down: |
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.