forked from seunghoeku/XGC_reader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxgc-visualization.py
executable file
·47 lines (34 loc) · 1.2 KB
/
xgc-visualization.py
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python
import os
import numpy as np
import matplotlib.pyplot as plt
import adios2
import matplotlib
import argparse
import yaml
import insitu_reader
def SetOptions(options):
known = ['turbulence intensity', 'dphi', 'dA']
for name in known:
if name not in options:
options[name] = {'use': True}
elif 'use' not in options[name]:
options[name]['use'] = True
if 'subsample-factor-3D' not in options:
options['subsample-factor-3D'] = 1
if 'last-step' not in options:
options['last-step'] = None
return options
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("datadir", help="Path to the XGC data directory")
parser.add_argument("-f", "--optsfile", help="Plot options file (YAML)", type=str, default=None)
args = parser.parse_args()
options = {}
if (args.optsfile is not None) and os.path.exists(args.optsfile):
with open(args.optsfile, 'r') as ystream:
options = yaml.load(ystream, Loader=yaml.FullLoader)
options = SetOptions(options)
xgc1 = insitu_reader.xgc1(args.datadir, options)
while xgc1.NotDone():
xgc1.MakePlots()