Skip to content

Commit

Permalink
Add a test and update docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
langevin-usgs committed Mar 13, 2024
1 parent 124efa2 commit a630d76
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
19 changes: 19 additions & 0 deletions autotest/test_binaryfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,3 +559,22 @@ def test_read_mf2005_freyberg(example_data_path, function_tmpdir, compact):
assert len(cbb_data) == len(cbb_data_kstpkper)
for i in range(len(cbb_data)):
assert np.array_equal(cbb_data[i], cbb_data_kstpkper[i])


def test_read_mf6_budgetfile(example_data_path):
cbb_file = (
example_data_path
/ "mf6"
/ "test005_advgw_tidal"
/ "expected_output"
/ "AdvGW_tidal.cbc"
)
cbb = CellBudgetFile(cbb_file)
rch_zone_1 = cbb.get_data(paknam2="rch-zone_1".upper())
rch_zone_2 = cbb.get_data(paknam2="rch-zone_2".upper())
rch_zone_3 = cbb.get_data(paknam2="rch-zone_3".upper())

# ensure there is a record for each time step
assert len(rch_zone_1) == 120 * 3 + 1
assert len(rch_zone_2) == 120 * 3 + 1
assert len(rch_zone_3) == 120 * 3 + 1
6 changes: 5 additions & 1 deletion flopy/utils/binaryfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1603,7 +1603,11 @@ def get_data(
paknam : str
The `from` package name for the record.
paknam2 : str
The `to` package name for the record.
The `to` package name for the record. This argument can be
useful for MODFLOW 6 budget files if multiple packages of
the same type are specified. The paknam2 argument can be
specified as the package name (not the package type) in
order to retrieve budget data for a specific named package.
full3D : boolean
If true, then return the record as a three dimensional numpy
array, even for those list-style records written as part of a
Expand Down

0 comments on commit a630d76

Please sign in to comment.