consistent and correct number of leading zeros
This commit is contained in:
parent
b5899b51e1
commit
0871111c11
|
@ -59,15 +59,18 @@ options = parser.parse_args()
|
||||||
|
|
||||||
for filename in options.filenames:
|
for filename in options.filenames:
|
||||||
f = damask.Result(filename)
|
f = damask.Result(filename)
|
||||||
|
N_digits = int(np.floor(np.log10(int(f.increments[-1][3:]))))+1
|
||||||
|
|
||||||
f.pick('increments',options.inc)
|
f.pick('increments',options.inc)
|
||||||
for increment in damask.util.show_progress(f.iterate('increments'),len(f.selection['increments'])):
|
for inc in damask.util.show_progress(f.iterate('increments'),len(f.selection['increments'])):
|
||||||
dirname = os.path.abspath(os.path.join(os.path.dirname(filename),options.dir))
|
dirname = os.path.abspath(os.path.join(os.path.dirname(filename),options.dir))
|
||||||
try:
|
try:
|
||||||
os.mkdir(dirname)
|
os.mkdir(dirname)
|
||||||
except FileExistsError:
|
except FileExistsError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
o = h5py.File(dirname + '/' + os.path.splitext(filename)[0] + '_{}.dream3D'.format(increment),'w')
|
o = h5py.File(dirname + '/' + os.path.splitext(filename)[0] \
|
||||||
|
+ 'inc_{}.dream3D'.format(inc[3:].zfill(N_digits)),'w')
|
||||||
o.attrs['DADF5toDREAM3D'] = '1.0'
|
o.attrs['DADF5toDREAM3D'] = '1.0'
|
||||||
o.attrs['FileVersion'] = '7.0'
|
o.attrs['FileVersion'] = '7.0'
|
||||||
|
|
||||||
|
|
|
@ -1039,7 +1039,7 @@ class Result:
|
||||||
elif mode.lower()=='point':
|
elif mode.lower()=='point':
|
||||||
v = VTK.from_polyData(self.cell_coordinates())
|
v = VTK.from_polyData(self.cell_coordinates())
|
||||||
|
|
||||||
N_digits = int(np.floor(np.log10(min(int(self.increments[-1][3:]),1))))+1
|
N_digits = int(np.floor(np.log10(int(self.increments[-1][3:]))))+1
|
||||||
|
|
||||||
for i,inc in enumerate(util.show_progress(self.iterate('increments'),len(self.selection['increments']))):
|
for i,inc in enumerate(util.show_progress(self.iterate('increments'),len(self.selection['increments']))):
|
||||||
|
|
||||||
|
|
|
@ -258,7 +258,7 @@ def scale_to_coprime(v):
|
||||||
return m//reduce(np.gcd,m)
|
return m//reduce(np.gcd,m)
|
||||||
|
|
||||||
|
|
||||||
class return_message():
|
class return_message:
|
||||||
"""Object with formatted return message."""
|
"""Object with formatted return message."""
|
||||||
|
|
||||||
def __init__(self,message):
|
def __init__(self,message):
|
||||||
|
|
Loading…
Reference in New Issue