modflowpy / flopy

A Python package to create, run, and post-process MODFLOW-based models.
https://flopy.readthedocs.io
Other
506 stars 306 forks source link

fix(HeadFile): fix dis reversal, expand tests #2247

Closed wpbonelli closed 2 months ago

wpbonelli commented 2 months ago

Fix the write logic for head file reversal to properly write each layer. Add a test for each discretization type. Fix in-place reverse by writing to a temp file first then renaming. Improve docstrings.

@cneyens could you check if this resolves #2246 on your end?

codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 98.21429% with 1 line in your changes missing coverage. Please review.

Project coverage is 75.7%. Comparing base (9dd66c7) to head (4341c30).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #2247 +/- ## ========================================= + Coverage 73.6% 75.7% +2.0% ========================================= Files 294 294 Lines 59029 58909 -120 ========================================= + Hits 43476 44624 +1148 + Misses 15553 14285 -1268 ``` | [Files](https://app.codecov.io/gh/modflowpy/flopy/pull/2247?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=modflowpy) | Coverage Δ | | |---|---|---| | [flopy/utils/binaryfile.py](https://app.codecov.io/gh/modflowpy/flopy/pull/2247?src=pr&el=tree&filepath=flopy%2Futils%2Fbinaryfile.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=modflowpy#diff-ZmxvcHkvdXRpbHMvYmluYXJ5ZmlsZS5weQ==) | `86.4% <98.2%> (+4.3%)` | :arrow_up: | ... and [142 files with indirect coverage changes](https://app.codecov.io/gh/modflowpy/flopy/pull/2247/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=modflowpy)
wpbonelli commented 2 months ago

I did some testing on example models, this seems to work OK for structured and unstructured grids. Feel free to reopen if you still see issues @cneyens.