Fix check when opening statepoint and fix documentation. Closes #464.

This commit is contained in:
Paul Romano 2015-10-26 05:29:25 -05:00
parent 9ab91e7df7
commit c2a53495cb
2 changed files with 9 additions and 4 deletions

View file

@ -4,7 +4,7 @@
State Point File Format
=======================
The current revision of the statepoint file format is 13.
The current revision of the statepoint file format is 14.
**/filetype** (*char[]*)

View file

@ -92,9 +92,14 @@ class StatePoint(object):
self._f = h5py.File(filename, 'r')
# Ensure filetype and revision are correct
if 'filetype' not in self._f or self._f[
'filetype'].value.decode() != 'statepoint':
raise IOError('{} is not a statepoint file.'.format(filename))
try:
if 'filetype' not in self._f or self._f[
'filetype'].value.decode() != 'statepoint':
raise IOError('{} is not a statepoint file.'.format(filename))
except AttributeError:
raise IOError('Could not read statepoint file. This most likely '
'means the statepoint file was produced by a different '
'version of OpenMC than the one you are using.')
if self._f['revision'].value != 14:
raise IOError('Statepoint file has a file revision of {} '
'which is not consistent with the revision this '