@@ -1,2077 +1,2177 | |||
|
1 | 1 | import os |
|
2 | 2 | import datetime |
|
3 | 3 | import numpy |
|
4 | 4 | import inspect |
|
5 | 5 | from figure import Figure, isRealtime, isTimeInHourRange |
|
6 | 6 | from plotting_codes import * |
|
7 | 7 | |
|
8 | 8 | |
|
9 | 9 | class MomentsPlot(Figure): |
|
10 | 10 | |
|
11 | 11 | isConfig = None |
|
12 | 12 | __nsubplots = None |
|
13 | 13 | |
|
14 | 14 | WIDTHPROF = None |
|
15 | 15 | HEIGHTPROF = None |
|
16 | 16 | PREFIX = 'prm' |
|
17 | 17 | |
|
18 | 18 | parameters = { |
|
19 | 19 | 'id': global_type_string, |
|
20 | 20 | 'wintitle': global_type_string, |
|
21 | 21 | 'channelList': global_type_list, |
|
22 | 22 | 'showprofile': global_type_boolean, |
|
23 | 23 | 'xmin': global_type_float, |
|
24 | 24 | 'xmax': global_type_float, |
|
25 | 25 | 'ymin': global_type_float, |
|
26 | 26 | 'ymax': global_type_float, |
|
27 | 27 | 'zmin': global_type_float, |
|
28 | 28 | 'zmax': global_type_float, |
|
29 | 29 | 'save': global_type_boolean, |
|
30 | 30 | 'figpath': global_type_string, |
|
31 | 31 | 'figfile': global_type_string, |
|
32 | 32 | 'show': global_type_boolean, |
|
33 | 33 | 'ftp': global_type_boolean, |
|
34 | 34 | 'wr_period': global_type_integer, |
|
35 | 35 | 'server': global_type_string, |
|
36 | 36 | 'folder': global_type_string, |
|
37 | 37 | 'username': global_type_string, |
|
38 | 38 | 'password': global_type_string, |
|
39 | 39 | 'ftp_wei': global_type_string, |
|
40 | 40 | 'exp_code': global_type_integer, |
|
41 | 41 | 'sub_exp_code': global_type_integer, |
|
42 | 42 | 'plot_pos': global_type_integer, |
|
43 | 43 | 'realtime': global_type_boolean, |
|
44 | 44 | } |
|
45 | 45 | |
|
46 | 46 | def __init__(self, **kwargs): |
|
47 | 47 | Figure.__init__(self, **kwargs) |
|
48 | 48 | self.isConfig = False |
|
49 | 49 | self.__nsubplots = 1 |
|
50 | 50 | |
|
51 | 51 | self.WIDTH = 280 |
|
52 | 52 | self.HEIGHT = 250 |
|
53 | 53 | self.WIDTHPROF = 120 |
|
54 | 54 | self.HEIGHTPROF = 0 |
|
55 | 55 | self.counter_imagwr = 0 |
|
56 | 56 | |
|
57 | 57 | self.PLOT_CODE = MOMENTS_CODE |
|
58 | 58 | |
|
59 | 59 | self.FTP_WEI = None |
|
60 | 60 | self.EXP_CODE = None |
|
61 | 61 | self.SUB_EXP_CODE = None |
|
62 | 62 | self.PLOT_POS = None |
|
63 | 63 | |
|
64 | 64 | def getSubplots(self): |
|
65 | 65 | |
|
66 | 66 | ncol = int(numpy.sqrt(self.nplots)+0.9) |
|
67 | 67 | nrow = int(self.nplots*1./ncol + 0.9) |
|
68 | 68 | |
|
69 | 69 | return nrow, ncol |
|
70 | 70 | |
|
71 | 71 | def setup(self, id, nplots, wintitle, showprofile=True, show=True): |
|
72 | 72 | |
|
73 | 73 | self.__showprofile = showprofile |
|
74 | 74 | self.nplots = nplots |
|
75 | 75 | |
|
76 | 76 | ncolspan = 1 |
|
77 | 77 | colspan = 1 |
|
78 | 78 | if showprofile: |
|
79 | 79 | ncolspan = 3 |
|
80 | 80 | colspan = 2 |
|
81 | 81 | self.__nsubplots = 2 |
|
82 | 82 | |
|
83 | 83 | self.createFigure(id = id, |
|
84 | 84 | wintitle = wintitle, |
|
85 | 85 | widthplot = self.WIDTH + self.WIDTHPROF, |
|
86 | 86 | heightplot = self.HEIGHT + self.HEIGHTPROF, |
|
87 | 87 | show=show) |
|
88 | 88 | |
|
89 | 89 | nrow, ncol = self.getSubplots() |
|
90 | 90 | |
|
91 | 91 | counter = 0 |
|
92 | 92 | for y in range(nrow): |
|
93 | 93 | for x in range(ncol): |
|
94 | 94 | |
|
95 | 95 | if counter >= self.nplots: |
|
96 | 96 | break |
|
97 | 97 | |
|
98 | 98 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
99 | 99 | |
|
100 | 100 | if showprofile: |
|
101 | 101 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1) |
|
102 | 102 | |
|
103 | 103 | counter += 1 |
|
104 | 104 | |
|
105 | 105 | def run(self, dataOut, id, wintitle="", channelList=None, showprofile=True, |
|
106 | 106 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, |
|
107 | 107 | save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1, |
|
108 | 108 | server=None, folder=None, username=None, password=None, |
|
109 | 109 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0, realtime=False): |
|
110 | 110 | |
|
111 | 111 | """ |
|
112 | 112 | |
|
113 | 113 | Input: |
|
114 | 114 | dataOut : |
|
115 | 115 | id : |
|
116 | 116 | wintitle : |
|
117 | 117 | channelList : |
|
118 | 118 | showProfile : |
|
119 | 119 | xmin : None, |
|
120 | 120 | xmax : None, |
|
121 | 121 | ymin : None, |
|
122 | 122 | ymax : None, |
|
123 | 123 | zmin : None, |
|
124 | 124 | zmax : None |
|
125 | 125 | """ |
|
126 | 126 | |
|
127 | 127 | if dataOut.flagNoData: |
|
128 | 128 | return None |
|
129 | 129 | |
|
130 | 130 | if realtime: |
|
131 | 131 | if not(isRealtime(utcdatatime = dataOut.utctime)): |
|
132 | 132 | print 'Skipping this plot function' |
|
133 | 133 | return |
|
134 | 134 | |
|
135 | 135 | if channelList == None: |
|
136 | 136 | channelIndexList = dataOut.channelIndexList |
|
137 | 137 | else: |
|
138 | 138 | channelIndexList = [] |
|
139 | 139 | for channel in channelList: |
|
140 | 140 | if channel not in dataOut.channelList: |
|
141 | 141 | raise ValueError, "Channel %d is not in dataOut.channelList" |
|
142 | 142 | channelIndexList.append(dataOut.channelList.index(channel)) |
|
143 | 143 | |
|
144 | 144 | factor = dataOut.normFactor |
|
145 | 145 | x = dataOut.abscissaList |
|
146 | 146 | y = dataOut.heightList |
|
147 | 147 | |
|
148 | 148 | z = dataOut.data_pre[channelIndexList,:,:]/factor |
|
149 | 149 | z = numpy.where(numpy.isfinite(z), z, numpy.NAN) |
|
150 | 150 | avg = numpy.average(z, axis=1) |
|
151 | 151 | noise = dataOut.noise/factor |
|
152 | 152 | |
|
153 | 153 | zdB = 10*numpy.log10(z) |
|
154 | 154 | avgdB = 10*numpy.log10(avg) |
|
155 | 155 | noisedB = 10*numpy.log10(noise) |
|
156 | 156 | |
|
157 | 157 | #thisDatetime = dataOut.datatime |
|
158 | 158 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) |
|
159 | 159 | title = wintitle + " Parameters" |
|
160 | 160 | xlabel = "Velocity (m/s)" |
|
161 | 161 | ylabel = "Range (Km)" |
|
162 | 162 | |
|
163 | 163 | update_figfile = False |
|
164 | 164 | |
|
165 | 165 | if not self.isConfig: |
|
166 | 166 | |
|
167 | 167 | nplots = len(channelIndexList) |
|
168 | 168 | |
|
169 | 169 | self.setup(id=id, |
|
170 | 170 | nplots=nplots, |
|
171 | 171 | wintitle=wintitle, |
|
172 | 172 | showprofile=showprofile, |
|
173 | 173 | show=show) |
|
174 | 174 | |
|
175 | 175 | if xmin == None: xmin = numpy.nanmin(x) |
|
176 | 176 | if xmax == None: xmax = numpy.nanmax(x) |
|
177 | 177 | if ymin == None: ymin = numpy.nanmin(y) |
|
178 | 178 | if ymax == None: ymax = numpy.nanmax(y) |
|
179 | 179 | if zmin == None: zmin = numpy.nanmin(avgdB)*0.9 |
|
180 | 180 | if zmax == None: zmax = numpy.nanmax(avgdB)*0.9 |
|
181 | 181 | |
|
182 | 182 | self.FTP_WEI = ftp_wei |
|
183 | 183 | self.EXP_CODE = exp_code |
|
184 | 184 | self.SUB_EXP_CODE = sub_exp_code |
|
185 | 185 | self.PLOT_POS = plot_pos |
|
186 | 186 | |
|
187 | 187 | self.isConfig = True |
|
188 | 188 | update_figfile = True |
|
189 | 189 | |
|
190 | 190 | self.setWinTitle(title) |
|
191 | 191 | |
|
192 | 192 | for i in range(self.nplots): |
|
193 | 193 | str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S")) |
|
194 | 194 | title = "Channel %d: %4.2fdB: %s" %(dataOut.channelList[i], noisedB[i], str_datetime) |
|
195 | 195 | axes = self.axesList[i*self.__nsubplots] |
|
196 | 196 | axes.pcolor(x, y, zdB[i,:,:], |
|
197 | 197 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
198 | 198 | xlabel=xlabel, ylabel=ylabel, title=title, |
|
199 | 199 | ticksize=9, cblabel='') |
|
200 | 200 | #Mean Line |
|
201 | 201 | mean = dataOut.data_param[i, 1, :] |
|
202 | 202 | axes.addpline(mean, y, idline=0, color="black", linestyle="solid", lw=1) |
|
203 | 203 | |
|
204 | 204 | if self.__showprofile: |
|
205 | 205 | axes = self.axesList[i*self.__nsubplots +1] |
|
206 | 206 | axes.pline(avgdB[i], y, |
|
207 | 207 | xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax, |
|
208 | 208 | xlabel='dB', ylabel='', title='', |
|
209 | 209 | ytick_visible=False, |
|
210 | 210 | grid='x') |
|
211 | 211 | |
|
212 | 212 | noiseline = numpy.repeat(noisedB[i], len(y)) |
|
213 | 213 | axes.addpline(noiseline, y, idline=1, color="black", linestyle="dashed", lw=2) |
|
214 | 214 | |
|
215 | 215 | self.draw() |
|
216 | 216 | |
|
217 | 217 | self.save(figpath=figpath, |
|
218 | 218 | figfile=figfile, |
|
219 | 219 | save=save, |
|
220 | 220 | ftp=ftp, |
|
221 | 221 | wr_period=wr_period, |
|
222 | 222 | thisDatetime=thisDatetime) |
|
223 | 223 | |
|
224 | 224 | |
|
225 | 225 | |
|
226 | 226 | class SkyMapPlot(Figure): |
|
227 | 227 | |
|
228 | 228 | __isConfig = None |
|
229 | 229 | __nsubplots = None |
|
230 | 230 | |
|
231 | 231 | WIDTHPROF = None |
|
232 | 232 | HEIGHTPROF = None |
|
233 | 233 | PREFIX = 'mmap' |
|
234 | 234 | |
|
235 | 235 | def __init__(self, **kwargs): |
|
236 | 236 | Figure.__init__(self, **kwargs) |
|
237 | 237 | self.isConfig = False |
|
238 | 238 | self.__nsubplots = 1 |
|
239 | 239 | |
|
240 | 240 | # self.WIDTH = 280 |
|
241 | 241 | # self.HEIGHT = 250 |
|
242 | 242 | self.WIDTH = 600 |
|
243 | 243 | self.HEIGHT = 600 |
|
244 | 244 | self.WIDTHPROF = 120 |
|
245 | 245 | self.HEIGHTPROF = 0 |
|
246 | 246 | self.counter_imagwr = 0 |
|
247 | 247 | |
|
248 | 248 | self.PLOT_CODE = MSKYMAP_CODE |
|
249 | 249 | |
|
250 | 250 | self.FTP_WEI = None |
|
251 | 251 | self.EXP_CODE = None |
|
252 | 252 | self.SUB_EXP_CODE = None |
|
253 | 253 | self.PLOT_POS = None |
|
254 | 254 | |
|
255 | 255 | def getSubplots(self): |
|
256 | 256 | |
|
257 | 257 | ncol = int(numpy.sqrt(self.nplots)+0.9) |
|
258 | 258 | nrow = int(self.nplots*1./ncol + 0.9) |
|
259 | 259 | |
|
260 | 260 | return nrow, ncol |
|
261 | 261 | |
|
262 | 262 | def setup(self, id, nplots, wintitle, showprofile=False, show=True): |
|
263 | 263 | |
|
264 | 264 | self.__showprofile = showprofile |
|
265 | 265 | self.nplots = nplots |
|
266 | 266 | |
|
267 | 267 | ncolspan = 1 |
|
268 | 268 | colspan = 1 |
|
269 | 269 | |
|
270 | 270 | self.createFigure(id = id, |
|
271 | 271 | wintitle = wintitle, |
|
272 | 272 | widthplot = self.WIDTH, #+ self.WIDTHPROF, |
|
273 | 273 | heightplot = self.HEIGHT,# + self.HEIGHTPROF, |
|
274 | 274 | show=show) |
|
275 | 275 | |
|
276 | 276 | nrow, ncol = 1,1 |
|
277 | 277 | counter = 0 |
|
278 | 278 | x = 0 |
|
279 | 279 | y = 0 |
|
280 | 280 | self.addAxes(1, 1, 0, 0, 1, 1, True) |
|
281 | 281 | |
|
282 | 282 | def run(self, dataOut, id, wintitle="", channelList=None, showprofile=False, |
|
283 | 283 | tmin=0, tmax=24, timerange=None, |
|
284 | 284 | save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1, |
|
285 | 285 | server=None, folder=None, username=None, password=None, |
|
286 | 286 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0, realtime=False): |
|
287 | 287 | |
|
288 | 288 | """ |
|
289 | 289 | |
|
290 | 290 | Input: |
|
291 | 291 | dataOut : |
|
292 | 292 | id : |
|
293 | 293 | wintitle : |
|
294 | 294 | channelList : |
|
295 | 295 | showProfile : |
|
296 | 296 | xmin : None, |
|
297 | 297 | xmax : None, |
|
298 | 298 | ymin : None, |
|
299 | 299 | ymax : None, |
|
300 | 300 | zmin : None, |
|
301 | 301 | zmax : None |
|
302 | 302 | """ |
|
303 | 303 | |
|
304 | 304 | arrayParameters = dataOut.data_param |
|
305 | 305 | error = arrayParameters[:,-1] |
|
306 | 306 | indValid = numpy.where(error == 0)[0] |
|
307 | 307 | finalMeteor = arrayParameters[indValid,:] |
|
308 | 308 | finalAzimuth = finalMeteor[:,3] |
|
309 | 309 | finalZenith = finalMeteor[:,4] |
|
310 | 310 | |
|
311 | 311 | x = finalAzimuth*numpy.pi/180 |
|
312 | 312 | y = finalZenith |
|
313 | 313 | x1 = [dataOut.ltctime, dataOut.ltctime] |
|
314 | 314 | |
|
315 | 315 | #thisDatetime = dataOut.datatime |
|
316 | 316 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.ltctime) |
|
317 | 317 | title = wintitle + " Parameters" |
|
318 | 318 | xlabel = "Zonal Zenith Angle (deg) " |
|
319 | 319 | ylabel = "Meridional Zenith Angle (deg)" |
|
320 | 320 | update_figfile = False |
|
321 | 321 | |
|
322 | 322 | if not self.isConfig: |
|
323 | 323 | |
|
324 | 324 | nplots = 1 |
|
325 | 325 | |
|
326 | 326 | self.setup(id=id, |
|
327 | 327 | nplots=nplots, |
|
328 | 328 | wintitle=wintitle, |
|
329 | 329 | showprofile=showprofile, |
|
330 | 330 | show=show) |
|
331 | 331 | |
|
332 | 332 | if self.xmin is None and self.xmax is None: |
|
333 | 333 | self.xmin, self.xmax = self.getTimeLim(x1, tmin, tmax, timerange) |
|
334 | 334 | |
|
335 | 335 | if timerange != None: |
|
336 | 336 | self.timerange = timerange |
|
337 | 337 | else: |
|
338 | 338 | self.timerange = self.xmax - self.xmin |
|
339 | 339 | |
|
340 | 340 | self.FTP_WEI = ftp_wei |
|
341 | 341 | self.EXP_CODE = exp_code |
|
342 | 342 | self.SUB_EXP_CODE = sub_exp_code |
|
343 | 343 | self.PLOT_POS = plot_pos |
|
344 | 344 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
345 | 345 | self.firstdate = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S")) |
|
346 | 346 | self.isConfig = True |
|
347 | 347 | update_figfile = True |
|
348 | 348 | |
|
349 | 349 | self.setWinTitle(title) |
|
350 | 350 | |
|
351 | 351 | i = 0 |
|
352 | 352 | str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S")) |
|
353 | 353 | |
|
354 | 354 | axes = self.axesList[i*self.__nsubplots] |
|
355 | 355 | nevents = axes.x_buffer.shape[0] + x.shape[0] |
|
356 | 356 | title = "Meteor Detection Sky Map\n %s - %s \n Number of events: %5.0f\n" %(self.firstdate,str_datetime,nevents) |
|
357 | 357 | axes.polar(x, y, |
|
358 | 358 | title=title, xlabel=xlabel, ylabel=ylabel, |
|
359 | 359 | ticksize=9, cblabel='') |
|
360 | 360 | |
|
361 | 361 | self.draw() |
|
362 | 362 | |
|
363 | 363 | self.save(figpath=figpath, |
|
364 | 364 | figfile=figfile, |
|
365 | 365 | save=save, |
|
366 | 366 | ftp=ftp, |
|
367 | 367 | wr_period=wr_period, |
|
368 | 368 | thisDatetime=thisDatetime, |
|
369 | 369 | update_figfile=update_figfile) |
|
370 | 370 | |
|
371 | 371 | if dataOut.ltctime >= self.xmax: |
|
372 | 372 | self.isConfigmagwr = wr_period |
|
373 | 373 | self.isConfig = False |
|
374 | 374 | update_figfile = True |
|
375 | 375 | axes.__firsttime = True |
|
376 | 376 | self.xmin += self.timerange |
|
377 | 377 | self.xmax += self.timerange |
|
378 | 378 | |
|
379 | 379 | |
|
380 | 380 | |
|
381 | 381 | |
|
382 | 382 | class WindProfilerPlot(Figure): |
|
383 | 383 | |
|
384 | 384 | __isConfig = None |
|
385 | 385 | __nsubplots = None |
|
386 | 386 | |
|
387 | 387 | WIDTHPROF = None |
|
388 | 388 | HEIGHTPROF = None |
|
389 | 389 | PREFIX = 'wind' |
|
390 | 390 | |
|
391 | 391 | def __init__(self, **kwargs): |
|
392 | 392 | Figure.__init__(self, **kwargs) |
|
393 | 393 | self.timerange = None |
|
394 | 394 | self.isConfig = False |
|
395 | 395 | self.__nsubplots = 1 |
|
396 | 396 | |
|
397 | 397 | self.WIDTH = 800 |
|
398 | 398 | self.HEIGHT = 300 |
|
399 | 399 | self.WIDTHPROF = 120 |
|
400 | 400 | self.HEIGHTPROF = 0 |
|
401 | 401 | self.counter_imagwr = 0 |
|
402 | 402 | |
|
403 | 403 | self.PLOT_CODE = WIND_CODE |
|
404 | 404 | |
|
405 | 405 | self.FTP_WEI = None |
|
406 | 406 | self.EXP_CODE = None |
|
407 | 407 | self.SUB_EXP_CODE = None |
|
408 | 408 | self.PLOT_POS = None |
|
409 | 409 | self.tmin = None |
|
410 | 410 | self.tmax = None |
|
411 | 411 | |
|
412 | 412 | self.xmin = None |
|
413 | 413 | self.xmax = None |
|
414 | 414 | |
|
415 | 415 | self.figfile = None |
|
416 | 416 | |
|
417 | 417 | def getSubplots(self): |
|
418 | 418 | |
|
419 | 419 | ncol = 1 |
|
420 | 420 | nrow = self.nplots |
|
421 | 421 | |
|
422 | 422 | return nrow, ncol |
|
423 | 423 | |
|
424 | 424 | def setup(self, id, nplots, wintitle, showprofile=True, show=True): |
|
425 | 425 | |
|
426 | 426 | self.__showprofile = showprofile |
|
427 | 427 | self.nplots = nplots |
|
428 | 428 | |
|
429 | 429 | ncolspan = 1 |
|
430 | 430 | colspan = 1 |
|
431 | 431 | |
|
432 | 432 | self.createFigure(id = id, |
|
433 | 433 | wintitle = wintitle, |
|
434 | 434 | widthplot = self.WIDTH + self.WIDTHPROF, |
|
435 | 435 | heightplot = self.HEIGHT + self.HEIGHTPROF, |
|
436 | 436 | show=show) |
|
437 | 437 | |
|
438 | 438 | nrow, ncol = self.getSubplots() |
|
439 | 439 | |
|
440 | 440 | counter = 0 |
|
441 | 441 | for y in range(nrow): |
|
442 | 442 | if counter >= self.nplots: |
|
443 | 443 | break |
|
444 | 444 | |
|
445 | 445 | self.addAxes(nrow, ncol*ncolspan, y, 0, colspan, 1) |
|
446 | 446 | counter += 1 |
|
447 | 447 | |
|
448 | 448 | def run(self, dataOut, id, wintitle="", channelList=None, showprofile='False', |
|
449 | 449 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, |
|
450 | 450 | zmax_ver = None, zmin_ver = None, SNRmin = None, SNRmax = None, |
|
451 | 451 | timerange=None, SNRthresh = None, |
|
452 | 452 | save=False, figpath='./', lastone=0,figfile=None, ftp=False, wr_period=1, show=True, |
|
453 | 453 | server=None, folder=None, username=None, password=None, |
|
454 | 454 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): |
|
455 | 455 | """ |
|
456 | 456 | |
|
457 | 457 | Input: |
|
458 | 458 | dataOut : |
|
459 | 459 | id : |
|
460 | 460 | wintitle : |
|
461 | 461 | channelList : |
|
462 | 462 | showProfile : |
|
463 | 463 | xmin : None, |
|
464 | 464 | xmax : None, |
|
465 | 465 | ymin : None, |
|
466 | 466 | ymax : None, |
|
467 | 467 | zmin : None, |
|
468 | 468 | zmax : None |
|
469 | 469 | """ |
|
470 | 470 | |
|
471 | 471 | # if timerange is not None: |
|
472 | 472 | # self.timerange = timerange |
|
473 | 473 | # |
|
474 | 474 | # tmin = None |
|
475 | 475 | # tmax = None |
|
476 | 476 | |
|
477 | 477 | |
|
478 | 478 | x = dataOut.getTimeRange1(dataOut.outputInterval) |
|
479 | 479 | y = dataOut.heightList |
|
480 | 480 | z = dataOut.data_output.copy() |
|
481 | 481 | nplots = z.shape[0] #Number of wind dimensions estimated |
|
482 | 482 | nplotsw = nplots |
|
483 | 483 | |
|
484 | 484 | |
|
485 | 485 | #If there is a SNR function defined |
|
486 | 486 | if dataOut.data_SNR is not None: |
|
487 | 487 | nplots += 1 |
|
488 | 488 | SNR = dataOut.data_SNR |
|
489 | 489 | SNRavg = numpy.average(SNR, axis=0) |
|
490 | 490 | |
|
491 | 491 | SNRdB = 10*numpy.log10(SNR) |
|
492 | 492 | SNRavgdB = 10*numpy.log10(SNRavg) |
|
493 | 493 | |
|
494 | 494 | if SNRthresh == None: SNRthresh = -5.0 |
|
495 | 495 | ind = numpy.where(SNRavg < 10**(SNRthresh/10))[0] |
|
496 | 496 | |
|
497 | 497 | for i in range(nplotsw): |
|
498 | 498 | z[i,ind] = numpy.nan |
|
499 | 499 | |
|
500 | 500 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.ltctime) |
|
501 | 501 | #thisDatetime = datetime.datetime.now() |
|
502 | 502 | title = wintitle + "Wind" |
|
503 | 503 | xlabel = "" |
|
504 | 504 | ylabel = "Height (km)" |
|
505 | 505 | update_figfile = False |
|
506 | 506 | |
|
507 | 507 | if not self.isConfig: |
|
508 | 508 | |
|
509 | 509 | self.setup(id=id, |
|
510 | 510 | nplots=nplots, |
|
511 | 511 | wintitle=wintitle, |
|
512 | 512 | showprofile=showprofile, |
|
513 | 513 | show=show) |
|
514 | 514 | |
|
515 | 515 | if timerange is not None: |
|
516 | 516 | self.timerange = timerange |
|
517 | 517 | |
|
518 | 518 | self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange) |
|
519 | 519 | |
|
520 | 520 | if ymin == None: ymin = numpy.nanmin(y) |
|
521 | 521 | if ymax == None: ymax = numpy.nanmax(y) |
|
522 | 522 | |
|
523 | 523 | if zmax == None: zmax = numpy.nanmax(abs(z[range(2),:])) |
|
524 | 524 | #if numpy.isnan(zmax): zmax = 50 |
|
525 | 525 | if zmin == None: zmin = -zmax |
|
526 | 526 | |
|
527 | 527 | if nplotsw == 3: |
|
528 | 528 | if zmax_ver == None: zmax_ver = numpy.nanmax(abs(z[2,:])) |
|
529 | 529 | if zmin_ver == None: zmin_ver = -zmax_ver |
|
530 | 530 | |
|
531 | 531 | if dataOut.data_SNR is not None: |
|
532 | 532 | if SNRmin == None: SNRmin = numpy.nanmin(SNRavgdB) |
|
533 | 533 | if SNRmax == None: SNRmax = numpy.nanmax(SNRavgdB) |
|
534 | 534 | |
|
535 | 535 | |
|
536 | 536 | self.FTP_WEI = ftp_wei |
|
537 | 537 | self.EXP_CODE = exp_code |
|
538 | 538 | self.SUB_EXP_CODE = sub_exp_code |
|
539 | 539 | self.PLOT_POS = plot_pos |
|
540 | 540 | |
|
541 | 541 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
542 | 542 | self.isConfig = True |
|
543 | 543 | self.figfile = figfile |
|
544 | 544 | update_figfile = True |
|
545 | 545 | |
|
546 | 546 | self.setWinTitle(title) |
|
547 | 547 | |
|
548 | 548 | if ((self.xmax - x[1]) < (x[1]-x[0])): |
|
549 | 549 | x[1] = self.xmax |
|
550 | 550 | |
|
551 | 551 | strWind = ['Zonal', 'Meridional', 'Vertical'] |
|
552 | 552 | strCb = ['Velocity (m/s)','Velocity (m/s)','Velocity (cm/s)'] |
|
553 | 553 | zmaxVector = [zmax, zmax, zmax_ver] |
|
554 | 554 | zminVector = [zmin, zmin, zmin_ver] |
|
555 | 555 | windFactor = [1,1,100] |
|
556 | 556 | |
|
557 | 557 | for i in range(nplotsw): |
|
558 | 558 | |
|
559 | 559 | title = "%s Wind: %s" %(strWind[i], thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) |
|
560 | 560 | axes = self.axesList[i*self.__nsubplots] |
|
561 | 561 | |
|
562 | 562 | z1 = z[i,:].reshape((1,-1))*windFactor[i] |
|
563 | 563 | #z1=numpy.ma.masked_where(z1==0.,z1) |
|
564 | 564 | |
|
565 | 565 | axes.pcolorbuffer(x, y, z1, |
|
566 | 566 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zminVector[i], zmax=zmaxVector[i], |
|
567 | 567 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, |
|
568 | 568 | ticksize=9, cblabel=strCb[i], cbsize="1%", colormap="seismic" ) |
|
569 | 569 | |
|
570 | 570 | if dataOut.data_SNR is not None: |
|
571 | 571 | i += 1 |
|
572 | 572 | title = "Signal Noise Ratio (SNR): %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) |
|
573 | 573 | axes = self.axesList[i*self.__nsubplots] |
|
574 | 574 | SNRavgdB = SNRavgdB.reshape((1,-1)) |
|
575 | 575 | axes.pcolorbuffer(x, y, SNRavgdB, |
|
576 | 576 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=SNRmin, zmax=SNRmax, |
|
577 | 577 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, |
|
578 | 578 | ticksize=9, cblabel='', cbsize="1%", colormap="jet") |
|
579 | 579 | |
|
580 | 580 | self.draw() |
|
581 | 581 | |
|
582 | 582 | self.save(figpath=figpath, |
|
583 | 583 | figfile=figfile, |
|
584 | 584 | save=save, |
|
585 | 585 | ftp=ftp, |
|
586 | 586 | wr_period=wr_period, |
|
587 | 587 | thisDatetime=thisDatetime, |
|
588 | 588 | update_figfile=update_figfile) |
|
589 | 589 | |
|
590 | 590 | if dataOut.ltctime + dataOut.outputInterval >= self.xmax: |
|
591 | 591 | self.counter_imagwr = wr_period |
|
592 | 592 | self.isConfig = False |
|
593 | 593 | update_figfile = True |
|
594 | 594 | |
|
595 | 595 | |
|
596 | 596 | class ParametersPlot(Figure): |
|
597 | 597 | |
|
598 | 598 | __isConfig = None |
|
599 | 599 | __nsubplots = None |
|
600 | 600 | |
|
601 | 601 | WIDTHPROF = None |
|
602 | 602 | HEIGHTPROF = None |
|
603 | 603 | PREFIX = 'param' |
|
604 | 604 | |
|
605 | 605 | nplots = None |
|
606 | 606 | nchan = None |
|
607 | 607 | |
|
608 | parameters = { | |
|
609 | 'id': global_type_string, | |
|
610 | 'wintitle': global_type_string, | |
|
611 | 'channelList': global_type_list, | |
|
612 | 'paramIndex': global_type_integer, | |
|
613 | 'colormap': global_type_colormap, | |
|
614 | 'xmin': global_type_float, | |
|
615 | 'xmax': global_type_float, | |
|
616 | 'ymin': global_type_float, | |
|
617 | 'ymax': global_type_float, | |
|
618 | 'zmin': global_type_float, | |
|
619 | 'zmax': global_type_float, | |
|
620 | 'timerange': global_type_float, | |
|
621 | 'showSNR': global_type_boolean, | |
|
622 | 'SNRthresh': global_type_float, | |
|
623 | 'SNRmin': global_type_float, | |
|
624 | 'SNRmax': global_type_float, | |
|
625 | 'save': global_type_boolean, | |
|
626 | 'figpath': global_type_string, | |
|
627 | 'lastone': global_type_integer, | |
|
628 | 'figfile': global_type_string, | |
|
629 | 'ftp': global_type_boolean, | |
|
630 | 'wr_period': global_type_integer, | |
|
631 | 'show': global_type_boolean, | |
|
632 | 'server': global_type_string, | |
|
633 | 'folder': global_type_string, | |
|
634 | 'username': global_type_string, | |
|
635 | 'password': global_type_string, | |
|
636 | 'ftp_wei': global_type_integer, | |
|
637 | 'exp_code': global_type_integer, | |
|
638 | 'sub_exp_code': global_type_integer, | |
|
639 | 'plot_pos': global_type_integer, | |
|
640 | } | |
|
641 | ||
|
608 | 642 | def __init__(self, **kwargs): |
|
609 | 643 | Figure.__init__(self, **kwargs) |
|
610 | 644 | self.timerange = None |
|
611 | 645 | self.isConfig = False |
|
612 | 646 | self.__nsubplots = 1 |
|
613 | 647 | |
|
614 | 648 | self.WIDTH = 800 |
|
615 | 649 | self.HEIGHT = 180 |
|
616 | 650 | self.WIDTHPROF = 120 |
|
617 | 651 | self.HEIGHTPROF = 0 |
|
618 | 652 | self.counter_imagwr = 0 |
|
619 | 653 | |
|
620 | 654 | self.PLOT_CODE = RTI_CODE |
|
621 | 655 | |
|
622 | 656 | self.FTP_WEI = None |
|
623 | 657 | self.EXP_CODE = None |
|
624 | 658 | self.SUB_EXP_CODE = None |
|
625 | 659 | self.PLOT_POS = None |
|
626 | 660 | self.tmin = None |
|
627 | 661 | self.tmax = None |
|
628 | 662 | |
|
629 | 663 | self.xmin = None |
|
630 | 664 | self.xmax = None |
|
631 | 665 | |
|
632 | 666 | self.figfile = None |
|
633 | 667 | |
|
634 | 668 | def getSubplots(self): |
|
635 | 669 | |
|
636 | 670 | ncol = 1 |
|
637 | 671 | nrow = self.nplots |
|
638 | 672 | |
|
639 | 673 | return nrow, ncol |
|
640 | 674 | |
|
641 | 675 | def setup(self, id, nplots, wintitle, show=True): |
|
642 | 676 | |
|
643 | 677 | self.nplots = nplots |
|
644 | 678 | |
|
645 | 679 | ncolspan = 1 |
|
646 | 680 | colspan = 1 |
|
647 | 681 | |
|
648 | 682 | self.createFigure(id = id, |
|
649 | 683 | wintitle = wintitle, |
|
650 | 684 | widthplot = self.WIDTH + self.WIDTHPROF, |
|
651 | 685 | heightplot = self.HEIGHT + self.HEIGHTPROF, |
|
652 | 686 | show=show) |
|
653 | 687 | |
|
654 | 688 | nrow, ncol = self.getSubplots() |
|
655 | 689 | |
|
656 | 690 | counter = 0 |
|
657 | 691 | for y in range(nrow): |
|
658 | 692 | for x in range(ncol): |
|
659 | 693 | |
|
660 | 694 | if counter >= self.nplots: |
|
661 | 695 | break |
|
662 | 696 | |
|
663 | 697 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
664 | 698 | |
|
665 | 699 | counter += 1 |
|
666 | 700 | |
|
667 | 701 | def run(self, dataOut, id, wintitle="", channelList=None, paramIndex = 0, colormap=True, |
|
668 | 702 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, timerange=None, |
|
669 | 703 | showSNR=False, SNRthresh = -numpy.inf, SNRmin=None, SNRmax=None, |
|
670 | 704 | save=False, figpath='./', lastone=0,figfile=None, ftp=False, wr_period=1, show=True, |
|
671 | 705 | server=None, folder=None, username=None, password=None, |
|
672 | 706 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): |
|
673 | 707 | """ |
|
674 | 708 | |
|
675 | 709 | Input: |
|
676 | 710 | dataOut : |
|
677 | 711 | id : |
|
678 | 712 | wintitle : |
|
679 | 713 | channelList : |
|
680 | 714 | showProfile : |
|
681 | 715 | xmin : None, |
|
682 | 716 | xmax : None, |
|
683 | 717 | ymin : None, |
|
684 | 718 | ymax : None, |
|
685 | 719 | zmin : None, |
|
686 | 720 | zmax : None |
|
687 | 721 | """ |
|
688 | 722 | |
|
689 | 723 | if colormap: |
|
690 | 724 | colormap="jet" |
|
691 | 725 | else: |
|
692 | 726 | colormap="RdBu_r" |
|
693 | 727 | |
|
694 | 728 | if not isTimeInHourRange(dataOut.datatime, xmin, xmax): |
|
695 | 729 | return |
|
696 | 730 | |
|
697 | 731 | if channelList == None: |
|
698 | 732 | channelIndexList = range(dataOut.data_param.shape[0]) |
|
699 | 733 | else: |
|
700 | 734 | channelIndexList = [] |
|
701 | 735 | for channel in channelList: |
|
702 | 736 | if channel not in dataOut.channelList: |
|
703 | 737 | raise ValueError, "Channel %d is not in dataOut.channelList" |
|
704 | 738 | channelIndexList.append(dataOut.channelList.index(channel)) |
|
705 | 739 | |
|
706 | 740 | x = dataOut.getTimeRange1(dataOut.paramInterval) |
|
707 | 741 | y = dataOut.getHeiRange() |
|
708 | 742 | |
|
709 | 743 | if dataOut.data_param.ndim == 3: |
|
710 | 744 | z = dataOut.data_param[channelIndexList,paramIndex,:] |
|
711 | 745 | else: |
|
712 | 746 | z = dataOut.data_param[channelIndexList,:] |
|
713 | 747 | |
|
714 | 748 | if showSNR: |
|
715 | 749 | #SNR data |
|
716 | 750 | SNRarray = dataOut.data_SNR[channelIndexList,:] |
|
717 | 751 | SNRdB = 10*numpy.log10(SNRarray) |
|
718 | 752 | ind = numpy.where(SNRdB < SNRthresh) |
|
719 | 753 | z[ind] = numpy.nan |
|
720 | 754 | |
|
721 | 755 | thisDatetime = dataOut.datatime |
|
722 | 756 | # thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) |
|
723 | 757 | title = wintitle + " Parameters Plot" #: %s" %(thisDatetime.strftime("%d-%b-%Y")) |
|
724 | 758 | xlabel = "" |
|
725 | 759 | ylabel = "Range (Km)" |
|
726 | 760 | |
|
727 | 761 | update_figfile = False |
|
728 | 762 | |
|
729 | 763 | if not self.isConfig: |
|
730 | 764 | |
|
731 | 765 | nchan = len(channelIndexList) |
|
732 | 766 | self.nchan = nchan |
|
733 | 767 | self.plotFact = 1 |
|
734 | 768 | nplots = nchan |
|
735 | 769 | |
|
736 | 770 | if showSNR: |
|
737 | 771 | nplots = nchan*2 |
|
738 | 772 | self.plotFact = 2 |
|
739 | 773 | if SNRmin == None: SNRmin = numpy.nanmin(SNRdB) |
|
740 | 774 | if SNRmax == None: SNRmax = numpy.nanmax(SNRdB) |
|
741 | 775 | |
|
742 | 776 | self.setup(id=id, |
|
743 | 777 | nplots=nplots, |
|
744 | 778 | wintitle=wintitle, |
|
745 | 779 | show=show) |
|
746 | 780 | |
|
747 | 781 | if timerange != None: |
|
748 | 782 | self.timerange = timerange |
|
749 | 783 | |
|
750 | 784 | self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange) |
|
751 | 785 | |
|
752 | 786 | if ymin == None: ymin = numpy.nanmin(y) |
|
753 | 787 | if ymax == None: ymax = numpy.nanmax(y) |
|
754 | 788 | if zmin == None: zmin = numpy.nanmin(z) |
|
755 | 789 | if zmax == None: zmax = numpy.nanmax(z) |
|
756 | 790 | |
|
757 | 791 | self.FTP_WEI = ftp_wei |
|
758 | 792 | self.EXP_CODE = exp_code |
|
759 | 793 | self.SUB_EXP_CODE = sub_exp_code |
|
760 | 794 | self.PLOT_POS = plot_pos |
|
761 | 795 | |
|
762 | 796 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
763 | 797 | self.isConfig = True |
|
764 | 798 | self.figfile = figfile |
|
765 | 799 | update_figfile = True |
|
766 | 800 | |
|
767 | 801 | self.setWinTitle(title) |
|
768 | 802 | |
|
769 | 803 | for i in range(self.nchan): |
|
770 | 804 | index = channelIndexList[i] |
|
771 | 805 | title = "Channel %d: %s" %(dataOut.channelList[index], thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) |
|
772 | 806 | axes = self.axesList[i*self.plotFact] |
|
773 | 807 | z1 = z[i,:].reshape((1,-1)) |
|
774 | 808 | axes.pcolorbuffer(x, y, z1, |
|
775 | 809 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
776 | 810 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, |
|
777 | 811 | ticksize=9, cblabel='', cbsize="1%",colormap=colormap) |
|
778 | 812 | |
|
779 | 813 | if showSNR: |
|
780 | 814 | title = "Channel %d SNR: %s" %(dataOut.channelList[index], thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) |
|
781 | 815 | axes = self.axesList[i*self.plotFact + 1] |
|
782 | 816 | SNRdB1 = SNRdB[i,:].reshape((1,-1)) |
|
783 | 817 | axes.pcolorbuffer(x, y, SNRdB1, |
|
784 | 818 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=SNRmin, zmax=SNRmax, |
|
785 | 819 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, |
|
786 | 820 | ticksize=9, cblabel='', cbsize="1%",colormap='jet') |
|
787 | 821 | |
|
788 | 822 | |
|
789 | 823 | self.draw() |
|
790 | 824 | |
|
791 | 825 | if dataOut.ltctime >= self.xmax: |
|
792 | 826 | self.counter_imagwr = wr_period |
|
793 | 827 | self.isConfig = False |
|
794 | 828 | update_figfile = True |
|
795 | 829 | |
|
796 | 830 | self.save(figpath=figpath, |
|
797 | 831 | figfile=figfile, |
|
798 | 832 | save=save, |
|
799 | 833 | ftp=ftp, |
|
800 | 834 | wr_period=wr_period, |
|
801 | 835 | thisDatetime=thisDatetime, |
|
802 | 836 | update_figfile=update_figfile) |
|
803 | 837 | |
|
804 | 838 | |
|
805 | 839 | |
|
806 | 840 | class Parameters1Plot(Figure): |
|
807 | 841 | |
|
808 | 842 | __isConfig = None |
|
809 | 843 | __nsubplots = None |
|
810 | 844 | |
|
811 | 845 | WIDTHPROF = None |
|
812 | 846 | HEIGHTPROF = None |
|
813 | 847 | PREFIX = 'prm' |
|
814 | 848 | |
|
849 | parameters = { | |
|
850 | 'id': global_type_string, | |
|
851 | 'wintitle': global_type_string, | |
|
852 | 'channelList': global_type_list, | |
|
853 | 'showprofile': global_type_boolean, | |
|
854 | 'xmin': global_type_float, | |
|
855 | 'xmax': global_type_float, | |
|
856 | 'ymin': global_type_float, | |
|
857 | 'ymax': global_type_float, | |
|
858 | 'zmin': global_type_float, | |
|
859 | 'zmax': global_type_float, | |
|
860 | 'timerange': global_type_float, | |
|
861 | 'parameterIndex': global_type_float, | |
|
862 | 'onlyPositive': global_type_boolean, | |
|
863 | 'SNRthresh': global_type_float, | |
|
864 | 'SNR': global_type_boolean, | |
|
865 | 'SNRmin': global_type_float, | |
|
866 | 'SNRmax': global_type_float, | |
|
867 | 'onlySNR': global_type_boolean, | |
|
868 | 'DOP': global_type_boolean, | |
|
869 | 'zlabel': global_type_string, | |
|
870 | 'parameterName': global_type_string, | |
|
871 | 'parameterObject': global_type_string, | |
|
872 | 'save': global_type_boolean, | |
|
873 | 'figpath': global_type_string, | |
|
874 | 'lastone': global_type_integer, | |
|
875 | 'figfile': global_type_string, | |
|
876 | 'ftp': global_type_boolean, | |
|
877 | 'wr_period': global_type_integer, | |
|
878 | 'show': global_type_string, | |
|
879 | 'server': global_type_string, | |
|
880 | 'folder': global_type_string, | |
|
881 | 'username': global_type_string, | |
|
882 | 'password': global_type_string, | |
|
883 | 'ftp_wei': global_type_integer, | |
|
884 | 'exp_code': global_type_integer, | |
|
885 | 'sub_exp_code': global_type_integer, | |
|
886 | 'plot_pos': global_type_integer, | |
|
887 | } | |
|
888 | ||
|
815 | 889 | def __init__(self, **kwargs): |
|
816 | 890 | Figure.__init__(self, **kwargs) |
|
817 | 891 | self.timerange = 2*60*60 |
|
818 | 892 | self.isConfig = False |
|
819 | 893 | self.__nsubplots = 1 |
|
820 | 894 | |
|
821 | 895 | self.WIDTH = 800 |
|
822 | 896 | self.HEIGHT = 180 |
|
823 | 897 | self.WIDTHPROF = 120 |
|
824 | 898 | self.HEIGHTPROF = 0 |
|
825 | 899 | self.counter_imagwr = 0 |
|
826 | 900 | |
|
827 | 901 | self.PLOT_CODE = PARMS_CODE |
|
828 | 902 | |
|
829 | 903 | self.FTP_WEI = None |
|
830 | 904 | self.EXP_CODE = None |
|
831 | 905 | self.SUB_EXP_CODE = None |
|
832 | 906 | self.PLOT_POS = None |
|
833 | 907 | self.tmin = None |
|
834 | 908 | self.tmax = None |
|
835 | 909 | |
|
836 | 910 | self.xmin = None |
|
837 | 911 | self.xmax = None |
|
838 | 912 | |
|
839 | 913 | self.figfile = None |
|
840 | 914 | |
|
841 | 915 | def getSubplots(self): |
|
842 | 916 | |
|
843 | 917 | ncol = 1 |
|
844 | 918 | nrow = self.nplots |
|
845 | 919 | |
|
846 | 920 | return nrow, ncol |
|
847 | 921 | |
|
848 | 922 | def setup(self, id, nplots, wintitle, showprofile=True, show=True): |
|
849 | 923 | |
|
850 | 924 | self.__showprofile = showprofile |
|
851 | 925 | self.nplots = nplots |
|
852 | 926 | |
|
853 | 927 | ncolspan = 1 |
|
854 | 928 | colspan = 1 |
|
855 | 929 | |
|
856 | 930 | self.createFigure(id = id, |
|
857 | 931 | wintitle = wintitle, |
|
858 | 932 | widthplot = self.WIDTH + self.WIDTHPROF, |
|
859 | 933 | heightplot = self.HEIGHT + self.HEIGHTPROF, |
|
860 | 934 | show=show) |
|
861 | 935 | |
|
862 | 936 | nrow, ncol = self.getSubplots() |
|
863 | 937 | |
|
864 | 938 | counter = 0 |
|
865 | 939 | for y in range(nrow): |
|
866 | 940 | for x in range(ncol): |
|
867 | 941 | |
|
868 | 942 | if counter >= self.nplots: |
|
869 | 943 | break |
|
870 | 944 | |
|
871 | 945 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
872 | 946 | |
|
873 | 947 | if showprofile: |
|
874 | 948 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1) |
|
875 | 949 | |
|
876 | 950 | counter += 1 |
|
877 | 951 | |
|
878 | 952 | def run(self, dataOut, id, wintitle="", channelList=None, showprofile=False, |
|
879 | 953 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,timerange=None, |
|
880 | 954 | parameterIndex = None, onlyPositive = False, |
|
881 | 955 | SNRthresh = -numpy.inf, SNR = True, SNRmin = None, SNRmax = None, onlySNR = False, |
|
882 | 956 | DOP = True, |
|
883 | 957 | zlabel = "", parameterName = "", parameterObject = "data_param", |
|
884 | 958 | save=False, figpath='./', lastone=0,figfile=None, ftp=False, wr_period=1, show=True, |
|
885 | 959 | server=None, folder=None, username=None, password=None, |
|
886 | 960 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): |
|
887 | 961 | #print inspect.getargspec(self.run).args |
|
888 | 962 | """ |
|
889 | 963 | |
|
890 | 964 | Input: |
|
891 | 965 | dataOut : |
|
892 | 966 | id : |
|
893 | 967 | wintitle : |
|
894 | 968 | channelList : |
|
895 | 969 | showProfile : |
|
896 | 970 | xmin : None, |
|
897 | 971 | xmax : None, |
|
898 | 972 | ymin : None, |
|
899 | 973 | ymax : None, |
|
900 | 974 | zmin : None, |
|
901 | 975 | zmax : None |
|
902 | 976 | """ |
|
903 | 977 | |
|
904 | 978 | data_param = getattr(dataOut, parameterObject) |
|
905 | 979 | |
|
906 | 980 | if channelList == None: |
|
907 | 981 | channelIndexList = numpy.arange(data_param.shape[0]) |
|
908 | 982 | else: |
|
909 | 983 | channelIndexList = numpy.array(channelList) |
|
910 | 984 | |
|
911 | 985 | nchan = len(channelIndexList) #Number of channels being plotted |
|
912 | 986 | |
|
913 | 987 | if nchan < 1: |
|
914 | 988 | return |
|
915 | 989 | |
|
916 | 990 | nGraphsByChannel = 0 |
|
917 | 991 | |
|
918 | 992 | if SNR: |
|
919 | 993 | nGraphsByChannel += 1 |
|
920 | 994 | if DOP: |
|
921 | 995 | nGraphsByChannel += 1 |
|
922 | 996 | |
|
923 | 997 | if nGraphsByChannel < 1: |
|
924 | 998 | return |
|
925 | 999 | |
|
926 | 1000 | nplots = nGraphsByChannel*nchan |
|
927 | 1001 | |
|
928 | 1002 | if timerange is not None: |
|
929 | 1003 | self.timerange = timerange |
|
930 | 1004 | |
|
931 | 1005 | #tmin = None |
|
932 | 1006 | #tmax = None |
|
933 | 1007 | if parameterIndex == None: |
|
934 | 1008 | parameterIndex = 1 |
|
935 | 1009 | |
|
936 | 1010 | x = dataOut.getTimeRange1(dataOut.paramInterval) |
|
937 | 1011 | y = dataOut.heightList |
|
938 | 1012 | z = data_param[channelIndexList,parameterIndex,:].copy() |
|
939 | 1013 | |
|
940 | 1014 | zRange = dataOut.abscissaList |
|
941 | 1015 | # nChannels = z.shape[0] #Number of wind dimensions estimated |
|
942 | 1016 | # thisDatetime = dataOut.datatime |
|
943 | 1017 | |
|
944 | 1018 | if dataOut.data_SNR is not None: |
|
945 | 1019 | SNRarray = dataOut.data_SNR[channelIndexList,:] |
|
946 | 1020 | SNRdB = 10*numpy.log10(SNRarray) |
|
947 | 1021 | # SNRavgdB = 10*numpy.log10(SNRavg) |
|
948 | 1022 | ind = numpy.where(SNRdB < 10**(SNRthresh/10)) |
|
949 | 1023 | z[ind] = numpy.nan |
|
950 | 1024 | |
|
951 | 1025 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) |
|
952 | 1026 | title = wintitle + " Parameters Plot" #: %s" %(thisDatetime.strftime("%d-%b-%Y")) |
|
953 | 1027 | xlabel = "" |
|
954 | 1028 | ylabel = "Range (Km)" |
|
955 | 1029 | |
|
956 | 1030 | if (SNR and not onlySNR): nplots = 2*nplots |
|
957 | 1031 | |
|
958 | 1032 | if onlyPositive: |
|
959 | 1033 | colormap = "jet" |
|
960 | 1034 | zmin = 0 |
|
961 | 1035 | else: colormap = "RdBu_r" |
|
962 | 1036 | |
|
963 | 1037 | if not self.isConfig: |
|
964 | 1038 | |
|
965 | 1039 | self.setup(id=id, |
|
966 | 1040 | nplots=nplots, |
|
967 | 1041 | wintitle=wintitle, |
|
968 | 1042 | showprofile=showprofile, |
|
969 | 1043 | show=show) |
|
970 | 1044 | |
|
971 | 1045 | self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange) |
|
972 | 1046 | |
|
973 | 1047 | if ymin == None: ymin = numpy.nanmin(y) |
|
974 | 1048 | if ymax == None: ymax = numpy.nanmax(y) |
|
975 | 1049 | if zmin == None: zmin = numpy.nanmin(zRange) |
|
976 | 1050 | if zmax == None: zmax = numpy.nanmax(zRange) |
|
977 | 1051 | |
|
978 | 1052 | if SNR: |
|
979 | 1053 | if SNRmin == None: SNRmin = numpy.nanmin(SNRdB) |
|
980 | 1054 | if SNRmax == None: SNRmax = numpy.nanmax(SNRdB) |
|
981 | 1055 | |
|
982 | 1056 | self.FTP_WEI = ftp_wei |
|
983 | 1057 | self.EXP_CODE = exp_code |
|
984 | 1058 | self.SUB_EXP_CODE = sub_exp_code |
|
985 | 1059 | self.PLOT_POS = plot_pos |
|
986 | 1060 | |
|
987 | 1061 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
988 | 1062 | self.isConfig = True |
|
989 | 1063 | self.figfile = figfile |
|
990 | 1064 | |
|
991 | 1065 | self.setWinTitle(title) |
|
992 | 1066 | |
|
993 | 1067 | if ((self.xmax - x[1]) < (x[1]-x[0])): |
|
994 | 1068 | x[1] = self.xmax |
|
995 | 1069 | |
|
996 | 1070 | for i in range(nchan): |
|
997 | 1071 | |
|
998 | 1072 | if (SNR and not onlySNR): j = 2*i |
|
999 | 1073 | else: j = i |
|
1000 | 1074 | |
|
1001 | 1075 | j = nGraphsByChannel*i |
|
1002 | 1076 | |
|
1003 | 1077 | if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)): |
|
1004 | 1078 | title = title + '_' + 'azimuth,zenith=%2.2f,%2.2f'%(dataOut.azimuth, dataOut.zenith) |
|
1005 | 1079 | |
|
1006 | 1080 | if not onlySNR: |
|
1007 | 1081 | axes = self.axesList[j*self.__nsubplots] |
|
1008 | 1082 | z1 = z[i,:].reshape((1,-1)) |
|
1009 | 1083 | axes.pcolorbuffer(x, y, z1, |
|
1010 | 1084 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
1011 | 1085 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,colormap=colormap, |
|
1012 | 1086 | ticksize=9, cblabel=zlabel, cbsize="1%") |
|
1013 | 1087 | |
|
1014 | 1088 | if DOP: |
|
1015 | 1089 | title = "%s Channel %d: %s" %(parameterName, channelIndexList[i], thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) |
|
1016 | 1090 | |
|
1017 | 1091 | if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)): |
|
1018 | 1092 | title = title + '_' + 'azimuth,zenith=%2.2f,%2.2f'%(dataOut.azimuth, dataOut.zenith) |
|
1019 | 1093 | axes = self.axesList[j] |
|
1020 | 1094 | z1 = z[i,:].reshape((1,-1)) |
|
1021 | 1095 | axes.pcolorbuffer(x, y, z1, |
|
1022 | 1096 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
1023 | 1097 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,colormap=colormap, |
|
1024 | 1098 | ticksize=9, cblabel=zlabel, cbsize="1%") |
|
1025 | 1099 | |
|
1026 | 1100 | if SNR: |
|
1027 | 1101 | title = "Channel %d Signal Noise Ratio (SNR): %s" %(channelIndexList[i], thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) |
|
1028 | 1102 | axes = self.axesList[(j)*self.__nsubplots] |
|
1029 | 1103 | if not onlySNR: |
|
1030 | 1104 | axes = self.axesList[(j + 1)*self.__nsubplots] |
|
1031 | 1105 | |
|
1032 | 1106 | axes = self.axesList[(j + nGraphsByChannel-1)] |
|
1033 | 1107 | |
|
1034 | 1108 | z1 = SNRdB[i,:].reshape((1,-1)) |
|
1035 | 1109 | axes.pcolorbuffer(x, y, z1, |
|
1036 | 1110 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=SNRmin, zmax=SNRmax, |
|
1037 | 1111 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,colormap="jet", |
|
1038 | 1112 | ticksize=9, cblabel=zlabel, cbsize="1%") |
|
1039 | 1113 | |
|
1040 | 1114 | |
|
1041 | 1115 | |
|
1042 | 1116 | self.draw() |
|
1043 | 1117 | |
|
1044 | 1118 | if x[1] >= self.axesList[0].xmax: |
|
1045 | 1119 | self.counter_imagwr = wr_period |
|
1046 | 1120 | self.isConfig = False |
|
1047 | 1121 | self.figfile = None |
|
1048 | 1122 | |
|
1049 | 1123 | self.save(figpath=figpath, |
|
1050 | 1124 | figfile=figfile, |
|
1051 | 1125 | save=save, |
|
1052 | 1126 | ftp=ftp, |
|
1053 | 1127 | wr_period=wr_period, |
|
1054 | 1128 | thisDatetime=thisDatetime, |
|
1055 | 1129 | update_figfile=False) |
|
1056 | 1130 | |
|
1057 | 1131 | class SpectralFittingPlot(Figure): |
|
1058 | 1132 | |
|
1059 | 1133 | __isConfig = None |
|
1060 | 1134 | __nsubplots = None |
|
1061 | 1135 | |
|
1062 | 1136 | WIDTHPROF = None |
|
1063 | 1137 | HEIGHTPROF = None |
|
1064 | 1138 | PREFIX = 'prm' |
|
1065 | 1139 | |
|
1066 | 1140 | |
|
1067 | 1141 | N = None |
|
1068 | 1142 | ippSeconds = None |
|
1069 | 1143 | |
|
1070 | 1144 | def __init__(self, **kwargs): |
|
1071 | 1145 | Figure.__init__(self, **kwargs) |
|
1072 | 1146 | self.isConfig = False |
|
1073 | 1147 | self.__nsubplots = 1 |
|
1074 | 1148 | |
|
1075 | 1149 | self.PLOT_CODE = SPECFIT_CODE |
|
1076 | 1150 | |
|
1077 | 1151 | self.WIDTH = 450 |
|
1078 | 1152 | self.HEIGHT = 250 |
|
1079 | 1153 | self.WIDTHPROF = 0 |
|
1080 | 1154 | self.HEIGHTPROF = 0 |
|
1081 | 1155 | |
|
1082 | 1156 | def getSubplots(self): |
|
1083 | 1157 | |
|
1084 | 1158 | ncol = int(numpy.sqrt(self.nplots)+0.9) |
|
1085 | 1159 | nrow = int(self.nplots*1./ncol + 0.9) |
|
1086 | 1160 | |
|
1087 | 1161 | return nrow, ncol |
|
1088 | 1162 | |
|
1089 | 1163 | def setup(self, id, nplots, wintitle, showprofile=False, show=True): |
|
1090 | 1164 | |
|
1091 | 1165 | showprofile = False |
|
1092 | 1166 | self.__showprofile = showprofile |
|
1093 | 1167 | self.nplots = nplots |
|
1094 | 1168 | |
|
1095 | 1169 | ncolspan = 5 |
|
1096 | 1170 | colspan = 4 |
|
1097 | 1171 | if showprofile: |
|
1098 | 1172 | ncolspan = 5 |
|
1099 | 1173 | colspan = 4 |
|
1100 | 1174 | self.__nsubplots = 2 |
|
1101 | 1175 | |
|
1102 | 1176 | self.createFigure(id = id, |
|
1103 | 1177 | wintitle = wintitle, |
|
1104 | 1178 | widthplot = self.WIDTH + self.WIDTHPROF, |
|
1105 | 1179 | heightplot = self.HEIGHT + self.HEIGHTPROF, |
|
1106 | 1180 | show=show) |
|
1107 | 1181 | |
|
1108 | 1182 | nrow, ncol = self.getSubplots() |
|
1109 | 1183 | |
|
1110 | 1184 | counter = 0 |
|
1111 | 1185 | for y in range(nrow): |
|
1112 | 1186 | for x in range(ncol): |
|
1113 | 1187 | |
|
1114 | 1188 | if counter >= self.nplots: |
|
1115 | 1189 | break |
|
1116 | 1190 | |
|
1117 | 1191 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
1118 | 1192 | |
|
1119 | 1193 | if showprofile: |
|
1120 | 1194 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1) |
|
1121 | 1195 | |
|
1122 | 1196 | counter += 1 |
|
1123 | 1197 | |
|
1124 | 1198 | def run(self, dataOut, id, cutHeight=None, fit=False, wintitle="", channelList=None, showprofile=True, |
|
1125 | 1199 | xmin=None, xmax=None, ymin=None, ymax=None, |
|
1126 | 1200 | save=False, figpath='./', figfile=None, show=True): |
|
1127 | 1201 | |
|
1128 | 1202 | """ |
|
1129 | 1203 | |
|
1130 | 1204 | Input: |
|
1131 | 1205 | dataOut : |
|
1132 | 1206 | id : |
|
1133 | 1207 | wintitle : |
|
1134 | 1208 | channelList : |
|
1135 | 1209 | showProfile : |
|
1136 | 1210 | xmin : None, |
|
1137 | 1211 | xmax : None, |
|
1138 | 1212 | zmin : None, |
|
1139 | 1213 | zmax : None |
|
1140 | 1214 | """ |
|
1141 | 1215 | |
|
1142 | 1216 | if cutHeight==None: |
|
1143 | 1217 | h=270 |
|
1144 | 1218 | heightindex = numpy.abs(cutHeight - dataOut.heightList).argmin() |
|
1145 | 1219 | cutHeight = dataOut.heightList[heightindex] |
|
1146 | 1220 | |
|
1147 | 1221 | factor = dataOut.normFactor |
|
1148 | 1222 | x = dataOut.abscissaList[:-1] |
|
1149 | 1223 | #y = dataOut.getHeiRange() |
|
1150 | 1224 | |
|
1151 | 1225 | z = dataOut.data_pre[:,:,heightindex]/factor |
|
1152 | 1226 | z = numpy.where(numpy.isfinite(z), z, numpy.NAN) |
|
1153 | 1227 | avg = numpy.average(z, axis=1) |
|
1154 | 1228 | listChannels = z.shape[0] |
|
1155 | 1229 | |
|
1156 | 1230 | #Reconstruct Function |
|
1157 | 1231 | if fit==True: |
|
1158 | 1232 | groupArray = dataOut.groupList |
|
1159 | 1233 | listChannels = groupArray.reshape((groupArray.size)) |
|
1160 | 1234 | listChannels.sort() |
|
1161 | 1235 | spcFitLine = numpy.zeros(z.shape) |
|
1162 | 1236 | constants = dataOut.constants |
|
1163 | 1237 | |
|
1164 | 1238 | nGroups = groupArray.shape[0] |
|
1165 | 1239 | nChannels = groupArray.shape[1] |
|
1166 | 1240 | nProfiles = z.shape[1] |
|
1167 | 1241 | |
|
1168 | 1242 | for f in range(nGroups): |
|
1169 | 1243 | groupChann = groupArray[f,:] |
|
1170 | 1244 | p = dataOut.data_param[f,:,heightindex] |
|
1171 | 1245 | # p = numpy.array([ 89.343967,0.14036615,0.17086219,18.89835291,1.58388365,1.55099167]) |
|
1172 | 1246 | fitLineAux = dataOut.library.modelFunction(p, constants)*nProfiles |
|
1173 | 1247 | fitLineAux = fitLineAux.reshape((nChannels,nProfiles)) |
|
1174 | 1248 | spcFitLine[groupChann,:] = fitLineAux |
|
1175 | 1249 | # spcFitLine = spcFitLine/factor |
|
1176 | 1250 | |
|
1177 | 1251 | z = z[listChannels,:] |
|
1178 | 1252 | spcFitLine = spcFitLine[listChannels,:] |
|
1179 | 1253 | spcFitLinedB = 10*numpy.log10(spcFitLine) |
|
1180 | 1254 | |
|
1181 | 1255 | zdB = 10*numpy.log10(z) |
|
1182 | 1256 | #thisDatetime = dataOut.datatime |
|
1183 | 1257 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) |
|
1184 | 1258 | title = wintitle + " Doppler Spectra: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
1185 | 1259 | xlabel = "Velocity (m/s)" |
|
1186 | 1260 | ylabel = "Spectrum" |
|
1187 | 1261 | |
|
1188 | 1262 | if not self.isConfig: |
|
1189 | 1263 | |
|
1190 | 1264 | nplots = listChannels.size |
|
1191 | 1265 | |
|
1192 | 1266 | self.setup(id=id, |
|
1193 | 1267 | nplots=nplots, |
|
1194 | 1268 | wintitle=wintitle, |
|
1195 | 1269 | showprofile=showprofile, |
|
1196 | 1270 | show=show) |
|
1197 | 1271 | |
|
1198 | 1272 | if xmin == None: xmin = numpy.nanmin(x) |
|
1199 | 1273 | if xmax == None: xmax = numpy.nanmax(x) |
|
1200 | 1274 | if ymin == None: ymin = numpy.nanmin(zdB) |
|
1201 | 1275 | if ymax == None: ymax = numpy.nanmax(zdB)+2 |
|
1202 | 1276 | |
|
1203 | 1277 | self.isConfig = True |
|
1204 | 1278 | |
|
1205 | 1279 | self.setWinTitle(title) |
|
1206 | 1280 | for i in range(self.nplots): |
|
1207 | 1281 | # title = "Channel %d: %4.2fdB" %(dataOut.channelList[i]+1, noisedB[i]) |
|
1208 | 1282 | title = "Height %4.1f km\nChannel %d:" %(cutHeight, listChannels[i]) |
|
1209 | 1283 | axes = self.axesList[i*self.__nsubplots] |
|
1210 | 1284 | if fit == False: |
|
1211 | 1285 | axes.pline(x, zdB[i,:], |
|
1212 | 1286 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, |
|
1213 | 1287 | xlabel=xlabel, ylabel=ylabel, title=title |
|
1214 | 1288 | ) |
|
1215 | 1289 | if fit == True: |
|
1216 | 1290 | fitline=spcFitLinedB[i,:] |
|
1217 | 1291 | y=numpy.vstack([zdB[i,:],fitline] ) |
|
1218 | 1292 | legendlabels=['Data','Fitting'] |
|
1219 | 1293 | axes.pmultilineyaxis(x, y, |
|
1220 | 1294 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, |
|
1221 | 1295 | xlabel=xlabel, ylabel=ylabel, title=title, |
|
1222 | 1296 | legendlabels=legendlabels, marker=None, |
|
1223 | 1297 | linestyle='solid', grid='both') |
|
1224 | 1298 | |
|
1225 | 1299 | self.draw() |
|
1226 | 1300 | |
|
1227 | 1301 | self.save(figpath=figpath, |
|
1228 | 1302 | figfile=figfile, |
|
1229 | 1303 | save=save, |
|
1230 | 1304 | ftp=ftp, |
|
1231 | 1305 | wr_period=wr_period, |
|
1232 | 1306 | thisDatetime=thisDatetime) |
|
1233 | 1307 | |
|
1234 | 1308 | |
|
1235 | 1309 | class EWDriftsPlot(Figure): |
|
1236 | 1310 | |
|
1237 | 1311 | __isConfig = None |
|
1238 | 1312 | __nsubplots = None |
|
1239 | 1313 | |
|
1240 | 1314 | WIDTHPROF = None |
|
1241 | 1315 | HEIGHTPROF = None |
|
1242 | 1316 | PREFIX = 'drift' |
|
1243 | 1317 | |
|
1244 | 1318 | parameters = { |
|
1245 | 1319 | 'id': global_type_string, |
|
1246 | 1320 | 'wintitle': global_type_string, |
|
1247 | 1321 | 'channelList': global_type_string, |
|
1248 | 1322 | 'xmin': global_type_float, |
|
1249 | 1323 | 'xmax': global_type_float, |
|
1250 | 1324 | 'ymin': global_type_float, |
|
1251 | 1325 | 'ymax': global_type_float, |
|
1252 | 1326 | 'zmin': global_type_float, |
|
1253 | 1327 | 'zmax': global_type_float, |
|
1254 | 1328 | 'zmaxVertfloat': global_type_float, |
|
1255 | 1329 | 'zminVertfloat': global_type_float, |
|
1256 | 1330 | 'zmaxZonafloat': global_type_float, |
|
1257 | 1331 | 'zminZonafloat': global_type_float, |
|
1258 | 1332 | 'timerange': global_type_float, |
|
1259 | 1333 | 'SNRthresh': global_type_float, |
|
1260 | 1334 | 'SNRmin': global_type_float, |
|
1261 | 1335 | 'SNRmax': global_type_float, |
|
1262 | 1336 | 'SNR_1': global_type_boolean, |
|
1263 | 1337 | 'save': global_type_boolean, |
|
1264 | 1338 | 'figpath': global_type_string, |
|
1265 | 1339 | 'lastone': global_type_float, |
|
1266 | 1340 | 'figfile': global_type_string, |
|
1267 | 1341 | 'ftp': global_type_string, |
|
1268 | 1342 | 'wr_period': global_type_integer, |
|
1269 | 1343 | 'show': global_type_string, |
|
1270 | 1344 | 'server': global_type_string, |
|
1271 | 1345 | 'folder': global_type_string, |
|
1272 | 1346 | 'username': global_type_string, |
|
1273 | 1347 | 'password': global_type_string, |
|
1274 | 1348 | 'ftp_wei': global_type_integer, |
|
1275 | 1349 | 'exp_code': global_type_integer, |
|
1276 | 1350 | 'sub_exp_code': global_type_integer, |
|
1277 | 1351 | 'plot_pos': global_type_integer, |
|
1278 | 1352 | } |
|
1279 | 1353 | |
|
1280 | 1354 | def __init__(self, **kwargs): |
|
1281 | 1355 | Figure.__init__(self, **kwargs) |
|
1282 | 1356 | self.timerange = 2*60*60 |
|
1283 | 1357 | self.isConfig = False |
|
1284 | 1358 | self.__nsubplots = 1 |
|
1285 | 1359 | |
|
1286 | 1360 | self.WIDTH = 800 |
|
1287 | 1361 | self.HEIGHT = 150 |
|
1288 | 1362 | self.WIDTHPROF = 120 |
|
1289 | 1363 | self.HEIGHTPROF = 0 |
|
1290 | 1364 | self.counter_imagwr = 0 |
|
1291 | 1365 | |
|
1292 | 1366 | self.PLOT_CODE = EWDRIFT_CODE |
|
1293 | 1367 | |
|
1294 | 1368 | self.FTP_WEI = None |
|
1295 | 1369 | self.EXP_CODE = None |
|
1296 | 1370 | self.SUB_EXP_CODE = None |
|
1297 | 1371 | self.PLOT_POS = None |
|
1298 | 1372 | self.tmin = None |
|
1299 | 1373 | self.tmax = None |
|
1300 | 1374 | |
|
1301 | 1375 | self.xmin = None |
|
1302 | 1376 | self.xmax = None |
|
1303 | 1377 | |
|
1304 | 1378 | self.figfile = None |
|
1305 | 1379 | |
|
1306 | 1380 | def getSubplots(self): |
|
1307 | 1381 | |
|
1308 | 1382 | ncol = 1 |
|
1309 | 1383 | nrow = self.nplots |
|
1310 | 1384 | |
|
1311 | 1385 | return nrow, ncol |
|
1312 | 1386 | |
|
1313 | 1387 | def setup(self, id, nplots, wintitle, showprofile=True, show=True): |
|
1314 | 1388 | |
|
1315 | 1389 | self.__showprofile = showprofile |
|
1316 | 1390 | self.nplots = nplots |
|
1317 | 1391 | |
|
1318 | 1392 | ncolspan = 1 |
|
1319 | 1393 | colspan = 1 |
|
1320 | 1394 | |
|
1321 | 1395 | self.createFigure(id = id, |
|
1322 | 1396 | wintitle = wintitle, |
|
1323 | 1397 | widthplot = self.WIDTH + self.WIDTHPROF, |
|
1324 | 1398 | heightplot = self.HEIGHT + self.HEIGHTPROF, |
|
1325 | 1399 | show=show) |
|
1326 | 1400 | |
|
1327 | 1401 | nrow, ncol = self.getSubplots() |
|
1328 | 1402 | |
|
1329 | 1403 | counter = 0 |
|
1330 | 1404 | for y in range(nrow): |
|
1331 | 1405 | if counter >= self.nplots: |
|
1332 | 1406 | break |
|
1333 | 1407 | |
|
1334 | 1408 | self.addAxes(nrow, ncol*ncolspan, y, 0, colspan, 1) |
|
1335 | 1409 | counter += 1 |
|
1336 | 1410 | |
|
1337 | 1411 | def run(self, dataOut, id, wintitle="", channelList=None, |
|
1338 | 1412 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, |
|
1339 | 1413 | zmaxVertical = None, zminVertical = None, zmaxZonal = None, zminZonal = None, |
|
1340 | 1414 | timerange=None, SNRthresh = -numpy.inf, SNRmin = None, SNRmax = None, SNR_1 = False, |
|
1341 | 1415 | save=False, figpath='./', lastone=0,figfile=None, ftp=False, wr_period=1, show=True, |
|
1342 | 1416 | server=None, folder=None, username=None, password=None, |
|
1343 | 1417 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): |
|
1344 | 1418 | """ |
|
1345 | 1419 | |
|
1346 | 1420 | Input: |
|
1347 | 1421 | dataOut : |
|
1348 | 1422 | id : |
|
1349 | 1423 | wintitle : |
|
1350 | 1424 | channelList : |
|
1351 | 1425 | showProfile : |
|
1352 | 1426 | xmin : None, |
|
1353 | 1427 | xmax : None, |
|
1354 | 1428 | ymin : None, |
|
1355 | 1429 | ymax : None, |
|
1356 | 1430 | zmin : None, |
|
1357 | 1431 | zmax : None |
|
1358 | 1432 | """ |
|
1359 | 1433 | |
|
1360 | 1434 | if timerange is not None: |
|
1361 | 1435 | self.timerange = timerange |
|
1362 | 1436 | |
|
1363 | 1437 | tmin = None |
|
1364 | 1438 | tmax = None |
|
1365 | 1439 | |
|
1366 | 1440 | x = dataOut.getTimeRange1(dataOut.outputInterval) |
|
1367 | 1441 | # y = dataOut.heightList |
|
1368 | 1442 | y = dataOut.heightList |
|
1369 | 1443 | |
|
1370 | 1444 | z = dataOut.data_output |
|
1371 | 1445 | nplots = z.shape[0] #Number of wind dimensions estimated |
|
1372 | 1446 | nplotsw = nplots |
|
1373 | 1447 | |
|
1374 | 1448 | #If there is a SNR function defined |
|
1375 | 1449 | if dataOut.data_SNR is not None: |
|
1376 | 1450 | nplots += 1 |
|
1377 | 1451 | SNR = dataOut.data_SNR |
|
1378 | 1452 | |
|
1379 | 1453 | if SNR_1: |
|
1380 | 1454 | SNR += 1 |
|
1381 | 1455 | |
|
1382 | 1456 | SNRavg = numpy.average(SNR, axis=0) |
|
1383 | 1457 | |
|
1384 | 1458 | SNRdB = 10*numpy.log10(SNR) |
|
1385 | 1459 | SNRavgdB = 10*numpy.log10(SNRavg) |
|
1386 | 1460 | |
|
1387 | 1461 | ind = numpy.where(SNRavg < 10**(SNRthresh/10))[0] |
|
1388 | 1462 | |
|
1389 | 1463 | for i in range(nplotsw): |
|
1390 | 1464 | z[i,ind] = numpy.nan |
|
1391 | 1465 | |
|
1392 | 1466 | |
|
1393 | 1467 | showprofile = False |
|
1394 | 1468 | # thisDatetime = dataOut.datatime |
|
1395 | 1469 | thisDatetime = datetime.datetime.utcfromtimestamp(x[1]) |
|
1396 | 1470 | title = wintitle + " EW Drifts" |
|
1397 | 1471 | xlabel = "" |
|
1398 | 1472 | ylabel = "Height (Km)" |
|
1399 | 1473 | |
|
1400 | 1474 | if not self.isConfig: |
|
1401 | 1475 | |
|
1402 | 1476 | self.setup(id=id, |
|
1403 | 1477 | nplots=nplots, |
|
1404 | 1478 | wintitle=wintitle, |
|
1405 | 1479 | showprofile=showprofile, |
|
1406 | 1480 | show=show) |
|
1407 | 1481 | |
|
1408 | 1482 | self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange) |
|
1409 | 1483 | |
|
1410 | 1484 | if ymin == None: ymin = numpy.nanmin(y) |
|
1411 | 1485 | if ymax == None: ymax = numpy.nanmax(y) |
|
1412 | 1486 | |
|
1413 | 1487 | if zmaxZonal == None: zmaxZonal = numpy.nanmax(abs(z[0,:])) |
|
1414 | 1488 | if zminZonal == None: zminZonal = -zmaxZonal |
|
1415 | 1489 | if zmaxVertical == None: zmaxVertical = numpy.nanmax(abs(z[1,:])) |
|
1416 | 1490 | if zminVertical == None: zminVertical = -zmaxVertical |
|
1417 | 1491 | |
|
1418 | 1492 | if dataOut.data_SNR is not None: |
|
1419 | 1493 | if SNRmin == None: SNRmin = numpy.nanmin(SNRavgdB) |
|
1420 | 1494 | if SNRmax == None: SNRmax = numpy.nanmax(SNRavgdB) |
|
1421 | 1495 | |
|
1422 | 1496 | self.FTP_WEI = ftp_wei |
|
1423 | 1497 | self.EXP_CODE = exp_code |
|
1424 | 1498 | self.SUB_EXP_CODE = sub_exp_code |
|
1425 | 1499 | self.PLOT_POS = plot_pos |
|
1426 | 1500 | |
|
1427 | 1501 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
1428 | 1502 | self.isConfig = True |
|
1429 | 1503 | |
|
1430 | 1504 | |
|
1431 | 1505 | self.setWinTitle(title) |
|
1432 | 1506 | |
|
1433 | 1507 | if ((self.xmax - x[1]) < (x[1]-x[0])): |
|
1434 | 1508 | x[1] = self.xmax |
|
1435 | 1509 | |
|
1436 | 1510 | strWind = ['Zonal','Vertical'] |
|
1437 | 1511 | strCb = 'Velocity (m/s)' |
|
1438 | 1512 | zmaxVector = [zmaxZonal, zmaxVertical] |
|
1439 | 1513 | zminVector = [zminZonal, zminVertical] |
|
1440 | 1514 | |
|
1441 | 1515 | for i in range(nplotsw): |
|
1442 | 1516 | |
|
1443 | 1517 | title = "%s Drifts: %s" %(strWind[i], thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) |
|
1444 | 1518 | axes = self.axesList[i*self.__nsubplots] |
|
1445 | 1519 | |
|
1446 | 1520 | z1 = z[i,:].reshape((1,-1)) |
|
1447 | 1521 | |
|
1448 | 1522 | axes.pcolorbuffer(x, y, z1, |
|
1449 | 1523 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zminVector[i], zmax=zmaxVector[i], |
|
1450 | 1524 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, |
|
1451 | 1525 | ticksize=9, cblabel=strCb, cbsize="1%", colormap="RdBu_r") |
|
1452 | 1526 | |
|
1453 | 1527 | if dataOut.data_SNR is not None: |
|
1454 | 1528 | i += 1 |
|
1455 | 1529 | if SNR_1: |
|
1456 | 1530 | title = "Signal Noise Ratio + 1 (SNR+1): %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) |
|
1457 | 1531 | else: |
|
1458 | 1532 | title = "Signal Noise Ratio (SNR): %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) |
|
1459 | 1533 | axes = self.axesList[i*self.__nsubplots] |
|
1460 | 1534 | SNRavgdB = SNRavgdB.reshape((1,-1)) |
|
1461 | 1535 | |
|
1462 | 1536 | axes.pcolorbuffer(x, y, SNRavgdB, |
|
1463 | 1537 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=SNRmin, zmax=SNRmax, |
|
1464 | 1538 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, |
|
1465 | 1539 | ticksize=9, cblabel='', cbsize="1%", colormap="jet") |
|
1466 | 1540 | |
|
1467 | 1541 | self.draw() |
|
1468 | 1542 | |
|
1469 | 1543 | if x[1] >= self.axesList[0].xmax: |
|
1470 | 1544 | self.counter_imagwr = wr_period |
|
1471 | 1545 | self.isConfig = False |
|
1472 | 1546 | self.figfile = None |
|
1473 | 1547 | |
|
1474 | 1548 | |
|
1475 | 1549 | |
|
1476 | 1550 | |
|
1477 | 1551 | class PhasePlot(Figure): |
|
1478 | 1552 | |
|
1479 | 1553 | __isConfig = None |
|
1480 | 1554 | __nsubplots = None |
|
1481 | 1555 | |
|
1482 | 1556 | PREFIX = 'mphase' |
|
1483 | 1557 | |
|
1558 | parameters = { | |
|
1559 | 'id': global_type_string, | |
|
1560 | 'wintitle': global_type_string, | |
|
1561 | 'pairsList': global_type_pairsList, | |
|
1562 | 'showprofile': global_type_boolean, | |
|
1563 | 'xmin': global_type_float, | |
|
1564 | 'xmax': global_type_float, | |
|
1565 | 'ymin': global_type_float, | |
|
1566 | 'ymax': global_type_float, | |
|
1567 | 'timerange': global_type_float, | |
|
1568 | 'save': global_type_boolean, | |
|
1569 | 'figpath': global_type_string, | |
|
1570 | 'figfile': global_type_string, | |
|
1571 | 'show': global_type_boolean, | |
|
1572 | 'ftp': global_type_boolean, | |
|
1573 | 'wr_period': global_type_integer, | |
|
1574 | 'server': global_type_string, | |
|
1575 | 'folder': global_type_string, | |
|
1576 | 'username': global_type_string, | |
|
1577 | 'password': global_type_string, | |
|
1578 | 'ftp_wei': global_type_integer, | |
|
1579 | 'exp_code': global_type_integer, | |
|
1580 | 'sub_exp_code': global_type_integer, | |
|
1581 | 'plot_pos': global_type_integer, | |
|
1582 | } | |
|
1583 | ||
|
1484 | 1584 | def __init__(self, **kwargs): |
|
1485 | 1585 | Figure.__init__(self, **kwargs) |
|
1486 | 1586 | self.timerange = 24*60*60 |
|
1487 | 1587 | self.isConfig = False |
|
1488 | 1588 | self.__nsubplots = 1 |
|
1489 | 1589 | self.counter_imagwr = 0 |
|
1490 | 1590 | self.WIDTH = 600 |
|
1491 | 1591 | self.HEIGHT = 300 |
|
1492 | 1592 | self.WIDTHPROF = 120 |
|
1493 | 1593 | self.HEIGHTPROF = 0 |
|
1494 | 1594 | self.xdata = None |
|
1495 | 1595 | self.ydata = None |
|
1496 | 1596 | |
|
1497 | 1597 | self.PLOT_CODE = MPHASE_CODE |
|
1498 | 1598 | |
|
1499 | 1599 | self.FTP_WEI = None |
|
1500 | 1600 | self.EXP_CODE = None |
|
1501 | 1601 | self.SUB_EXP_CODE = None |
|
1502 | 1602 | self.PLOT_POS = None |
|
1503 | 1603 | |
|
1504 | 1604 | |
|
1505 | 1605 | self.filename_phase = None |
|
1506 | 1606 | |
|
1507 | 1607 | self.figfile = None |
|
1508 | 1608 | |
|
1509 | 1609 | def getSubplots(self): |
|
1510 | 1610 | |
|
1511 | 1611 | ncol = 1 |
|
1512 | 1612 | nrow = 1 |
|
1513 | 1613 | |
|
1514 | 1614 | return nrow, ncol |
|
1515 | 1615 | |
|
1516 | 1616 | def setup(self, id, nplots, wintitle, showprofile=True, show=True): |
|
1517 | 1617 | |
|
1518 | 1618 | self.__showprofile = showprofile |
|
1519 | 1619 | self.nplots = nplots |
|
1520 | 1620 | |
|
1521 | 1621 | ncolspan = 7 |
|
1522 | 1622 | colspan = 6 |
|
1523 | 1623 | self.__nsubplots = 2 |
|
1524 | 1624 | |
|
1525 | 1625 | self.createFigure(id = id, |
|
1526 | 1626 | wintitle = wintitle, |
|
1527 | 1627 | widthplot = self.WIDTH+self.WIDTHPROF, |
|
1528 | 1628 | heightplot = self.HEIGHT+self.HEIGHTPROF, |
|
1529 | 1629 | show=show) |
|
1530 | 1630 | |
|
1531 | 1631 | nrow, ncol = self.getSubplots() |
|
1532 | 1632 | |
|
1533 | 1633 | self.addAxes(nrow, ncol*ncolspan, 0, 0, colspan, 1) |
|
1534 | 1634 | |
|
1535 | 1635 | |
|
1536 | 1636 | def run(self, dataOut, id, wintitle="", pairsList=None, showprofile='True', |
|
1537 | 1637 | xmin=None, xmax=None, ymin=None, ymax=None, |
|
1538 | 1638 | timerange=None, |
|
1539 | 1639 | save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1, |
|
1540 | 1640 | server=None, folder=None, username=None, password=None, |
|
1541 | 1641 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): |
|
1542 | 1642 | |
|
1543 | 1643 | |
|
1544 | 1644 | tmin = None |
|
1545 | 1645 | tmax = None |
|
1546 | 1646 | x = dataOut.getTimeRange1(dataOut.outputInterval) |
|
1547 | 1647 | y = dataOut.getHeiRange() |
|
1548 | 1648 | |
|
1549 | 1649 | |
|
1550 | 1650 | #thisDatetime = dataOut.datatime |
|
1551 | 1651 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.ltctime) |
|
1552 | 1652 | title = wintitle + " Phase of Beacon Signal" # : %s" %(thisDatetime.strftime("%d-%b-%Y")) |
|
1553 | 1653 | xlabel = "Local Time" |
|
1554 | 1654 | ylabel = "Phase" |
|
1555 | 1655 | |
|
1556 | 1656 | |
|
1557 | 1657 | #phase = numpy.zeros((len(pairsIndexList),len(dataOut.beacon_heiIndexList))) |
|
1558 | 1658 | phase_beacon = dataOut.data_output |
|
1559 | 1659 | update_figfile = False |
|
1560 | 1660 | |
|
1561 | 1661 | if not self.isConfig: |
|
1562 | 1662 | |
|
1563 | 1663 | self.nplots = phase_beacon.size |
|
1564 | 1664 | |
|
1565 | 1665 | self.setup(id=id, |
|
1566 | 1666 | nplots=self.nplots, |
|
1567 | 1667 | wintitle=wintitle, |
|
1568 | 1668 | showprofile=showprofile, |
|
1569 | 1669 | show=show) |
|
1570 | 1670 | |
|
1571 | 1671 | if timerange is not None: |
|
1572 | 1672 | self.timerange = timerange |
|
1573 | 1673 | |
|
1574 | 1674 | self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange) |
|
1575 | 1675 | |
|
1576 | 1676 | if ymin == None: ymin = numpy.nanmin(phase_beacon) - 10.0 |
|
1577 | 1677 | if ymax == None: ymax = numpy.nanmax(phase_beacon) + 10.0 |
|
1578 | 1678 | |
|
1579 | 1679 | self.FTP_WEI = ftp_wei |
|
1580 | 1680 | self.EXP_CODE = exp_code |
|
1581 | 1681 | self.SUB_EXP_CODE = sub_exp_code |
|
1582 | 1682 | self.PLOT_POS = plot_pos |
|
1583 | 1683 | |
|
1584 | 1684 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
1585 | 1685 | self.isConfig = True |
|
1586 | 1686 | self.figfile = figfile |
|
1587 | 1687 | self.xdata = numpy.array([]) |
|
1588 | 1688 | self.ydata = numpy.array([]) |
|
1589 | 1689 | |
|
1590 | 1690 | #open file beacon phase |
|
1591 | 1691 | path = '%s%03d' %(self.PREFIX, self.id) |
|
1592 | 1692 | beacon_file = os.path.join(path,'%s.txt'%self.name) |
|
1593 | 1693 | self.filename_phase = os.path.join(figpath,beacon_file) |
|
1594 | 1694 | update_figfile = True |
|
1595 | 1695 | |
|
1596 | 1696 | |
|
1597 | 1697 | #store data beacon phase |
|
1598 | 1698 | #self.save_data(self.filename_phase, phase_beacon, thisDatetime) |
|
1599 | 1699 | |
|
1600 | 1700 | self.setWinTitle(title) |
|
1601 | 1701 | |
|
1602 | 1702 | |
|
1603 | 1703 | title = "Phase Offset %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) |
|
1604 | 1704 | |
|
1605 | 1705 | legendlabels = ["phase %d"%(chan) for chan in numpy.arange(self.nplots)] |
|
1606 | 1706 | |
|
1607 | 1707 | axes = self.axesList[0] |
|
1608 | 1708 | |
|
1609 | 1709 | self.xdata = numpy.hstack((self.xdata, x[0:1])) |
|
1610 | 1710 | |
|
1611 | 1711 | if len(self.ydata)==0: |
|
1612 | 1712 | self.ydata = phase_beacon.reshape(-1,1) |
|
1613 | 1713 | else: |
|
1614 | 1714 | self.ydata = numpy.hstack((self.ydata, phase_beacon.reshape(-1,1))) |
|
1615 | 1715 | |
|
1616 | 1716 | |
|
1617 | 1717 | axes.pmultilineyaxis(x=self.xdata, y=self.ydata, |
|
1618 | 1718 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, |
|
1619 | 1719 | xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels, marker='x', markersize=8, linestyle="solid", |
|
1620 | 1720 | XAxisAsTime=True, grid='both' |
|
1621 | 1721 | ) |
|
1622 | 1722 | |
|
1623 | 1723 | self.draw() |
|
1624 | 1724 | |
|
1625 | 1725 | self.save(figpath=figpath, |
|
1626 | 1726 | figfile=figfile, |
|
1627 | 1727 | save=save, |
|
1628 | 1728 | ftp=ftp, |
|
1629 | 1729 | wr_period=wr_period, |
|
1630 | 1730 | thisDatetime=thisDatetime, |
|
1631 | 1731 | update_figfile=update_figfile) |
|
1632 | 1732 | |
|
1633 | 1733 | if dataOut.ltctime + dataOut.outputInterval >= self.xmax: |
|
1634 | 1734 | self.counter_imagwr = wr_period |
|
1635 | 1735 | self.isConfig = False |
|
1636 | 1736 | update_figfile = True |
|
1637 | 1737 | |
|
1638 | 1738 | |
|
1639 | 1739 | |
|
1640 | 1740 | class NSMeteorDetection1Plot(Figure): |
|
1641 | 1741 | |
|
1642 | 1742 | isConfig = None |
|
1643 | 1743 | __nsubplots = None |
|
1644 | 1744 | |
|
1645 | 1745 | WIDTHPROF = None |
|
1646 | 1746 | HEIGHTPROF = None |
|
1647 | 1747 | PREFIX = 'nsm' |
|
1648 | 1748 | |
|
1649 | 1749 | zminList = None |
|
1650 | 1750 | zmaxList = None |
|
1651 | 1751 | cmapList = None |
|
1652 | 1752 | titleList = None |
|
1653 | 1753 | nPairs = None |
|
1654 | 1754 | nChannels = None |
|
1655 | 1755 | nParam = None |
|
1656 | 1756 | |
|
1657 | 1757 | parameters = { |
|
1658 | 1758 | 'id': global_type_string, |
|
1659 | 1759 | 'wintitle': global_type_string, |
|
1660 | 1760 | 'channelList': global_type_list, |
|
1661 | 1761 | 'showprofile': global_type_boolean, |
|
1662 | 1762 | 'xmin': global_type_float, |
|
1663 | 1763 | 'xmax': global_type_float, |
|
1664 | 1764 | 'ymin': global_type_float, |
|
1665 | 1765 | 'ymax': global_type_float, |
|
1666 | 1766 | 'SNRmin': global_type_float, |
|
1667 | 1767 | 'SNRmax': global_type_float, |
|
1668 | 1768 | 'vmin': global_type_float, |
|
1669 | 1769 | 'vmax': global_type_float, |
|
1670 | 1770 | 'wmin': global_type_float, |
|
1671 | 1771 | 'wmax': global_type_float, |
|
1672 | 1772 | 'mode': global_type_string, |
|
1673 | 1773 | 'save': global_type_boolean, |
|
1674 | 1774 | 'figpath': global_type_string, |
|
1675 | 1775 | 'figfile': global_type_string, |
|
1676 | 1776 | 'show': global_type_boolean, |
|
1677 | 1777 | 'ftp': global_type_string, |
|
1678 | 1778 | 'wr_period': global_type_integer, |
|
1679 | 1779 | 'server': global_type_string, |
|
1680 | 1780 | 'folder': global_type_string, |
|
1681 | 1781 | 'username': global_type_string, |
|
1682 | 1782 | 'password': global_type_string, |
|
1683 | 1783 | 'ftp_wei': global_type_integer, |
|
1684 | 1784 | 'exp_code': global_type_integer, |
|
1685 | 1785 | 'sub_exp_code': global_type_integer, |
|
1686 | 1786 | 'plot_pos': global_type_integer, |
|
1687 | 1787 | 'realtime': global_type_boolean, |
|
1688 | 1788 | 'xaxis': global_type_string, |
|
1689 | 1789 | } |
|
1690 | 1790 | |
|
1691 | 1791 | def __init__(self, **kwargs): |
|
1692 | 1792 | Figure.__init__(self, **kwargs) |
|
1693 | 1793 | self.isConfig = False |
|
1694 | 1794 | self.__nsubplots = 1 |
|
1695 | 1795 | |
|
1696 | 1796 | self.WIDTH = 750 |
|
1697 | 1797 | self.HEIGHT = 250 |
|
1698 | 1798 | self.WIDTHPROF = 120 |
|
1699 | 1799 | self.HEIGHTPROF = 0 |
|
1700 | 1800 | self.counter_imagwr = 0 |
|
1701 | 1801 | |
|
1702 | 1802 | self.PLOT_CODE = SPEC_CODE |
|
1703 | 1803 | |
|
1704 | 1804 | self.FTP_WEI = None |
|
1705 | 1805 | self.EXP_CODE = None |
|
1706 | 1806 | self.SUB_EXP_CODE = None |
|
1707 | 1807 | self.PLOT_POS = None |
|
1708 | 1808 | |
|
1709 | 1809 | self.__xfilter_ena = False |
|
1710 | 1810 | self.__yfilter_ena = False |
|
1711 | 1811 | |
|
1712 | 1812 | def getSubplots(self): |
|
1713 | 1813 | |
|
1714 | 1814 | ncol = 3 |
|
1715 | 1815 | nrow = int(numpy.ceil(self.nplots/3.0)) |
|
1716 | 1816 | |
|
1717 | 1817 | return nrow, ncol |
|
1718 | 1818 | |
|
1719 | 1819 | def setup(self, id, nplots, wintitle, show=True): |
|
1720 | 1820 | |
|
1721 | 1821 | self.nplots = nplots |
|
1722 | 1822 | |
|
1723 | 1823 | ncolspan = 1 |
|
1724 | 1824 | colspan = 1 |
|
1725 | 1825 | |
|
1726 | 1826 | self.createFigure(id = id, |
|
1727 | 1827 | wintitle = wintitle, |
|
1728 | 1828 | widthplot = self.WIDTH + self.WIDTHPROF, |
|
1729 | 1829 | heightplot = self.HEIGHT + self.HEIGHTPROF, |
|
1730 | 1830 | show=show) |
|
1731 | 1831 | |
|
1732 | 1832 | nrow, ncol = self.getSubplots() |
|
1733 | 1833 | |
|
1734 | 1834 | counter = 0 |
|
1735 | 1835 | for y in range(nrow): |
|
1736 | 1836 | for x in range(ncol): |
|
1737 | 1837 | |
|
1738 | 1838 | if counter >= self.nplots: |
|
1739 | 1839 | break |
|
1740 | 1840 | |
|
1741 | 1841 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
1742 | 1842 | |
|
1743 | 1843 | counter += 1 |
|
1744 | 1844 | |
|
1745 | 1845 | def run(self, dataOut, id, wintitle="", channelList=None, showprofile=True, |
|
1746 | 1846 | xmin=None, xmax=None, ymin=None, ymax=None, SNRmin=None, SNRmax=None, |
|
1747 | 1847 | vmin=None, vmax=None, wmin=None, wmax=None, mode = 'SA', |
|
1748 | 1848 | save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1, |
|
1749 | 1849 | server=None, folder=None, username=None, password=None, |
|
1750 | 1850 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0, realtime=False, |
|
1751 | 1851 | xaxis="frequency"): |
|
1752 | 1852 | |
|
1753 | 1853 | """ |
|
1754 | 1854 | |
|
1755 | 1855 | Input: |
|
1756 | 1856 | dataOut : |
|
1757 | 1857 | id : |
|
1758 | 1858 | wintitle : |
|
1759 | 1859 | channelList : |
|
1760 | 1860 | showProfile : |
|
1761 | 1861 | xmin : None, |
|
1762 | 1862 | xmax : None, |
|
1763 | 1863 | ymin : None, |
|
1764 | 1864 | ymax : None, |
|
1765 | 1865 | zmin : None, |
|
1766 | 1866 | zmax : None |
|
1767 | 1867 | """ |
|
1768 | 1868 | #SEPARAR EN DOS PLOTS |
|
1769 | 1869 | nParam = dataOut.data_param.shape[1] - 3 |
|
1770 | 1870 | |
|
1771 | 1871 | utctime = dataOut.data_param[0,0] |
|
1772 | 1872 | tmet = dataOut.data_param[:,1].astype(int) |
|
1773 | 1873 | hmet = dataOut.data_param[:,2].astype(int) |
|
1774 | 1874 | |
|
1775 | 1875 | x = dataOut.abscissaList |
|
1776 | 1876 | y = dataOut.heightList |
|
1777 | 1877 | |
|
1778 | 1878 | z = numpy.zeros((nParam, y.size, x.size - 1)) |
|
1779 | 1879 | z[:,:] = numpy.nan |
|
1780 | 1880 | z[:,hmet,tmet] = dataOut.data_param[:,3:].T |
|
1781 | 1881 | z[0,:,:] = 10*numpy.log10(z[0,:,:]) |
|
1782 | 1882 | |
|
1783 | 1883 | xlabel = "Time (s)" |
|
1784 | 1884 | ylabel = "Range (km)" |
|
1785 | 1885 | |
|
1786 | 1886 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.ltctime) |
|
1787 | 1887 | |
|
1788 | 1888 | if not self.isConfig: |
|
1789 | 1889 | |
|
1790 | 1890 | nplots = nParam |
|
1791 | 1891 | |
|
1792 | 1892 | self.setup(id=id, |
|
1793 | 1893 | nplots=nplots, |
|
1794 | 1894 | wintitle=wintitle, |
|
1795 | 1895 | show=show) |
|
1796 | 1896 | |
|
1797 | 1897 | if xmin is None: xmin = numpy.nanmin(x) |
|
1798 | 1898 | if xmax is None: xmax = numpy.nanmax(x) |
|
1799 | 1899 | if ymin is None: ymin = numpy.nanmin(y) |
|
1800 | 1900 | if ymax is None: ymax = numpy.nanmax(y) |
|
1801 | 1901 | if SNRmin is None: SNRmin = numpy.nanmin(z[0,:]) |
|
1802 | 1902 | if SNRmax is None: SNRmax = numpy.nanmax(z[0,:]) |
|
1803 | 1903 | if vmax is None: vmax = numpy.nanmax(numpy.abs(z[1,:])) |
|
1804 | 1904 | if vmin is None: vmin = -vmax |
|
1805 | 1905 | if wmin is None: wmin = 0 |
|
1806 | 1906 | if wmax is None: wmax = 50 |
|
1807 | 1907 | |
|
1808 | 1908 | pairsList = dataOut.groupList |
|
1809 | 1909 | self.nPairs = len(dataOut.groupList) |
|
1810 | 1910 | |
|
1811 | 1911 | zminList = [SNRmin, vmin, cmin] + [pmin]*self.nPairs |
|
1812 | 1912 | zmaxList = [SNRmax, vmax, cmax] + [pmax]*self.nPairs |
|
1813 | 1913 | titleList = ["SNR","Radial Velocity","Coherence"] |
|
1814 | 1914 | cmapList = ["jet","RdBu_r","jet"] |
|
1815 | 1915 | |
|
1816 | 1916 | for i in range(self.nPairs): |
|
1817 | 1917 | strAux1 = "Phase Difference "+ str(pairsList[i][0]) + str(pairsList[i][1]) |
|
1818 | 1918 | titleList = titleList + [strAux1] |
|
1819 | 1919 | cmapList = cmapList + ["RdBu_r"] |
|
1820 | 1920 | |
|
1821 | 1921 | self.zminList = zminList |
|
1822 | 1922 | self.zmaxList = zmaxList |
|
1823 | 1923 | self.cmapList = cmapList |
|
1824 | 1924 | self.titleList = titleList |
|
1825 | 1925 | |
|
1826 | 1926 | self.FTP_WEI = ftp_wei |
|
1827 | 1927 | self.EXP_CODE = exp_code |
|
1828 | 1928 | self.SUB_EXP_CODE = sub_exp_code |
|
1829 | 1929 | self.PLOT_POS = plot_pos |
|
1830 | 1930 | |
|
1831 | 1931 | self.isConfig = True |
|
1832 | 1932 | |
|
1833 | 1933 | str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S")) |
|
1834 | 1934 | |
|
1835 | 1935 | for i in range(nParam): |
|
1836 | 1936 | title = self.titleList[i] + ": " +str_datetime |
|
1837 | 1937 | axes = self.axesList[i] |
|
1838 | 1938 | axes.pcolor(x, y, z[i,:].T, |
|
1839 | 1939 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=self.zminList[i], zmax=self.zmaxList[i], |
|
1840 | 1940 | xlabel=xlabel, ylabel=ylabel, title=title, colormap=self.cmapList[i],ticksize=9, cblabel='') |
|
1841 | 1941 | self.draw() |
|
1842 | 1942 | |
|
1843 | 1943 | if figfile == None: |
|
1844 | 1944 | str_datetime = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
1845 | 1945 | name = str_datetime |
|
1846 | 1946 | if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)): |
|
1847 | 1947 | name = name + '_az' + '_%2.2f'%(dataOut.azimuth) + '_zn' + '_%2.2f'%(dataOut.zenith) |
|
1848 | 1948 | figfile = self.getFilename(name) |
|
1849 | 1949 | |
|
1850 | 1950 | self.save(figpath=figpath, |
|
1851 | 1951 | figfile=figfile, |
|
1852 | 1952 | save=save, |
|
1853 | 1953 | ftp=ftp, |
|
1854 | 1954 | wr_period=wr_period, |
|
1855 | 1955 | thisDatetime=thisDatetime) |
|
1856 | 1956 | |
|
1857 | 1957 | |
|
1858 | 1958 | class NSMeteorDetection2Plot(Figure): |
|
1859 | 1959 | |
|
1860 | 1960 | isConfig = None |
|
1861 | 1961 | __nsubplots = None |
|
1862 | 1962 | |
|
1863 | 1963 | WIDTHPROF = None |
|
1864 | 1964 | HEIGHTPROF = None |
|
1865 | 1965 | PREFIX = 'nsm' |
|
1866 | 1966 | |
|
1867 | 1967 | zminList = None |
|
1868 | 1968 | zmaxList = None |
|
1869 | 1969 | cmapList = None |
|
1870 | 1970 | titleList = None |
|
1871 | 1971 | nPairs = None |
|
1872 | 1972 | nChannels = None |
|
1873 | 1973 | nParam = None |
|
1874 | 1974 | |
|
1875 | 1975 | parameters = { |
|
1876 | 1976 | 'id': global_type_string, |
|
1877 | 1977 | 'wintitle': global_type_string, |
|
1878 | 1978 | 'channelList': global_type_list, |
|
1879 | 1979 | 'showprofile': global_type_boolean, |
|
1880 | 1980 | 'xmin': global_type_float, |
|
1881 | 1981 | 'xmax': global_type_float, |
|
1882 | 1982 | 'ymin': global_type_float, |
|
1883 | 1983 | 'ymax': global_type_float, |
|
1884 | 1984 | 'SNRmin': global_type_float, |
|
1885 | 1985 | 'SNRmax': global_type_float, |
|
1886 | 1986 | 'vmin': global_type_float, |
|
1887 | 1987 | 'vmax': global_type_float, |
|
1888 | 1988 | 'wmin': global_type_float, |
|
1889 | 1989 | 'wmax': global_type_float, |
|
1890 | 1990 | 'mode': global_type_string, |
|
1891 | 1991 | 'save': global_type_boolean, |
|
1892 | 1992 | 'figpath': global_type_string, |
|
1893 | 1993 | 'figfile': global_type_string, |
|
1894 | 1994 | 'show': global_type_string, |
|
1895 | 1995 | 'ftp': global_type_boolean, |
|
1896 | 1996 | 'wr_period': global_type_integer, |
|
1897 | 1997 | 'server': global_type_string, |
|
1898 | 1998 | 'folder': global_type_string, |
|
1899 | 1999 | 'username': global_type_string, |
|
1900 | 2000 | 'password': global_type_string, |
|
1901 | 2001 | 'ftp_wei': global_type_integer, |
|
1902 | 2002 | 'exp_code': global_type_integer, |
|
1903 | 2003 | 'sub_exp_code': global_type_integer, |
|
1904 | 2004 | 'plot_pos': global_type_integer, |
|
1905 | 2005 | 'realtime': global_type_boolean, |
|
1906 | 2006 | 'xaxis': global_type_string, |
|
1907 | 2007 | } |
|
1908 | 2008 | |
|
1909 | 2009 | def __init__(self, **kwargs): |
|
1910 | 2010 | Figure.__init__(self, **kwargs) |
|
1911 | 2011 | self.isConfig = False |
|
1912 | 2012 | self.__nsubplots = 1 |
|
1913 | 2013 | |
|
1914 | 2014 | self.WIDTH = 750 |
|
1915 | 2015 | self.HEIGHT = 250 |
|
1916 | 2016 | self.WIDTHPROF = 120 |
|
1917 | 2017 | self.HEIGHTPROF = 0 |
|
1918 | 2018 | self.counter_imagwr = 0 |
|
1919 | 2019 | |
|
1920 | 2020 | self.PLOT_CODE = SPEC_CODE |
|
1921 | 2021 | |
|
1922 | 2022 | self.FTP_WEI = None |
|
1923 | 2023 | self.EXP_CODE = None |
|
1924 | 2024 | self.SUB_EXP_CODE = None |
|
1925 | 2025 | self.PLOT_POS = None |
|
1926 | 2026 | |
|
1927 | 2027 | self.__xfilter_ena = False |
|
1928 | 2028 | self.__yfilter_ena = False |
|
1929 | 2029 | |
|
1930 | 2030 | def getSubplots(self): |
|
1931 | 2031 | |
|
1932 | 2032 | ncol = 3 |
|
1933 | 2033 | nrow = int(numpy.ceil(self.nplots/3.0)) |
|
1934 | 2034 | |
|
1935 | 2035 | return nrow, ncol |
|
1936 | 2036 | |
|
1937 | 2037 | def setup(self, id, nplots, wintitle, show=True): |
|
1938 | 2038 | |
|
1939 | 2039 | self.nplots = nplots |
|
1940 | 2040 | |
|
1941 | 2041 | ncolspan = 1 |
|
1942 | 2042 | colspan = 1 |
|
1943 | 2043 | |
|
1944 | 2044 | self.createFigure(id = id, |
|
1945 | 2045 | wintitle = wintitle, |
|
1946 | 2046 | widthplot = self.WIDTH + self.WIDTHPROF, |
|
1947 | 2047 | heightplot = self.HEIGHT + self.HEIGHTPROF, |
|
1948 | 2048 | show=show) |
|
1949 | 2049 | |
|
1950 | 2050 | nrow, ncol = self.getSubplots() |
|
1951 | 2051 | |
|
1952 | 2052 | counter = 0 |
|
1953 | 2053 | for y in range(nrow): |
|
1954 | 2054 | for x in range(ncol): |
|
1955 | 2055 | |
|
1956 | 2056 | if counter >= self.nplots: |
|
1957 | 2057 | break |
|
1958 | 2058 | |
|
1959 | 2059 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
1960 | 2060 | |
|
1961 | 2061 | counter += 1 |
|
1962 | 2062 | |
|
1963 | 2063 | def run(self, dataOut, id, wintitle="", channelList=None, showprofile=True, |
|
1964 | 2064 | xmin=None, xmax=None, ymin=None, ymax=None, SNRmin=None, SNRmax=None, |
|
1965 | 2065 | vmin=None, vmax=None, wmin=None, wmax=None, mode = 'SA', |
|
1966 | 2066 | save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1, |
|
1967 | 2067 | server=None, folder=None, username=None, password=None, |
|
1968 | 2068 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0, realtime=False, |
|
1969 | 2069 | xaxis="frequency"): |
|
1970 | 2070 | |
|
1971 | 2071 | """ |
|
1972 | 2072 | |
|
1973 | 2073 | Input: |
|
1974 | 2074 | dataOut : |
|
1975 | 2075 | id : |
|
1976 | 2076 | wintitle : |
|
1977 | 2077 | channelList : |
|
1978 | 2078 | showProfile : |
|
1979 | 2079 | xmin : None, |
|
1980 | 2080 | xmax : None, |
|
1981 | 2081 | ymin : None, |
|
1982 | 2082 | ymax : None, |
|
1983 | 2083 | zmin : None, |
|
1984 | 2084 | zmax : None |
|
1985 | 2085 | """ |
|
1986 | 2086 | #Rebuild matrix |
|
1987 | 2087 | utctime = dataOut.data_param[0,0] |
|
1988 | 2088 | cmet = dataOut.data_param[:,1].astype(int) |
|
1989 | 2089 | tmet = dataOut.data_param[:,2].astype(int) |
|
1990 | 2090 | hmet = dataOut.data_param[:,3].astype(int) |
|
1991 | 2091 | |
|
1992 | 2092 | nParam = 3 |
|
1993 | 2093 | nChan = len(dataOut.groupList) |
|
1994 | 2094 | x = dataOut.abscissaList |
|
1995 | 2095 | y = dataOut.heightList |
|
1996 | 2096 | |
|
1997 | 2097 | z = numpy.full((nChan, nParam, y.size, x.size - 1),numpy.nan) |
|
1998 | 2098 | z[cmet,:,hmet,tmet] = dataOut.data_param[:,4:] |
|
1999 | 2099 | z[:,0,:,:] = 10*numpy.log10(z[:,0,:,:]) #logarithmic scale |
|
2000 | 2100 | z = numpy.reshape(z, (nChan*nParam, y.size, x.size-1)) |
|
2001 | 2101 | |
|
2002 | 2102 | xlabel = "Time (s)" |
|
2003 | 2103 | ylabel = "Range (km)" |
|
2004 | 2104 | |
|
2005 | 2105 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.ltctime) |
|
2006 | 2106 | |
|
2007 | 2107 | if not self.isConfig: |
|
2008 | 2108 | |
|
2009 | 2109 | nplots = nParam*nChan |
|
2010 | 2110 | |
|
2011 | 2111 | self.setup(id=id, |
|
2012 | 2112 | nplots=nplots, |
|
2013 | 2113 | wintitle=wintitle, |
|
2014 | 2114 | show=show) |
|
2015 | 2115 | |
|
2016 | 2116 | if xmin is None: xmin = numpy.nanmin(x) |
|
2017 | 2117 | if xmax is None: xmax = numpy.nanmax(x) |
|
2018 | 2118 | if ymin is None: ymin = numpy.nanmin(y) |
|
2019 | 2119 | if ymax is None: ymax = numpy.nanmax(y) |
|
2020 | 2120 | if SNRmin is None: SNRmin = numpy.nanmin(z[0,:]) |
|
2021 | 2121 | if SNRmax is None: SNRmax = numpy.nanmax(z[0,:]) |
|
2022 | 2122 | if vmax is None: vmax = numpy.nanmax(numpy.abs(z[1,:])) |
|
2023 | 2123 | if vmin is None: vmin = -vmax |
|
2024 | 2124 | if wmin is None: wmin = 0 |
|
2025 | 2125 | if wmax is None: wmax = 50 |
|
2026 | 2126 | |
|
2027 | 2127 | self.nChannels = nChan |
|
2028 | 2128 | |
|
2029 | 2129 | zminList = [] |
|
2030 | 2130 | zmaxList = [] |
|
2031 | 2131 | titleList = [] |
|
2032 | 2132 | cmapList = [] |
|
2033 | 2133 | for i in range(self.nChannels): |
|
2034 | 2134 | strAux1 = "SNR Channel "+ str(i) |
|
2035 | 2135 | strAux2 = "Radial Velocity Channel "+ str(i) |
|
2036 | 2136 | strAux3 = "Spectral Width Channel "+ str(i) |
|
2037 | 2137 | |
|
2038 | 2138 | titleList = titleList + [strAux1,strAux2,strAux3] |
|
2039 | 2139 | cmapList = cmapList + ["jet","RdBu_r","jet"] |
|
2040 | 2140 | zminList = zminList + [SNRmin,vmin,wmin] |
|
2041 | 2141 | zmaxList = zmaxList + [SNRmax,vmax,wmax] |
|
2042 | 2142 | |
|
2043 | 2143 | self.zminList = zminList |
|
2044 | 2144 | self.zmaxList = zmaxList |
|
2045 | 2145 | self.cmapList = cmapList |
|
2046 | 2146 | self.titleList = titleList |
|
2047 | 2147 | |
|
2048 | 2148 | self.FTP_WEI = ftp_wei |
|
2049 | 2149 | self.EXP_CODE = exp_code |
|
2050 | 2150 | self.SUB_EXP_CODE = sub_exp_code |
|
2051 | 2151 | self.PLOT_POS = plot_pos |
|
2052 | 2152 | |
|
2053 | 2153 | self.isConfig = True |
|
2054 | 2154 | |
|
2055 | 2155 | str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S")) |
|
2056 | 2156 | |
|
2057 | 2157 | for i in range(self.nplots): |
|
2058 | 2158 | title = self.titleList[i] + ": " +str_datetime |
|
2059 | 2159 | axes = self.axesList[i] |
|
2060 | 2160 | axes.pcolor(x, y, z[i,:].T, |
|
2061 | 2161 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=self.zminList[i], zmax=self.zmaxList[i], |
|
2062 | 2162 | xlabel=xlabel, ylabel=ylabel, title=title, colormap=self.cmapList[i],ticksize=9, cblabel='') |
|
2063 | 2163 | self.draw() |
|
2064 | 2164 | |
|
2065 | 2165 | if figfile == None: |
|
2066 | 2166 | str_datetime = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
2067 | 2167 | name = str_datetime |
|
2068 | 2168 | if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)): |
|
2069 | 2169 | name = name + '_az' + '_%2.2f'%(dataOut.azimuth) + '_zn' + '_%2.2f'%(dataOut.zenith) |
|
2070 | 2170 | figfile = self.getFilename(name) |
|
2071 | 2171 | |
|
2072 | 2172 | self.save(figpath=figpath, |
|
2073 | 2173 | figfile=figfile, |
|
2074 | 2174 | save=save, |
|
2075 | 2175 | ftp=ftp, |
|
2076 | 2176 | wr_period=wr_period, |
|
2077 | 2177 | thisDatetime=thisDatetime) |
@@ -1,1090 +1,1090 | |||
|
1 | 1 | import numpy |
|
2 | 2 | import time |
|
3 | 3 | import os |
|
4 | 4 | import h5py |
|
5 | 5 | import re |
|
6 | 6 | import datetime |
|
7 | 7 | |
|
8 | 8 | from schainpy.model.data.jrodata import * |
|
9 | 9 | from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation |
|
10 | 10 | # from jroIO_base import * |
|
11 | 11 | from schainpy.model.io.jroIO_base import * |
|
12 | 12 | import schainpy |
|
13 | 13 | |
|
14 | 14 | |
|
15 | 15 | class ParamReader(ProcessingUnit): |
|
16 | 16 | ''' |
|
17 | 17 | Reads HDF5 format files |
|
18 | 18 | |
|
19 | 19 | path |
|
20 | 20 | |
|
21 | 21 | startDate |
|
22 | 22 | |
|
23 | 23 | endDate |
|
24 | 24 | |
|
25 | 25 | startTime |
|
26 | 26 | |
|
27 | 27 | endTime |
|
28 | 28 | ''' |
|
29 | 29 | |
|
30 | 30 | ext = ".hdf5" |
|
31 | 31 | |
|
32 | 32 | optchar = "D" |
|
33 | 33 | |
|
34 | 34 | timezone = None |
|
35 | 35 | |
|
36 | 36 | startTime = None |
|
37 | 37 | |
|
38 | 38 | endTime = None |
|
39 | 39 | |
|
40 | 40 | fileIndex = None |
|
41 | 41 | |
|
42 | 42 | utcList = None #To select data in the utctime list |
|
43 | 43 | |
|
44 | 44 | blockList = None #List to blocks to be read from the file |
|
45 | 45 | |
|
46 | 46 | blocksPerFile = None #Number of blocks to be read |
|
47 | 47 | |
|
48 | 48 | blockIndex = None |
|
49 | 49 | |
|
50 | 50 | path = None |
|
51 | 51 | |
|
52 | 52 | #List of Files |
|
53 | 53 | |
|
54 | 54 | filenameList = None |
|
55 | 55 | |
|
56 | 56 | datetimeList = None |
|
57 | 57 | |
|
58 | 58 | #Hdf5 File |
|
59 | 59 | |
|
60 | 60 | listMetaname = None |
|
61 | 61 | |
|
62 | 62 | listMeta = None |
|
63 | 63 | |
|
64 | 64 | listDataname = None |
|
65 | 65 | |
|
66 | 66 | listData = None |
|
67 | 67 | |
|
68 | 68 | listShapes = None |
|
69 | 69 | |
|
70 | 70 | fp = None |
|
71 | 71 | |
|
72 | 72 | #dataOut reconstruction |
|
73 | 73 | |
|
74 | 74 | dataOut = None |
|
75 | 75 | |
|
76 | 76 | |
|
77 | 77 | def __init__(self, **kwargs): |
|
78 | 78 | ProcessingUnit.__init__(self, **kwargs) |
|
79 | 79 | self.dataOut = Parameters() |
|
80 | 80 | return |
|
81 | 81 | |
|
82 | 82 | def setup(self, **kwargs): |
|
83 | 83 | |
|
84 | 84 | path = kwargs['path'] |
|
85 | 85 | startDate = kwargs['startDate'] |
|
86 | 86 | endDate = kwargs['endDate'] |
|
87 | 87 | startTime = kwargs['startTime'] |
|
88 | 88 | endTime = kwargs['endTime'] |
|
89 | 89 | walk = kwargs['walk'] |
|
90 | 90 | if kwargs.has_key('ext'): |
|
91 | 91 | ext = kwargs['ext'] |
|
92 | 92 | else: |
|
93 | 93 | ext = '.hdf5' |
|
94 | 94 | if kwargs.has_key('timezone'): |
|
95 | 95 | self.timezone = kwargs['timezone'] |
|
96 | 96 | else: |
|
97 | 97 | self.timezone = 'lt' |
|
98 | 98 | |
|
99 | 99 | print "[Reading] Searching files in offline mode ..." |
|
100 | 100 | pathList, filenameList = self.__searchFilesOffLine(path, startDate=startDate, endDate=endDate, |
|
101 | 101 | startTime=startTime, endTime=endTime, |
|
102 | 102 | ext=ext, walk=walk) |
|
103 | 103 | |
|
104 | 104 | if not(filenameList): |
|
105 | 105 | print "There is no files into the folder: %s"%(path) |
|
106 | 106 | sys.exit(-1) |
|
107 | 107 | |
|
108 | 108 | self.fileIndex = -1 |
|
109 | 109 | self.startTime = startTime |
|
110 | 110 | self.endTime = endTime |
|
111 | 111 | |
|
112 | 112 | self.__readMetadata() |
|
113 | 113 | |
|
114 | 114 | self.__setNextFileOffline() |
|
115 | 115 | |
|
116 | 116 | return |
|
117 | 117 | |
|
118 | 118 | def __searchFilesOffLine(self, |
|
119 | 119 | path, |
|
120 | 120 | startDate=None, |
|
121 | 121 | endDate=None, |
|
122 | 122 | startTime=datetime.time(0,0,0), |
|
123 | 123 | endTime=datetime.time(23,59,59), |
|
124 | 124 | ext='.hdf5', |
|
125 | 125 | walk=True): |
|
126 | 126 | |
|
127 | 127 | expLabel = '' |
|
128 | 128 | self.filenameList = [] |
|
129 | 129 | self.datetimeList = [] |
|
130 | 130 | |
|
131 | 131 | pathList = [] |
|
132 | 132 | |
|
133 | 133 | JRODataObj = JRODataReader() |
|
134 | 134 | dateList, pathList = JRODataObj.findDatafiles(path, startDate, endDate, expLabel, ext, walk, include_path=True) |
|
135 | 135 | |
|
136 | 136 | if dateList == []: |
|
137 | 137 | print "[Reading] No *%s files in %s from %s to %s)"%(ext, path, |
|
138 | 138 | datetime.datetime.combine(startDate,startTime).ctime(), |
|
139 | 139 | datetime.datetime.combine(endDate,endTime).ctime()) |
|
140 | 140 | |
|
141 | 141 | return None, None |
|
142 | 142 | |
|
143 | 143 | if len(dateList) > 1: |
|
144 | 144 | print "[Reading] %d days were found in date range: %s - %s" %(len(dateList), startDate, endDate) |
|
145 | 145 | else: |
|
146 | 146 | print "[Reading] data was found for the date %s" %(dateList[0]) |
|
147 | 147 | |
|
148 | 148 | filenameList = [] |
|
149 | 149 | datetimeList = [] |
|
150 | 150 | |
|
151 | 151 | #---------------------------------------------------------------------------------- |
|
152 | 152 | |
|
153 | 153 | for thisPath in pathList: |
|
154 | 154 | # thisPath = pathList[pathDict[file]] |
|
155 | 155 | |
|
156 | 156 | fileList = glob.glob1(thisPath, "*%s" %ext) |
|
157 | 157 | fileList.sort() |
|
158 | 158 | |
|
159 | 159 | for file in fileList: |
|
160 | 160 | |
|
161 | 161 | filename = os.path.join(thisPath,file) |
|
162 | 162 | |
|
163 | 163 | if not isFileInDateRange(filename, startDate, endDate): |
|
164 | 164 | continue |
|
165 | 165 | |
|
166 | 166 | thisDatetime = self.__isFileInTimeRange(filename, startDate, endDate, startTime, endTime) |
|
167 | 167 | |
|
168 | 168 | if not(thisDatetime): |
|
169 | 169 | continue |
|
170 | 170 | |
|
171 | 171 | filenameList.append(filename) |
|
172 | 172 | datetimeList.append(thisDatetime) |
|
173 | 173 | |
|
174 | 174 | if not(filenameList): |
|
175 | 175 | print "[Reading] Any file was found int time range %s - %s" %(datetime.datetime.combine(startDate,startTime).ctime(), datetime.datetime.combine(endDate,endTime).ctime()) |
|
176 | 176 | return None, None |
|
177 | 177 | |
|
178 | 178 | print "[Reading] %d file(s) was(were) found in time range: %s - %s" %(len(filenameList), startTime, endTime) |
|
179 | 179 | |
|
180 | 180 | |
|
181 | 181 | for i in range(len(filenameList)): |
|
182 | 182 | print "[Reading] %s -> [%s]" %(filenameList[i], datetimeList[i].ctime()) |
|
183 | 183 | |
|
184 | 184 | self.filenameList = filenameList |
|
185 | 185 | self.datetimeList = datetimeList |
|
186 | 186 | |
|
187 | 187 | return pathList, filenameList |
|
188 | 188 | |
|
189 | 189 | def __isFileInTimeRange(self,filename, startDate, endDate, startTime, endTime): |
|
190 | 190 | |
|
191 | 191 | """ |
|
192 | 192 | Retorna 1 si el archivo de datos se encuentra dentro del rango de horas especificado. |
|
193 | 193 | |
|
194 | 194 | Inputs: |
|
195 | 195 | filename : nombre completo del archivo de datos en formato Jicamarca (.r) |
|
196 | 196 | |
|
197 | 197 | startDate : fecha inicial del rango seleccionado en formato datetime.date |
|
198 | 198 | |
|
199 | 199 | endDate : fecha final del rango seleccionado en formato datetime.date |
|
200 | 200 | |
|
201 | 201 | startTime : tiempo inicial del rango seleccionado en formato datetime.time |
|
202 | 202 | |
|
203 | 203 | endTime : tiempo final del rango seleccionado en formato datetime.time |
|
204 | 204 | |
|
205 | 205 | Return: |
|
206 | 206 | Boolean : Retorna True si el archivo de datos contiene datos en el rango de |
|
207 | 207 | fecha especificado, de lo contrario retorna False. |
|
208 | 208 | |
|
209 | 209 | Excepciones: |
|
210 | 210 | Si el archivo no existe o no puede ser abierto |
|
211 | 211 | Si la cabecera no puede ser leida. |
|
212 | 212 | |
|
213 | 213 | """ |
|
214 | 214 | |
|
215 | 215 | try: |
|
216 | 216 | fp = h5py.File(filename,'r') |
|
217 | 217 | grp1 = fp['Data'] |
|
218 | 218 | |
|
219 | 219 | except IOError: |
|
220 | 220 | traceback.print_exc() |
|
221 | 221 | raise IOError, "The file %s can't be opened" %(filename) |
|
222 | 222 | #chino rata |
|
223 | 223 | #In case has utctime attribute |
|
224 | 224 | grp2 = grp1['utctime'] |
|
225 | 225 | # thisUtcTime = grp2.value[0] - 5*3600 #To convert to local time |
|
226 | 226 | thisUtcTime = grp2.value[0] |
|
227 | 227 | |
|
228 | 228 | fp.close() |
|
229 | 229 | |
|
230 | 230 | if self.timezone == 'lt': |
|
231 | 231 | thisUtcTime -= 5*3600 |
|
232 | 232 | |
|
233 | 233 | thisDatetime = datetime.datetime.fromtimestamp(thisUtcTime[0] + 5*3600) |
|
234 | 234 | # thisDatetime = datetime.datetime.fromtimestamp(thisUtcTime[0]) |
|
235 | 235 | thisDate = thisDatetime.date() |
|
236 | 236 | thisTime = thisDatetime.time() |
|
237 | 237 | |
|
238 | 238 | startUtcTime = (datetime.datetime.combine(thisDate,startTime)- datetime.datetime(1970, 1, 1)).total_seconds() |
|
239 | 239 | endUtcTime = (datetime.datetime.combine(thisDate,endTime)- datetime.datetime(1970, 1, 1)).total_seconds() |
|
240 | 240 | |
|
241 | 241 | #General case |
|
242 | 242 | # o>>>>>>>>>>>>>><<<<<<<<<<<<<<o |
|
243 | 243 | #-----------o----------------------------o----------- |
|
244 | 244 | # startTime endTime |
|
245 | 245 | |
|
246 | 246 | if endTime >= startTime: |
|
247 | 247 | thisUtcLog = numpy.logical_and(thisUtcTime > startUtcTime, thisUtcTime < endUtcTime) |
|
248 | 248 | if numpy.any(thisUtcLog): #If there is one block between the hours mentioned |
|
249 | 249 | return thisDatetime |
|
250 | 250 | return None |
|
251 | 251 | |
|
252 | 252 | #If endTime < startTime then endTime belongs to the next day |
|
253 | 253 | #<<<<<<<<<<<o o>>>>>>>>>>> |
|
254 | 254 | #-----------o----------------------------o----------- |
|
255 | 255 | # endTime startTime |
|
256 | 256 | |
|
257 | 257 | if (thisDate == startDate) and numpy.all(thisUtcTime < startUtcTime): |
|
258 | 258 | return None |
|
259 | 259 | |
|
260 | 260 | if (thisDate == endDate) and numpy.all(thisUtcTime > endUtcTime): |
|
261 | 261 | return None |
|
262 | 262 | |
|
263 | 263 | if numpy.all(thisUtcTime < startUtcTime) and numpy.all(thisUtcTime > endUtcTime): |
|
264 | 264 | return None |
|
265 | 265 | |
|
266 | 266 | return thisDatetime |
|
267 | 267 | |
|
268 | 268 | def __setNextFileOffline(self): |
|
269 | 269 | |
|
270 | 270 | self.fileIndex += 1 |
|
271 | 271 | idFile = self.fileIndex |
|
272 | 272 | |
|
273 | 273 | if not(idFile < len(self.filenameList)): |
|
274 | 274 | print "No more Files" |
|
275 | 275 | return 0 |
|
276 | 276 | |
|
277 | 277 | filename = self.filenameList[idFile] |
|
278 | 278 | |
|
279 | 279 | filePointer = h5py.File(filename,'r') |
|
280 | 280 | |
|
281 | 281 | self.filename = filename |
|
282 | 282 | |
|
283 | 283 | self.fp = filePointer |
|
284 | 284 | |
|
285 | 285 | print "Setting the file: %s"%self.filename |
|
286 | 286 | |
|
287 | 287 | # self.__readMetadata() |
|
288 | 288 | self.__setBlockList() |
|
289 | 289 | self.__readData() |
|
290 | 290 | # self.nRecords = self.fp['Data'].attrs['blocksPerFile'] |
|
291 | 291 | # self.nRecords = self.fp['Data'].attrs['nRecords'] |
|
292 | 292 | self.blockIndex = 0 |
|
293 | 293 | return 1 |
|
294 | 294 | |
|
295 | 295 | def __setBlockList(self): |
|
296 | 296 | ''' |
|
297 | 297 | Selects the data within the times defined |
|
298 | 298 | |
|
299 | 299 | self.fp |
|
300 | 300 | self.startTime |
|
301 | 301 | self.endTime |
|
302 | 302 | |
|
303 | 303 | self.blockList |
|
304 | 304 | self.blocksPerFile |
|
305 | 305 | |
|
306 | 306 | ''' |
|
307 | 307 | fp = self.fp |
|
308 | 308 | startTime = self.startTime |
|
309 | 309 | endTime = self.endTime |
|
310 | 310 | |
|
311 | 311 | grp = fp['Data'] |
|
312 | 312 | thisUtcTime = grp['utctime'].value.astype(numpy.float)[0] |
|
313 | 313 | |
|
314 | 314 | #ERROOOOR |
|
315 | 315 | if self.timezone == 'lt': |
|
316 | 316 | thisUtcTime -= 5*3600 |
|
317 | 317 | |
|
318 | 318 | thisDatetime = datetime.datetime.fromtimestamp(thisUtcTime[0] + 5*3600) |
|
319 | 319 | |
|
320 | 320 | thisDate = thisDatetime.date() |
|
321 | 321 | thisTime = thisDatetime.time() |
|
322 | 322 | |
|
323 | 323 | startUtcTime = (datetime.datetime.combine(thisDate,startTime) - datetime.datetime(1970, 1, 1)).total_seconds() |
|
324 | 324 | endUtcTime = (datetime.datetime.combine(thisDate,endTime) - datetime.datetime(1970, 1, 1)).total_seconds() |
|
325 | 325 | |
|
326 | 326 | ind = numpy.where(numpy.logical_and(thisUtcTime >= startUtcTime, thisUtcTime < endUtcTime))[0] |
|
327 | 327 | |
|
328 | 328 | self.blockList = ind |
|
329 | 329 | self.blocksPerFile = len(ind) |
|
330 | 330 | |
|
331 | 331 | return |
|
332 | 332 | |
|
333 | 333 | def __readMetadata(self): |
|
334 | 334 | ''' |
|
335 | 335 | Reads Metadata |
|
336 | 336 | |
|
337 | 337 | self.pathMeta |
|
338 | 338 | |
|
339 | 339 | self.listShapes |
|
340 | 340 | self.listMetaname |
|
341 | 341 | self.listMeta |
|
342 | 342 | |
|
343 | 343 | ''' |
|
344 | 344 | |
|
345 | 345 | # grp = self.fp['Data'] |
|
346 | 346 | # pathMeta = os.path.join(self.path, grp.attrs['metadata']) |
|
347 | 347 | # |
|
348 | 348 | # if pathMeta == self.pathMeta: |
|
349 | 349 | # return |
|
350 | 350 | # else: |
|
351 | 351 | # self.pathMeta = pathMeta |
|
352 | 352 | # |
|
353 | 353 | # filePointer = h5py.File(self.pathMeta,'r') |
|
354 | 354 | # groupPointer = filePointer['Metadata'] |
|
355 | 355 | |
|
356 | 356 | filename = self.filenameList[0] |
|
357 | 357 | |
|
358 | 358 | fp = h5py.File(filename,'r') |
|
359 | 359 | |
|
360 | 360 | gp = fp['Metadata'] |
|
361 | 361 | |
|
362 | 362 | listMetaname = [] |
|
363 | 363 | listMetadata = [] |
|
364 | 364 | for item in gp.items(): |
|
365 | 365 | name = item[0] |
|
366 | 366 | |
|
367 | 367 | if name=='array dimensions': |
|
368 | 368 | table = gp[name][:] |
|
369 | 369 | listShapes = {} |
|
370 | 370 | for shapes in table: |
|
371 | 371 | listShapes[shapes[0]] = numpy.array([shapes[1],shapes[2],shapes[3],shapes[4],shapes[5]]) |
|
372 | 372 | else: |
|
373 | 373 | data = gp[name].value |
|
374 | 374 | listMetaname.append(name) |
|
375 | 375 | listMetadata.append(data) |
|
376 | 376 | |
|
377 | 377 | # if name=='type': |
|
378 | 378 | # self.__initDataOut(data) |
|
379 | 379 | |
|
380 | 380 | self.listShapes = listShapes |
|
381 | 381 | self.listMetaname = listMetaname |
|
382 | 382 | self.listMeta = listMetadata |
|
383 | 383 | |
|
384 | 384 | fp.close() |
|
385 | 385 | return |
|
386 | 386 | |
|
387 | 387 | def __readData(self): |
|
388 | 388 | grp = self.fp['Data'] |
|
389 | 389 | listdataname = [] |
|
390 | 390 | listdata = [] |
|
391 | 391 | |
|
392 | 392 | for item in grp.items(): |
|
393 | 393 | name = item[0] |
|
394 | 394 | listdataname.append(name) |
|
395 | 395 | |
|
396 | 396 | array = self.__setDataArray(grp[name],self.listShapes[name]) |
|
397 | 397 | listdata.append(array) |
|
398 | 398 | |
|
399 | 399 | self.listDataname = listdataname |
|
400 | 400 | self.listData = listdata |
|
401 | 401 | return |
|
402 | 402 | |
|
403 | 403 | def __setDataArray(self, dataset, shapes): |
|
404 | 404 | |
|
405 | 405 | nDims = shapes[0] |
|
406 | 406 | |
|
407 | 407 | nDim2 = shapes[1] #Dimension 0 |
|
408 | 408 | |
|
409 | 409 | nDim1 = shapes[2] #Dimension 1, number of Points or Parameters |
|
410 | 410 | |
|
411 | 411 | nDim0 = shapes[3] #Dimension 2, number of samples or ranges |
|
412 | 412 | |
|
413 | 413 | mode = shapes[4] #Mode of storing |
|
414 | 414 | |
|
415 | 415 | blockList = self.blockList |
|
416 | 416 | |
|
417 | 417 | blocksPerFile = self.blocksPerFile |
|
418 | 418 | |
|
419 | 419 | #Depending on what mode the data was stored |
|
420 | 420 | if mode == 0: #Divided in channels |
|
421 | 421 | arrayData = dataset.value.astype(numpy.float)[0][blockList] |
|
422 | 422 | if mode == 1: #Divided in parameter |
|
423 | 423 | strds = 'table' |
|
424 | 424 | nDatas = nDim1 |
|
425 | 425 | newShapes = (blocksPerFile,nDim2,nDim0) |
|
426 | 426 | elif mode==2: #Concatenated in a table |
|
427 | 427 | strds = 'table0' |
|
428 | 428 | arrayData = dataset[strds].value |
|
429 | 429 | #Selecting part of the dataset |
|
430 | 430 | utctime = arrayData[:,0] |
|
431 | 431 | u, indices = numpy.unique(utctime, return_index=True) |
|
432 | 432 | |
|
433 | 433 | if blockList.size != indices.size: |
|
434 | 434 | indMin = indices[blockList[0]] |
|
435 | 435 | if blockList[1] + 1 >= indices.size: |
|
436 | 436 | arrayData = arrayData[indMin:,:] |
|
437 | 437 | else: |
|
438 | 438 | indMax = indices[blockList[1] + 1] |
|
439 | 439 | arrayData = arrayData[indMin:indMax,:] |
|
440 | 440 | return arrayData |
|
441 | 441 | |
|
442 | 442 | # One dimension |
|
443 | 443 | if nDims == 0: |
|
444 | 444 | arrayData = dataset.value.astype(numpy.float)[0][blockList] |
|
445 | 445 | |
|
446 | 446 | # Two dimensions |
|
447 | 447 | elif nDims == 2: |
|
448 | 448 | arrayData = numpy.zeros((blocksPerFile,nDim1,nDim0)) |
|
449 | 449 | newShapes = (blocksPerFile,nDim0) |
|
450 | 450 | nDatas = nDim1 |
|
451 | 451 | |
|
452 | 452 | for i in range(nDatas): |
|
453 | 453 | data = dataset[strds + str(i)].value |
|
454 | 454 | arrayData[:,i,:] = data[blockList,:] |
|
455 | 455 | |
|
456 | 456 | # Three dimensions |
|
457 | 457 | else: |
|
458 | 458 | arrayData = numpy.zeros((blocksPerFile,nDim2,nDim1,nDim0)) |
|
459 | 459 | for i in range(nDatas): |
|
460 | 460 | |
|
461 | 461 | data = dataset[strds + str(i)].value |
|
462 | 462 | |
|
463 | 463 | for b in range(blockList.size): |
|
464 | 464 | arrayData[b,:,i,:] = data[:,:,blockList[b]] |
|
465 | 465 | |
|
466 | 466 | return arrayData |
|
467 | 467 | |
|
468 | 468 | def __setDataOut(self): |
|
469 | 469 | listMeta = self.listMeta |
|
470 | 470 | listMetaname = self.listMetaname |
|
471 | 471 | listDataname = self.listDataname |
|
472 | 472 | listData = self.listData |
|
473 | 473 | listShapes = self.listShapes |
|
474 | 474 | |
|
475 | 475 | blockIndex = self.blockIndex |
|
476 | 476 | # blockList = self.blockList |
|
477 | 477 | |
|
478 | 478 | for i in range(len(listMeta)): |
|
479 | 479 | setattr(self.dataOut,listMetaname[i],listMeta[i]) |
|
480 | 480 | |
|
481 | 481 | for j in range(len(listData)): |
|
482 | 482 | nShapes = listShapes[listDataname[j]][0] |
|
483 | 483 | mode = listShapes[listDataname[j]][4] |
|
484 | 484 | if nShapes == 1: |
|
485 | 485 | setattr(self.dataOut,listDataname[j],listData[j][blockIndex]) |
|
486 | 486 | elif nShapes > 1: |
|
487 | 487 | setattr(self.dataOut,listDataname[j],listData[j][blockIndex,:]) |
|
488 | 488 | elif mode==0: |
|
489 | 489 | setattr(self.dataOut,listDataname[j],listData[j][blockIndex]) |
|
490 | 490 | #Mode Meteors |
|
491 | 491 | elif mode ==2: |
|
492 | 492 | selectedData = self.__selectDataMode2(listData[j], blockIndex) |
|
493 | 493 | setattr(self.dataOut, listDataname[j], selectedData) |
|
494 | 494 | return |
|
495 | 495 | |
|
496 | 496 | def __selectDataMode2(self, data, blockIndex): |
|
497 | 497 | utctime = data[:,0] |
|
498 | 498 | aux, indices = numpy.unique(utctime, return_inverse=True) |
|
499 | 499 | selInd = numpy.where(indices == blockIndex)[0] |
|
500 | 500 | selData = data[selInd,:] |
|
501 | 501 | |
|
502 | 502 | return selData |
|
503 | 503 | |
|
504 | 504 | def getData(self): |
|
505 | 505 | |
|
506 | 506 | # if self.flagNoMoreFiles: |
|
507 | 507 | # self.dataOut.flagNoData = True |
|
508 | 508 | # print 'Process finished' |
|
509 | 509 | # return 0 |
|
510 | 510 | # |
|
511 | 511 | if self.blockIndex==self.blocksPerFile: |
|
512 | 512 | if not( self.__setNextFileOffline() ): |
|
513 | 513 | self.dataOut.flagNoData = True |
|
514 | 514 | return 0 |
|
515 | 515 | |
|
516 | 516 | # if self.datablock == None: # setear esta condicion cuando no hayan datos por leers |
|
517 | 517 | # self.dataOut.flagNoData = True |
|
518 | 518 | # return 0 |
|
519 | 519 | # self.__readData() |
|
520 | 520 | self.__setDataOut() |
|
521 | 521 | self.dataOut.flagNoData = False |
|
522 | 522 | |
|
523 | 523 | self.blockIndex += 1 |
|
524 | 524 | |
|
525 | 525 | return |
|
526 | 526 | |
|
527 | 527 | def run(self, **kwargs): |
|
528 | 528 | |
|
529 | 529 | if not(self.isConfig): |
|
530 | 530 | self.setup(**kwargs) |
|
531 | 531 | # self.setObjProperties() |
|
532 | 532 | self.isConfig = True |
|
533 | 533 | |
|
534 | 534 | self.getData() |
|
535 | 535 | |
|
536 | 536 | return |
|
537 | 537 | |
|
538 | 538 | class ParamWriter(Operation): |
|
539 | 539 | ''' |
|
540 | 540 | HDF5 Writer, stores parameters data in HDF5 format files |
|
541 | 541 | |
|
542 | 542 | path: path where the files will be stored |
|
543 | 543 | |
|
544 | 544 | blocksPerFile: number of blocks that will be saved in per HDF5 format file |
|
545 | 545 | |
|
546 | 546 | mode: selects the data stacking mode: '0' channels, '1' parameters, '3' table (for meteors) |
|
547 | 547 | |
|
548 | 548 | metadataList: list of attributes that will be stored as metadata |
|
549 | 549 | |
|
550 | 550 | dataList: list of attributes that will be stores as data |
|
551 | 551 | |
|
552 | 552 | ''' |
|
553 | 553 | |
|
554 | 554 | |
|
555 | 555 | ext = ".hdf5" |
|
556 | 556 | |
|
557 | 557 | optchar = "D" |
|
558 | 558 | |
|
559 | 559 | metaoptchar = "M" |
|
560 | 560 | |
|
561 | 561 | metaFile = None |
|
562 | 562 | |
|
563 | 563 | filename = None |
|
564 | 564 | |
|
565 | 565 | path = None |
|
566 | 566 | |
|
567 | 567 | setFile = None |
|
568 | 568 | |
|
569 | 569 | fp = None |
|
570 | 570 | |
|
571 | 571 | grp = None |
|
572 | 572 | |
|
573 | 573 | ds = None |
|
574 | 574 | |
|
575 | 575 | firsttime = True |
|
576 | 576 | |
|
577 | 577 | #Configurations |
|
578 | 578 | |
|
579 | 579 | blocksPerFile = None |
|
580 | 580 | |
|
581 | 581 | blockIndex = None |
|
582 | 582 | |
|
583 | 583 | dataOut = None |
|
584 | 584 | |
|
585 | 585 | #Data Arrays |
|
586 | 586 | |
|
587 | 587 | dataList = None |
|
588 | 588 | |
|
589 | 589 | metadataList = None |
|
590 | 590 | |
|
591 | 591 | # arrayDim = None |
|
592 | 592 | |
|
593 | 593 | dsList = None #List of dictionaries with dataset properties |
|
594 | 594 | |
|
595 | 595 | tableDim = None |
|
596 | 596 | |
|
597 | 597 | # dtype = [('arrayName', 'S20'),('nChannels', 'i'), ('nPoints', 'i'), ('nSamples', 'i'),('mode', 'b')] |
|
598 | 598 | |
|
599 | 599 | dtype = [('arrayName', 'S20'),('nDimensions', 'i'), ('dim2', 'i'), ('dim1', 'i'),('dim0', 'i'),('mode', 'b')] |
|
600 | 600 | |
|
601 | 601 | currentDay = None |
|
602 | 602 | |
|
603 | 603 | lastTime = None |
|
604 | 604 | |
|
605 | parameters = { | |
|
606 | 'path': global_type_string, | |
|
607 | 'blocksPerFile':global_type_integer, | |
|
608 | 'metadataList': global_type_list, | |
|
609 | 'dataList': global_type_list, | |
|
610 | 'mode': global_type_integer, | |
|
611 | } | |
|
612 | ||
|
605 | 613 | def __init__(self, **kwargs): |
|
606 | 614 | Operation.__init__(self, **kwargs) |
|
607 | 615 | self.isConfig = False |
|
608 | 616 | return |
|
609 | 617 | |
|
610 | def setup(self, dataOut, **kwargs): | |
|
611 | ||
|
612 | self.path = kwargs['path'] | |
|
618 | def setup(self, dataOut, path=None, blocksPerFile=10, metadataList=None, dataList=None, mode=None, **kwargs): | |
|
613 | 619 | |
|
614 | if kwargs.has_key('blocksPerFile'): | |
|
615 |
|
|
|
616 | else: | |
|
617 | self.blocksPerFile = 10 | |
|
618 | ||
|
619 | self.metadataList = kwargs['metadataList'] | |
|
620 | self.dataList = kwargs['dataList'] | |
|
620 | self.path = path | |
|
621 | self.blocksPerFile = blocksPerFile | |
|
622 | self.metadataList = metadataList | |
|
623 | self.dataList = dataList | |
|
621 | 624 | self.dataOut = dataOut |
|
622 | ||
|
623 | if kwargs.has_key('mode'): | |
|
624 | mode = kwargs['mode'] | |
|
625 | ||
|
626 | if type(mode) == int: | |
|
627 | mode = numpy.zeros(len(self.dataList)) + mode | |
|
628 | else: | |
|
629 | mode = numpy.ones(len(self.dataList)) | |
|
630 | ||
|
631 | 625 | self.mode = mode |
|
626 | ||
|
627 | if self.mode is not None: | |
|
628 | self.mode = numpy.zeros(len(self.dataList)) + mode | |
|
629 | else: | |
|
630 | self.mode = numpy.ones(len(self.dataList)) | |
|
632 | 631 | |
|
633 | 632 | arrayDim = numpy.zeros((len(self.dataList),5)) |
|
634 | 633 | |
|
635 | 634 | #Table dimensions |
|
636 | 635 | dtype0 = self.dtype |
|
637 | 636 | tableList = [] |
|
638 | 637 | |
|
639 | 638 | #Dictionary and list of tables |
|
640 | 639 | dsList = [] |
|
641 | 640 | |
|
642 | 641 | for i in range(len(self.dataList)): |
|
643 | 642 | dsDict = {} |
|
644 | 643 | dataAux = getattr(self.dataOut, self.dataList[i]) |
|
645 | 644 | dsDict['variable'] = self.dataList[i] |
|
646 | 645 | #--------------------- Conditionals ------------------------ |
|
647 | 646 | #There is no data |
|
648 | 647 | if dataAux is None: |
|
649 | 648 | return 0 |
|
650 | 649 | |
|
651 | 650 | #Not array, just a number |
|
652 | 651 | #Mode 0 |
|
653 | 652 | if type(dataAux)==float or type(dataAux)==int: |
|
654 | 653 | dsDict['mode'] = 0 |
|
655 | 654 | dsDict['nDim'] = 0 |
|
656 | 655 | arrayDim[i,0] = 0 |
|
657 | 656 | dsList.append(dsDict) |
|
658 | 657 | |
|
659 | 658 | #Mode 2: meteors |
|
660 | 659 | elif mode[i] == 2: |
|
661 | 660 | # dsDict['nDim'] = 0 |
|
662 | 661 | dsDict['dsName'] = 'table0' |
|
663 | 662 | dsDict['mode'] = 2 # Mode meteors |
|
664 | 663 | dsDict['shape'] = dataAux.shape[-1] |
|
665 | 664 | dsDict['nDim'] = 0 |
|
666 | 665 | dsDict['dsNumber'] = 1 |
|
667 | 666 | |
|
668 | 667 | arrayDim[i,3] = dataAux.shape[-1] |
|
669 | 668 | arrayDim[i,4] = mode[i] #Mode the data was stored |
|
670 | 669 | |
|
671 | 670 | dsList.append(dsDict) |
|
672 | 671 | |
|
673 | 672 | #Mode 1 |
|
674 | 673 | else: |
|
675 | 674 | arrayDim0 = dataAux.shape #Data dimensions |
|
676 | 675 | arrayDim[i,0] = len(arrayDim0) #Number of array dimensions |
|
677 | 676 | arrayDim[i,4] = mode[i] #Mode the data was stored |
|
678 | 677 | |
|
679 | 678 | strtable = 'table' |
|
680 | 679 | dsDict['mode'] = 1 # Mode parameters |
|
681 | 680 | |
|
682 | 681 | # Three-dimension arrays |
|
683 | 682 | if len(arrayDim0) == 3: |
|
684 | 683 | arrayDim[i,1:-1] = numpy.array(arrayDim0) |
|
685 | 684 | nTables = int(arrayDim[i,2]) |
|
686 | 685 | dsDict['dsNumber'] = nTables |
|
687 | 686 | dsDict['shape'] = arrayDim[i,2:4] |
|
688 | 687 | dsDict['nDim'] = 3 |
|
689 | 688 | |
|
690 | 689 | for j in range(nTables): |
|
691 | 690 | dsDict = dsDict.copy() |
|
692 | 691 | dsDict['dsName'] = strtable + str(j) |
|
693 | 692 | dsList.append(dsDict) |
|
694 | 693 | |
|
695 | 694 | # Two-dimension arrays |
|
696 | 695 | elif len(arrayDim0) == 2: |
|
697 | 696 | arrayDim[i,2:-1] = numpy.array(arrayDim0) |
|
698 | 697 | nTables = int(arrayDim[i,2]) |
|
699 | 698 | dsDict['dsNumber'] = nTables |
|
700 | 699 | dsDict['shape'] = arrayDim[i,3] |
|
701 | 700 | dsDict['nDim'] = 2 |
|
702 | 701 | |
|
703 | 702 | for j in range(nTables): |
|
704 | 703 | dsDict = dsDict.copy() |
|
705 | 704 | dsDict['dsName'] = strtable + str(j) |
|
706 | 705 | dsList.append(dsDict) |
|
707 | 706 | |
|
708 | 707 | # One-dimension arrays |
|
709 | 708 | elif len(arrayDim0) == 1: |
|
710 | 709 | arrayDim[i,3] = arrayDim0[0] |
|
711 | 710 | dsDict['shape'] = arrayDim0[0] |
|
712 | 711 | dsDict['dsNumber'] = 1 |
|
713 | 712 | dsDict['dsName'] = strtable + str(0) |
|
714 | 713 | dsDict['nDim'] = 1 |
|
715 | 714 | dsList.append(dsDict) |
|
716 | 715 | |
|
717 | 716 | table = numpy.array((self.dataList[i],) + tuple(arrayDim[i,:]),dtype = dtype0) |
|
718 | 717 | tableList.append(table) |
|
719 | 718 | |
|
720 | 719 | # self.arrayDim = arrayDim |
|
721 | 720 | self.dsList = dsList |
|
722 | 721 | self.tableDim = numpy.array(tableList, dtype = dtype0) |
|
723 | 722 | self.blockIndex = 0 |
|
724 | 723 | |
|
725 | 724 | timeTuple = time.localtime(dataOut.utctime) |
|
726 | 725 | self.currentDay = timeTuple.tm_yday |
|
727 | 726 | return 1 |
|
728 | 727 | |
|
729 | 728 | def putMetadata(self): |
|
730 | 729 | |
|
731 | 730 | fp = self.createMetadataFile() |
|
732 | 731 | self.writeMetadata(fp) |
|
733 | 732 | fp.close() |
|
734 | 733 | return |
|
735 | 734 | |
|
736 | 735 | def createMetadataFile(self): |
|
737 | 736 | ext = self.ext |
|
738 | 737 | path = self.path |
|
739 | 738 | setFile = self.setFile |
|
740 | 739 | |
|
741 | 740 | timeTuple = time.localtime(self.dataOut.utctime) |
|
742 | 741 | |
|
743 | 742 | subfolder = '' |
|
744 | 743 | fullpath = os.path.join( path, subfolder ) |
|
745 | 744 | |
|
746 | 745 | if not( os.path.exists(fullpath) ): |
|
747 | 746 | os.mkdir(fullpath) |
|
748 | 747 | setFile = -1 #inicializo mi contador de seteo |
|
749 | 748 | |
|
750 | 749 | subfolder = 'd%4.4d%3.3d' % (timeTuple.tm_year,timeTuple.tm_yday) |
|
751 | 750 | fullpath = os.path.join( path, subfolder ) |
|
752 | 751 | |
|
753 | 752 | if not( os.path.exists(fullpath) ): |
|
754 | 753 | os.mkdir(fullpath) |
|
755 | 754 | setFile = -1 #inicializo mi contador de seteo |
|
756 | 755 | |
|
757 | 756 | else: |
|
758 | 757 | filesList = os.listdir( fullpath ) |
|
759 | 758 | filesList = sorted( filesList, key=str.lower ) |
|
760 | 759 | if len( filesList ) > 0: |
|
761 | 760 | filesList = [k for k in filesList if 'M' in k] |
|
762 | 761 | filen = filesList[-1] |
|
763 | 762 | # el filename debera tener el siguiente formato |
|
764 | 763 | # 0 1234 567 89A BCDE (hex) |
|
765 | 764 | # x YYYY DDD SSS .ext |
|
766 | 765 | if isNumber( filen[8:11] ): |
|
767 | 766 | setFile = int( filen[8:11] ) #inicializo mi contador de seteo al seteo del ultimo file |
|
768 | 767 | else: |
|
769 | 768 | setFile = -1 |
|
770 | 769 | else: |
|
771 | 770 | setFile = -1 #inicializo mi contador de seteo |
|
772 | 771 | |
|
773 | 772 | setFile += 1 |
|
774 | 773 | |
|
775 | 774 | file = '%s%4.4d%3.3d%3.3d%s' % (self.metaoptchar, |
|
776 | 775 | timeTuple.tm_year, |
|
777 | 776 | timeTuple.tm_yday, |
|
778 | 777 | setFile, |
|
779 | 778 | ext ) |
|
780 | 779 | |
|
781 | 780 | filename = os.path.join( path, subfolder, file ) |
|
782 | 781 | self.metaFile = file |
|
783 | 782 | #Setting HDF5 File |
|
784 | 783 | fp = h5py.File(filename,'w') |
|
785 | 784 | |
|
786 | 785 | return fp |
|
787 | 786 | |
|
788 | 787 | def writeMetadata(self, fp): |
|
789 | 788 | |
|
790 | 789 | grp = fp.create_group("Metadata") |
|
791 | 790 | grp.create_dataset('array dimensions', data = self.tableDim, dtype = self.dtype) |
|
792 | 791 | |
|
793 | 792 | for i in range(len(self.metadataList)): |
|
794 | 793 | grp.create_dataset(self.metadataList[i], data=getattr(self.dataOut, self.metadataList[i])) |
|
795 | 794 | return |
|
796 | 795 | |
|
797 | 796 | def timeFlag(self): |
|
798 | 797 | currentTime = self.dataOut.utctime |
|
799 | 798 | |
|
800 | 799 | if self.lastTime is None: |
|
801 | 800 | self.lastTime = currentTime |
|
802 | 801 | |
|
803 | 802 | #Day |
|
804 | 803 | timeTuple = time.localtime(currentTime) |
|
805 | 804 | dataDay = timeTuple.tm_yday |
|
806 | 805 | |
|
807 | 806 | #Time |
|
808 | 807 | timeDiff = currentTime - self.lastTime |
|
809 | 808 | |
|
810 | 809 | #Si el dia es diferente o si la diferencia entre un dato y otro supera la hora |
|
811 | 810 | if dataDay != self.currentDay: |
|
812 | 811 | self.currentDay = dataDay |
|
813 | 812 | return True |
|
814 | 813 | elif timeDiff > 3*60*60: |
|
815 | 814 | self.lastTime = currentTime |
|
816 | 815 | return True |
|
817 | 816 | else: |
|
818 | 817 | self.lastTime = currentTime |
|
819 | 818 | return False |
|
820 | 819 | |
|
821 | 820 | def setNextFile(self): |
|
822 | 821 | |
|
823 | 822 | ext = self.ext |
|
824 | 823 | path = self.path |
|
825 | 824 | setFile = self.setFile |
|
826 | 825 | mode = self.mode |
|
827 | 826 | |
|
828 | 827 | timeTuple = time.localtime(self.dataOut.utctime) |
|
829 | 828 | subfolder = 'd%4.4d%3.3d' % (timeTuple.tm_year,timeTuple.tm_yday) |
|
830 | 829 | |
|
831 | 830 | fullpath = os.path.join( path, subfolder ) |
|
832 | 831 | |
|
833 | 832 | if os.path.exists(fullpath): |
|
834 | 833 | filesList = os.listdir( fullpath ) |
|
835 | 834 | filesList = [k for k in filesList if 'D' in k] |
|
836 | 835 | if len( filesList ) > 0: |
|
837 | 836 | filesList = sorted( filesList, key=str.lower ) |
|
838 | 837 | filen = filesList[-1] |
|
839 | 838 | # el filename debera tener el siguiente formato |
|
840 | 839 | # 0 1234 567 89A BCDE (hex) |
|
841 | 840 | # x YYYY DDD SSS .ext |
|
842 | 841 | if isNumber( filen[8:11] ): |
|
843 | 842 | setFile = int( filen[8:11] ) #inicializo mi contador de seteo al seteo del ultimo file |
|
844 | 843 | else: |
|
845 | 844 | setFile = -1 |
|
846 | 845 | else: |
|
847 | 846 | setFile = -1 #inicializo mi contador de seteo |
|
848 | 847 | else: |
|
849 | 848 | os.makedirs(fullpath) |
|
850 | 849 | setFile = -1 #inicializo mi contador de seteo |
|
851 | 850 | |
|
852 | 851 | setFile += 1 |
|
853 | 852 | |
|
854 | 853 | file = '%s%4.4d%3.3d%3.3d%s' % (self.optchar, |
|
855 | 854 | timeTuple.tm_year, |
|
856 | 855 | timeTuple.tm_yday, |
|
857 | 856 | setFile, |
|
858 | 857 | ext ) |
|
859 | 858 | |
|
860 | 859 | filename = os.path.join( path, subfolder, file ) |
|
861 | 860 | |
|
862 | 861 | #Setting HDF5 File |
|
863 | 862 | fp = h5py.File(filename,'w') |
|
864 | 863 | #write metadata |
|
865 | 864 | self.writeMetadata(fp) |
|
866 | 865 | #Write data |
|
867 | 866 | grp = fp.create_group("Data") |
|
868 | 867 | # grp.attrs['metadata'] = self.metaFile |
|
869 | 868 | |
|
870 | 869 | # grp.attrs['blocksPerFile'] = 0 |
|
871 | 870 | ds = [] |
|
872 | 871 | data = [] |
|
873 | 872 | dsList = self.dsList |
|
874 | 873 | i = 0 |
|
875 | 874 | while i < len(dsList): |
|
876 | 875 | dsInfo = dsList[i] |
|
877 | 876 | #One-dimension data |
|
878 | 877 | if dsInfo['mode'] == 0: |
|
879 | 878 | # ds0 = grp.create_dataset(self.dataList[i], (1,1), maxshape=(1,self.blocksPerFile) , chunks = True, dtype='S20') |
|
880 | 879 | ds0 = grp.create_dataset(dsInfo['variable'], (1,1), maxshape=(1,self.blocksPerFile) , chunks = True, dtype=numpy.float64) |
|
881 | 880 | ds.append(ds0) |
|
882 | 881 | data.append([]) |
|
883 | 882 | i += 1 |
|
884 | 883 | continue |
|
885 | 884 | # nDimsForDs.append(nDims[i]) |
|
886 | 885 | |
|
887 | 886 | elif dsInfo['mode'] == 2: |
|
888 | 887 | grp0 = grp.create_group(dsInfo['variable']) |
|
889 | 888 | ds0 = grp0.create_dataset(dsInfo['dsName'], (1,dsInfo['shape']), data = numpy.zeros((1,dsInfo['shape'])) , maxshape=(None,dsInfo['shape']), chunks=True) |
|
890 | 889 | ds.append(ds0) |
|
891 | 890 | data.append([]) |
|
892 | 891 | i += 1 |
|
893 | 892 | continue |
|
894 | 893 | |
|
895 | 894 | elif dsInfo['mode'] == 1: |
|
896 | 895 | grp0 = grp.create_group(dsInfo['variable']) |
|
897 | 896 | |
|
898 | 897 | for j in range(dsInfo['dsNumber']): |
|
899 | 898 | dsInfo = dsList[i] |
|
900 | 899 | tableName = dsInfo['dsName'] |
|
901 | 900 | shape = int(dsInfo['shape']) |
|
902 | 901 | |
|
903 | 902 | if dsInfo['nDim'] == 3: |
|
904 | 903 | ds0 = grp0.create_dataset(tableName, (shape[0],shape[1],1) , data = numpy.zeros((shape[0],shape[1],1)), maxshape = (None,shape[1],None), chunks=True) |
|
905 | 904 | else: |
|
906 | 905 | ds0 = grp0.create_dataset(tableName, (1,shape), data = numpy.zeros((1,shape)) , maxshape=(None,shape), chunks=True) |
|
907 | 906 | |
|
908 | 907 | ds.append(ds0) |
|
909 | 908 | data.append([]) |
|
910 | 909 | i += 1 |
|
911 | 910 | # nDimsForDs.append(nDims[i]) |
|
912 | 911 | |
|
913 | 912 | fp.flush() |
|
914 | 913 | fp.close() |
|
915 | 914 | |
|
916 | 915 | # self.nDatas = nDatas |
|
917 | 916 | # self.nDims = nDims |
|
918 | 917 | # self.nDimsForDs = nDimsForDs |
|
919 | 918 | #Saving variables |
|
920 | 919 | print 'Writing the file: %s'%filename |
|
921 | 920 | self.filename = filename |
|
922 | 921 | # self.fp = fp |
|
923 | 922 | # self.grp = grp |
|
924 | 923 | # self.grp.attrs.modify('nRecords', 1) |
|
925 | 924 | self.ds = ds |
|
926 | 925 | self.data = data |
|
927 | 926 | # self.setFile = setFile |
|
928 | 927 | self.firsttime = True |
|
929 | 928 | self.blockIndex = 0 |
|
930 | 929 | return |
|
931 | 930 | |
|
932 | 931 | def putData(self): |
|
933 | 932 | |
|
934 | 933 | if self.blockIndex == self.blocksPerFile or self.timeFlag(): |
|
935 | 934 | self.setNextFile() |
|
936 | 935 | |
|
937 | 936 | # if not self.firsttime: |
|
938 | 937 | self.readBlock() |
|
939 | 938 | self.setBlock() #Prepare data to be written |
|
940 | 939 | self.writeBlock() #Write data |
|
941 | 940 | |
|
942 | 941 | return |
|
943 | 942 | |
|
944 | 943 | def readBlock(self): |
|
945 | 944 | |
|
946 | 945 | ''' |
|
947 | 946 | data Array configured |
|
948 | 947 | |
|
949 | 948 | |
|
950 | 949 | self.data |
|
951 | 950 | ''' |
|
952 | 951 | dsList = self.dsList |
|
953 | 952 | ds = self.ds |
|
954 | 953 | #Setting HDF5 File |
|
955 | 954 | fp = h5py.File(self.filename,'r+') |
|
956 | 955 | grp = fp["Data"] |
|
957 | 956 | ind = 0 |
|
958 | 957 | |
|
959 | 958 | # grp.attrs['blocksPerFile'] = 0 |
|
960 | 959 | while ind < len(dsList): |
|
961 | 960 | dsInfo = dsList[ind] |
|
962 | 961 | |
|
963 | 962 | if dsInfo['mode'] == 0: |
|
964 | 963 | ds0 = grp[dsInfo['variable']] |
|
965 | 964 | ds[ind] = ds0 |
|
966 | 965 | ind += 1 |
|
967 | 966 | else: |
|
968 | 967 | |
|
969 | 968 | grp0 = grp[dsInfo['variable']] |
|
970 | 969 | |
|
971 | 970 | for j in range(dsInfo['dsNumber']): |
|
972 | 971 | dsInfo = dsList[ind] |
|
973 | 972 | ds0 = grp0[dsInfo['dsName']] |
|
974 | 973 | ds[ind] = ds0 |
|
975 | 974 | ind += 1 |
|
976 | 975 | |
|
977 | 976 | self.fp = fp |
|
978 | 977 | self.grp = grp |
|
979 | 978 | self.ds = ds |
|
980 | 979 | |
|
981 | 980 | return |
|
982 | 981 | |
|
983 | 982 | def setBlock(self): |
|
984 | 983 | ''' |
|
985 | 984 | data Array configured |
|
986 | 985 | |
|
987 | 986 | |
|
988 | 987 | self.data |
|
989 | 988 | ''' |
|
990 | 989 | #Creating Arrays |
|
991 | 990 | dsList = self.dsList |
|
992 | 991 | data = self.data |
|
993 | 992 | ind = 0 |
|
994 | 993 | |
|
995 | 994 | while ind < len(dsList): |
|
996 | 995 | dsInfo = dsList[ind] |
|
997 | 996 | dataAux = getattr(self.dataOut, dsInfo['variable']) |
|
998 | 997 | |
|
999 | 998 | mode = dsInfo['mode'] |
|
1000 | 999 | nDim = dsInfo['nDim'] |
|
1001 | 1000 | |
|
1002 | 1001 | if mode == 0 or mode == 2 or nDim == 1: |
|
1003 | 1002 | data[ind] = dataAux |
|
1004 | 1003 | ind += 1 |
|
1005 | 1004 | # elif nDim == 1: |
|
1006 | 1005 | # data[ind] = numpy.reshape(dataAux,(numpy.size(dataAux),1)) |
|
1007 | 1006 | # ind += 1 |
|
1008 | 1007 | elif nDim == 2: |
|
1009 | 1008 | for j in range(dsInfo['dsNumber']): |
|
1010 | 1009 | data[ind] = dataAux[j,:] |
|
1011 | 1010 | ind += 1 |
|
1012 | 1011 | elif nDim == 3: |
|
1013 | 1012 | for j in range(dsInfo['dsNumber']): |
|
1014 | 1013 | data[ind] = dataAux[:,j,:] |
|
1015 | 1014 | ind += 1 |
|
1016 | 1015 | |
|
1017 | 1016 | self.data = data |
|
1018 | 1017 | return |
|
1019 | 1018 | |
|
1020 | 1019 | def writeBlock(self): |
|
1021 | 1020 | ''' |
|
1022 | 1021 | Saves the block in the HDF5 file |
|
1023 | 1022 | ''' |
|
1024 | 1023 | dsList = self.dsList |
|
1025 | 1024 | |
|
1026 | 1025 | for i in range(len(self.ds)): |
|
1027 | 1026 | dsInfo = dsList[i] |
|
1028 | 1027 | nDim = dsInfo['nDim'] |
|
1029 | 1028 | mode = dsInfo['mode'] |
|
1030 | 1029 | |
|
1031 | 1030 | # First time |
|
1032 | 1031 | if self.firsttime: |
|
1033 | 1032 | # self.ds[i].resize(self.data[i].shape) |
|
1034 | 1033 | # self.ds[i][self.blockIndex,:] = self.data[i] |
|
1035 | 1034 | if type(self.data[i]) == numpy.ndarray: |
|
1036 | 1035 | |
|
1037 | 1036 | if nDim == 3: |
|
1038 | 1037 | self.data[i] = self.data[i].reshape((self.data[i].shape[0],self.data[i].shape[1],1)) |
|
1039 | 1038 | self.ds[i].resize(self.data[i].shape) |
|
1040 | 1039 | if mode == 2: |
|
1041 | 1040 | self.ds[i].resize(self.data[i].shape) |
|
1042 | 1041 | self.ds[i][:] = self.data[i] |
|
1043 | 1042 | else: |
|
1044 | 1043 | |
|
1045 | 1044 | # From second time |
|
1046 | 1045 | # Meteors! |
|
1047 | 1046 | if mode == 2: |
|
1048 | 1047 | dataShape = self.data[i].shape |
|
1049 | 1048 | dsShape = self.ds[i].shape |
|
1050 | 1049 | self.ds[i].resize((self.ds[i].shape[0] + dataShape[0],self.ds[i].shape[1])) |
|
1051 | 1050 | self.ds[i][dsShape[0]:,:] = self.data[i] |
|
1052 | 1051 | # No dimension |
|
1053 | 1052 | elif mode == 0: |
|
1054 | 1053 | self.ds[i].resize((self.ds[i].shape[0], self.ds[i].shape[1] + 1)) |
|
1055 | 1054 | self.ds[i][0,-1] = self.data[i] |
|
1056 | 1055 | # One dimension |
|
1057 | 1056 | elif nDim == 1: |
|
1058 | 1057 | self.ds[i].resize((self.ds[i].shape[0] + 1, self.ds[i].shape[1])) |
|
1059 | 1058 | self.ds[i][-1,:] = self.data[i] |
|
1060 | 1059 | # Two dimension |
|
1061 | 1060 | elif nDim == 2: |
|
1062 | 1061 | self.ds[i].resize((self.ds[i].shape[0] + 1,self.ds[i].shape[1])) |
|
1063 | 1062 | self.ds[i][self.blockIndex,:] = self.data[i] |
|
1064 | 1063 | # Three dimensions |
|
1065 | 1064 | elif nDim == 3: |
|
1066 | 1065 | self.ds[i].resize((self.ds[i].shape[0],self.ds[i].shape[1],self.ds[i].shape[2]+1)) |
|
1067 | 1066 | self.ds[i][:,:,-1] = self.data[i] |
|
1068 | 1067 | |
|
1069 | 1068 | self.firsttime = False |
|
1070 | 1069 | self.blockIndex += 1 |
|
1071 | 1070 | |
|
1072 | 1071 | #Close to save changes |
|
1073 | 1072 | self.fp.flush() |
|
1074 | 1073 | self.fp.close() |
|
1075 | 1074 | return |
|
1076 | 1075 | |
|
1077 | def run(self, dataOut, **kwargs): | |
|
1076 | def run(self, dataOut, path=None, blocksPerFile=10, metadataList=None, dataList=None, mode=None, **kwargs): | |
|
1078 | 1077 | |
|
1079 | 1078 | if not(self.isConfig): |
|
1080 |
flagdata = self.setup(dataOut, |
|
|
1079 | flagdata = self.setup(dataOut, path=path, blocksPerFile=blocksPerFile, | |
|
1080 | metadataList=metadataList, dataList=dataList, mode=mode, **kwargs) | |
|
1081 | 1081 | |
|
1082 | 1082 | if not(flagdata): |
|
1083 | 1083 | return |
|
1084 | 1084 | |
|
1085 | 1085 | self.isConfig = True |
|
1086 | 1086 | # self.putMetadata() |
|
1087 | 1087 | self.setNextFile() |
|
1088 | 1088 | |
|
1089 | 1089 | self.putData() |
|
1090 | 1090 | return |
@@ -1,1172 +1,1177 | |||
|
1 | 1 | |
|
2 | 2 | global_type_string = 'string' |
|
3 | 3 | global_type_integer = 'int' |
|
4 | 4 | global_type_floatList = 'floatList' |
|
5 | 5 | global_type_pairsList = 'pairsList' |
|
6 | 6 | global_type_boolean = 'bolean' |
|
7 | 7 | global_type_float = 'float' |
|
8 | 8 | global_type_colormap = 'colormap' |
|
9 | 9 | global_type_list = 'list' |
|
10 | global_type_integer_or_list = 'integer_or_list' | |
|
10 | 11 | |
|
11 | 12 | #BeaconPhase |
|
12 | 13 | parameters = { |
|
13 | 14 | 'id': global_type_string, |
|
14 | 15 | 'wintitle': global_type_string, |
|
15 | 16 | 'pairsList': global_type_pairsList, |
|
16 | 17 | 'showprofile': global_type_boolean, |
|
17 | 18 | 'xmin': global_type_float, |
|
18 | 19 | 'xmax': global_type_float, |
|
19 | 20 | 'ymin': global_type_float, |
|
20 | 21 | 'ymax': global_type_float, |
|
21 | 22 | 'hmin': global_type_float, |
|
22 | 23 | 'hmax': global_type_float, |
|
23 | 24 | 'timerange': global_type_float, |
|
24 | 25 | 'save': global_type_boolean, |
|
25 | 26 | 'figpath': global_type_string, |
|
26 | 27 | 'figfile': global_type_string, |
|
27 | 28 | 'show': global_type_boolean, |
|
28 | 29 | 'ftp': global_type_boolean, |
|
29 | 30 | 'wr_period': global_type_integer, |
|
30 | 31 | 'server': global_type_string, |
|
31 | 32 | 'folder': global_type_string, |
|
32 | 33 | 'username': global_type_string, |
|
33 | 34 | 'password': global_type_string, |
|
34 | 35 | 'ftp_wei': global_type_integer, |
|
35 | 36 | 'exp_code': global_type_integer, |
|
36 | 37 | 'sub_exp_code': global_type_integer, |
|
37 | 38 | 'plot_pos': global_type_integer, |
|
38 | 39 | } |
|
39 | 40 | |
|
40 | 41 | |
|
41 | 42 | #BeamSelector |
|
42 | 43 | parameters = { |
|
43 | 44 | 'beam': global_type_string, |
|
44 | 45 | } |
|
45 | 46 | |
|
46 | 47 | |
|
47 | 48 | #CohInt |
|
48 | 49 | parameters = { |
|
49 | 50 | 'n': global_type_integer, |
|
50 | 51 | 'timeInterval': global_type_float, |
|
51 | 52 | 'overlapping': global_type_boolean, |
|
52 | 53 | 'byblock': global_type_boolean |
|
53 | 54 | } |
|
54 | 55 | |
|
55 | 56 | |
|
56 | 57 | #CoherenceMap |
|
57 | 58 | parameters = { |
|
58 | 59 | 'id': global_type_string, |
|
59 | 60 | 'wintitle': global_type_string, |
|
60 | 61 | 'pairsList': global_type_pairsList, |
|
61 | 62 | 'showprofile': global_type_boolean, |
|
62 | 63 | 'xmin': global_type_float, |
|
63 | 64 | 'xmax': global_type_float, |
|
64 | 65 | 'ymin': global_type_float, |
|
65 | 66 | 'ymax': global_type_float, |
|
66 | 67 | 'zmin': global_type_float, |
|
67 | 68 | 'zmax': global_type_float, |
|
68 | 69 | 'timerange': global_type_float, |
|
69 | 70 | 'phase_min': global_type_float, |
|
70 | 71 | 'phase_max': global_type_float, |
|
71 | 72 | 'save': global_type_boolean, |
|
72 | 73 | 'figpath': global_type_string, |
|
73 | 74 | 'figfile': global_type_string, |
|
74 | 75 | 'ftp': global_type_boolean, |
|
75 | 76 | 'wr_period': global_type_integer, |
|
76 | 77 | 'coherence_cmap': global_type_colormap, |
|
77 | 78 | 'phase_cmap': global_type_colormap, |
|
78 | 79 | 'show': global_type_boolean, |
|
79 | 80 | 'server': global_type_string, |
|
80 | 81 | 'folder': global_type_string, |
|
81 | 82 | 'username': global_type_string, |
|
82 | 83 | 'password': global_type_string, |
|
83 | 84 | 'ftp_wei': global_type_integer, |
|
84 | 85 | 'exp_code': global_type_integer, |
|
85 | 86 | 'sub_exp_code': global_type_integer, |
|
86 | 87 | 'plot_pos': global_type_integer, |
|
87 | 88 | } |
|
88 | 89 | |
|
89 | 90 | |
|
90 | 91 | #CombineProfiles |
|
91 | 92 | parameters = { |
|
92 | 93 | 'n': global_type_integer, |
|
93 | 94 | } |
|
94 | 95 | |
|
95 | 96 | |
|
96 | 97 | #CorrectSMPhases |
|
97 | 98 | parameters = { |
|
98 | 99 | 'phaseOffsets': global_type_pairsList, |
|
99 | 100 | 'hmin': global_type_float, |
|
100 | 101 | 'hmax': global_type_float, |
|
101 | 102 | 'azimuth': global_type_float, |
|
102 | 103 | 'channelPositions': global_type_pairsList, |
|
103 | 104 | } |
|
104 | 105 | |
|
105 | 106 | |
|
106 | 107 | #CorrelationPlot |
|
107 | 108 | parameters = { |
|
108 | 109 | 'id': global_type_string, |
|
109 | 110 | 'wintitle': global_type_string, |
|
110 | 111 | 'channelList': global_type_list, |
|
111 | 112 | 'showprofile': global_type_boolean, |
|
112 | 113 | 'xmin': global_type_float, |
|
113 | 114 | 'xmax': global_type_float, |
|
114 | 115 | 'ymin': global_type_float, |
|
115 | 116 | 'ymax': global_type_float, |
|
116 | 117 | 'zmin': global_type_float, |
|
117 | 118 | 'zmax': global_type_float, |
|
118 | 119 | 'save': global_type_boolean, |
|
119 | 120 | 'figpath': global_type_string, |
|
120 | 121 | 'figfile': global_type_string, |
|
121 | 122 | 'show': global_type_boolean, |
|
122 | 123 | 'ftp': global_type_boolean, |
|
123 | 124 | 'wr_period': global_type_integer, |
|
124 | 125 | 'server': global_type_string, |
|
125 | 126 | 'folder': global_type_string, |
|
126 | 127 | 'username': global_type_string, |
|
127 | 128 | 'password': global_type_string, |
|
128 | 129 | 'ftp_wei': global_type_integer, |
|
129 | 130 | 'exp_code': global_type_integer, |
|
130 | 131 | 'sub_exp_code': global_type_integer, |
|
131 | 132 | 'plot_pos': global_type_integer, |
|
132 | 133 | 'realtime': global_type_boolean, |
|
133 | 134 | } |
|
134 | 135 | |
|
135 | 136 | |
|
136 | 137 | #CrossSpectraPlot |
|
137 | 138 | parameters = { |
|
138 | 139 | 'id': global_type_string, |
|
139 | 140 | 'wintitle': global_type_string, |
|
140 | 141 | 'pairsList': global_type_pairsList, |
|
141 | 142 | 'xmin': global_type_float, |
|
142 | 143 | 'xmax': global_type_float, |
|
143 | 144 | 'ymin': global_type_float, |
|
144 | 145 | 'ymax': global_type_float, |
|
145 | 146 | 'zmin': global_type_float, |
|
146 | 147 | 'zmax': global_type_float, |
|
147 | 148 | 'coh_min': global_type_float, |
|
148 | 149 | 'coh_max': global_type_float, |
|
149 | 150 | 'phase_min': global_type_float, |
|
150 | 151 | 'phase_max': global_type_float, |
|
151 | 152 | 'save': global_type_boolean, |
|
152 | 153 | 'figpath': global_type_string, |
|
153 | 154 | 'figfile': global_type_string, |
|
154 | 155 | 'ftp': global_type_boolean, |
|
155 | 156 | 'wr_period': global_type_integer, |
|
156 | 157 | 'power_cmap': global_type_colormap, |
|
157 | 158 | 'coherence_cmap': global_type_colormap, |
|
158 | 159 | 'phase_cmap': global_type_colormap, |
|
159 | 160 | 'show': global_type_boolean, |
|
160 | 161 | 'server': global_type_string, |
|
161 | 162 | 'folder': global_type_string, |
|
162 | 163 | 'username': global_type_string, |
|
163 | 164 | 'password': global_type_string, |
|
164 | 165 | 'ftp_wei': global_type_integer, |
|
165 | 166 | 'exp_code': global_type_integer, |
|
166 | 167 | 'sub_exp_code': global_type_integer, |
|
167 | 168 | 'plot_pos': global_type_integer, |
|
168 | 169 | 'xaxis': global_type_string, |
|
169 | 170 | } |
|
170 | 171 | |
|
171 | 172 | |
|
172 | 173 | #Decoder |
|
173 | 174 | parameters = { |
|
174 | 175 | 'code': global_type_list, |
|
175 | 176 | 'nCode': global_type_integer, |
|
176 | 177 | 'nBaud': global_type_integer, |
|
177 | 178 | 'mode': global_type_integer, |
|
178 | 179 | 'osamp': global_type_float, |
|
179 | 180 | } |
|
180 | 181 | |
|
181 | 182 | |
|
182 | 183 | #EWDriftsEstimation |
|
183 | 184 | parameters = { |
|
184 | 185 | 'zenith': global_type_list, |
|
185 | 186 | 'zenithCorrection': global_type_float, |
|
186 | 187 | } |
|
187 | 188 | |
|
188 | 189 | |
|
189 | 190 | #EWDriftsPlot |
|
190 | 191 | parameters = { |
|
191 | 192 | 'id': global_type_string, |
|
192 | 193 | 'wintitle': global_type_string, |
|
193 | 194 | 'channelList': global_type_list, |
|
194 | 195 | 'xmin': global_type_float, |
|
195 | 196 | 'xmax': global_type_float, |
|
196 | 197 | 'ymin': global_type_float, |
|
197 | 198 | 'ymax': global_type_float, |
|
198 | 199 | 'zmin': global_type_float, |
|
199 | 200 | 'zmax': global_type_float, |
|
200 | 201 | 'zmaxVertfloat': global_type_float, |
|
201 | 202 | 'zminVertfloat': global_type_float, |
|
202 | 203 | 'zmaxZonafloat': global_type_float, |
|
203 | 204 | 'zminZonafloat': global_type_float, |
|
204 | 205 | 'timerange': global_type_float, |
|
205 | 206 | 'SNRthresh': global_type_float, |
|
206 | 207 | 'SNRmin': global_type_float, |
|
207 | 208 | 'SNRmax': global_type_float, |
|
208 | 209 | 'SNR_1': global_type_boolean, |
|
209 | 210 | 'save': global_type_boolean, |
|
210 | 211 | 'figpath': global_type_string, |
|
211 | 212 | 'lastone': global_type_float, |
|
212 | 213 | 'figfile': global_type_string, |
|
213 | 214 | 'ftp': global_type_string, |
|
214 | 215 | 'wr_period': global_type_integer, |
|
215 | 216 | 'show': global_type_string, |
|
216 | 217 | 'server': global_type_string, |
|
217 | 218 | 'folder': global_type_string, |
|
218 | 219 | 'username': global_type_string, |
|
219 | 220 | 'password': global_type_string, |
|
220 | 221 | 'ftp_wei': global_type_integer, |
|
221 | 222 | 'exp_code': global_type_integer, |
|
222 | 223 | 'sub_exp_code': global_type_integer, |
|
223 | 224 | 'plot_pos': global_type_integer, |
|
224 | 225 | } |
|
225 | 226 | |
|
226 | 227 | |
|
227 | 228 | Figure |
|
228 | 229 | # parameters = { |
|
229 | 230 | # : global_type_string, |
|
230 | 231 | # } |
|
231 | 232 | |
|
232 | 233 | |
|
233 | 234 | #FitsWriter |
|
234 | 235 | parameters = { |
|
235 | 236 | 'path': global_type_string, |
|
236 | 237 | 'dataBlocksPerFile': global_type_integer, |
|
237 | 238 | 'metadatafile': global_type_string, |
|
238 | 239 | } |
|
239 | 240 | |
|
240 | 241 | |
|
241 | 242 | #IncohInt |
|
242 | 243 | parameters = { |
|
243 | 244 | 'n': global_type_float, |
|
244 | 245 | 'timeInterval': global_type_integer, |
|
245 | 246 | 'overlapping': global_type_boolean, |
|
246 | 247 | } |
|
247 | 248 | |
|
248 | 249 | |
|
249 | 250 | #IncohInt4SpectraHeis |
|
250 | 251 | parameters = { |
|
251 | 252 | 'n': global_type_float, |
|
252 | 253 | 'timeInterval': global_type_integer, |
|
253 | 254 | 'overlapping': global_type_boolean, |
|
254 | 255 | } |
|
255 | 256 | |
|
256 | 257 | |
|
257 | 258 | #MomentsPlot |
|
258 | 259 | parameters = { |
|
259 | 260 | 'id': global_type_string, |
|
260 | 261 | 'wintitle': global_type_string, |
|
261 | 262 | 'channelList': global_type_list, |
|
262 | 263 | 'showprofile': global_type_boolean, |
|
263 | 264 | 'xmin': global_type_float, |
|
264 | 265 | 'xmax': global_type_float, |
|
265 | 266 | 'ymin': global_type_float, |
|
266 | 267 | 'ymax': global_type_float, |
|
267 | 268 | 'zmin': global_type_float, |
|
268 | 269 | 'zmax': global_type_float, |
|
269 | 270 | 'save': global_type_boolean, |
|
270 | 271 | 'figpath': global_type_string, |
|
271 | 272 | 'figfile': global_type_string, |
|
272 | 273 | 'show': global_type_boolean, |
|
273 | 274 | 'ftp': global_type_boolean, |
|
274 | 275 | 'wr_period': global_type_integer, |
|
275 | 276 | 'server': global_type_string, |
|
276 | 277 | 'folder': global_type_string, |
|
277 | 278 | 'username': global_type_string, |
|
278 | 279 | 'password': global_type_string, |
|
279 | 280 | 'ftp_wei': global_type_string, |
|
280 | 281 | 'exp_code': global_type_integer, |
|
281 | 282 | 'sub_exp_code': global_type_integer, |
|
282 | 283 | 'plot_pos': global_type_integer, |
|
283 | 284 | 'realtime': global_type_boolean, |
|
284 | 285 | } |
|
285 | 286 | |
|
286 | 287 | |
|
287 | 288 | #NSMeteorDetection1Plot |
|
288 | 289 | parameters = { |
|
289 | 290 | 'id': global_type_string, |
|
290 | 291 | 'wintitle': global_type_string, |
|
291 | 292 | 'channelList': global_type_list, |
|
292 | 293 | 'showprofile': global_type_boolean, |
|
293 | 294 | 'xmin': global_type_float, |
|
294 | 295 | 'xmax': global_type_float, |
|
295 | 296 | 'ymin': global_type_float, |
|
296 | 297 | 'ymax': global_type_float, |
|
297 | 298 | 'SNRmin': global_type_float, |
|
298 | 299 | 'SNRmax': global_type_float, |
|
299 | 300 | 'vmin': global_type_float, |
|
300 | 301 | 'vmax': global_type_float, |
|
301 | 302 | 'wmin': global_type_float, |
|
302 | 303 | 'wmax': global_type_float, |
|
303 | 304 | 'mode': global_type_string, |
|
304 | 305 | 'save': global_type_boolean, |
|
305 | 306 | 'figpath': global_type_string, |
|
306 | 307 | 'figfile': global_type_string, |
|
307 | 308 | 'show': global_type_boolean, |
|
308 | 309 | 'ftp': global_type_string, |
|
309 | 310 | 'wr_period': global_type_integer, |
|
310 | 311 | 'server': global_type_string, |
|
311 | 312 | 'folder': global_type_string, |
|
312 | 313 | 'username': global_type_string, |
|
313 | 314 | 'password': global_type_string, |
|
314 | 315 | 'ftp_wei': global_type_integer, |
|
315 | 316 | 'exp_code': global_type_integer, |
|
316 | 317 | 'sub_exp_code': global_type_integer, |
|
317 | 318 | 'plot_pos': global_type_integer, |
|
318 | 319 | 'realtime': global_type_boolean, |
|
319 | 320 | 'xaxis': global_type_string, |
|
320 | 321 | } |
|
321 | 322 | |
|
322 | 323 | |
|
323 | 324 | #NSMeteorDetection2Plot |
|
324 | 325 | parameters = { |
|
325 | 326 | 'id': global_type_string, |
|
326 | 327 | 'wintitle': global_type_string, |
|
327 | 328 | 'channelList': global_type_list, |
|
328 | 329 | 'showprofile': global_type_boolean, |
|
329 | 330 | 'xmin': global_type_float, |
|
330 | 331 | 'xmax': global_type_float, |
|
331 | 332 | 'ymin': global_type_float, |
|
332 | 333 | 'ymax': global_type_float, |
|
333 | 334 | 'SNRmin': global_type_float, |
|
334 | 335 | 'SNRmax': global_type_float, |
|
335 | 336 | 'vmin': global_type_float, |
|
336 | 337 | 'vmax': global_type_float, |
|
337 | 338 | 'wmin': global_type_float, |
|
338 | 339 | 'wmax': global_type_float, |
|
339 | 340 | 'mode': global_type_string, |
|
340 | 341 | 'save': global_type_boolean, |
|
341 | 342 | 'figpath': global_type_string, |
|
342 | 343 | 'figfile': global_type_string, |
|
343 | 344 | 'show': global_type_string, |
|
344 | 345 | 'ftp': global_type_boolean, |
|
345 | 346 | 'wr_period': global_type_integer, |
|
346 | 347 | 'server': global_type_string, |
|
347 | 348 | 'folder': global_type_string, |
|
348 | 349 | 'username': global_type_string, |
|
349 | 350 | 'password': global_type_string, |
|
350 | 351 | 'ftp_wei': global_type_integer, |
|
351 | 352 | 'exp_code': global_type_integer, |
|
352 | 353 | 'sub_exp_code': global_type_integer, |
|
353 | 354 | 'plot_pos': global_type_integer, |
|
354 | 355 | 'realtime': global_type_boolean, |
|
355 | 356 | 'xaxis': global_type_string, |
|
356 | 357 | } |
|
357 | 358 | |
|
358 | 359 | |
|
359 | 360 | #Noise |
|
360 | 361 | parameters = { |
|
361 | 362 | 'id': global_type_string, |
|
362 | 363 | 'wintitle': global_type_string, |
|
363 | 364 | 'channelList': global_type_list, |
|
364 | 365 | 'showprofile': global_type_boolean, |
|
365 | 366 | 'xmin': global_type_float, |
|
366 | 367 | 'xmax': global_type_float, |
|
367 | 368 | 'ymin': global_type_float, |
|
368 | 369 | 'ymax': global_type_float, |
|
369 | 370 | 'timerange': global_type_float, |
|
370 | 371 | 'save': global_type_boolean, |
|
371 | 372 | 'figpath': global_type_string, |
|
372 | 373 | 'figfile': global_type_string, |
|
373 | 374 | 'show': global_type_boolean, |
|
374 | 375 | 'ftp': global_type_boolean, |
|
375 | 376 | 'wr_period': global_type_integer, |
|
376 | 377 | 'server': global_type_string, |
|
377 | 378 | 'folder': global_type_string, |
|
378 | 379 | 'username': global_type_string, |
|
379 | 380 | 'password': global_type_string, |
|
380 | 381 | 'ftp_wei': global_type_integer, |
|
381 | 382 | 'exp_code': global_type_integer, |
|
382 | 383 | 'sub_exp_code': global_type_integer, |
|
383 | 384 | 'plot_pos': global_type_integer, |
|
384 | 385 | } |
|
385 | 386 | |
|
386 | 387 | |
|
387 | 388 | #NonSpecularMeteorDetection |
|
388 | 389 | parameters = { |
|
389 | 390 | 'mode': global_type_string, |
|
390 | 391 | 'SNRthresh': global_type_float, |
|
391 | 392 | 'phaseDerThresh': global_type_float, |
|
392 | 393 | 'cohThresh': global_type_float, |
|
393 | 394 | 'allData': global_type_boolean, |
|
394 | 395 | } |
|
395 | 396 | |
|
396 | 397 | |
|
397 | 398 | Operation |
|
398 | 399 | parameters = { |
|
399 | 400 | 'dataIn': global_type_string, |
|
400 | 401 | } |
|
401 | 402 | |
|
402 | 403 | |
|
403 | ParamWriter | |
|
404 | #ParamWriter | |
|
404 | 405 | parameters = { |
|
405 | : global_type_string, | |
|
406 | } | |
|
406 | 'path': global_type_string, | |
|
407 | 'blocksPerFile':global_type_integer, | |
|
408 | 'metadataList': global_type_list, | |
|
409 | 'dataList': global_type_list, | |
|
410 | 'mode': global_type_integer, | |
|
411 | } | |
|
407 | 412 | |
|
408 | 413 | |
|
409 | Parameters1Plot | |
|
414 | #Parameters1Plot | |
|
410 | 415 | parameters = { |
|
411 | 416 | 'id': global_type_string, |
|
412 | 417 | 'wintitle': global_type_string, |
|
413 | 418 | 'channelList': global_type_list, |
|
414 | 419 | 'showprofile': global_type_boolean, |
|
415 | 420 | 'xmin': global_type_float, |
|
416 | 421 | 'xmax': global_type_float, |
|
417 | 422 | 'ymin': global_type_float, |
|
418 | 423 | 'ymax': global_type_float, |
|
419 | 424 | 'zmin': global_type_float, |
|
420 | 425 | 'zmax': global_type_float, |
|
421 | 426 | 'timerange': global_type_float, |
|
422 |
'parameterIndex': global_type_ |
|
|
423 |
'onlyPositive': global_type_ |
|
|
424 |
'SNRthresh': global_type_ |
|
|
425 |
'SNR': global_type_ |
|
|
427 | 'parameterIndex': global_type_float, | |
|
428 | 'onlyPositive': global_type_boolean, | |
|
429 | 'SNRthresh': global_type_float, | |
|
430 | 'SNR': global_type_boolean, | |
|
426 | 431 | 'SNRmin': global_type_float, |
|
427 | 432 | 'SNRmax': global_type_float, |
|
428 |
'onlySNR': global_type_ |
|
|
429 |
'DOP': global_type_ |
|
|
433 | 'onlySNR': global_type_boolean, | |
|
434 | 'DOP': global_type_boolean, | |
|
430 | 435 | 'zlabel': global_type_string, |
|
431 | 436 | 'parameterName': global_type_string, |
|
432 | 437 | 'parameterObject': global_type_string, |
|
433 | 438 | 'save': global_type_boolean, |
|
434 | 439 | 'figpath': global_type_string, |
|
435 |
'lastone': global_type_ |
|
|
440 | 'lastone': global_type_integer, | |
|
436 | 441 | 'figfile': global_type_string, |
|
437 |
'ftp': global_type_ |
|
|
442 | 'ftp': global_type_boolean, | |
|
438 | 443 | 'wr_period': global_type_integer, |
|
439 | 444 | 'show': global_type_string, |
|
440 | 445 | 'server': global_type_string, |
|
441 | 446 | 'folder': global_type_string, |
|
442 | 447 | 'username': global_type_string, |
|
443 | 448 | 'password': global_type_string, |
|
444 | 449 | 'ftp_wei': global_type_integer, |
|
445 | 450 | 'exp_code': global_type_integer, |
|
446 | 451 | 'sub_exp_code': global_type_integer, |
|
447 | 452 | 'plot_pos': global_type_integer, |
|
448 | 453 | } |
|
449 | 454 | |
|
450 | 455 | |
|
451 | ParametersPlot | |
|
456 | #ParametersPlot | |
|
452 | 457 | parameters = { |
|
453 | 458 | 'id': global_type_string, |
|
454 | 459 | 'wintitle': global_type_string, |
|
455 | 460 | 'channelList': global_type_list, |
|
456 |
'paramIndex': global_type_ |
|
|
457 |
'colormap': global_type_ |
|
|
461 | 'paramIndex': global_type_integer, | |
|
462 | 'colormap': global_type_colormap, | |
|
458 | 463 | 'xmin': global_type_float, |
|
459 | 464 | 'xmax': global_type_float, |
|
460 | 465 | 'ymin': global_type_float, |
|
461 | 466 | 'ymax': global_type_float, |
|
462 | 467 | 'zmin': global_type_float, |
|
463 | 468 | 'zmax': global_type_float, |
|
464 | 469 | 'timerange': global_type_float, |
|
465 |
'showSNR': global_type_ |
|
|
466 |
'SNRthresh': global_type_ |
|
|
470 | 'showSNR': global_type_boolean, | |
|
471 | 'SNRthresh': global_type_float, | |
|
467 | 472 | 'SNRmin': global_type_float, |
|
468 | 473 | 'SNRmax': global_type_float, |
|
469 | 474 | 'save': global_type_boolean, |
|
470 | 475 | 'figpath': global_type_string, |
|
471 |
'lastone': global_type_ |
|
|
476 | 'lastone': global_type_integer, | |
|
472 | 477 | 'figfile': global_type_string, |
|
473 |
'ftp': global_type_ |
|
|
478 | 'ftp': global_type_boolean, | |
|
474 | 479 | 'wr_period': global_type_integer, |
|
475 |
'show': global_type_ |
|
|
480 | 'show': global_type_boolean, | |
|
476 | 481 | 'server': global_type_string, |
|
477 | 482 | 'folder': global_type_string, |
|
478 | 483 | 'username': global_type_string, |
|
479 | 484 | 'password': global_type_string, |
|
480 | 485 | 'ftp_wei': global_type_integer, |
|
481 | 486 | 'exp_code': global_type_integer, |
|
482 | 487 | 'sub_exp_code': global_type_integer, |
|
483 | 488 | 'plot_pos': global_type_integer, |
|
484 | 489 | } |
|
485 | 490 | |
|
486 | 491 | |
|
487 | PhasePlot | |
|
492 | #PhasePlot | |
|
488 | 493 | parameters = { |
|
489 | 494 | 'id': global_type_string, |
|
490 | 495 | 'wintitle': global_type_string, |
|
491 |
'pairsList': |
|
|
496 | 'pairsList': global_type_pairsList, | |
|
492 | 497 | 'showprofile': global_type_boolean, |
|
493 | 498 | 'xmin': global_type_float, |
|
494 | 499 | 'xmax': global_type_float, |
|
495 | 500 | 'ymin': global_type_float, |
|
496 | 501 | 'ymax': global_type_float, |
|
497 | 502 | 'timerange': global_type_float, |
|
498 | 503 | 'save': global_type_boolean, |
|
499 | 504 | 'figpath': global_type_string, |
|
500 | 505 | 'figfile': global_type_string, |
|
501 |
'show': global_type_ |
|
|
502 |
'ftp': global_type_ |
|
|
506 | 'show': global_type_boolean, | |
|
507 | 'ftp': global_type_boolean, | |
|
503 | 508 | 'wr_period': global_type_integer, |
|
504 | 509 | 'server': global_type_string, |
|
505 | 510 | 'folder': global_type_string, |
|
506 | 511 | 'username': global_type_string, |
|
507 | 512 | 'password': global_type_string, |
|
508 | 513 | 'ftp_wei': global_type_integer, |
|
509 | 514 | 'exp_code': global_type_integer, |
|
510 | 515 | 'sub_exp_code': global_type_integer, |
|
511 | 516 | 'plot_pos': global_type_integer, |
|
512 | 517 | } |
|
513 | 518 | |
|
514 | 519 | |
|
515 | 520 | PlotCOHData |
|
516 | 521 | parameters = { |
|
517 | 522 | : global_type_string, |
|
518 | 523 | } |
|
519 | 524 | |
|
520 | 525 | |
|
521 | 526 | PlotCrossSpectraData |
|
522 | 527 | parameters = { |
|
523 | 528 | : global_type_string, |
|
524 | 529 | } |
|
525 | 530 | |
|
526 | 531 | |
|
527 | 532 | PlotDOPData |
|
528 | 533 | parameters = { |
|
529 | 534 | : global_type_string, |
|
530 | 535 | } |
|
531 | 536 | |
|
532 | 537 | |
|
533 | 538 | PlotData |
|
534 | 539 | parameters = { |
|
535 | 540 | : global_type_string, |
|
536 | 541 | } |
|
537 | 542 | |
|
538 | 543 | |
|
539 | 544 | PlotNoiseData |
|
540 | 545 | parameters = { |
|
541 | 546 | : global_type_string, |
|
542 | 547 | } |
|
543 | 548 | |
|
544 | 549 | |
|
545 | 550 | PlotPHASEData |
|
546 | 551 | parameters = { |
|
547 | 552 | : global_type_string, |
|
548 | 553 | } |
|
549 | 554 | |
|
550 | 555 | |
|
551 | 556 | PlotRTIData |
|
552 | 557 | parameters = { |
|
553 | 558 | : global_type_string, |
|
554 | 559 | } |
|
555 | 560 | |
|
556 | 561 | |
|
557 | 562 | PlotSNRData |
|
558 | 563 | parameters = { |
|
559 | 564 | : global_type_string, |
|
560 | 565 | } |
|
561 | 566 | |
|
562 | 567 | |
|
563 | 568 | PlotSpectraData |
|
564 | 569 | parameters = { |
|
565 | 570 | : global_type_string, |
|
566 | 571 | } |
|
567 | 572 | |
|
568 | 573 | |
|
569 | 574 | PlotSpectraMeanData |
|
570 | 575 | parameters = { |
|
571 | 576 | : global_type_string, |
|
572 | 577 | } |
|
573 | 578 | |
|
574 | 579 | |
|
575 | 580 | PlotWindProfilerData |
|
576 | 581 | parameters = { |
|
577 | 582 | : global_type_string, |
|
578 | 583 | } |
|
579 | 584 | |
|
580 | 585 | |
|
581 | 586 | PowerProfilePlot |
|
582 | 587 | parameters = { |
|
583 | 588 | 'id': global_type_string, |
|
584 | 589 | 'wintitle': global_type_string, |
|
585 | 590 | 'channelList': global_type_list, |
|
586 | 591 | 'xmin': global_type_float, |
|
587 | 592 | 'xmax': global_type_float, |
|
588 | 593 | 'ymin': global_type_float, |
|
589 | 594 | 'ymax': global_type_float, |
|
590 | 595 | 'save': global_type_boolean, |
|
591 | 596 | 'figpath': global_type_string, |
|
592 | 597 | 'figfile': global_type_string, |
|
593 |
'show': global_type_ |
|
|
594 |
'ftp': global_type_ |
|
|
598 | 'show': global_type_boolean, | |
|
599 | 'ftp': global_type_boolean, | |
|
595 | 600 | 'wr_period': global_type_integer, |
|
596 | 601 | 'server': global_type_string, |
|
597 | 602 | 'folder': global_type_string, |
|
598 | 603 | 'username': global_type_string, |
|
599 | 604 | 'password': global_type_string, |
|
600 | 605 | } |
|
601 | 606 | |
|
602 | 607 | |
|
603 | 608 | PrintInfo |
|
604 | 609 | parameters = { |
|
605 | 610 | : global_type_string, |
|
606 | 611 | } |
|
607 | 612 | |
|
608 | 613 | |
|
609 | 614 | ProfileConcat |
|
610 | 615 | parameters = { |
|
611 | 616 | 'm': global_type_string, |
|
612 | 617 | } |
|
613 | 618 | |
|
614 | 619 | |
|
615 | 620 | ProfileSelector |
|
616 | 621 | parameters = { |
|
617 | 622 | 'profileList': global_type_string, |
|
618 | 623 | 'profileRangeList': global_type_string, |
|
619 | 624 | 'beam': global_type_string, |
|
620 | 625 | 'byblock': global_type_string, |
|
621 | 626 | 'rangeList': global_type_string, |
|
622 | 627 | 'nProfiles': global_type_string, |
|
623 | 628 | } |
|
624 | 629 | |
|
625 | 630 | |
|
626 | 631 | ProfileToChannels |
|
627 | 632 | parameters = { |
|
628 | 633 | : global_type_string, |
|
629 | 634 | } |
|
630 | 635 | |
|
631 | 636 | |
|
632 | 637 | PublishData |
|
633 | 638 | parameters = { |
|
634 | 639 | : global_type_string, |
|
635 | 640 | } |
|
636 | 641 | |
|
637 | 642 | |
|
638 | 643 | RTIPlot |
|
639 | 644 | parameters = { |
|
640 | 645 | 'id': global_type_string, |
|
641 | 646 | 'wintitle': global_type_string, |
|
642 | 647 | 'channelList': global_type_list, |
|
643 | 648 | 'showprofile': global_type_boolean, |
|
644 | 649 | 'xmin': global_type_float, |
|
645 | 650 | 'xmax': global_type_float, |
|
646 | 651 | 'ymin': global_type_float, |
|
647 | 652 | 'ymax': global_type_float, |
|
648 | 653 | 'zmin': global_type_float, |
|
649 | 654 | 'zmax': global_type_float, |
|
650 | 655 | 'timerange': global_type_float, |
|
651 | 656 | 'save': global_type_boolean, |
|
652 | 657 | 'figpath': global_type_string, |
|
653 | 658 | 'lastone': global_type_string, |
|
654 | 659 | 'figfile': global_type_string, |
|
655 |
'ftp': global_type_ |
|
|
660 | 'ftp': global_type_boolean, | |
|
656 | 661 | 'wr_period': global_type_integer, |
|
657 |
'show': global_type_ |
|
|
662 | 'show': global_type_boolean, | |
|
658 | 663 | 'server': global_type_string, |
|
659 | 664 | 'folder': global_type_string, |
|
660 | 665 | 'username': global_type_string, |
|
661 | 666 | 'password': global_type_string, |
|
662 | 667 | 'ftp_wei': global_type_integer, |
|
663 | 668 | 'exp_code': global_type_integer, |
|
664 | 669 | 'sub_exp_code': global_type_integer, |
|
665 | 670 | 'plot_pos': global_type_integer, |
|
666 | 671 | } |
|
667 | 672 | |
|
668 | 673 | |
|
669 | 674 | RTIfromSpectraHeis |
|
670 | 675 | parameters = { |
|
671 | 676 | 'id': global_type_string, |
|
672 | 677 | 'wintitle': global_type_string, |
|
673 | 678 | 'channelList': global_type_list, |
|
674 | 679 | 'showprofile': global_type_boolean, |
|
675 | 680 | 'xmin': global_type_float, |
|
676 | 681 | 'xmax': global_type_float, |
|
677 | 682 | 'ymin': global_type_float, |
|
678 | 683 | 'ymax': global_type_float, |
|
679 | 684 | 'timerange': global_type_float, |
|
680 | 685 | 'save': global_type_boolean, |
|
681 | 686 | 'figpath': global_type_string, |
|
682 | 687 | 'figfile': global_type_string, |
|
683 |
'ftp': global_type_ |
|
|
688 | 'ftp': global_type_boolean, | |
|
684 | 689 | 'wr_period': global_type_integer, |
|
685 |
'show': global_type_ |
|
|
690 | 'show': global_type_boolean, | |
|
686 | 691 | 'server': global_type_string, |
|
687 | 692 | 'folder': global_type_string, |
|
688 | 693 | 'username': global_type_string, |
|
689 | 694 | 'password': global_type_string, |
|
690 | 695 | 'ftp_wei': global_type_integer, |
|
691 | 696 | 'exp_code': global_type_integer, |
|
692 | 697 | 'sub_exp_code': global_type_integer, |
|
693 | 698 | 'plot_pos': global_type_integer, |
|
694 | 699 | } |
|
695 | 700 | |
|
696 | 701 | |
|
697 | 702 | Reshaper |
|
698 | 703 | parameters = { |
|
699 | 704 | 'shape': global_type_string, |
|
700 | 705 | 'nTxs': global_type_string, |
|
701 | 706 | } |
|
702 | 707 | |
|
703 | 708 | |
|
704 | 709 | SALags |
|
705 | 710 | parameters = { |
|
706 | 711 | : global_type_string, |
|
707 | 712 | } |
|
708 | 713 | |
|
709 | 714 | |
|
710 | 715 | SMDetection |
|
711 | 716 | parameters = { |
|
712 | 717 | 'hei_ref': global_type_string, |
|
713 | 718 | 'tauindex': global_type_string, |
|
714 | 719 | 'phaseOffsets': global_type_string, |
|
715 | 720 | 'cohDetection': global_type_string, |
|
716 | 721 | 'cohDet_timeStep': global_type_string, |
|
717 | 722 | 'cohDet_thresh': global_type_string, |
|
718 | 723 | 'noise_timeStep': global_type_string, |
|
719 | 724 | 'noise_multiple': global_type_string, |
|
720 | 725 | 'multDet_timeLimit': global_type_string, |
|
721 | 726 | 'multDet_rangeLimit': global_type_string, |
|
722 | 727 | 'phaseThresh': global_type_string, |
|
723 | 728 | 'SNRThresh': global_type_string, |
|
724 | 729 | 'hmin': global_type_string, |
|
725 | 730 | 'hmax': global_type_string, |
|
726 | 731 | 'azimuth': global_type_string, |
|
727 | 732 | 'channelPositions': global_type_string, |
|
728 | 733 | } |
|
729 | 734 | |
|
730 | 735 | |
|
731 | 736 | SMPhaseCalibration |
|
732 | 737 | parameters = { |
|
733 | 738 | 'hmin': global_type_string, |
|
734 | 739 | 'hmax': global_type_string, |
|
735 | 740 | 'channelPositions': global_type_string, |
|
736 | 741 | 'nHours': global_type_string, |
|
737 | 742 | } |
|
738 | 743 | |
|
739 | 744 | |
|
740 | 745 | Scope |
|
741 | 746 | parameters = { |
|
742 | 747 | 'id': global_type_string, |
|
743 | 748 | 'wintitle': global_type_string, |
|
744 | 749 | 'channelList': global_type_list, |
|
745 | 750 | 'xmin': global_type_float, |
|
746 | 751 | 'xmax': global_type_float, |
|
747 | 752 | 'ymin': global_type_float, |
|
748 | 753 | 'ymax': global_type_float, |
|
749 | 754 | 'save': global_type_boolean, |
|
750 | 755 | 'figpath': global_type_string, |
|
751 | 756 | 'figfile': global_type_string, |
|
752 |
'show': global_type_ |
|
|
757 | 'show': global_type_boolean, | |
|
753 | 758 | 'wr_period': global_type_integer, |
|
754 |
'ftp': global_type_ |
|
|
759 | 'ftp': global_type_boolean, | |
|
755 | 760 | 'server': global_type_string, |
|
756 | 761 | 'folder': global_type_string, |
|
757 | 762 | 'username': global_type_string, |
|
758 | 763 | 'password': global_type_string, |
|
759 | 764 | 'type': global_type_string, |
|
760 | 765 | } |
|
761 | 766 | |
|
762 | 767 | |
|
763 | 768 | SendByFTP |
|
764 | 769 | parameters = { |
|
765 | 770 | 'ext': global_type_string, |
|
766 | 771 | 'localfolder': global_type_string, |
|
767 | 772 | 'remotefolder': global_type_string, |
|
768 | 773 | 'server': global_type_string, |
|
769 | 774 | 'username': global_type_string, |
|
770 | 775 | 'password': global_type_string, |
|
771 | 776 | 'period': global_type_string, |
|
772 | 777 | } |
|
773 | 778 | |
|
774 | 779 | |
|
775 | 780 | SkyMapPlot |
|
776 | 781 | parameters = { |
|
777 | 782 | 'id': global_type_string, |
|
778 | 783 | 'wintitle': global_type_string, |
|
779 | 784 | 'channelList': global_type_list, |
|
780 | 785 | 'showprofile': global_type_boolean, |
|
781 | 786 | 'tmin': global_type_string, |
|
782 | 787 | 'tmax': global_type_string, |
|
783 | 788 | 'timerange': global_type_float, |
|
784 | 789 | 'save': global_type_boolean, |
|
785 | 790 | 'figpath': global_type_string, |
|
786 | 791 | 'figfile': global_type_string, |
|
787 |
'show': global_type_ |
|
|
788 |
'ftp': global_type_ |
|
|
792 | 'show': global_type_boolean, | |
|
793 | 'ftp': global_type_boolean, | |
|
789 | 794 | 'wr_period': global_type_integer, |
|
790 | 795 | 'server': global_type_string, |
|
791 | 796 | 'folder': global_type_string, |
|
792 | 797 | 'username': global_type_string, |
|
793 | 798 | 'password': global_type_string, |
|
794 | 799 | 'ftp_wei': global_type_integer, |
|
795 | 800 | 'exp_code': global_type_integer, |
|
796 | 801 | 'sub_exp_code': global_type_integer, |
|
797 | 802 | 'plot_pos': global_type_integer, |
|
798 | 803 | 'realtime': global_type_boolean, |
|
799 | 804 | } |
|
800 | 805 | |
|
801 | 806 | |
|
802 | 807 | SpectraCutPlot |
|
803 | 808 | parameters = { |
|
804 | 809 | 'id': global_type_string, |
|
805 | 810 | 'wintitle': global_type_string, |
|
806 | 811 | 'channelList': global_type_list, |
|
807 | 812 | 'xmin': global_type_float, |
|
808 | 813 | 'xmax': global_type_float, |
|
809 | 814 | 'ymin': global_type_float, |
|
810 | 815 | 'ymax': global_type_float, |
|
811 | 816 | 'save': global_type_boolean, |
|
812 | 817 | 'figpath': global_type_string, |
|
813 | 818 | 'figfile': global_type_string, |
|
814 |
'show': global_type_ |
|
|
815 |
'ftp': global_type_ |
|
|
819 | 'show': global_type_boolean, | |
|
820 | 'ftp': global_type_boolean, | |
|
816 | 821 | 'wr_period': global_type_integer, |
|
817 | 822 | 'server': global_type_string, |
|
818 | 823 | 'folder': global_type_string, |
|
819 | 824 | 'username': global_type_string, |
|
820 | 825 | 'password': global_type_string, |
|
821 | 826 | 'xaxis': global_type_string, |
|
822 | 827 | } |
|
823 | 828 | |
|
824 | 829 | |
|
825 | 830 | SpectraHeisScope |
|
826 | 831 | parameters = { |
|
827 | 832 | 'id': global_type_string, |
|
828 | 833 | 'wintitle': global_type_string, |
|
829 | 834 | 'channelList': global_type_list, |
|
830 | 835 | 'xmin': global_type_float, |
|
831 | 836 | 'xmax': global_type_float, |
|
832 | 837 | 'ymin': global_type_float, |
|
833 | 838 | 'ymax': global_type_float, |
|
834 | 839 | 'save': global_type_boolean, |
|
835 | 840 | 'figpath': global_type_string, |
|
836 | 841 | 'figfile': global_type_string, |
|
837 |
'ftp': global_type_ |
|
|
842 | 'ftp': global_type_boolean, | |
|
838 | 843 | 'wr_period': global_type_integer, |
|
839 |
'show': global_type_ |
|
|
844 | 'show': global_type_boolean, | |
|
840 | 845 | 'server': global_type_string, |
|
841 | 846 | 'folder': global_type_string, |
|
842 | 847 | 'username': global_type_string, |
|
843 | 848 | 'password': global_type_string, |
|
844 | 849 | 'ftp_wei': global_type_integer, |
|
845 | 850 | 'exp_code': global_type_integer, |
|
846 | 851 | 'sub_exp_code': global_type_integer, |
|
847 | 852 | 'plot_pos': global_type_integer, |
|
848 | 853 | } |
|
849 | 854 | |
|
850 | 855 | |
|
851 | 856 | SpectraHeisWriter |
|
852 | 857 | parameters = { |
|
853 | 858 | : global_type_string, |
|
854 | 859 | } |
|
855 | 860 | |
|
856 | 861 | |
|
857 | 862 | SpectraPlot |
|
858 | 863 | parameters = { |
|
859 | 864 | 'id': global_type_string, |
|
860 | 865 | 'wintitle': global_type_string, |
|
861 | 866 | 'channelList': global_type_list, |
|
862 | 867 | 'showprofile': global_type_boolean, |
|
863 | 868 | 'xmin': global_type_float, |
|
864 | 869 | 'xmax': global_type_float, |
|
865 | 870 | 'ymin': global_type_float, |
|
866 | 871 | 'ymax': global_type_float, |
|
867 | 872 | 'zmin': global_type_float, |
|
868 | 873 | 'zmax': global_type_float, |
|
869 | 874 | 'save': global_type_boolean, |
|
870 | 875 | 'figpath': global_type_string, |
|
871 | 876 | 'figfile': global_type_string, |
|
872 |
'show': global_type_ |
|
|
873 |
'ftp': global_type_ |
|
|
877 | 'show': global_type_boolean, | |
|
878 | 'ftp': global_type_boolean, | |
|
874 | 879 | 'wr_period': global_type_integer, |
|
875 | 880 | 'server': global_type_string, |
|
876 | 881 | 'folder': global_type_string, |
|
877 | 882 | 'username': global_type_string, |
|
878 | 883 | 'password': global_type_string, |
|
879 | 884 | 'ftp_wei': global_type_integer, |
|
880 | 885 | 'exp_code': global_type_integer, |
|
881 | 886 | 'sub_exp_code': global_type_integer, |
|
882 | 887 | 'plot_pos': global_type_integer, |
|
883 | 888 | 'realtime': global_type_boolean, |
|
884 | 889 | 'xaxis': global_type_string, |
|
885 | 890 | } |
|
886 | 891 | |
|
887 | 892 | |
|
888 | 893 | SpectraWriter |
|
889 | 894 | parameters = { |
|
890 | 895 | 'path': global_type_string, |
|
891 | 896 | 'blocksPerFile': global_type_string, |
|
892 | 897 | 'profilesPerBlock': global_type_string, |
|
893 | 898 | 'set': global_type_string, |
|
894 | 899 | 'ext': global_type_string, |
|
895 | 900 | 'datatype': global_type_string, |
|
896 | 901 | } |
|
897 | 902 | |
|
898 | 903 | |
|
899 | 904 | SpectralFitting |
|
900 | 905 | parameters = { |
|
901 | 906 | 'getSNR': global_type_string, |
|
902 | 907 | 'path': global_type_string, |
|
903 | 908 | 'file': global_type_string, |
|
904 | 909 | 'groupList': global_type_string, |
|
905 | 910 | } |
|
906 | 911 | |
|
907 | 912 | |
|
908 | 913 | SpectralFittingPlot |
|
909 | 914 | parameters = { |
|
910 | 915 | 'id': global_type_string, |
|
911 | 916 | 'cutHeight': global_type_string, |
|
912 | 917 | 'fit': global_type_string, |
|
913 | 918 | 'wintitle': global_type_string, |
|
914 | 919 | 'channelList': global_type_list, |
|
915 | 920 | 'showprofile': global_type_boolean, |
|
916 | 921 | 'xmin': global_type_float, |
|
917 | 922 | 'xmax': global_type_float, |
|
918 | 923 | 'ymin': global_type_float, |
|
919 | 924 | 'ymax': global_type_float, |
|
920 | 925 | 'save': global_type_boolean, |
|
921 | 926 | 'figpath': global_type_string, |
|
922 | 927 | 'figfile': global_type_string, |
|
923 |
'show': global_type_ |
|
|
928 | 'show': global_type_boolean, | |
|
924 | 929 | } |
|
925 | 930 | |
|
926 | 931 | |
|
927 | 932 | SpectralMoments |
|
928 | 933 | parameters = { |
|
929 | 934 | : global_type_string, |
|
930 | 935 | } |
|
931 | 936 | |
|
932 | 937 | |
|
933 | 938 | SplitProfiles |
|
934 | 939 | parameters = { |
|
935 | 940 | 'n': global_type_string, |
|
936 | 941 | } |
|
937 | 942 | |
|
938 | 943 | |
|
939 | 944 | USRPWriter |
|
940 | 945 | parameters = { |
|
941 | 946 | 'dataIn': global_type_string, |
|
942 | 947 | } |
|
943 | 948 | |
|
944 | 949 | |
|
945 | 950 | VoltageWriter |
|
946 | 951 | parameters = { |
|
947 | 952 | 'path': global_type_string, |
|
948 | 953 | 'blocksPerFile': global_type_string, |
|
949 | 954 | 'profilesPerBlock': global_type_string, |
|
950 | 955 | 'set': global_type_string, |
|
951 | 956 | 'ext': global_type_string, |
|
952 | 957 | 'datatype': global_type_string, |
|
953 | 958 | } |
|
954 | 959 | |
|
955 | 960 | |
|
956 | 961 | WindProfiler |
|
957 | 962 | parameters = { |
|
958 | 963 | 'technique': global_type_string, |
|
959 | 964 | } |
|
960 | 965 | |
|
961 | 966 | |
|
962 | 967 | WindProfilerPlot |
|
963 | 968 | parameters = { |
|
964 | 969 | 'id': global_type_string, |
|
965 | 970 | 'wintitle': global_type_string, |
|
966 | 971 | 'channelList': global_type_list, |
|
967 | 972 | 'showprofile': global_type_boolean, |
|
968 | 973 | 'xmin': global_type_float, |
|
969 | 974 | 'xmax': global_type_float, |
|
970 | 975 | 'ymin': global_type_float, |
|
971 | 976 | 'ymax': global_type_float, |
|
972 | 977 | 'zmin': global_type_float, |
|
973 | 978 | 'zmax': global_type_float, |
|
974 | 979 | 'zmax_ver': global_type_string, |
|
975 | 980 | 'zmin_ver': global_type_string, |
|
976 | 981 | 'SNRmin': global_type_float, |
|
977 | 982 | 'SNRmax': global_type_float, |
|
978 | 983 | 'timerange': global_type_float, |
|
979 | 984 | 'SNRthresh': global_type_string, |
|
980 | 985 | 'save': global_type_boolean, |
|
981 | 986 | 'figpath': global_type_string, |
|
982 | 987 | 'lastone': global_type_string, |
|
983 | 988 | 'figfile': global_type_string, |
|
984 |
'ftp': global_type_ |
|
|
989 | 'ftp': global_type_boolean, | |
|
985 | 990 | 'wr_period': global_type_integer, |
|
986 |
'show': global_type_ |
|
|
991 | 'show': global_type_boolean, | |
|
987 | 992 | 'server': global_type_string, |
|
988 | 993 | 'folder': global_type_string, |
|
989 | 994 | 'username': global_type_string, |
|
990 | 995 | 'password': global_type_string, |
|
991 | 996 | 'ftp_wei': global_type_integer, |
|
992 | 997 | 'exp_code': global_type_integer, |
|
993 | 998 | 'sub_exp_code': global_type_integer, |
|
994 | 999 | 'plot_pos': global_type_integer, |
|
995 | 1000 | } |
|
996 | 1001 | |
|
997 | 1002 | |
|
998 | 1003 | Writer |
|
999 | 1004 | parameters = { |
|
1000 | 1005 | 'dataIn': global_type_string, |
|
1001 | 1006 | } |
|
1002 | 1007 | |
|
1003 | 1008 | |
|
1004 | 1009 | AMISRProc |
|
1005 | 1010 | parameters = { |
|
1006 | 1011 | : global_type_string, |
|
1007 | 1012 | } |
|
1008 | 1013 | |
|
1009 | 1014 | |
|
1010 | 1015 | AMISRReader |
|
1011 | 1016 | parameters = { |
|
1012 | 1017 | : global_type_string, |
|
1013 | 1018 | } |
|
1014 | 1019 | |
|
1015 | 1020 | |
|
1016 | 1021 | CorrelationProc |
|
1017 | 1022 | parameters = { |
|
1018 | 1023 | 'lags': global_type_string, |
|
1019 | 1024 | 'mode': global_type_string, |
|
1020 | 1025 | 'pairsList': 'pairsLists', |
|
1021 | 1026 | 'fullBuffer': global_type_string, |
|
1022 | 1027 | 'nAvg': global_type_string, |
|
1023 | 1028 | 'removeDC': global_type_string, |
|
1024 | 1029 | 'splitCF': global_type_string, |
|
1025 | 1030 | } |
|
1026 | 1031 | |
|
1027 | 1032 | |
|
1028 | 1033 | FitsReader |
|
1029 | 1034 | parameters = { |
|
1030 | 1035 | : global_type_string, |
|
1031 | 1036 | } |
|
1032 | 1037 | |
|
1033 | 1038 | |
|
1034 | 1039 | HFReader |
|
1035 | 1040 | parameters = { |
|
1036 | 1041 | : global_type_string, |
|
1037 | 1042 | } |
|
1038 | 1043 | |
|
1039 | 1044 | |
|
1040 | 1045 | ParamReader |
|
1041 | 1046 | parameters = { |
|
1042 | 1047 | : global_type_string, |
|
1043 | 1048 | } |
|
1044 | 1049 | |
|
1045 | 1050 | |
|
1046 | 1051 | ParametersProc |
|
1047 | 1052 | parameters = { |
|
1048 | 1053 | : global_type_string, |
|
1049 | 1054 | } |
|
1050 | 1055 | |
|
1051 | 1056 | |
|
1052 | 1057 | ProcessingUnit |
|
1053 | 1058 | parameters = { |
|
1054 | 1059 | : global_type_string, |
|
1055 | 1060 | } |
|
1056 | 1061 | |
|
1057 | 1062 | |
|
1058 | 1063 | ReceiverData |
|
1059 | 1064 | parameters = { |
|
1060 | 1065 | : global_type_string, |
|
1061 | 1066 | } |
|
1062 | 1067 | |
|
1063 | 1068 | |
|
1064 | 1069 | SendToServer |
|
1065 | 1070 | parameters = { |
|
1066 | 1071 | : global_type_string, |
|
1067 | 1072 | } |
|
1068 | 1073 | |
|
1069 | 1074 | |
|
1070 | 1075 | SpectraAFCProc |
|
1071 | 1076 | parameters = { |
|
1072 | 1077 | 'nProfiles': global_type_string, |
|
1073 | 1078 | 'nFFTPoints': global_type_string, |
|
1074 | 1079 | 'pairsList': 'pairsLists', |
|
1075 | 1080 | 'code': global_type_string, |
|
1076 | 1081 | 'nCode': global_type_string, |
|
1077 | 1082 | 'nBaud': global_type_string, |
|
1078 | 1083 | } |
|
1079 | 1084 | |
|
1080 | 1085 | |
|
1081 | 1086 | SpectraHeisProc |
|
1082 | 1087 | parameters = { |
|
1083 | 1088 | : global_type_string, |
|
1084 | 1089 | } |
|
1085 | 1090 | |
|
1086 | 1091 | |
|
1087 | 1092 | SpectraLagsProc |
|
1088 | 1093 | parameters = { |
|
1089 | 1094 | 'nProfiles': global_type_string, |
|
1090 | 1095 | 'nFFTPoints': global_type_string, |
|
1091 | 1096 | 'pairsList': 'pairsLists', |
|
1092 | 1097 | 'code': global_type_string, |
|
1093 | 1098 | 'nCode': global_type_string, |
|
1094 | 1099 | 'nBaud': global_type_string, |
|
1095 | 1100 | 'codeFromHeader': global_type_string, |
|
1096 | 1101 | 'pulseIndex': global_type_string, |
|
1097 | 1102 | } |
|
1098 | 1103 | |
|
1099 | 1104 | |
|
1100 | 1105 | SpectraProc |
|
1101 | 1106 | parameters = { |
|
1102 | 1107 | 'nProfiles': global_type_string, |
|
1103 | 1108 | 'nFFTPoints': global_type_string, |
|
1104 | 1109 | 'pairsList': 'pairsLists', |
|
1105 | 1110 | 'ippFactor': global_type_string, |
|
1106 | 1111 | } |
|
1107 | 1112 | |
|
1108 | 1113 | |
|
1109 | 1114 | SpectraReader |
|
1110 | 1115 | parameters = { |
|
1111 | 1116 | 'path': global_type_string, |
|
1112 | 1117 | 'startDate': global_type_string, |
|
1113 | 1118 | 'endDate': global_type_string, |
|
1114 | 1119 | 'startTime': global_type_string, |
|
1115 | 1120 | 'endTime': global_type_string, |
|
1116 | 1121 | 'set': global_type_string, |
|
1117 | 1122 | 'expLabel': global_type_string, |
|
1118 | 1123 | 'ext': global_type_string, |
|
1119 | 1124 | 'online': global_type_string, |
|
1120 | 1125 | 'delay': global_type_string, |
|
1121 | 1126 | 'walk': global_type_string, |
|
1122 | 1127 | 'getblock': global_type_string, |
|
1123 | 1128 | 'nTxs': global_type_string, |
|
1124 | 1129 | 'realtime': global_type_boolean, |
|
1125 | 1130 | 'blocksize': global_type_string, |
|
1126 | 1131 | 'blocktime': global_type_string, |
|
1127 | 1132 | 'queue': global_type_string, |
|
1128 | 1133 | 'skip': global_type_string, |
|
1129 | 1134 | 'cursor': global_type_string, |
|
1130 | 1135 | 'warnings': global_type_string, |
|
1131 | 1136 | 'verbose': global_type_string, |
|
1132 | 1137 | } |
|
1133 | 1138 | |
|
1134 | 1139 | |
|
1135 | 1140 | USRPReader |
|
1136 | 1141 | parameters = { |
|
1137 | 1142 | : global_type_string, |
|
1138 | 1143 | } |
|
1139 | 1144 | |
|
1140 | 1145 | |
|
1141 | 1146 | VoltageProc |
|
1142 | 1147 | parameters = { |
|
1143 | 1148 | : global_type_string, |
|
1144 | 1149 | } |
|
1145 | 1150 | |
|
1146 | 1151 | |
|
1147 | 1152 | VoltageReader |
|
1148 | 1153 | parameters = { |
|
1149 | 1154 | 'path': global_type_string, |
|
1150 | 1155 | 'startDate': global_type_string, |
|
1151 | 1156 | 'endDate': global_type_string, |
|
1152 | 1157 | 'startTime': global_type_string, |
|
1153 | 1158 | 'endTime': global_type_string, |
|
1154 | 1159 | 'set': global_type_string, |
|
1155 | 1160 | 'expLabel': global_type_string, |
|
1156 | 1161 | 'ext': global_type_string, |
|
1157 | 1162 | 'online': global_type_string, |
|
1158 | 1163 | 'delay': global_type_string, |
|
1159 | 1164 | 'walk': global_type_string, |
|
1160 | 1165 | 'getblock': global_type_string, |
|
1161 | 1166 | 'nTxs': global_type_string, |
|
1162 | 1167 | 'realtime': global_type_boolean, |
|
1163 | 1168 | 'blocksize': global_type_string, |
|
1164 | 1169 | 'blocktime': global_type_string, |
|
1165 | 1170 | 'queue': global_type_string, |
|
1166 | 1171 | 'skip': global_type_string, |
|
1167 | 1172 | 'cursor': global_type_string, |
|
1168 | 1173 | 'warnings': global_type_string, |
|
1169 | 1174 | 'verbose': global_type_string, |
|
1170 | 1175 | } |
|
1171 | 1176 | |
|
1172 | 1177 |
General Comments 0
You need to be logged in to leave comments.
Login now