forked from python-hydro/pyro2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_thumbnail.py
More file actions
executable file
·46 lines (26 loc) · 927 Bytes
/
Copy pathplot_thumbnail.py
File metadata and controls
executable file
·46 lines (26 loc) · 927 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
import sys
import mesh.patch as patch
# plot an output file using the solver's dovis script
def makeplot(myd, variable):
plt.figure(num=1, figsize=(1.28,1.28), dpi=100, facecolor='w')
var = myd.get_var(variable)
#u = myd.get_var("x-velocity")
#v = myd.get_var("y-velocity")
#var = np.sqrt(u*u + v*v)
myg = myd.grid
img = plt.imshow(np.transpose(var[myg.ilo:myg.ihi+1,myg.jlo:myg.jhi+1]),
interpolation="nearest", origin="lower",
extent=[myg.xmin, myg.xmax, myg.ymin, myg.ymax])
plt.axis("off")
plt.subplots_adjust(bottom=0.0, top=1.0, left=0.0, right=1.0)
plt.savefig("plot.png")
plt.show()
if __name__== "__main__":
print(sys.argv)
file = sys.argv[1]
variable = sys.argv[2]
myg, myd = patch.read(file)
makeplot(myd, variable)