2019-02-15 04:54:09 +05:30
|
|
|
#!/usr/bin/env python3
|
2015-09-10 03:52:29 +05:30
|
|
|
|
2019-06-14 02:44:40 +05:30
|
|
|
import os
|
|
|
|
import sys
|
2015-09-10 03:52:29 +05:30
|
|
|
from optparse import OptionParser
|
2019-06-14 02:44:40 +05:30
|
|
|
|
2015-09-10 03:52:29 +05:30
|
|
|
import damask
|
|
|
|
|
2016-01-27 22:36:00 +05:30
|
|
|
scriptName = os.path.splitext(os.path.basename(__file__))[0]
|
|
|
|
scriptID = ' '.join([scriptName,damask.version])
|
2015-09-10 03:52:29 +05:30
|
|
|
|
2019-06-14 02:44:40 +05:30
|
|
|
|
2015-09-10 03:52:29 +05:30
|
|
|
# --------------------------------------------------------------------
|
|
|
|
# MAIN
|
|
|
|
# --------------------------------------------------------------------
|
|
|
|
|
2019-02-16 22:55:41 +05:30
|
|
|
parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [ASCIItable(s)]', description = """
|
2019-06-14 02:44:40 +05:30
|
|
|
Append data of ASCIItable(s) column-wise.
|
2015-09-10 03:52:29 +05:30
|
|
|
|
|
|
|
""", version = scriptID)
|
|
|
|
|
|
|
|
parser.add_option('-a', '--add','--table',
|
|
|
|
dest = 'table',
|
|
|
|
action = 'extend', metavar = '<string LIST>',
|
|
|
|
help = 'tables to add')
|
|
|
|
|
|
|
|
(options,filenames) = parser.parse_args()
|
2019-12-23 02:53:48 +05:30
|
|
|
if filenames == []: filenames = [None]
|
2015-09-10 03:52:29 +05:30
|
|
|
|
2019-02-16 19:23:56 +05:30
|
|
|
if options.table is None:
|
2019-12-23 02:53:48 +05:30
|
|
|
parser.error('no table specified.')
|
2015-09-10 03:52:29 +05:30
|
|
|
|
|
|
|
for name in filenames:
|
2019-12-23 02:53:48 +05:30
|
|
|
damask.util.report(scriptName,name)
|
2015-09-10 03:52:29 +05:30
|
|
|
|
2019-12-23 02:53:48 +05:30
|
|
|
table = damask.Table.from_ASCII(StringIO(''.join(sys.stdin.read())) if name is None else name)
|
2015-09-10 03:52:29 +05:30
|
|
|
|
2019-12-23 02:53:48 +05:30
|
|
|
for addTable in options.table:
|
|
|
|
table2 = damask.Table.from_ASCII(addTable)
|
|
|
|
table2.data = table2.data[:table.data.shape[0]]
|
|
|
|
table.join(table2)
|
2015-09-10 03:52:29 +05:30
|
|
|
|
2019-12-23 02:53:48 +05:30
|
|
|
table.to_ASCII(sys.stdout if name is None else name)
|