flopy icon indicating copy to clipboard operation
flopy copied to clipboard

fix(cellbudgetfile): fix get_ts support for aux vars

Open wpbonelli opened this issue 1 month ago • 2 comments

close #2647, correcting initial buggy implementation of #2270

wpbonelli avatar Nov 09 '25 12:11 wpbonelli

Codecov Report

:x: Patch coverage is 67.44186% with 56 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 72.7%. Comparing base (556c088) to head (1576fb8). :warning: Report is 95 commits behind head on develop.

Files with missing lines Patch % Lines
flopy/utils/binaryfile/__init__.py 70.3% 35 Missing :warning:
flopy/utils/datafile.py 62.2% 20 Missing :warning:
flopy/pakbase.py 0.0% 1 Missing :warning:
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2648      +/-   ##
===========================================
+ Coverage     55.5%    72.7%   +17.1%     
===========================================
  Files          644      667      +23     
  Lines       124135   129516    +5381     
===========================================
+ Hits         68947    94162   +25215     
+ Misses       55188    35354   -19834     
Files with missing lines Coverage Δ
flopy/pakbase.py 82.7% <0.0%> (-1.8%) :arrow_down:
flopy/utils/datafile.py 75.4% <62.2%> (+1.1%) :arrow_up:
flopy/utils/binaryfile/__init__.py 84.3% <70.3%> (-0.2%) :arrow_down:

... and 556 files with indirect coverage changes

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

codecov[bot] avatar Nov 09 '25 12:11 codecov[bot]

@cneyens do you mind having a look at this before I merge?

wpbonelli avatar Dec 11 '25 21:12 wpbonelli

@cneyens do you mind having a look at this before I merge?

@wpbonelli thanks for this! I've checked with the example in #2647 which now works with both DIS and DISV grids. For DISV grids, the same results are returned for qx when using the original three-indices cell id (with dummy value in the second position) and the new two-indices approach.

Can this also be implemented for the head object, so hds.get_ts() has the same behaviour as bud.get_ts() when using DISV grids?

Time series of other fluxes are also working as expected, except STO-SS with a DISV grid (regardless of using three-indices or two-indices for the idx argument): bud.get_ts(idx=pbidx_full, text='STO-SS') fails on the following line:

https://github.com/modflowpy/flopy/blob/1336e60be8aa71e97dbf0eb35740ff7bba83b098/flopy/utils/binaryfile/init.py#L1724

returning error TypeError: argument of type 'NoneType' is not iterable. With a DIS grid, it works fine. I think this is due to STO-SS having IMETH=1 and returning an array instead of a recarray. For DIS grids, use_full3d is True and that part of the code is not accessed.

cneyens avatar Dec 15 '25 08:12 cneyens

Thanks @cneyens nice catch. I guess the fact that IMETH=1 arrays are always padded to 3D regardless of grid type is probably where the motivation to use dummy-valued 3-tuple cell IDs came from.

CellBudgetFile and HeadFile will both take padded and properly-shaped cell IDs now.

wpbonelli avatar Dec 15 '25 13:12 wpbonelli