Skip to content

Commit

Permalink
fix(obs package loading): fixed problem with loading multiple continu…
Browse files Browse the repository at this point in the history
…ous blocks (modflowpy#2058) (modflowpy#2064)
  • Loading branch information
scottrp authored Jan 22, 2024
1 parent 9318d62 commit a017b77
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
13 changes: 13 additions & 0 deletions autotest/regression/test_mf6.py
Original file line number Diff line number Diff line change
Expand Up @@ -3783,6 +3783,19 @@ def test005_advgw_tidal(function_tmpdir, example_data_path):
names = ghb.ts.time_series_namerecord.get_data()
assert names[0][0] == "tides"

# test obs blocks
obs_pkg = model.get_package("obs-1")
cont_mfl = obs_pkg.continuous
cont_data = cont_mfl.get_data()
assert len(cont_data) == 2
assert "head_hydrographs.csv" in cont_data
assert "gwf-advtidal.obs.flow.csv" in cont_data
flow = cont_data["gwf-advtidal.obs.flow.csv"]
assert flow[0][0] == "icf1"
assert flow[0][1] == "flow-ja-face"
assert flow[0][2] == (2, 4, 6)
assert flow[0][3] == (2, 4, 7)

# add a stress period beyond nper
spd = ghb.stress_period_data.get_data()
spd[20] = copy.deepcopy(spd[0])
Expand Down
5 changes: 5 additions & 0 deletions examples/data/mf6/test005_advgw_tidal/AdvGW_tidal.obs
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ BEGIN CONTINUOUS FILEOUT head_hydrographs.csv
open/close AdvGW_tidal.head.cont.opncls
END CONTINUOUS FILEOUT head_hydrographs.csv

BEGIN continuous FILEOUT gwf-advtidal.obs.flow.csv
icf1 flow-ja-face 3 5 7 3 5 8
END continuous FILEOUT gwf-advtidal.obs.flow.csv


2 changes: 1 addition & 1 deletion flopy/mf6/data/mffileaccess.py
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,7 @@ def read_list_data_from_file(
if store_internal:
# store as rec array
storage.store_internal(
data_loaded, None, False, current_key
data_loaded, None, False, key=current_key
)
storage.data_dimensions.unlock()
return [False, line, data_line]
Expand Down

0 comments on commit a017b77

Please sign in to comment.