forked from simaberson/tkmap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplotdrops.gs
263 lines (261 loc) · 5.73 KB
/
plotdrops.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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
'open ens.ctl'
'set grads off'
fname='points'
fname2='hurrloc'
fname3='stnlist0012'
fname4='stnlist00'
fname5='stnlist12'
'set mpdset hires'
i=1
nst = 0
while (1)
res = read(fname)
rc = sublin(res,1)
if(rc != 0)
if(rc = 2)
say 'End of points file'
say nst' flights to be plotted'
say ' '
break
endif
if(rc = 1); say 'rc=1: OPEN ERROR FOR 'fname; endif
if(rc = 8); say 'rc=8: 'fname' OPEN FOR WRITE ONLY'; endif
if(rc = 9); say 'rc=9: I/O ERROR FOR 'fname; endif
return 99
endif
nst = nst + 1
_points.nst = sublin(res,2)
endwhile
nsth = 0
while (1)
res = read(fname2)
rc = sublin(res,1)
if(rc != 0)
if(rc = 2)
say ' '
break
endif
if(rc = 1); say 'rc=1: OPEN ERROR FOR 'fname2; endif
if(rc = 8); say 'rc=8: 'fname2' OPEN FOR WRITE ONLY'; endif
if(rc = 9); say 'rc=9: I/O ERROR FOR 'fname2; endif
return 99
endif
nsth = nsth + 1
_hurrloc.nsth = sublin(res,2)
endwhile
rc = close(fname)
rc = close(fname2)
rc = getbounds(nst)
'set lat '_southlat' '_northlat
'set lon '_westlon' '_eastlon
'set cmin 0'
'set cmax 0'
'd pressfc'
'set line 3 1 6'
ist = 1
while(ist<=nst)
i = 0
while(1)
ret=read(_points.ist)
rc = sublin(ret,1)
if(rc = 2)
break
endif
rec = sublin(ret,2)
xlatll=subwrd(rec,1)
xlonll=-subwrd(rec,2)
turn=substr(rec,18,1)
'query ll2xy 'xlonll' 'xlatll
xdum=sublin(result,1)
xlonxy=subwrd(xdum,1)
xlatxy=subwrd(xdum,2)
if(turn != T)
if(i > 0)
'draw mark 3 'xlonxy' 'xlatxy' 0.175'
'set strsiz 0.15 0.15'
'draw string 'xlonxy+0.08' 'xlatxy+0.08' 'i
'draw line 'xlonold' 'xlatold' 'xlonxy' 'xlatxy
endif
else
if(i = 0)
xlonold=xlonxy
xlatold=xlatxy
endif
'draw line 'xlonold' 'xlatold' 'xlonxy' 'xlatxy
i=i-1
endif
xlonold=xlonxy
xlatold=xlatxy
i=i+1
endwhile
ist = ist + 1
endwhile
xdum=sublin(result,1)
leglon=subwrd(xdum,1)
leglat=subwrd(xdum,2)
modstring='Dropwindsonde'
'query ll2xy '_westlon' '_southlat
'set string 3'
ist = 1
while (ist <= nst)
ret=read(_hurrloc.ist)
rec = sublin(ret,2)
xlatll=subwrd(rec,1)
xlonll=subwrd(rec,2)
'query ll2xy 'xlonll' 'xlatll
xdum=sublin(result,1)
xlonxy=subwrd(xdum,1)
xlatxy=subwrd(xdum,2)
'draw wxsym 41 'xlonxy' 'xlatxy' 0.630'
ist = ist + 1
endwhile
'set line 2'
while (1)
ret=read(fname3)
rc = sublin(ret,1)
if(rc = 2)
break
endif
rec = sublin(ret,2)
xlatll=subwrd(rec,1)
xlonll=subwrd(rec,2)
if (xlonll <= _eastlon)
if(xlonll >= _westlon)
if(xlatll <= _northlat)
if(xlatll >= _southlat)
'query ll2xy 'xlonll' 'xlatll
xdum=sublin(result,1)
xlonxy=subwrd(xdum,1)
xlatxy=subwrd(xdum,2)
'draw mark 3 'xlonxy' 'xlatxy' 0.175'
endif
endif
endif
endif
endwhile
'query ll2xy '_westlon' '_southlat
xdum=sublin(result,1)
leglon=subwrd(xdum,1)
leglat=subwrd(xdum,2)
modstring='00 and 12 UTC Rawinsonde'
'set string 2'
'draw mark 3 'leglon+0.2' 'leglat+0.4' 0.150'
'draw string 'leglon+0.35' 'leglat+0.35' 'modstring
'set line 5'
while (1)
ret=read(fname4)
rc = sublin(ret,1)
if(rc = 2)
break
endif
rec = sublin(ret,2)
xlatll=subwrd(rec,1)
xlonll=subwrd(rec,2)
if (xlonll <= _eastlon)
if(xlonll >= _westlon)
if(xlatll <= _northlat)
if(xlatll >= _southlat)
'query ll2xy 'xlonll' 'xlatll
xdum=sublin(result,1)
xlonxy=subwrd(xdum,1)
xlatxy=subwrd(xdum,2)
set ccolor 3
'draw mark 3 'xlonxy' 'xlatxy' 0.175'
endif
endif
endif
endif
endwhile
'query ll2xy '_westlon' '_southlat
xdum=sublin(result,1)
leglon=subwrd(xdum,1)
leglat=subwrd(xdum,2)
modstring='00 UTC Rawinsonde'
'set string 5'
'draw mark 3 'leglon+0.2' 'leglat+0.6' 0.150'
'draw string 'leglon+0.35' 'leglat+0.55' 'modstring
'set line 9'
while (1)
ret=read(fname5)
rc = sublin(ret,1)
if(rc = 2)
break
endif
rec = sublin(ret,2)
xlatll=subwrd(rec,1)
xlonll=subwrd(rec,2)
if (xlonll <= _eastlon)
if(xlonll >= _westlon)
if(xlatll <= _northlat)
if(xlatll >= _southlat)
'query ll2xy 'xlonll' 'xlatll
xdum=sublin(result,1)
xlonxy=subwrd(xdum,1)
xlatxy=subwrd(xdum,2)
'draw mark 3 'xlonxy' 'xlatxy' 0.175'
endif
endif
endif
endif
endwhile
'query ll2xy '_westlon' '_southlat
xdum=sublin(result,1)
leglon=subwrd(xdum,1)
leglat=subwrd(xdum,2)
modstring='12 UTC Rawinsonde'
'set string 9'
'draw mark 3 'leglon+0.2' 'leglat+0.8' 0.150'
'draw string 'leglon+0.35' 'leglat+0.75' 'modstring
'set line 8'
'gxprint ftk.png png white'
*---------------------------
*
*---------------------------
function getbounds(nst)
* This function looks through the forecast tracks points
* and/or the verification track points and figures out
* which points are the farthest N,E,S and W. Remember,
* we are using degrees positive westward, the TPC standard.
_northlat = -99.0
_southlat = 99.0
_westlon = 361.0
_eastlon = -361.0
ist = 1
while(ist<=nst)
while(1)
res=read(_points.ist)
rc = sublin(res,1)
if(rc = 2)
break
endif
rec = sublin(res,2)
ylat=subwrd(rec,1)
xlon=-subwrd(rec,2)
if (ylat > _northlat)
_northlat = ylat
endif
if (ylat < _southlat)
_southlat = ylat
endif
if (xlon < _westlon)
_westlon = xlon
endif
if (xlon > _eastlon)
_eastlon = xlon
endif
endwhile
res=close(_points.ist)
ist = ist + 1
endwhile
_northlat = _northlat + 5
_southlat = _southlat - 5
_westlon = _westlon - 5
_eastlon = _eastlon + 5
say 'At end of getbounds....'
say ' northlat = '_northlat' southlat = '_southlat
say ' westlon = '_westlon' eastlon = '_eastlon
_origwlon = _westlon
_origelon = _eastlon
_orignlat = _northlat
_origslat = _southlat
return