2

I want to load an existing mf2005 model into flopy to be able to export the model reuslts in .vtk. The model was created using model muse.

import flopy

ml = flopy.modflow.Modflow.load("C:/Users/Kristina/Desktop/kwb/Modflow/versions/WW-SPA_3_v5.nam")

I get this error message:

Traceback (most recent call last):

File "C:\Users\Kristina\PycharmProjects\flopy-tutorial\venv\load-model.py", line 3, in ww_spa = flopy.modflow.Modflow.load("C:/Users/Kristina/Desktop/kwb/Modflow/versions/WW-SPA_3_v5.nam")

File "C:\Users\Kristina\anaconda3\envs\flopy-tutorial\lib\site-packages\flopy\modflow\mf.py", line 916, in load item.package.load(

File "C:\Users\Kristina\anaconda3\envs\flopy-tutorial\lib\site-packages\flopy\modflow\mfgmg.py", line 395, in load relax = float(t[0])

IndexError: list index out of range

Can anyone help me with this? I am new to python and have trouble interpeting the message. Thanks Kris

Any

user97744
  • 21
  • 2

1 Answers1

1

The error message is originating from trying to load the GMG package of your model. Verify that the GMG package is formatted correctly. Another thing to try is to run the model using the standard MODFLOW 2005 executable. If the model runs to completion it should have no trouble being read into flopy (in theory).

If your model does execute normally using the standard executable and your package is formatted correctly, check the flopy documentation about what they expect for the GMG package. If there isn't documentation, it'd be worthwhile to go to github.com, find the flopy repository, and raise an issue there so they can know about the issue. You'll need to include your run logs and also provide the GMG package format for them to see and they can give you additional guidance from there.

Jacob
  • 58
  • 9
  • Thanks so much for answering!! I really appreciate it, I did get many friendly answers here so far. In modelmuse the model is running without errors or warnings. Do you think it could be an issue that I included some particle tracking with Modpath in the original model? Eventhough I don't see how this should be related to the gmg package which is the solver, right? – user97744 Jan 12 '21 at 12:24
  • 1
    I agree that I don't think the MODPATH should affect the original model. Can you verify whether you have the ISC set to 4 and whether you give it a RELAX value? The error failed out on the RELAX value as I read more closely into that error. – Jacob Jan 15 '21 at 14:47
  • ISC is set to 1 in the original model without a relax value given. I read the part about in the documentation, the relax value should only be an issue when the ISC is set to 4, which it is not. It says "IndexError", so maybe its given the index[0] to read the relax value but since there isn't one, I get the error?.. something like this? – user97744 Jan 17 '21 at 15:07
  • I would suggest taking the GMG package out of your name file, loading the modified model into flopy, then adding in the GMG package information yourself. If that still doesn't work, then you really should submit your problem as an issue with the development team. My suspicion is that you'll be able to get your model in (provided there aren't other errors) if you first remove the GMG package, load the model, then load it in/build it yourself in flopy. It might be a formatting error that's preventing it from working as-is. – Jacob Jan 18 '21 at 21:30
  • Yes, I was already considering that myself, just wasn't sure I could just delete the package from the nam file. Thanks a lot for clarifying! – user97744 Jan 20 '21 at 09:10