-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathplt_diff.py
More file actions
26 lines (18 loc) · 832 Bytes
/
plt_diff.py
File metadata and controls
26 lines (18 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""
This is for diffing all the variables in two plt files, each with one zone.
Call it like:
python plt-diff.py path/to/plt-1.plt path/to/plt-2.plt
"""
import numpy as np
import tecplot
import sys
## load the zone we're starting with and the zone we're comparing
tp_data = tecplot.data.load_tecplot([sys.argv[1],sys.argv[2]])
print(sys.argv[0].split('/')[-1],': loaded!')
print(sys.argv[0].split('/')[-1],': Dataset has the following variables')
print([v.name for v in tp_data.variables()])
print(sys.argv[0].split('/')[-1],': Diffing variables!')
## make a dict where each key is a variable and each value is a bool about if there's any difference
vars = {v.name: max(abs(np.array(v.values(0)[:]) - np.array(v.values(1)[:]))) != 0 for v in tp_data.variables()}
for k in vars:
print('{}\t : {}'.format(k, vars[k]))