Skip to content

fix(mf6): opt into writing optional default values#2712

Open
wpbonelli wants to merge 6 commits intomodflowpy:developfrom
wpbonelli:fix-2710
Open

fix(mf6): opt into writing optional default values#2712
wpbonelli wants to merge 6 commits intomodflowpy:developfrom
wpbonelli:fix-2710

Conversation

@wpbonelli
Copy link
Copy Markdown
Member

@wpbonelli wpbonelli commented Feb 15, 2026

Add an option write_defaults to the simulation, determining whether optional options block fields that have the default value are written to input files.

Default to false to keep new/breaking options from being written to input files when they are not explicitly used. This gives new versions of flopy, aimed at new versions of MF6, better odds of remaining compatible with older versions of MF6. This is safe assuming MF6 consistently implements defaults as declared in DFN files. It will change the contents of input files, but in a way that prevents breakage, so seems better to consider a fix than a breaking change.

One can opt into writing all option fields regardless of value by setting write_defaults = True. This preserves the input file as a complete record of the user's intent.

Fix #2710

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.4%. Comparing base (556c088) to head (c5ba01d).
⚠️ Report is 130 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2712      +/-   ##
===========================================
+ Coverage     55.5%    72.4%   +16.9%     
===========================================
  Files          644      674      +30     
  Lines       124135   130572    +6437     
===========================================
+ Hits         68947    94635   +25688     
+ Misses       55188    35937   -19251     
Files with missing lines Coverage Δ
flopy/mf6/data/mfdatascalar.py 60.4% <100.0%> (+1.0%) ⬆️
flopy/mf6/data/mfstructure.py 74.2% <100.0%> (+0.4%) ⬆️
flopy/mf6/mfsimbase.py 62.7% <100.0%> (-12.8%) ⬇️

... and 567 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wpbonelli wpbonelli marked this pull request as ready for review February 16, 2026 13:17
@wpbonelli wpbonelli added this to the 3.10.1 milestone Feb 16, 2026
@wpbonelli wpbonelli changed the title fix(mfdatascalar): skip fields with default values fix(mfdatascalar): skip multiple choice fields with default values Feb 16, 2026
@wpbonelli wpbonelli marked this pull request as draft February 17, 2026 19:36
@wpbonelli

This comment was marked as outdated.

@wpbonelli

This comment was marked as resolved.

@wpbonelli wpbonelli changed the title fix(mfdatascalar): skip multiple choice fields with default values fix(mf6): initialize optional variables to None, not default Feb 18, 2026
@wpbonelli wpbonelli marked this pull request as ready for review February 18, 2026 12:36
@wpbonelli wpbonelli changed the title fix(mf6): initialize optional variables to None, not default fix(mf6): don't write optional default values by default Feb 18, 2026
@wpbonelli wpbonelli changed the title fix(mf6): don't write optional default values by default fix(mf6): opt into writing optional default values Feb 18, 2026
@wpbonelli

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: the default value for coordinate_check_method in ModflowPrtprp of 'eager' errors in latest MODFLOW (6.6.3)

1 participant