feat(binaryfile): add write methods#2722
Merged
wpbonelli merged 26 commits intomodflowpy:developfrom Apr 10, 2026
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #2722 +/- ##
===========================================
+ Coverage 55.5% 72.3% +16.8%
===========================================
Files 644 674 +30
Lines 124135 132006 +7871
===========================================
+ Hits 68947 95561 +26614
+ Misses 55188 36445 -18743
🚀 New features to boost your workflow:
|
jdhughes-dev
approved these changes
Apr 10, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Support writing binary head, budget and grid files.
Class methods
Add
write()classmethods toHeadFileandCellBudgetFile. These write a new file with the given data and return an instance with it open.Head files
There are a few syntax variants
Budget files
Again there are variants. The typical case is to use
datawith a list, where each entry has "text", "kper", "kstp", and "data" entries, and "data" is an array, typically grid-shaped. But it can be convenient to usetextand pass a time-indexed dictionary todatato create a file with a single variable.If only face flows are provided, the grid shape must be specified with
nlay/nrow/ncol,nlay/ncpl, ornnodes. If grid-shaped variables are provided, the grid's shape will be inferred.Instance methods
Add instance
export()methods toMfGrdFileHeadFileCellBudgetFileThese copy the contents of an open file to another, optionally filtering by variable and/or time step, or changing the precision.
Grid files
There is no
write()method forMfGrdFile, as its signature would have been long and complicated to accommodate all grid types.Head/budget files
Close #2717