modflowpy / flopy

A Python package to create, run, and post-process MODFLOW-based models.
https://flopy.readthedocs.io
Other
506 stars 306 forks source link

bug: trying to run lpr_tutorial01 I get an MFDataException #2260

Closed jaumegomez closed 3 weeks ago

jaumegomez commented 1 month ago

While trying to run in Spyder 5.5.1 the lpr_tutorial01.py out of the box, I get the following output and the script stops with an MFDataException

3.10.8 | packaged by conda-forge | (main, Nov 22 2022, 08:25:13) [Clang 14.0.6 ] numpy version: 1.26.4 matplotlib version: 3.8.4 flopy version: 3.7.0 ncppl: [2 2 0] Parent grid information parent nlay: 3 parent nrow: 25 parent ncol: 45 parent delr[0]: 100.0 parent delc[0]: 100.0 parent top[0, 0]: 20.0 parent botm[:, 0, 0]: [-20. -40. -60.]

Child grid information child nlay: 4 child nrow: 45 child ncol: 80 child delr[0]: 20.0 child delc[0]: 20.0 child top[0, 0]: 20.0 child botm[:, 0, 0]: [ 0. -20. -30. -40.] writing simulation... writing simulation name file... writing simulation tdis package... writing solution package ims_-1... writing package lgr.gwfgwf... writing model parent... writing model name file... writing package dis... writing package ic... writing package npf... writing package chd_0... INFORMATION: maxbound in ('gwf6', 'chd', 'dimensions') changed to 2 based on size of stress_period_data writing package oc... writing model child... writing model name file... writing package dis... writing package ic... writing package npf... writing package oc... ncppl: [1 1 0] Traceback (most recent call last):

File ~/anaconda3/lib/python3.10/site-packages/flopy/mf6/data/mfdatalist.py:396 in _set_data self._get_storage_obj().set_data(

File ~/anaconda3/lib/python3.10/site-packages/flopy/mf6/data/mfdatastorage.py:923 in set_data self._set_list(

File ~/anaconda3/lib/python3.10/site-packages/flopy/mf6/data/mfdatastorage.py:970 in _set_list self.process_open_close_line(data, layer)

File ~/anaconda3/lib/python3.10/site-packages/flopy/mf6/data/mfdatastorage.py:2252 in process_open_close_line self.store_external(

File ~/anaconda3/lib/python3.10/site-packages/flopy/mf6/data/mfdatastorage.py:1766 in store_external self._model_or_sim.modeldiscrit,

File ~/anaconda3/lib/python3.10/site-packages/flopy/mf6/mfsimbase.py:581 in getattr raise AttributeError(item)

AttributeError: modeldiscrit

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File ~/anaconda3/lib/python3.10/site-packages/flopy/mf6/data/mfdatalist.py:85 in init self.set_data(data, True)

File ~/anaconda3/lib/python3.10/site-packages/flopy/mf6/data/mfdatalist.py:571 in set_data self._set_data(data, autofill, check_data=check_data)

File ~/anaconda3/lib/python3.10/site-packages/flopy/mf6/data/mfdatalist.py:404 in _set_data raise MFDataException(

MFDataException: An error occurred in data element "exchangedata" package "gwtgwt". The error occurred while setting data in the "_set_data" method.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File ~/anaconda3/lib/python3.10/site-packages/flopy/mf6/mfpackage.py:620 in add_dataset self.datasets[var_path[-1]] = self.data_factory(

File ~/anaconda3/lib/python3.10/site-packages/flopy/mf6/mfpackage.py:492 in data_factory return mfdatalist.MFList(

File ~/anaconda3/lib/python3.10/site-packages/flopy/mf6/data/mfdatalist.py:88 in init raise MFDataException(

MFDataException: An error occurred in data element "exchangedata" package "gwtgwt". The error occurred while setting data in the "init" method.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File ~/anaconda3/lib/python3.10/site-packages/spyder_kernels/py3compat.py:356 in compat_exec exec(code, globals, locals)

File ~/Library/CloudStorage/OneDrive-UPV/OneDrive - Docs/Clases/CursoModelosMaterialComun/flopy/.docs/Notebooks/lgr_tutorial01.py:517 exg = flopy.mf6.ModflowGwtgwt(

File ~/anaconda3/lib/python3.10/site-packages/flopy/mf6/modflow/mfgwtgwt.py:488 in init self.exchangedata = self.build_mfdata("exchangedata", exchangedata)

File ~/anaconda3/lib/python3.10/site-packages/flopy/mf6/mfpackage.py:2670 in build_mfdata ds = self.blocks[block.name].add_dataset(

File ~/anaconda3/lib/python3.10/site-packages/flopy/mf6/mfpackage.py:631 in add_dataset raise MFDataException(

MFDataException: An error occurred in data element "exchangedata" package "lgr.gwtgwt". The error occurred while setting data in the "init" method. Additional Information: (1) Error occurred while adding dataset "exchangedata" to block "exchangedata"

wpbonelli commented 1 month ago

Thanks @jaumegomez for reporting — I am able to reproduce this with 3.7.0 from conda/pypi, as well as the 3.7.0 tag and master branch. It does not occur with develop — seems it may have been fixed in the meantime? As a workaround, you can install the develop branch.

wpbonelli commented 3 weeks ago

Tentatively closing, feel free to reopen if the problem persists