-
Notifications
You must be signed in to change notification settings - Fork 6
/
diag_charney_ellip_vavg.gs
executable file
·146 lines (122 loc) · 2.78 KB
/
diag_charney_ellip_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
* 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 vertkeb(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 the Charney (1955) balance ellipticity term, 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 temporary grid over lat and lon:" ; 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 = "ellipvavg = vint(sfcpres / 100.0, ellip, "vintpres") / vint(sfcpres / 100.0, one, "vintpres")"
say " "defa ; say ""
"define "defa
say "undefining temporary grid" ; 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"