-
Notifications
You must be signed in to change notification settings - Fork 6
/
diag_budget_kinetic_vavg.gs
executable file
·215 lines (172 loc) · 5.19 KB
/
diag_budget_kinetic_vavg.gs
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
* This script computes one of various diagnostic quantities using
* basic NCEP Reanalysis grids stored in a template netcdf file.
* An assumption is that the calculation domain of interest has been
* specified - RD, Apr `98
function kebvavg(args)
* query file for dimensions of current viewing domain
"q dims"
rec = sublin(result,5)
if (subwrd(rec,3) = "varying")
tmin = subwrd(rec,11)
tmax = subwrd(rec,13)
tvar = "varying"
else
tval = subwrd(rec,9)
tvar = "fixed"
endif
rec = sublin(result,4)
if (subwrd(rec,3) = "varying")
zmin = subwrd(rec,11)
zmax = subwrd(rec,13)
zvar = "varying"
else
zval = subwrd(rec,9)
zvar = "fixed"
endif
rec = sublin(result,3)
if (subwrd(rec,3) = "varying")
ymin = subwrd(rec,11)
ymax = subwrd(rec,13)
yvar = "varying"
else
yval = subwrd(rec,9)
yvar = "fixed"
endif
rec = sublin(result,2)
if (subwrd(rec,3) = "varying")
xmin = subwrd(rec,11)
xmax = subwrd(rec,13)
xvar = "varying"
else
xval = subwrd(rec,9)
xvar = "fixed"
endif
* query file for dimensions of calculation domain
"d timemin"
rec = sublin(result,1)
timemin = subwrd(rec,4)
"d timemax"
rec = sublin(result,1)
timemax = subwrd(rec,4)
"d levmin"
rec = sublin(result,1)
levmin = subwrd(rec,4)
"d levmax"
rec = sublin(result,1)
levmax = subwrd(rec,4)
"d moistmax"
rec = sublin(result,1)
moistmax = subwrd(rec,4)
"d latmin"
rec = sublin(result,1)
latmin = subwrd(rec,4)
"d latmax"
rec = sublin(result,1)
latmax = subwrd(rec,4)
"d lonmin"
rec = sublin(result,1)
lonmin = subwrd(rec,4)
"d lonmax"
rec = sublin(result,1)
lonmax = subwrd(rec,4)
vintpres = args
say ""
say "calculating kinetic energy budget terms, vertically"
say "averaged from the surface to the "vintpres" hPa level"
say ""
say "using the following calculation domain:"
say "time from "timemin" to "timemax
say "lat from "latmin" to "latmax
say "lon from "lonmin" to "lonmax
say ""
say "defining field of 1.0 (assuming lon is defined)..." ; say ""
"set t 1"
"set z 1"
"set lat "latmin" "latmax
"set lon "lonmin" "lonmax
defa = "one = 1.0 + lon - lon"
say " "defa ; say ""
"define "defa
say "computing over time, lat, and lon:" ; say ""
"set t "timemin" "timemax
"set z 1"
"set lat "latmin" "latmax
"set lon "lonmin" "lonmax
defa = "kinemidvavg = vint(sfcpres / 100.0, kinemid, "vintpres") / vint(sfcpres / 100.0, one, "vintpres")"
say " "defa ; say ""
"define "defa
defa = "ukinemidvavg = vint(sfcpres / 100.0, ukinemid, "vintpres") / vint(sfcpres / 100.0, one, "vintpres")"
say " "defa ; say ""
"define "defa
defa = "vkinemidvavg = vint(sfcpres / 100.0, vkinemid, "vintpres") / vint(sfcpres / 100.0, one, "vintpres")"
say " "defa ; say ""
"define "defa
defa = "wkinemidvavg = vint(sfcpres / 100.0, wkinemid, "vintpres") / vint(sfcpres / 100.0, one, "vintpres")"
say " "defa ; say ""
"define "defa
defa = "ktendmidvavg = vint(sfcpres / 100.0, ktendmid, "vintpres") / vint(sfcpres / 100.0, one, "vintpres")"
say " "defa ; say ""
"define "defa
defa = "khfcmidvavg = vint(sfcpres / 100.0, khfcmid, "vintpres") / vint(sfcpres / 100.0, one, "vintpres")"
say " "defa ; say ""
"define "defa
defa = "kvfcmidvavg = vint(sfcpres / 100.0, kvfcmid, "vintpres") / vint(sfcpres / 100.0, one, "vintpres")"
say " "defa ; say ""
"define "defa
defa = "kgenmidvavg = vint(sfcpres / 100.0, kgenmid, "vintpres") / vint(sfcpres / 100.0, one, "vintpres")"
say " "defa ; say ""
"define "defa
defa = "kresmidvavg = vint(sfcpres / 100.0, kresmid, "vintpres") / vint(sfcpres / 100.0, one, "vintpres")"
say " "defa ; say ""
"define "defa
defa = "kabremidvavg = vint(sfcpres / 100.0, kabremid, "vintpres") / vint(sfcpres / 100.0, one, "vintpres")"
say " "defa ; say ""
"define "defa
say "undefining field of 1.0" ; say ""
"undefine one"
say "resetting the original viewing domain" ; say ""
if (tvar = "varying")
"set t "tmin" "tmax
else
"set t "tval
endif
if (zvar = "varying")
"set z "zmin" "zmax
else
"set z "zval
endif
if (yvar = "varying")
"set y "ymin" "ymax
else
"set y "yval
endif
if (xvar = "varying")
"set x "xmin" "xmax
else
"set x "xval
endif
say "re-creating the display script" ; say ""
"run gui_list"
# other formulae:
# time average
#defa = "kinemidavvavg = vint(avsfcp / 100.0, kinemidav, "vintpres") / vint(avsfcp / 100.0, one, "vintpres")"
# say " "defa ; say ""
# "define "defa
#defa = "ktendmidavvavg = vint(avsfcp / 100.0, ktendmidav, "vintpres") / vint(avsfcp / 100.0, one, "vintpres")"
# say " "defa ; say ""
# "define "defa
#defa = "khfcmidavvavg = vint(avsfcp / 100.0, khfcmidav, "vintpres") / vint(avsfcp / 100.0, one, "vintpres")"
# say " "defa ; say ""
# "define "defa
#defa = "kvfcmidavvavg = vint(avsfcp / 100.0, kvfcmidav, "vintpres") / vint(avsfcp / 100.0, one, "vintpres")"
# say " "defa ; say ""
# "define "defa
#defa = "kgenmidavvavg = vint(avsfcp / 100.0, kgenmidav, "vintpres") / vint(avsfcp / 100.0, one, "vintpres")"
# say " "defa ; say ""
# "define "defa
#defa = "kresmidavvavg = vint(avsfcp / 100.0, kresmidav, "vintpres") / vint(avsfcp / 100.0, one, "vintpres")"
# say " "defa ; say ""
# "define "defa
#defa = "kabremidavvavg = vint(avsfcp / 100.0, kabremidav, "vintpres") / vint(avsfcp / 100.0, one, "vintpres")"
# say " "defa ; say ""
# "define "defa