Deltares / imod-python

🐍🧰 Make massive MODFLOW models
https://deltares.github.io/imod-python/
MIT License
16 stars 0 forks source link

Projectfile: Improve error message when number of stresses doesn't match number of data entries #1077

Open FransRoelofsen opened 2 weeks ago

FransRoelofsen commented 2 weeks ago

In the header of each 'package' in the PRJ file there is a number, referring to the total number of stresses (incl steady state) that follows. If the number is larger than the following data blocks an error is thrown: "list index out of range failed to parse date time for line 517 with content [] Error occurred for keyword: (drn)"

However, this error thrown might not be clear. At lease not for us. It took us some time to find out. The project file looked good at line 517. Positive: the keyword (e.g. drn) is given and also the prj file line number. But the text was not clear for us.

is it possible to make the error more self-explanatory

Huite commented 2 weeks ago

I suppose in this case it would be possible to specifically catch the IndexError and relate it to the problem here, i.e. that the number of stresses does not match the data.

The error message would be something like: "Number of stresses in the header does not match the number of data entries." Although better would be: "Number of stresses in the header is larger than the number of data entries".

If the number in the header is smaller than the number of entries, which error do you get now?

JoerivanEngelen commented 3 days ago

FYI: I also ran into this issue with a version of the Aa & Maas model, but then for a case where the number of stresses was less than amount of data entries.