syntax polish
This commit is contained in:
parent
0a35761636
commit
b04c5801a5
|
@ -28,12 +28,12 @@ from optparse import OptionParser
|
||||||
|
|
||||||
|
|
||||||
scriptName = os.path.splitext(os.path.basename(__file__))[0]
|
scriptName = os.path.splitext(os.path.basename(__file__))[0]
|
||||||
scriptID = ' '.join([scriptName,damask.version])
|
scriptID = ' '.join([scriptName, damask.version])
|
||||||
|
|
||||||
|
|
||||||
# ----- helper function ----- #
|
# ----- helper function ----- #
|
||||||
def get_rectMshVectors(xyz_array, posNum):
|
def get_rectMshVectors(xyz_array, posNum):
|
||||||
"""take in a xyz array from rectangular mesh and figure out Vx, Vy, Vz"""
|
"""Get Vx, Vy, Vz for rectLinear grid"""
|
||||||
# need some improvement, and only works for rectangular grid
|
# need some improvement, and only works for rectangular grid
|
||||||
v = sorted(list(set(xyz_array[:, posNum])))
|
v = sorted(list(set(xyz_array[:, posNum])))
|
||||||
v_interval = (v[2]+v[1])/2.0 - (v[1]+v[0])/2.0
|
v_interval = (v[2]+v[1])/2.0 - (v[1]+v[0])/2.0
|
||||||
|
@ -46,24 +46,23 @@ def get_rectMshVectors(xyz_array, posNum):
|
||||||
# ----- MAIN ---- #
|
# ----- MAIN ---- #
|
||||||
desp_msg = "Convert DAMASK ascii table to HDF5 file"
|
desp_msg = "Convert DAMASK ascii table to HDF5 file"
|
||||||
parser = OptionParser(option_class=damask.extendableOption,
|
parser = OptionParser(option_class=damask.extendableOption,
|
||||||
usage='%prog options [file[s]]',
|
usage='%prog options [file[s]]',
|
||||||
description = desp_msg,
|
description=desp_msg,
|
||||||
version = scriptID)
|
version=scriptID)
|
||||||
parser.add_option('-D', '--DefinitionFile',
|
parser.add_option('-D', '--DefinitionFile',
|
||||||
dest = 'storage definition file',
|
dest='storage definition file',
|
||||||
type = 'string',
|
type='string',
|
||||||
metavar = 'string',
|
metavar='string',
|
||||||
help = 'definition file for H5 data storage')
|
help='definition file for H5 data storage')
|
||||||
parser.add_option('-p',
|
parser.add_option('-p', '--pos', '--position',
|
||||||
'--pos', '--position',
|
dest='pos',
|
||||||
dest = 'pos',
|
type='string', metavar='string',
|
||||||
type = 'string', metavar = 'string',
|
help='label of coordinates [%default]')
|
||||||
help = 'label of coordinates [%default]')
|
|
||||||
|
|
||||||
parser.set_defaults(DefinitionFile='default',
|
parser.set_defaults(DefinitionFile='default',
|
||||||
pos='pos')
|
pos='pos')
|
||||||
|
|
||||||
(options,filenames) = parser.parse_args()
|
(options, filenames) = parser.parse_args()
|
||||||
|
|
||||||
filename = filenames[0]
|
filename = filenames[0]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue