Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

partial test for special case of reach 1 unconnected #1635

Closed
wants to merge 3 commits into from

Conversation

wkitlasten
Copy link
Contributor

I have added test_sfr_connections() to test_mf6.py. It uses external files added to examples/data/sfr_test/ which define the package and connection data.

The model that uses examples/data/sfr_test/mf6_sfr0_* has the last two reaches unconnected . MF6 runs with a mild warning and flopy loads the model fine.

The model that uses examples/data/sfr_test/mf6_sfr1_* has the first reach unconnected. MF6 runs with the same warning but flopy fails to load the model with the following warning, seemingly unrelated to the first reach:

loading simulation...
  loading simulation name file...
  loading tdis package...
  loading model gwf6...
    loading package dis...
    loading package ic...
    loading package npf...
    loading package sfr...
Traceback (most recent call last):
  File "C:\modelling\flopy\flopy\mf6\data\mffileaccess.py", line 1477, in read_list_data_from_file
    data_line=data_line,
  File "C:\modelling\flopy\flopy\mf6\data\mffileaccess.py", line 1893, in load_list_line
    zero_based=zero_based,
  File "C:\modelling\flopy\flopy\mf6\data\mffileaccess.py", line 2199, in _append_data_list
    sub_amt=sub_amt,
  File "C:\modelling\flopy\flopy\mf6\data\mfdatautil.py", line 107, in convert_data
    return int(PyListUtil.clean_numeric(data)) - sub_amt
ValueError: invalid literal for int() with base 10: '17 16 -18'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\modelling\flopy\flopy\mf6\mfpackage.py", line 896, in load
    external_file_info,
  File "C:\modelling\flopy\flopy\mf6\data\mfdatalist.py", line 1341, in load
    first_line, file_handle, storage, pre_data_comments
  File "C:\modelling\flopy\flopy\mf6\data\mffileaccess.py", line 1158, in load_from_package
    self._data_line,
  File "C:\modelling\flopy\flopy\mf6\data\mffileaccess.py", line 1497, in read_list_data_from_file
    ex,
flopy.mf6.mfbase.MFDataException: An error occurred in data element "connectiondata" model "gwf6" package "sfr". The error occurred while loading data list from package file in the "read_list_data_from_file" method.
Additional Information:
(1) Unable to process line 17 of data list: "17 16 -18
"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\modelling\flopy\autotest\test_mf6.py", line 1091, in test_sfr_connections
    sim2 = MFSimulation.load(sim_ws=str(tmpdir))
  File "C:\modelling\flopy\flopy\mf6\modflow\mfsimulation.py", line 719, in load
    load_only,
  File "C:\modelling\flopy\flopy\mf6\modflow\mfgwf.py", line 137, in load
    load_only,
  File "C:\modelling\flopy\flopy\mf6\mfmodel.py", line 805, in load_base
    instance.load_package(ftype, fname, pname, strict, None)
  File "C:\modelling\flopy\flopy\mf6\mfmodel.py", line 1858, in load_package
    package.load(strict)
  File "C:\modelling\flopy\flopy\mf6\mfpackage.py", line 2639, in load
    self._load_blocks(fd_input_file, strict)
  File "C:\modelling\flopy\flopy\mf6\mfpackage.py", line 2817, in _load_blocks
    block_header_info, fd_input_file, strict
  File "C:\modelling\flopy\flopy\mf6\mfpackage.py", line 908, in load
    fd_block.name,
flopy.mf6.mfbase.MFDataException: An error occurred in data element "connectiondata" model "test_sfr" package "sfr". The error occurred while loading data list from package file in the "read_list_data_from_file" method.
Additional Information:
(1) Unable to process line 17 of data list: "17 16 -18
"
(2) Error occurred while loading data "connectiondata" in block "connectiondata" from file "C:\modelling\flopy\autotest\.\../examples/data/sfr_test/mf6_sfr1_connection.txt".

Admittedly this is a "special" case and I am struggling to piece together the testing structure (I'm new to testing, sorry). But hopefully this gives enough for someone to go on? @mwtoews , @emorway-usgs ?

@codecov
Copy link

codecov bot commented Nov 24, 2022

Codecov Report

Merging #1635 (071eb19) into develop (f017c0d) will decrease coverage by 41.8%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           develop   #1635      +/-   ##
==========================================
- Coverage     71.8%   30.1%   -41.8%     
==========================================
  Files          253     253              
  Lines        55887   54388    -1499     
==========================================
- Hits         40178   16395   -23783     
- Misses       15709   37993   +22284     
Impacted Files Coverage Δ
flopy/mfusg/mfusgsms.py 6.1% <0.0%> (-92.0%) ⬇️
flopy/mf6/utils/postprocessing.py 9.2% <0.0%> (-88.9%) ⬇️
flopy/seawat/swtvdf.py 8.0% <0.0%> (-88.5%) ⬇️
flopy/modflow/mfevt.py 7.5% <0.0%> (-87.5%) ⬇️
flopy/utils/mtlistfile.py 4.6% <0.0%> (-85.4%) ⬇️
flopy/mf6/utils/lakpak_utils.py 2.0% <0.0%> (-85.4%) ⬇️
flopy/modflow/mfhyd.py 13.2% <0.0%> (-85.2%) ⬇️
flopy/utils/swroutputfile.py 10.7% <0.0%> (-85.1%) ⬇️
flopy/modflow/mfag.py 7.2% <0.0%> (-83.9%) ⬇️
flopy/modflow/mfhob.py 5.9% <0.0%> (-83.1%) ⬇️
... and 207 more

@wkitlasten wkitlasten closed this Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants