@@ -20,7 +20,7 import matplotlib,re | |||||
20 | if 'BACKEND' in os.environ: |
|
20 | if 'BACKEND' in os.environ: | |
21 | matplotlib.use(os.environ['BACKEND']) |
|
21 | matplotlib.use(os.environ['BACKEND']) | |
22 | elif 'linux' in sys.platform: |
|
22 | elif 'linux' in sys.platform: | |
23 |
matplotlib.use(" |
|
23 | matplotlib.use("Agg") | |
24 | elif 'darwin' in sys.platform: |
|
24 | elif 'darwin' in sys.platform: | |
25 | matplotlib.use('MacOSX') |
|
25 | matplotlib.use('MacOSX') | |
26 | else: |
|
26 | else: | |
@@ -168,6 +168,7 class Plot(Operation): | |||||
168 | bgcolor = 'white' |
|
168 | bgcolor = 'white' | |
169 | buffering = True |
|
169 | buffering = True | |
170 | __missing = 1E30 |
|
170 | __missing = 1E30 | |
|
171 | projection = None | |||
171 |
|
172 | |||
172 | __attrs__ = ['show', 'save', 'ymin', 'ymax', 'zmin', 'zmax', 'title', |
|
173 | __attrs__ = ['show', 'save', 'ymin', 'ymax', 'zmin', 'zmax', 'title', | |
173 | 'showprofile'] |
|
174 | 'showprofile'] | |
@@ -252,7 +253,7 class Plot(Operation): | |||||
252 | self.ang_max = kwargs.get('ang_max', None) |
|
253 | self.ang_max = kwargs.get('ang_max', None) | |
253 | self.mode = kwargs.get('mode', None) |
|
254 | self.mode = kwargs.get('mode', None) | |
254 | self.mask = kwargs.get('mask', False) |
|
255 | self.mask = kwargs.get('mask', False) | |
255 |
|
256 | self.shapes = kwargs.get('shapes', './') | ||
256 |
|
257 | |||
257 | if self.server: |
|
258 | if self.server: | |
258 | if not self.server.startswith('tcp://'): |
|
259 | if not self.server.startswith('tcp://'): | |
@@ -277,8 +278,8 class Plot(Operation): | |||||
277 | if self.width is None: |
|
278 | if self.width is None: | |
278 | self.width = 8 |
|
279 | self.width = 8 | |
279 |
|
280 | |||
280 | self.figures = [] |
|
281 | self.figures = {'PPI':[], 'RHI':[]} | |
281 | self.axes = [] |
|
282 | self.axes = {'PPI':[], 'RHI':[]} | |
282 | self.cb_axes = [] |
|
283 | self.cb_axes = [] | |
283 | self.pf_axes = [] |
|
284 | self.pf_axes = [] | |
284 | self.cmaps = [] |
|
285 | self.cmaps = [] | |
@@ -289,18 +290,29 class Plot(Operation): | |||||
289 | if self.oneFigure: |
|
290 | if self.oneFigure: | |
290 | if self.height is None: |
|
291 | if self.height is None: | |
291 | self.height = 1.4 * self.nrows + 1 |
|
292 | self.height = 1.4 * self.nrows + 1 | |
292 | fig = plt.figure(figsize=(self.width, self.height), |
|
293 | fig_p = plt.figure(figsize=(self.width, self.height), | |
293 | edgecolor='k', |
|
294 | edgecolor='k', | |
294 | facecolor='w') |
|
295 | facecolor='w') | |
295 | self.figures.append(fig) |
|
296 | fig_r = plt.figure(figsize=(self.width, self.height), | |
296 | for n in range(self.nplots): |
|
297 | edgecolor='k', | |
297 | ax = fig.add_subplot(self.nrows, self.ncols, |
|
298 | facecolor='w') | |
298 | n + 1, polar=self.polar) |
|
299 | self.figures['PPI'].append(fig_p) | |
299 | ax.tick_params(labelsize=8) |
|
300 | self.figures['RHI'].append(fig_r) | |
300 | ax.firsttime = True |
|
301 | for n in range(self.nplots): | |
301 | ax.index = 0 |
|
302 | ax_p = fig_p.add_subplot(self.nrows, self.ncols, n+1, polar=self.polar, projection=self.projection) | |
302 | ax.press = None |
|
303 | ax_r = fig_r.add_subplot(self.nrows, self.ncols, n+1, polar=self.polar) | |
303 | self.axes.append(ax) |
|
304 | ax_p.tick_params(labelsize=8) | |
|
305 | ax_p.firsttime = True | |||
|
306 | ax_p.index = 0 | |||
|
307 | ax_p.press = None | |||
|
308 | ax_r.tick_params(labelsize=8) | |||
|
309 | ax_r.firsttime = True | |||
|
310 | ax_r.index = 0 | |||
|
311 | ax_r.press = None | |||
|
312 | ||||
|
313 | self.axes['PPI'].append(ax_p) | |||
|
314 | self.axes['RHI'].append(ax_r) | |||
|
315 | ||||
304 | if self.showprofile: |
|
316 | if self.showprofile: | |
305 | cax = self.__add_axes(ax, size=size, pad=pad) |
|
317 | cax = self.__add_axes(ax, size=size, pad=pad) | |
306 | cax.tick_params(labelsize=8) |
|
318 | cax.tick_params(labelsize=8) | |
@@ -312,13 +324,19 class Plot(Operation): | |||||
312 | fig = plt.figure(figsize=(self.width, self.height), |
|
324 | fig = plt.figure(figsize=(self.width, self.height), | |
313 | edgecolor='k', |
|
325 | edgecolor='k', | |
314 | facecolor='w') |
|
326 | facecolor='w') | |
315 | ax = fig.add_subplot(1, 1, 1, polar=self.polar) |
|
327 | ax_p = fig.add_subplot(1, 1, 1, polar=self.polar, projection=self.projection) | |
316 | ax.tick_params(labelsize=8) |
|
328 | ax_r = fig.add_subplot(1, 1, 1, polar=self.polar) | |
317 |
ax. |
|
329 | ax_p.tick_params(labelsize=8) | |
318 |
ax. |
|
330 | ax_p.firsttime = True | |
319 |
ax. |
|
331 | ax_p.index = 0 | |
|
332 | ax_p.press = None | |||
|
333 | ax_r.tick_params(labelsize=8) | |||
|
334 | ax_r.firsttime = True | |||
|
335 | ax_r.index = 0 | |||
|
336 | ax_r.press = None | |||
320 | self.figures.append(fig) |
|
337 | self.figures.append(fig) | |
321 | self.axes.append(ax) |
|
338 | self.axes['PPI'].append(ax_p) | |
|
339 | self.axes['RHI'].append(ax_r) | |||
322 | if self.showprofile: |
|
340 | if self.showprofile: | |
323 | cax = self.__add_axes(ax, size=size, pad=pad) |
|
341 | cax = self.__add_axes(ax, size=size, pad=pad) | |
324 | cax.tick_params(labelsize=8) |
|
342 | cax.tick_params(labelsize=8) | |
@@ -378,7 +396,7 class Plot(Operation): | |||||
378 | Set min and max values, labels, ticks and titles |
|
396 | Set min and max values, labels, ticks and titles | |
379 | ''' |
|
397 | ''' | |
380 |
|
398 | |||
381 | for n, ax in enumerate(self.axes): |
|
399 | for n, ax in enumerate(self.axes[self.mode]): | |
382 | if ax.firsttime: |
|
400 | if ax.firsttime: | |
383 | if self.xaxis != 'time': |
|
401 | if self.xaxis != 'time': | |
384 | xmin = self.xmin |
|
402 | xmin = self.xmin | |
@@ -390,7 +408,9 class Plot(Operation): | |||||
390 | ax.xaxis.set_major_locator(LinearLocator(9)) |
|
408 | ax.xaxis.set_major_locator(LinearLocator(9)) | |
391 | ymin = self.ymin if self.ymin is not None else numpy.nanmin(self.y[numpy.isfinite(self.y)]) |
|
409 | ymin = self.ymin if self.ymin is not None else numpy.nanmin(self.y[numpy.isfinite(self.y)]) | |
392 | ymax = self.ymax if self.ymax is not None else numpy.nanmax(self.y[numpy.isfinite(self.y)]) |
|
410 | ymax = self.ymax if self.ymax is not None else numpy.nanmax(self.y[numpy.isfinite(self.y)]) | |
|
411 | ||||
393 | ax.set_facecolor(self.bgcolor) |
|
412 | ax.set_facecolor(self.bgcolor) | |
|
413 | ||||
394 | if self.xscale: |
|
414 | if self.xscale: | |
395 | ax.xaxis.set_major_formatter(FuncFormatter( |
|
415 | ax.xaxis.set_major_formatter(FuncFormatter( | |
396 | lambda x, pos: '{0:g}'.format(x*self.xscale))) |
|
416 | lambda x, pos: '{0:g}'.format(x*self.xscale))) | |
@@ -407,7 +427,7 class Plot(Operation): | |||||
407 | self.pf_axes[n].set_xlabel('dB') |
|
427 | self.pf_axes[n].set_xlabel('dB') | |
408 | self.pf_axes[n].grid(b=True, axis='x') |
|
428 | self.pf_axes[n].grid(b=True, axis='x') | |
409 | [tick.set_visible(False) |
|
429 | [tick.set_visible(False) | |
410 |
|
|
430 | for tick in self.pf_axes[n].get_yticklabels()] | |
411 | if self.colorbar: |
|
431 | if self.colorbar: | |
412 | ax.cbar = plt.colorbar( |
|
432 | ax.cbar = plt.colorbar( | |
413 | ax.plt, ax=ax, fraction=0.05, pad=0.06, aspect=10) |
|
433 | ax.plt, ax=ax, fraction=0.05, pad=0.06, aspect=10) | |
@@ -419,8 +439,9 class Plot(Operation): | |||||
419 | ax.cbar.set_label(self.cb_labels[n], size=8) |
|
439 | ax.cbar.set_label(self.cb_labels[n], size=8) | |
420 | else: |
|
440 | else: | |
421 | ax.cbar = None |
|
441 | ax.cbar = None | |
422 | ax.set_xlim(xmin, xmax) |
|
442 | if self.mode == 'RHI': | |
423 |
ax.set_ |
|
443 | ax.set_xlim(xmin, xmax) | |
|
444 | ax.set_ylim(ymin, ymax) | |||
424 | ax.firsttime = False |
|
445 | ax.firsttime = False | |
425 | if self.grid: |
|
446 | if self.grid: | |
426 | ax.grid(True) |
|
447 | ax.grid(True) | |
@@ -447,7 +468,7 class Plot(Operation): | |||||
447 | ax.xaxis.labelpad = 16 |
|
468 | ax.xaxis.labelpad = 16 | |
448 |
|
469 | |||
449 | if self.firsttime: |
|
470 | if self.firsttime: | |
450 |
for |
|
471 | for fig in self.figures['PPI'] + self.figures['RHI']: | |
451 | fig.subplots_adjust(**self.plots_adjust) |
|
472 | fig.subplots_adjust(**self.plots_adjust) | |
452 | self.firsttime = False |
|
473 | self.firsttime = False | |
453 |
|
474 | |||
@@ -456,7 +477,9 class Plot(Operation): | |||||
456 | Reset axes for redraw plots |
|
477 | Reset axes for redraw plots | |
457 | ''' |
|
478 | ''' | |
458 |
|
479 | |||
459 |
|
|
480 | axes = self.pf_axes + self.cb_axes + self.axes[self.mode] | |
|
481 | ||||
|
482 | for ax in axes: | |||
460 | ax.clear() |
|
483 | ax.clear() | |
461 | ax.firsttime = True |
|
484 | ax.firsttime = True | |
462 | if hasattr(ax, 'cbar') and ax.cbar: |
|
485 | if hasattr(ax, 'cbar') and ax.cbar: | |
@@ -469,8 +492,8 class Plot(Operation): | |||||
469 |
|
492 | |||
470 | self.plot() |
|
493 | self.plot() | |
471 | self.format() |
|
494 | self.format() | |
472 |
|
495 | figures = self.figures[self.mode] | ||
473 |
for n, fig in enumerate( |
|
496 | for n, fig in enumerate(figures): | |
474 | if self.nrows == 0 or self.nplots == 0: |
|
497 | if self.nrows == 0 or self.nplots == 0: | |
475 | log.warning('No data', self.name) |
|
498 | log.warning('No data', self.name) | |
476 | fig.text(0.5, 0.5, 'No Data', fontsize='large', ha='center') |
|
499 | fig.text(0.5, 0.5, 'No Data', fontsize='large', ha='center') | |
@@ -511,8 +534,10 class Plot(Operation): | |||||
511 | ''' |
|
534 | ''' | |
512 | if self.mode is not None: |
|
535 | if self.mode is not None: | |
513 | ang = 'AZ' if self.mode == 'RHI' else 'EL' |
|
536 | ang = 'AZ' if self.mode == 'RHI' else 'EL' | |
514 |
|
|
537 | folder = '_{}_{}_{}'.format(self.mode, ang, self.mode_value) | |
|
538 | label = '{}{}_{}'.format(ang[0], self.mode_value, self.save_code) | |||
515 | else: |
|
539 | else: | |
|
540 | folder = '' | |||
516 | label = '' |
|
541 | label = '' | |
517 |
|
542 | |||
518 | if self.oneFigure: |
|
543 | if self.oneFigure: | |
@@ -521,18 +546,19 class Plot(Operation): | |||||
521 |
|
546 | |||
522 | self.save_time = self.data.max_time |
|
547 | self.save_time = self.data.max_time | |
523 |
|
548 | |||
524 | fig = self.figures[n] |
|
549 | fig = self.figures[self.mode][n] | |
525 |
|
550 | |||
526 | if self.throttle == 0: |
|
551 | if self.throttle == 0: | |
527 | if self.oneFigure: |
|
552 | if self.oneFigure: | |
528 | figname = os.path.join( |
|
553 | figname = os.path.join( | |
529 | self.save, |
|
554 | self.save, | |
530 |
self.save_code + |
|
555 | self.save_code + folder, | |
531 | '{}_{}.png'.format( |
|
556 | '{}_{}_{}.png'.format( | |
532 |
|
|
557 | 'SOPHY', | |
533 | self.getDateTime(self.data.max_time).strftime( |
|
558 | self.getDateTime(self.data.max_time).strftime( | |
534 | '%Y%m%d_%H%M%S' |
|
559 | '%Y%m%d_%H%M%S' | |
535 | ), |
|
560 | ), | |
|
561 | label | |||
536 | ) |
|
562 | ) | |
537 | ) |
|
563 | ) | |
538 | else: |
|
564 | else: |
@@ -3,6 +3,10 import datetime | |||||
3 | import warnings |
|
3 | import warnings | |
4 | import numpy |
|
4 | import numpy | |
5 | from mpl_toolkits.axisartist.grid_finder import FixedLocator, DictFormatter |
|
5 | from mpl_toolkits.axisartist.grid_finder import FixedLocator, DictFormatter | |
|
6 | from matplotlib.patches import Circle | |||
|
7 | import cartopy.crs as ccrs | |||
|
8 | from cartopy.feature import ShapelyFeature | |||
|
9 | import cartopy.io.shapereader as shpreader | |||
6 |
|
10 | |||
7 | from schainpy.model.graphics.jroplot_base import Plot, plt |
|
11 | from schainpy.model.graphics.jroplot_base import Plot, plt | |
8 | from schainpy.model.graphics.jroplot_spectra import SpectraPlot, RTIPlot, CoherencePlot, SpectraCutPlot |
|
12 | from schainpy.model.graphics.jroplot_spectra import SpectraPlot, RTIPlot, CoherencePlot, SpectraCutPlot | |
@@ -514,6 +518,7 class WeatherParamsPlot(Plot): | |||||
514 | #plot_name = 'RHI' |
|
518 | #plot_name = 'RHI' | |
515 | plot_type = 'scattermap' |
|
519 | plot_type = 'scattermap' | |
516 | buffering = False |
|
520 | buffering = False | |
|
521 | projection = ccrs.PlateCarree() | |||
517 |
|
522 | |||
518 | def setup(self): |
|
523 | def setup(self): | |
519 |
|
524 | |||
@@ -522,8 +527,7 class WeatherParamsPlot(Plot): | |||||
522 | self.nplots= 1 |
|
527 | self.nplots= 1 | |
523 | self.ylabel= 'Range [km]' |
|
528 | self.ylabel= 'Range [km]' | |
524 | self.xlabel= 'Range [km]' |
|
529 | self.xlabel= 'Range [km]' | |
525 | self.polar = True |
|
530 | ||
526 | self.grid = True |
|
|||
527 | if self.channels is not None: |
|
531 | if self.channels is not None: | |
528 | self.nplots = len(self.channels) |
|
532 | self.nplots = len(self.channels) | |
529 | self.ncols = len(self.channels) |
|
533 | self.ncols = len(self.channels) | |
@@ -537,7 +541,7 class WeatherParamsPlot(Plot): | |||||
537 | self.width = 12 |
|
541 | self.width = 12 | |
538 | else: |
|
542 | else: | |
539 | self.width =8 |
|
543 | self.width =8 | |
540 |
self.height = |
|
544 | self.height =7 | |
541 | self.ini =0 |
|
545 | self.ini =0 | |
542 | self.len_azi =0 |
|
546 | self.len_azi =0 | |
543 | self.buffer_ini = None |
|
547 | self.buffer_ini = None | |
@@ -589,11 +593,12 class WeatherParamsPlot(Plot): | |||||
589 |
|
593 | |||
590 | data['data'] = [0, 0] |
|
594 | data['data'] = [0, 0] | |
591 |
|
595 | |||
592 |
|
|
596 | try: | |
593 | data['data'][0] = tmp[0][:,valid] |
|
597 | data['data'][0] = tmp[0][:,valid] | |
594 | data['data'][1] = tmp[1][:,valid] |
|
598 | data['data'][1] = tmp[1][:,valid] | |
595 |
|
|
599 | except: | |
596 |
|
|
600 | data['data'][0] = tmp[0][:,valid] | |
|
601 | data['data'][1] = tmp[0][:,valid] | |||
597 |
|
602 | |||
598 | if dataOut.mode_op == 'PPI': |
|
603 | if dataOut.mode_op == 'PPI': | |
599 | self.CODE = 'PPI' |
|
604 | self.CODE = 'PPI' | |
@@ -606,23 +611,6 class WeatherParamsPlot(Plot): | |||||
606 | data['ele'] = dataOut.data_ele |
|
611 | data['ele'] = dataOut.data_ele | |
607 | data['mode_op'] = dataOut.mode_op |
|
612 | data['mode_op'] = dataOut.mode_op | |
608 | self.mode = dataOut.mode_op |
|
613 | self.mode = dataOut.mode_op | |
609 | var = data['data'][0].flatten() |
|
|||
610 | r = numpy.tile(data['r'], data['data'][0].shape[0]) |
|
|||
611 | az = numpy.repeat(data['azi'], data['data'][0].shape[1]) |
|
|||
612 | el = numpy.repeat(data['ele'], data['data'][0].shape[1]) |
|
|||
613 |
|
||||
614 | # lla = georef.spherical_to_proj(r, data['azi'], data['ele'], (-75.295893, -12.040436, 3379.2147)) |
|
|||
615 |
|
||||
616 | latlon = antenna_to_geographic(r, az, el, (-75.295893, -12.040436)) |
|
|||
617 |
|
||||
618 | if self.mask: |
|
|||
619 | meta['lat'] = latlon[1][var.mask==False] |
|
|||
620 | meta['lon'] = latlon[0][var.mask==False] |
|
|||
621 | data['var'] = numpy.array([var[var.mask==False]]) |
|
|||
622 | else: |
|
|||
623 | meta['lat'] = latlon[1] |
|
|||
624 | meta['lon'] = latlon[0] |
|
|||
625 | data['var'] = numpy.array([var]) |
|
|||
626 |
|
614 | |||
627 | return data, meta |
|
615 | return data, meta | |
628 |
|
616 | |||
@@ -641,45 +629,32 class WeatherParamsPlot(Plot): | |||||
641 | data['mode_op'] = data['mode_op'].decode() |
|
629 | data['mode_op'] = data['mode_op'].decode() | |
642 |
|
630 | |||
643 | if data['mode_op'] == 'RHI': |
|
631 | if data['mode_op'] == 'RHI': | |
644 | try: |
|
632 | r, theta = numpy.meshgrid(r, numpy.radians(data['ele'])) | |
645 | if self.data['mode_op'][-2] == 'PPI': |
|
633 | len_aux = int(data['azi'].shape[0]/4) | |
646 | self.ang_min = None |
|
634 | mean = numpy.mean(data['azi'][len_aux:-len_aux]) | |
647 | self.ang_max = None |
|
635 | x, y = r*numpy.cos(theta), r*numpy.sin(theta) | |
648 | except: |
|
636 | elif data['mode_op'] == 'PPI': | |
649 | pass |
|
637 | r, theta = numpy.meshgrid(r, -numpy.radians(data['azi'])+numpy.pi/2) | |
650 | self.ang_min = self.ang_min if self.ang_min else 0 |
|
638 | len_aux = int(data['ele'].shape[0]/4) | |
651 | self.ang_max = self.ang_max if self.ang_max else 90 |
|
639 | mean = numpy.mean(data['ele'][len_aux:-len_aux]) | |
652 | r, theta = numpy.meshgrid(r, numpy.radians(data['ele']) ) |
|
640 | x, y = r*numpy.cos(theta)*numpy.cos(numpy.radians(mean)), r*numpy.sin( | |
653 | elif data['mode_op'] == 'PPI': |
|
641 | theta)*numpy.cos(numpy.radians(mean)) | |
654 | try: |
|
642 | x = km2deg(x) + -75.295893 | |
655 | if self.data['mode_op'][-2] == 'RHI': |
|
643 | y = km2deg(y) + -12.040436 | |
656 | self.ang_min = None |
|
|||
657 | self.ang_max = None |
|
|||
658 | except: |
|
|||
659 | pass |
|
|||
660 | self.ang_min = self.ang_min if self.ang_min else 0 |
|
|||
661 | self.ang_max = self.ang_max if self.ang_max else 360 |
|
|||
662 | r, theta = numpy.meshgrid(r, numpy.radians(data['azi']) ) |
|
|||
663 |
|
644 | |||
664 | self.clear_figures() |
|
645 | self.clear_figures() | |
665 |
|
646 | |||
666 | for i,ax in enumerate(self.axes): |
|
647 | if data['mode_op'] == 'PPI': | |
667 |
|
648 | axes = self.axes['PPI'] | ||
668 | if ax.firsttime: |
|
649 | else: | |
669 | ax.set_xlim(numpy.radians(self.ang_min),numpy.radians(self.ang_max)) |
|
650 | axes = self.axes['RHI'] | |
670 | ax.plt = ax.pcolormesh(theta, r, z[i], cmap=self.colormap, vmin=self.zmin, vmax=self.zmax) |
|
|||
671 | if data['mode_op'] == 'PPI': |
|
|||
672 | ax.set_theta_direction(-1) |
|
|||
673 | ax.set_theta_offset(numpy.pi/2) |
|
|||
674 |
|
651 | |||
675 | else: |
|
652 | for i, ax in enumerate(axes): | |
676 | ax.set_xlim(numpy.radians(self.ang_min),numpy.radians(self.ang_max)) |
|
653 | if data['mode_op'] == 'PPI': | |
677 | ax.plt = ax.pcolormesh(theta, r, z[i], cmap=self.colormap, vmin=self.zmin, vmax=self.zmax) |
|
654 | ax.set_extent([-75.745893, -74.845893, -12.490436, -11.590436]) | |
678 | if data['mode_op'] == 'PPI': |
|
655 | ||
679 | ax.set_theta_direction(-1) |
|
656 | ax.plt = ax.pcolormesh(x, y, z[i], cmap=self.colormap, vmin=self.zmin, vmax=self.zmax) | |
680 | ax.set_theta_offset(numpy.pi/2) |
|
|||
681 |
|
657 | |||
682 | ax.grid(True) |
|
|||
683 | if data['mode_op'] == 'RHI': |
|
658 | if data['mode_op'] == 'RHI': | |
684 | len_aux = int(data['azi'].shape[0]/4) |
|
659 | len_aux = int(data['azi'].shape[0]/4) | |
685 | mean = numpy.mean(data['azi'][len_aux:-len_aux]) |
|
660 | mean = numpy.mean(data['azi'][len_aux:-len_aux]) | |
@@ -694,4 +669,48 class WeatherParamsPlot(Plot): | |||||
694 | self.titles = ['PPI {} at EL: {} CH {}'.format(self.labels[x], str(round(mean,1)), x) for x in self.channels] |
|
669 | self.titles = ['PPI {} at EL: {} CH {}'.format(self.labels[x], str(round(mean,1)), x) for x in self.channels] | |
695 | else: |
|
670 | else: | |
696 | self.titles = ['PPI {} at EL: {} CH {}'.format(self.labels[0], str(round(mean,1)), self.channels[0])] |
|
671 | self.titles = ['PPI {} at EL: {} CH {}'.format(self.labels[0], str(round(mean,1)), self.channels[0])] | |
697 | self.mode_value = round(mean,1) No newline at end of file |
|
672 | self.mode_value = round(mean,1) | |
|
673 | ||||
|
674 | if data['mode_op'] == 'PPI': | |||
|
675 | gl = ax.gridlines(crs=ccrs.PlateCarree(), draw_labels=True, | |||
|
676 | linewidth=1, color='gray', alpha=0.5, linestyle='--') | |||
|
677 | gl.xlabel_style = {'size': 8} | |||
|
678 | gl.ylabel_style = {'size': 8} | |||
|
679 | gl.xlabels_top = False | |||
|
680 | gl.ylabels_right = False | |||
|
681 | shape_p = os.path.join(self.shapes,'PER_ADM2/PER_ADM2.shp') | |||
|
682 | shape_d = os.path.join(self.shapes,'PER_ADM1/PER_ADM1.shp') | |||
|
683 | capitales = os.path.join(self.shapes,'CAPITALES/cap_provincia.shp') | |||
|
684 | vias = os.path.join(self.shapes,'Carreteras/VIAS_NACIONAL_250000.shp') | |||
|
685 | reader_d = shpreader.BasicReader(shape_p, encoding='latin1') | |||
|
686 | reader_p = shpreader.BasicReader(shape_d, encoding='latin1') | |||
|
687 | reader_c = shpreader.BasicReader(capitales, encoding='latin1') | |||
|
688 | reader_v = shpreader.BasicReader(vias, encoding='latin1') | |||
|
689 | caps = [x for x in reader_c.records() if x.attributes["Departa"] in ("JUNIN", "LIMA", "AYACUCHO", "HUANCAVELICA")] | |||
|
690 | districts = [x for x in reader_d.records() if x.attributes["Name"] in ("JUNΓN", "CHANCHAMAYO", "CHUPACA", "CONCEPCIΓN", "HUANCAYO", "JAUJA", "SATIPO", "TARMA", "YAUYOS", "HUAROCHIRΓ", "CANTA", "HUANTA", "TAYACAJA")] | |||
|
691 | provs = [x for x in reader_p.records() if x.attributes["NAME"] in ("JunΓn", "Lima")] | |||
|
692 | vias = [x for x in reader_v.records() if x.attributes["DEP"] in ("JUNIN", "LIMA")] | |||
|
693 | ||||
|
694 | # Display Kenya's shape | |||
|
695 | shape_feature = ShapelyFeature([x.geometry for x in districts], ccrs.PlateCarree(), facecolor="none", edgecolor='grey', lw=0.5) | |||
|
696 | ax.add_feature(shape_feature) | |||
|
697 | shape_feature = ShapelyFeature([x.geometry for x in provs], ccrs.PlateCarree(), facecolor="none", edgecolor='white', lw=1) | |||
|
698 | ax.add_feature(shape_feature) | |||
|
699 | shape_feature = ShapelyFeature([x.geometry for x in vias], ccrs.PlateCarree(), facecolor="none", edgecolor='yellow', lw=1) | |||
|
700 | ax.add_feature(shape_feature) | |||
|
701 | ||||
|
702 | for cap in caps: | |||
|
703 | if cap.attributes['Nombre'] in ("LA OROYA", "CONCEPCIΓN", "HUANCAYO", "JAUJA", "CHUPACA", "YAUYOS", "HUANTA", "PAMPAS"): | |||
|
704 | ax.text(cap.attributes['X'], cap.attributes['Y'], cap.attributes['Nombre'].title(), size=7, color='white') | |||
|
705 | ax.text(-75.052003, -11.915552, 'Huaytapallana', size=7, color='cyan') | |||
|
706 | ax.plot(-75.052003, -11.915552, '*') | |||
|
707 | ||||
|
708 | for R in (10, 20, 30 , 40, 50): | |||
|
709 | circle = Circle((-75.295893, -12.040436), km2deg(R), facecolor='none', | |||
|
710 | edgecolor='skyblue', linewidth=1, alpha=0.5) | |||
|
711 | ax.add_patch(circle) | |||
|
712 | ax.text(km2deg(R)*numpy.cos(numpy.radians(45))-75.295893, | |||
|
713 | km2deg(R)*numpy.sin(numpy.radians(45))-12.040436, | |||
|
714 | '{}km'.format(R), color='skyblue', size=7) | |||
|
715 | elif data['mode_op'] == 'RHI': | |||
|
716 | ax.grid(color='grey', alpha=0.5, linestyle='--', linewidth=1) |
@@ -505,6 +505,7 class HDFWriter(Operation): | |||||
505 |
|
505 | |||
506 | if self.setType == 'weather': |
|
506 | if self.setType == 'weather': | |
507 | subfolder = dt.strftime('%Y-%m-%dT%H-00-00') |
|
507 | subfolder = dt.strftime('%Y-%m-%dT%H-00-00') | |
|
508 | subfolder = '' | |||
508 | else: |
|
509 | else: | |
509 | subfolder = dt.strftime('d%Y%j') |
|
510 | subfolder = dt.strftime('d%Y%j') | |
510 |
|
511 | |||
@@ -541,12 +542,14 class HDFWriter(Operation): | |||||
541 | #SOPHY_20200505_140215_E10.0_Z.h5 |
|
542 | #SOPHY_20200505_140215_E10.0_Z.h5 | |
542 | #SOPHY_20200505_140215_A40.0_Z.h5 |
|
543 | #SOPHY_20200505_140215_A40.0_Z.h5 | |
543 | if self.dataOut.flagMode == 1: #'AZI' #PPI |
|
544 | if self.dataOut.flagMode == 1: #'AZI' #PPI | |
544 | ang_type = 'E' |
|
545 | ang_type = 'EL' | |
|
546 | mode_type = 'PPI' | |||
545 | len_aux = int(self.dataOut.data_ele.shape[0]/4) |
|
547 | len_aux = int(self.dataOut.data_ele.shape[0]/4) | |
546 | mean = numpy.mean(self.dataOut.data_ele[len_aux:-len_aux]) |
|
548 | mean = numpy.mean(self.dataOut.data_ele[len_aux:-len_aux]) | |
547 | ang_ = round(mean,1) |
|
549 | ang_ = round(mean,1) | |
548 | elif self.dataOut.flagMode == 0: #'ELE' #RHI |
|
550 | elif self.dataOut.flagMode == 0: #'ELE' #RHI | |
549 | ang_type = 'A' |
|
551 | ang_type = 'AZ' | |
|
552 | mode_type = 'RHI' | |||
550 | len_aux = int(self.dataOut.data_azi.shape[0]/4) |
|
553 | len_aux = int(self.dataOut.data_azi.shape[0]/4) | |
551 | mean = numpy.mean(self.dataOut.data_azi[len_aux:-len_aux]) |
|
554 | mean = numpy.mean(self.dataOut.data_azi[len_aux:-len_aux]) | |
552 | ang_ = round(mean,1) |
|
555 | ang_ = round(mean,1) | |
@@ -559,11 +562,14 class HDFWriter(Operation): | |||||
559 | dt.hour, |
|
562 | dt.hour, | |
560 | dt.minute, |
|
563 | dt.minute, | |
561 | dt.second, |
|
564 | dt.second, | |
562 | ang_type, |
|
565 | ang_type[0], | |
563 | ang_, |
|
566 | ang_, | |
564 | self.weather_var, |
|
567 | self.weather_var, | |
565 | ext ) |
|
568 | ext ) | |
566 |
|
569 | subfolder = '{}_{}_{}_{:2.1f}'.format(self.weather_var, mode_type, ang_type, ang_) | ||
|
570 | fullpath = os.path.join(path, subfolder) | |||
|
571 | if not os.path.exists(fullpath): | |||
|
572 | os.makedirs(fullpath) | |||
567 | else: |
|
573 | else: | |
568 | setFile = dt.hour*60+dt.minute |
|
574 | setFile = dt.hour*60+dt.minute | |
569 | file = '%s%4.4d%3.3d%04d%s' % (self.optchar, |
|
575 | file = '%s%4.4d%3.3d%04d%s' % (self.optchar, |
@@ -4143,6 +4143,9 class PedestalInformation(Operation): | |||||
4143 | continue |
|
4143 | continue | |
4144 | self.fp.close() |
|
4144 | self.fp.close() | |
4145 | self.fp = h5py.File(self.filename, 'r') |
|
4145 | self.fp = h5py.File(self.filename, 'r') | |
|
4146 | self.ele = self.fp['Data']['ele_pos'][:] | |||
|
4147 | self.azi = self.fp['Data']['azi_pos'][:] + 26.27 | |||
|
4148 | self.azi[self.azi>360] = self.azi[self.azi>360] - 360 | |||
4146 | log.log('Opening file: {}'.format(self.filename), self.name) |
|
4149 | log.log('Opening file: {}'.format(self.filename), self.name) | |
4147 | ok = True |
|
4150 | ok = True | |
4148 | break |
|
4151 | break | |
@@ -4162,25 +4165,25 class PedestalInformation(Operation): | |||||
4162 | raise IOError('No new position files found in {}'.format(path)) |
|
4165 | raise IOError('No new position files found in {}'.format(path)) | |
4163 |
|
4166 | |||
4164 |
|
4167 | |||
4165 | def find_mode(self,index): |
|
4168 | def find_mode(self, index): | |
4166 | sample_max = 20 |
|
4169 | sample_max = 20 | |
4167 | start = index |
|
4170 | start = index | |
4168 | flag_mode = None |
|
4171 | flag_mode = None | |
4169 | azi = self.fp['Data']['azi_pos'][:] |
|
|||
4170 | ele = self.fp['Data']['ele_pos'][:] |
|
|||
4171 |
|
4172 | |||
4172 | while True: |
|
4173 | while True: | |
4173 |
|
|
4174 | print(start, sample_max, numpy.shape(self.ele)) | |
4174 | print("CANNOT KNOW IF MODE IS PPI OR RHI, ANALIZE NEXT FILE") |
|
4175 | if start+sample_max > numpy.shape(self.ele)[0]: | |
4175 | print("ele",ele[start-sample_max:start+sample_max]) |
|
|||
4176 | print("azi",azi[start-sample_max:start+sample_max]) |
|
|||
4177 | if sample_max == 10: |
|
4176 | if sample_max == 10: | |
|
4177 | print("CANNOT KNOW IF MODE IS PPI OR RHI, ANALIZE NEXT FILE") | |||
4178 | break |
|
4178 | break | |
4179 | else: |
|
4179 | else: | |
4180 | sample_max = 10 |
|
4180 | sample_max = 10 | |
4181 | continue |
|
4181 | continue | |
4182 | sigma_ele = numpy.nanstd(ele[start:start+sample_max]) |
|
4182 | sigma_ele = numpy.nanstd(self.ele[start:start+sample_max]) | |
4183 | sigma_azi = numpy.nanstd(azi[start:start+sample_max]) |
|
4183 | sigma_azi = numpy.nanstd(self.azi[start:start+sample_max]) | |
|
4184 | print("ele",self.ele[start-sample_max:start+sample_max]) | |||
|
4185 | print("azi",self.azi[start-sample_max:start+sample_max]) | |||
|
4186 | print(sigma_azi, sigma_ele) | |||
4184 |
|
4187 | |||
4185 | if sigma_ele<.5 and sigma_azi<.5: |
|
4188 | if sigma_ele<.5 and sigma_azi<.5: | |
4186 | if sigma_ele<sigma_azi: |
|
4189 | if sigma_ele<sigma_azi: | |
@@ -4206,14 +4209,20 class PedestalInformation(Operation): | |||||
4206 | return numpy.nan, numpy.nan, numpy.nan #Should be self.mode? |
|
4209 | return numpy.nan, numpy.nan, numpy.nan #Should be self.mode? | |
4207 | else: |
|
4210 | else: | |
4208 | index = int((self.utctime-self.utcfile)/self.interval) |
|
4211 | index = int((self.utctime-self.utcfile)/self.interval) | |
|
4212 | try: | |||
|
4213 | #print( self.azi[index], self.ele[index], None) | |||
|
4214 | return self.azi[index], self.ele[index], None | |||
|
4215 | except: | |||
|
4216 | return numpy.nan, numpy.nan, numpy.nan | |||
4209 |
|
4217 | |||
4210 | if self.flagAskMode: |
|
4218 | if self.flagAskMode: | |
4211 | mode = self.find_mode(index) |
|
4219 | mode = self.find_mode(index) | |
|
4220 | print('MODE: ', mode) | |||
4212 | else: |
|
4221 | else: | |
4213 | mode = self.mode |
|
4222 | mode = self.mode | |
4214 |
|
4223 | |||
4215 | if mode is not None: |
|
4224 | if mode is not None: | |
4216 |
return self. |
|
4225 | return self.azi[index], self.ele[index], mode | |
4217 | else: |
|
4226 | else: | |
4218 | return numpy.nan, numpy.nan, numpy.nan |
|
4227 | return numpy.nan, numpy.nan, numpy.nan | |
4219 |
|
4228 | |||
@@ -4242,6 +4251,10 class PedestalInformation(Operation): | |||||
4242 | try: |
|
4251 | try: | |
4243 | self.fp = h5py.File(self.filename, 'r') |
|
4252 | self.fp = h5py.File(self.filename, 'r') | |
4244 | self.utcfile = int(self.filename.split('/')[-1][4:14]) |
|
4253 | self.utcfile = int(self.filename.split('/')[-1][4:14]) | |
|
4254 | ||||
|
4255 | self.ele = self.fp['Data']['ele_pos'][:] | |||
|
4256 | self.azi = self.fp['Data']['azi_pos'][:] + 26.27 | |||
|
4257 | self.azi[self.azi>360] = self.azi[self.azi>360] - 360 | |||
4245 | break |
|
4258 | break | |
4246 | except: |
|
4259 | except: | |
4247 | log.warning('Waiting {}s for position file to be ready...'.format(self.delay), self.name) |
|
4260 | log.warning('Waiting {}s for position file to be ready...'.format(self.delay), self.name) | |
@@ -4258,12 +4271,13 class PedestalInformation(Operation): | |||||
4258 | self.find_next_file() |
|
4271 | self.find_next_file() | |
4259 |
|
4272 | |||
4260 | az, el, scan = self.get_values() |
|
4273 | az, el, scan = self.get_values() | |
|
4274 | ||||
4261 | dataOut.flagNoData = False |
|
4275 | dataOut.flagNoData = False | |
4262 | if numpy.isnan(az) or numpy.isnan(el) : |
|
4276 | if numpy.isnan(az) or numpy.isnan(el) : | |
4263 | dataOut.flagNoData = True |
|
4277 | dataOut.flagNoData = True | |
4264 | return dataOut |
|
4278 | return dataOut | |
4265 |
|
4279 | |||
4266 | dataOut.azimuth = round(az, 2) |
|
4280 | dataOut.azimuth = round(az, 2) | |
4267 | dataOut.elevation = round(el, 2) |
|
4281 | dataOut.elevation = round(el, 2) | |
4268 | dataOut.mode_op = scan |
|
4282 | dataOut.mode_op = scan | |
4269 |
|
4283 | |||
@@ -4303,146 +4317,150 class Block360(Operation): | |||||
4303 | self.attr = attr |
|
4317 | self.attr = attr | |
4304 |
|
4318 | |||
4305 | self.__buffer = [] |
|
4319 | self.__buffer = [] | |
4306 |
self. |
|
4320 | self.azi = [] | |
4307 |
self. |
|
4321 | self.ele = [] | |
4308 | self.__buffer4 = [] |
|
|||
4309 |
|
4322 | |||
4310 |
def putData(self, data, attr |
|
4323 | def putData(self, data, attr): | |
4311 | ''' |
|
4324 | ''' | |
4312 | Add a profile to he __buffer and increase in one the __profiel Index |
|
4325 | Add a profile to he __buffer and increase in one the __profiel Index | |
4313 | ''' |
|
4326 | ''' | |
4314 | tmp= getattr(data, attr) |
|
4327 | tmp= getattr(data, attr) | |
4315 | self.__buffer.append(tmp) |
|
4328 | self.__buffer.append(tmp) | |
4316 |
self. |
|
4329 | self.azi.append(data.azimuth) | |
4317 |
self. |
|
4330 | self.ele.append(data.elevation) | |
4318 | self.__profIndex += 1 |
|
4331 | self.__profIndex += 1 | |
4319 |
|
4332 | |||
4320 | if flagMode == 1: #'AZI' |
|
4333 | def pushData(self, data, case_flag): | |
4321 | return numpy.array(self.__buffer2) |
|
|||
4322 | elif flagMode == 0: #'ELE' |
|
|||
4323 | return numpy.array(self.__buffer3) |
|
|||
4324 |
|
||||
4325 | def pushData(self, data,flagMode,case_flag): |
|
|||
4326 | ''' |
|
4334 | ''' | |
4327 | Return the PULSEPAIR and the profiles used in the operation |
|
|||
4328 | Affected : self.__profileIndex |
|
|||
4329 | ''' |
|
4335 | ''' | |
4330 |
|
4336 | |||
4331 | data_360 = numpy.array(self.__buffer).transpose(1, 2, 0, 3) |
|
4337 | data_360 = numpy.array(self.__buffer).transpose(1, 2, 0, 3) | |
4332 |
data_p = numpy.array(self. |
|
4338 | data_p = numpy.array(self.azi) | |
4333 |
data_e = numpy.array(self. |
|
4339 | data_e = numpy.array(self.ele) | |
4334 | n = self.__profIndex |
|
4340 | n = self.__profIndex | |
4335 |
|
4341 | |||
4336 | self.__buffer = [] |
|
4342 | self.__buffer = [] | |
4337 |
self. |
|
4343 | self.azi = [] | |
4338 |
self. |
|
4344 | self.ele = [] | |
4339 | self.__buffer4 = [] |
|
|||
4340 | self.__profIndex = 0 |
|
4345 | self.__profIndex = 0 | |
4341 |
|
4346 | |||
4342 | if flagMode == 1 and case_flag == 0: #'AZI' y ha girado |
|
4347 | if case_flag in (0, 1, -1): | |
4343 |
self.putData(data=data, attr = self.attr |
|
4348 | self.putData(data=data, attr = self.attr) | |
4344 |
|
4349 | |||
4345 | return data_360, n, data_p, data_e |
|
4350 | return data_360, n, data_p, data_e | |
4346 |
|
4351 | |||
4347 |
def byProfiles(self,dataOut |
|
4352 | def byProfiles(self, dataOut): | |
4348 |
|
4353 | |||
4349 |
self.__dataReady |
|
4354 | self.__dataReady = False | |
4350 | data_360 = [] |
|
4355 | data_360 = [] | |
4351 |
data_p |
|
4356 | data_p = None | |
4352 |
data_e |
|
4357 | data_e = None | |
4353 |
|
4358 | |||
4354 |
|
|
4359 | self.putData(data=dataOut, attr = self.attr) | |
4355 | if self.__profIndex > 1: |
|
4360 | ||
4356 | case_flag = self.checkcase(angles,flagMode) |
|
4361 | if self.__profIndex > 5: | |
|
4362 | case_flag = self.checkcase() | |||
4357 |
|
4363 | |||
4358 | if flagMode == 1: #'AZI': |
|
4364 | if self.flagMode == 1: #'AZI': | |
4359 | if case_flag == 0: #Ya girΓ³ |
|
4365 | if case_flag == 0: #Ya girΓ³ | |
4360 | self.__buffer.pop() #Erase last data |
|
4366 | self.__buffer.pop() #Erase last data | |
4361 |
self. |
|
4367 | self.azi.pop() | |
4362 |
self. |
|
4368 | self.ele.pop() | |
4363 |
data_360 ,n,data_p,data_e = self.pushData( |
|
4369 | data_360 ,n,data_p,data_e = self.pushData(dataOut, case_flag) | |
4364 |
|
|
4370 | if len(data_p)>350: | |
4365 |
|
||||
4366 | elif flagMode == 0: #'ELE' |
|
|||
4367 |
|
||||
4368 | if case_flag == 0: #Subida |
|
|||
4369 |
|
||||
4370 | if len(self.__buffer) == 2: #Cuando estΓ‘ de subida |
|
|||
4371 | #Se borra el dato anterior para liberar buffer y comparar el dato actual con el siguiente |
|
|||
4372 | self.__buffer.pop(0) #Erase first data |
|
|||
4373 | self.__buffer2.pop(0) |
|
|||
4374 | self.__buffer3.pop(0) |
|
|||
4375 | self.__profIndex -= 1 |
|
|||
4376 | else: #Cuando ha estado de bajada y ha vuelto a subir |
|
|||
4377 | #Se borra el ΓΊltimo dato |
|
|||
4378 | self.__buffer.pop() #Erase last data |
|
|||
4379 | self.__buffer2.pop() |
|
|||
4380 | self.__buffer3.pop() |
|
|||
4381 | data_360, n, data_p, data_e = self.pushData(data=dataOut,flagMode=flagMode,case_flag=case_flag) |
|
|||
4382 | self.__dataReady = True |
|
4371 | self.__dataReady = True | |
|
4372 | elif self.flagMode == 0: #'ELE' | |||
|
4373 | if case_flag == 1: #Bajada | |||
|
4374 | self.__buffer.pop() #Erase last data | |||
|
4375 | self.azi.pop() | |||
|
4376 | self.ele.pop() | |||
|
4377 | data_360, n, data_p, data_e = self.pushData(dataOut, case_flag) | |||
|
4378 | self.__dataReady = True | |||
|
4379 | if case_flag == -1: #Subida | |||
|
4380 | self.__buffer.pop() #Erase last data | |||
|
4381 | self.azi.pop() | |||
|
4382 | self.ele.pop() | |||
|
4383 | data_360, n, data_p, data_e = self.pushData(dataOut, case_flag) | |||
|
4384 | #self.__dataReady = True | |||
4383 |
|
4385 | |||
4384 | return data_360, data_p, data_e |
|
4386 | return data_360, data_p, data_e | |
4385 |
|
4387 | |||
4386 |
|
4388 | |||
4387 |
def blockOp(self, dataOut, |
|
4389 | def blockOp(self, dataOut, datatime= None): | |
4388 | if self.__initime == None: |
|
4390 | if self.__initime == None: | |
4389 | self.__initime = datatime |
|
4391 | self.__initime = datatime | |
4390 |
data_360, data_p, data_e = self.byProfiles(dataOut |
|
4392 | data_360, data_p, data_e = self.byProfiles(dataOut) | |
4391 |
self.__lastdatatime |
|
4393 | self.__lastdatatime = datatime | |
4392 |
|
4394 | |||
4393 |
avgdatatime |
|
4395 | avgdatatime = self.__initime | |
4394 | if self.n==1: |
|
4396 | if self.n==1: | |
4395 | avgdatatime = datatime |
|
4397 | avgdatatime = datatime | |
4396 | deltatime = datatime - self.__lastdatatime |
|
4398 | ||
4397 | self.__initime = datatime |
|
4399 | self.__initime = datatime | |
4398 | return data_360, avgdatatime, data_p, data_e |
|
4400 | return data_360, avgdatatime, data_p, data_e | |
4399 |
|
4401 | |||
4400 |
def checkcase(self |
|
4402 | def checkcase(self): | |
|
4403 | ||||
|
4404 | sigma_ele = numpy.nanstd(self.ele[-5:]) | |||
|
4405 | sigma_azi = numpy.nanstd(self.azi[-5:]) | |||
4401 |
|
4406 | |||
4402 | if flagMode == 1: #'AZI' |
|
4407 | if sigma_ele<.5 and sigma_azi<.5: | |
4403 | start = angles[-2] |
|
4408 | if sigma_ele<sigma_azi: | |
4404 |
|
|
4409 | self.flagMode = 1 | |
|
4410 | self.mode_op = 'PPI' | |||
|
4411 | else: | |||
|
4412 | self.flagMode = 0 | |||
|
4413 | self.mode_op = 'RHI' | |||
|
4414 | elif sigma_ele < .5: | |||
|
4415 | self.flagMode = 1 | |||
|
4416 | self.mode_op = 'PPI' | |||
|
4417 | elif sigma_azi < .5: | |||
|
4418 | self.flagMode = 0 | |||
|
4419 | self.mode_op = 'RHI' | |||
|
4420 | else: | |||
|
4421 | self.flagMode = None | |||
|
4422 | self.mode_op = 'None' | |||
|
4423 | ||||
|
4424 | if self.flagMode == 1: #'AZI' | |||
|
4425 | start = self.azi[-2] | |||
|
4426 | end = self.azi[-1] | |||
4405 | diff_angle = (end-start) |
|
4427 | diff_angle = (end-start) | |
4406 |
|
4428 | |||
4407 | if diff_angle < 0: #Ya girΓ³ |
|
4429 | if diff_angle < 0: #Ya girΓ³ | |
4408 | return 0 |
|
4430 | return 0 | |
4409 |
|
4431 | |||
4410 | elif flagMode == 0: #'ELE' |
|
4432 | elif self.flagMode == 0: #'ELE' | |
4411 |
|
4433 | |||
4412 |
start = |
|
4434 | start = self.ele[-3] | |
4413 |
|
|
4435 | middle = self.ele[-2] | |
4414 | diff_angle = (end-start) |
|
4436 | end = self.ele[-1] | |
4415 |
|
4437 | |||
4416 |
if d |
|
4438 | if end < 0: | |
4417 |
return |
|
4439 | return 1 | |
|
4440 | elif (middle>start and end<middle): | |||
|
4441 | return -1 | |||
4418 |
|
4442 | |||
4419 | def run(self, dataOut, attr_data='dataPP_POWER', runNextOp = False,**kwargs): |
|
4443 | def run(self, dataOut, attr_data='dataPP_POWER', runNextOp = False,**kwargs): | |
4420 |
|
4444 | |||
4421 | dataOut.attr_data = attr_data |
|
4445 | dataOut.attr_data = attr_data | |
4422 | dataOut.runNextOp = runNextOp |
|
4446 | dataOut.runNextOp = runNextOp | |
4423 | dataOut.flagAskMode = False |
|
|||
4424 |
|
||||
4425 | if dataOut.mode_op == 'PPI': |
|
|||
4426 | dataOut.flagMode = 1 |
|
|||
4427 | elif dataOut.mode_op == 'RHI': |
|
|||
4428 | dataOut.flagMode = 0 |
|
|||
4429 |
|
4447 | |||
4430 | if not self.isConfig: |
|
4448 | if not self.isConfig: | |
4431 | self.setup(dataOut = dataOut, attr = attr_data ,**kwargs) |
|
4449 | self.setup(dataOut = dataOut, attr = attr_data ,**kwargs) | |
4432 | self.isConfig = True |
|
4450 | self.isConfig = True | |
4433 |
|
4451 | |||
4434 |
data_360, avgdatatime, data_p, data_e = self.blockOp(dataOut, dataOut. |
|
4452 | data_360, avgdatatime, data_p, data_e = self.blockOp(dataOut, dataOut.utctime) | |
4435 |
|
4453 | |||
4436 | dataOut.flagNoData = True |
|
4454 | dataOut.flagNoData = True | |
4437 |
|
4455 | |||
4438 | if self.__dataReady: |
|
4456 | if self.__dataReady: | |
4439 | setattr(dataOut, attr_data, data_360 ) |
|
4457 | setattr(dataOut, attr_data, data_360 ) | |
4440 |
dataOut.data_azi = data_p |
|
4458 | dataOut.data_azi = data_p | |
4441 | dataOut.data_azi[dataOut.data_azi>360] = dataOut.data_azi[dataOut.data_azi>360] - 360 |
|
|||
4442 | dataOut.data_ele = data_e |
|
4459 | dataOut.data_ele = data_e | |
4443 | dataOut.utctime = avgdatatime |
|
4460 | dataOut.utctime = avgdatatime | |
4444 | dataOut.flagNoData = False |
|
4461 | dataOut.flagNoData = False | |
4445 |
dataOut.flag |
|
4462 | dataOut.flagMode = self.flagMode | |
|
4463 | dataOut.mode_op = self.mode_op | |||
4446 |
|
4464 | |||
4447 | return dataOut |
|
4465 | return dataOut | |
4448 |
|
4466 |
General Comments 0
You need to be logged in to leave comments.
Login now