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

feat(datafile): Raise IOError when attempting to read empty files #481

Merged
merged 1 commit into from
Mar 14, 2019
Merged

Conversation

mwtoews
Copy link
Contributor

@mwtoews mwtoews commented Mar 14, 2019

This feature provides a more useful error message when attempting to read an empty file. For example, if a mt3dms simulations crashes (e.g. #466), it leaves an empty file.ucn file and this is the error:

ucnobj = flopy.utils.UcnFile('file.ucn')

IndexError: index 0 is out of bounds for axis 0 with size 0

The new message should now be:

OSError: datafile error: file is empty: file.ucn

which is intended to help the user sort out their issue. This message is used for:

  • flopy.utils.UcnFile
  • flopy.utils.FormattedHeadFile
  • flopy.utils.HeadFile (with/without auto-precision detection)
  • flopy.utils.CellBudgetFile

@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 68.699% when pulling a1ad306 on mwtoews:empty into 9f8e632 on modflowpy:develop.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 68.699% when pulling a1ad306 on mwtoews:empty into 9f8e632 on modflowpy:develop.

@langevin-usgs langevin-usgs merged commit 1a3c772 into modflowpy:develop Mar 14, 2019
@langevin-usgs
Copy link
Contributor

Weird things are breaking and we're timing out on 3.7, but they are not related to this, so I'm going to merge it in.

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.

3 participants