Skip to content

fix(evt): fix optional field handling at write time#2684

Merged
wpbonelli merged 2 commits intomodflowpy:developfrom
wpbonelli:fix-2683
Jan 24, 2026
Merged

fix(evt): fix optional field handling at write time#2684
wpbonelli merged 2 commits intomodflowpy:developfrom
wpbonelli:fix-2683

Conversation

@wpbonelli
Copy link
Copy Markdown
Member

@wpbonelli wpbonelli commented Jan 24, 2026

EVT packages with nseg > 1, and auxiliary variables, failed on file write with:

  IndexError: invalid index (7)
  MFDataException: An error occurred while processing auxiliary variables in the "_get_file_entry_record" method.

When nseg > 1, the EVT package has optional fields pxdp, petm, petm0 that may or may not be present in the structured array depending on nseg and surf_rate_specified values. #2496 added _dependent_opt() and _optional_nval() methods to handle these fields when reading, but _get_file_entry_record() in mfdatalist.py still iterated through all DFN-defined fields when writing. The index then advanced past the array bounds before reaching auxiliary variables.

At write time, skip EVT-specific optional fields that aren't present in the structured array, using the same methods #2496 added for reading.

Close #2683

@wpbonelli wpbonelli added this to the 3.10 milestone Jan 24, 2026
@wpbonelli wpbonelli added the bug label Jan 24, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 24, 2026

Codecov Report

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

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2684      +/-   ##
===========================================
+ Coverage     55.5%    72.3%   +16.7%     
===========================================
  Files          644      667      +23     
  Lines       124135   130124    +5989     
===========================================
+ Hits         68947    94134   +25187     
+ Misses       55188    35990   -19198     
Files with missing lines Coverage Δ
flopy/mf6/data/mfdatalist.py 64.1% <100.0%> (-5.3%) ⬇️

... and 562 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 January 24, 2026 16:29
@wpbonelli wpbonelli merged commit a88f0e1 into modflowpy:develop Jan 24, 2026
2 of 3 checks passed
@wpbonelli wpbonelli deleted the fix-2683 branch January 24, 2026 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Auxiliary variables in EVT-package produce error after version 3.9.2

1 participant