1 | #! /usr/bin/env python |
---|
2 | from ppclass import pp |
---|
3 | |
---|
4 | ### LMD simulation results |
---|
5 | ### ---------------------- |
---|
6 | ### set object |
---|
7 | lmdu = pp() |
---|
8 | ### set file var coord |
---|
9 | lmdu.file = 'LMD/wrfout_d01_2024-09-08_01:00:00_z' |
---|
10 | lmdu.var = 'Um' |
---|
11 | lmdu.x = -6. |
---|
12 | lmdu.y = -2. |
---|
13 | lmdu.t = 0. |
---|
14 | ### get data |
---|
15 | lmdu.get() |
---|
16 | |
---|
17 | ### MRAMS simulation results |
---|
18 | ### ------------------------ |
---|
19 | ### set object |
---|
20 | mramsu = pp() |
---|
21 | ### get attributes from lmd object |
---|
22 | mramsu << lmdu |
---|
23 | ### OK just change what changes in MRAMS |
---|
24 | mramsu.file = 'MRAMS/mramsout_d01_2024-09-08_01:00:00_z' |
---|
25 | mramsu.var = 'u_areo' |
---|
26 | ### get data |
---|
27 | mramsu.get() |
---|
28 | |
---|
29 | ### THE SAME BUT FOR V |
---|
30 | ### ------------------ |
---|
31 | lmdv = pp() |
---|
32 | lmdv << lmdu |
---|
33 | lmdv.var = 'Vm' |
---|
34 | lmdv.get() |
---|
35 | mramsv = pp() |
---|
36 | mramsv << mramsu |
---|
37 | mramsv.var = 'v_areo' |
---|
38 | mramsv.get() |
---|
39 | |
---|
40 | ### COMPUTE WIND SPEED |
---|
41 | ### ------------------ |
---|
42 | lmd = (lmdu**2+lmdv**2)**0.5 |
---|
43 | mrams = (mramsu**2+mramsv**2)**0.5 |
---|
44 | |
---|
45 | ### NOW PLOT |
---|
46 | ### -------- |
---|
47 | ### define plot for LMD |
---|
48 | ### ... and prepare it so that MRAMS will be superimposed |
---|
49 | lmd.superpose = True |
---|
50 | lmd.defineplot(extraplot=1) |
---|
51 | ### ... add a few personal settings |
---|
52 | lmd.p[0].title = "LMD (blue) vs. MRAMS (red)" |
---|
53 | lmd.p[0].swaplab = False |
---|
54 | lmd.p[0].xlabel = "Wind speed (m s$^{-1})$" |
---|
55 | lmd.p[0].ylabel = "Altitude above MOLA zero datum (km)" |
---|
56 | lmd.p[0].ycoeff = 1./1000. |
---|
57 | ### ... and make plot (no output, wait for extraplot) |
---|
58 | lmd.makeplot() |
---|
59 | ### -------- |
---|
60 | ### define plot for MRAMS |
---|
61 | ### ... say we will plot this in lmd figure |
---|
62 | mrams.plotin = lmd |
---|
63 | mrams.superpose = True |
---|
64 | ### ... and make plot (now there is an output) |
---|
65 | mrams.out = 'png' |
---|
66 | mrams.filename = 'wind_intercomp' |
---|
67 | mrams.plot() |
---|
68 | |
---|
69 | ### COMPUTE REL DIFF in % AND PLOT IT INDEPENDENTLY |
---|
70 | ### ----------------------------------------------- |
---|
71 | diff = ((lmd-mrams)/(lmd*0.5+mrams*0.5))*100. |
---|
72 | diff.filename = 'wind_intercomp_diff' |
---|
73 | diff.superpose = False |
---|
74 | diff.out = 'png' |
---|
75 | diff.defineplot() |
---|
76 | diff.p[0].title = "" |
---|
77 | diff.p[0].swaplab = False |
---|
78 | diff.p[0].xlabel = "Relative difference in wind LMD vs. MRAMS (%)" |
---|
79 | diff.p[0].ylabel = "Altitude above MOLA zero datum (km)" |
---|
80 | diff.p[0].ycoeff = 1./1000. |
---|
81 | diff.makeplot() |
---|
82 | |
---|
83 | ### SAME FOR TEMPERATURE |
---|
84 | ### -------------------- |
---|
85 | lmdt = pp() |
---|
86 | lmdt << lmdu |
---|
87 | lmdt.var = 'tk' |
---|
88 | lmdt.get() |
---|
89 | mramst = pp() |
---|
90 | mramst << mramsu |
---|
91 | mramst.var = 'tk' |
---|
92 | mramst.get() |
---|
93 | difft = ((lmdt-mramst)/(lmdt*0.5+mramst*0.5))*100. |
---|
94 | difft.defineplot() |
---|
95 | difft.filename = 'temp_intercomp_diff' |
---|
96 | difft.superpose = False |
---|
97 | difft.out = 'png' |
---|
98 | difft.defineplot() |
---|
99 | difft.p[0].title = "" |
---|
100 | difft.p[0].swaplab = False |
---|
101 | difft.p[0].xlabel = "Relative difference in temperature LMD vs. MRAMS (%)" |
---|
102 | difft.p[0].ylabel = "Altitude above MOLA zero datum (km)" |
---|
103 | difft.p[0].ycoeff = 1./1000. |
---|
104 | difft.makeplot() |
---|
105 | |
---|
106 | ### TEMPERATURE |
---|
107 | ############### |
---|
108 | |
---|
109 | int = pp() |
---|
110 | int.file = ['LMD/wrfout_d01_2024-09-08_01:00:00_z','MRAMS/mramsout_d01_2024-09-08_01:00:00_z'] |
---|
111 | int.var = 'tk' |
---|
112 | int.x = -6. |
---|
113 | int.y = -2. |
---|
114 | int.t = 0. |
---|
115 | int.out = 'png' |
---|
116 | int.filename = 'temp_intercomp' |
---|
117 | int.superpose = True |
---|
118 | int.getdefineplot() |
---|
119 | |
---|
120 | int.p[0].title = "LMD (blue) vs. MRAMS (red)" |
---|
121 | int.p[0].swaplab = False |
---|
122 | int.p[0].ylabel = "Altitude above MOLA zero datum (km)" |
---|
123 | int.p[0].ycoeff = 1./1000. |
---|
124 | int.p[0].title = lmd.p[0].title |
---|
125 | int.p[0].xlabel = "Temperature (K)" |
---|
126 | |
---|
127 | int.makeplot() |
---|
128 | |
---|