do not clutter with leading zeros

This commit is contained in:
Martin Diehl 2019-11-29 17:00:48 +01:00
parent 9b4252da68
commit dc3fc8f70c
2 changed files with 7 additions and 6 deletions

View File

@ -30,7 +30,7 @@ class DADF5():
"""
with h5py.File(filename,'r') as f:
if f.attrs['DADF5-major'] != 0 or not 2 <= f.attrs['DADF5-minor'] <= 3:
if f.attrs['DADF5-major'] != 0 or not 2 <= f.attrs['DADF5-minor'] <= 4:
raise TypeError('Unsupported DADF5 version {} '.format(f.attrs['DADF5-version']))
self.structured = 'grid' in f['geometry'].attrs.keys()
@ -40,7 +40,8 @@ class DADF5():
self.size = f['geometry'].attrs['size']
r=re.compile('inc[0-9]+')
self.increments = [i for i in f.keys() if r.match(i)]
increments_unsorted = {int(i[3:]):i for i in f.keys() if r.match(i)}
self.increments = [increments_unsorted[i] for i in sorted(increments_unsorted)]
self.times = [round(f[i].attrs['time/s'],12) for i in self.increments]
self.Nmaterialpoints, self.Nconstituents = np.shape(f['mapping/cellResults/constituent'])

View File

@ -68,9 +68,9 @@ subroutine results_init
write(6,'(a)') ' https://doi.org/10.1007/s40192-017-0084-5'
resultsFile = HDF5_openFile(trim(getSolverJobName())//'.hdf5','w',.true.)
call HDF5_addAttribute(resultsFile,'DADF5-version',0.3_pReal)
call HDF5_addAttribute(resultsFile,'DADF5-version',0.4_pReal)
call HDF5_addAttribute(resultsFile,'DADF5-major',0)
call HDF5_addAttribute(resultsFile,'DADF5-minor',3)
call HDF5_addAttribute(resultsFile,'DADF5-minor',4)
call HDF5_addAttribute(resultsFile,'DAMASK',DAMASKVERSION)
call get_command(commandLine)
call HDF5_addAttribute(resultsFile,'call',trim(commandLine))
@ -110,7 +110,7 @@ subroutine results_addIncrement(inc,time)
real(pReal), intent(in) :: time
character(len=pStringLen) :: incChar
write(incChar,'(i5.5)') inc ! allow up to 99999 increments
write(incChar,'(i10)') inc
call HDF5_closeGroup(results_addGroup(trim('inc'//trim(adjustl(incChar)))))
call results_setLink(trim('inc'//trim(adjustl(incChar))),'current')
call HDF5_addAttribute(resultsFile,'time/s',time,trim('inc'//trim(adjustl(incChar))))