corrected bug that added index column values as first output
This commit is contained in:
parent
20c5ccc112
commit
231f05e142
|
@ -57,6 +57,8 @@ if options.asciitable is not None and os.path.isfile(options.asciitable):
|
||||||
if len(missing_labels) > 0:
|
if len(missing_labels) > 0:
|
||||||
damask.util.croak('column{} {} not found...'.format('s' if len(missing_labels) > 1 else '',', '.join(missing_labels)))
|
damask.util.croak('column{} {} not found...'.format('s' if len(missing_labels) > 1 else '',', '.join(missing_labels)))
|
||||||
|
|
||||||
|
index = mappedTable.data[:,0]
|
||||||
|
data = mappedTable.data[:,1:]
|
||||||
else:
|
else:
|
||||||
parser.error('no indexed ASCIItable given.')
|
parser.error('no indexed ASCIItable given.')
|
||||||
|
|
||||||
|
@ -90,6 +92,7 @@ for name in filenames:
|
||||||
|
|
||||||
table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:]))
|
table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:]))
|
||||||
table.labels_append(mappedTable.labels(raw = True)[1:]) # extend with new labels (except for mapped column)
|
table.labels_append(mappedTable.labels(raw = True)[1:]) # extend with new labels (except for mapped column)
|
||||||
|
|
||||||
table.head_write()
|
table.head_write()
|
||||||
|
|
||||||
# ------------------------------------------ process data ------------------------------------------
|
# ------------------------------------------ process data ------------------------------------------
|
||||||
|
@ -97,10 +100,9 @@ for name in filenames:
|
||||||
outputAlive = True
|
outputAlive = True
|
||||||
while outputAlive and table.data_read(): # read next data line of ASCII table
|
while outputAlive and table.data_read(): # read next data line of ASCII table
|
||||||
try:
|
try:
|
||||||
table.data_append(mappedTable.data[np.argwhere(mappedTable.data[:,0] ==
|
table.data_append(data[np.argwhere(index == float(table.data[mappedColumn]))[0]]) # add data from first matching line
|
||||||
float(table.data[mappedColumn]))[0]]) # add data from first matching line
|
|
||||||
except IndexError:
|
except IndexError:
|
||||||
table.data_append(np.nan*np.ones_like(mappedTable.data[0])) # or add NaNs
|
table.data_append(np.nan*np.ones_like(data[0])) # or add NaNs
|
||||||
outputAlive = table.data_write() # output processed line
|
outputAlive = table.data_write() # output processed line
|
||||||
|
|
||||||
# ------------------------------------------ output finalization -----------------------------------
|
# ------------------------------------------ output finalization -----------------------------------
|
||||||
|
|
Loading…
Reference in New Issue