##// END OF EJS Templates
Fix weatherplot for two channels
jespinoza -
r1544:24f1bea5f47d
parent child
Show More
@@ -526,13 +526,16 class WeatherParamsPlot(Plot):
526 self.grid = True
526 self.grid = True
527 if self.channels is not None:
527 if self.channels is not None:
528 self.nplots = len(self.channels)
528 self.nplots = len(self.channels)
529 self.nrows = len(self.channels)
529 self.ncols = len(self.channels)
530 else:
530 else:
531 self.nplots = self.data.shape(self.CODE)[0]
531 self.nplots = self.data.shape(self.CODE)[0]
532 self.nrows = self.nplots
532 self.ncols = self.nplots
533 self.channels = list(range(self.nplots))
533 self.channels = list(range(self.nplots))
534
534
535 self.colorbar=True
535 self.colorbar=True
536 if len(self.channels)>1:
537 self.width = 12
538 else:
536 self.width =8
539 self.width =8
537 self.height =8
540 self.height =8
538 self.ini =0
541 self.ini =0
@@ -584,10 +587,13 class WeatherParamsPlot(Plot):
584 valid = numpy.where(r>=0)[0]
587 valid = numpy.where(r>=0)[0]
585 data['r'] = numpy.arange(len(valid))*delta_height
588 data['r'] = numpy.arange(len(valid))*delta_height
586
589
587 try:
590 data['data'] = [0, 0]
588 data['data'] = tmp[self.channels[0]][:,valid]
591
589 except:
592 #try:
590 data['data'] = tmp[0][:,valid]
593 data['data'][0] = tmp[0][:,valid]
594 data['data'][1] = tmp[1][:,valid]
595 #except:
596 # data['data'] = tmp[0][:,valid]
591
597
592 if dataOut.mode_op == 'PPI':
598 if dataOut.mode_op == 'PPI':
593 self.CODE = 'PPI'
599 self.CODE = 'PPI'
@@ -600,10 +606,10 class WeatherParamsPlot(Plot):
600 data['ele'] = dataOut.data_ele
606 data['ele'] = dataOut.data_ele
601 data['mode_op'] = dataOut.mode_op
607 data['mode_op'] = dataOut.mode_op
602 self.mode = dataOut.mode_op
608 self.mode = dataOut.mode_op
603 var = data['data'].flatten()
609 var = data['data'][0].flatten()
604 r = numpy.tile(data['r'], data['data'].shape[0])
610 r = numpy.tile(data['r'], data['data'][0].shape[0])
605 az = numpy.repeat(data['azi'], data['data'].shape[1])
611 az = numpy.repeat(data['azi'], data['data'][0].shape[1])
606 el = numpy.repeat(data['ele'], data['data'].shape[1])
612 el = numpy.repeat(data['ele'], data['data'][0].shape[1])
607
613
608 # lla = georef.spherical_to_proj(r, data['azi'], data['ele'], (-75.295893, -12.040436, 3379.2147))
614 # lla = georef.spherical_to_proj(r, data['azi'], data['ele'], (-75.295893, -12.040436, 3379.2147))
609
615
@@ -661,14 +667,14 class WeatherParamsPlot(Plot):
661
667
662 if ax.firsttime:
668 if ax.firsttime:
663 ax.set_xlim(numpy.radians(self.ang_min),numpy.radians(self.ang_max))
669 ax.set_xlim(numpy.radians(self.ang_min),numpy.radians(self.ang_max))
664 ax.plt = ax.pcolormesh(theta, r, z, cmap=self.colormap, vmin=self.zmin, vmax=self.zmax)
670 ax.plt = ax.pcolormesh(theta, r, z[i], cmap=self.colormap, vmin=self.zmin, vmax=self.zmax)
665 if data['mode_op'] == 'PPI':
671 if data['mode_op'] == 'PPI':
666 ax.set_theta_direction(-1)
672 ax.set_theta_direction(-1)
667 ax.set_theta_offset(numpy.pi/2)
673 ax.set_theta_offset(numpy.pi/2)
668
674
669 else:
675 else:
670 ax.set_xlim(numpy.radians(self.ang_min),numpy.radians(self.ang_max))
676 ax.set_xlim(numpy.radians(self.ang_min),numpy.radians(self.ang_max))
671 ax.plt = ax.pcolormesh(theta, r, z, cmap=self.colormap, vmin=self.zmin, vmax=self.zmax)
677 ax.plt = ax.pcolormesh(theta, r, z[i], cmap=self.colormap, vmin=self.zmin, vmax=self.zmax)
672 if data['mode_op'] == 'PPI':
678 if data['mode_op'] == 'PPI':
673 ax.set_theta_direction(-1)
679 ax.set_theta_direction(-1)
674 ax.set_theta_offset(numpy.pi/2)
680 ax.set_theta_offset(numpy.pi/2)
@@ -678,14 +684,14 class WeatherParamsPlot(Plot):
678 len_aux = int(data['azi'].shape[0]/4)
684 len_aux = int(data['azi'].shape[0]/4)
679 mean = numpy.mean(data['azi'][len_aux:-len_aux])
685 mean = numpy.mean(data['azi'][len_aux:-len_aux])
680 if len(self.channels) !=1:
686 if len(self.channels) !=1:
681 self.titles = ['RHI {} at AZ: {} CH {}'.format(self.labels[x], str(round(mean,1)), x) for x in range(self.nrows)]
687 self.titles = ['RHI {} at AZ: {} CH {}'.format(self.labels[x], str(round(mean,1)), x) for x in self.channels]
682 else:
688 else:
683 self.titles = ['RHI {} at AZ: {} CH {}'.format(self.labels[0], str(round(mean,1)), self.channels[0])]
689 self.titles = ['RHI {} at AZ: {} CH {}'.format(self.labels[0], str(round(mean,1)), self.channels[0])]
684 elif data['mode_op'] == 'PPI':
690 elif data['mode_op'] == 'PPI':
685 len_aux = int(data['ele'].shape[0]/4)
691 len_aux = int(data['ele'].shape[0]/4)
686 mean = numpy.mean(data['ele'][len_aux:-len_aux])
692 mean = numpy.mean(data['ele'][len_aux:-len_aux])
687 if len(self.channels) !=1:
693 if len(self.channels) !=1:
688 self.titles = ['PPI {} at EL: {} CH {}'.format(self.labels[x], str(round(mean,1)), x) for x in range(self.nrows)]
694 self.titles = ['PPI {} at EL: {} CH {}'.format(self.labels[x], str(round(mean,1)), x) for x in self.channels]
689 else:
695 else:
690 self.titles = ['PPI {} at EL: {} CH {}'.format(self.labels[0], str(round(mean,1)), self.channels[0])]
696 self.titles = ['PPI {} at EL: {} CH {}'.format(self.labels[0], str(round(mean,1)), self.channels[0])]
691 self.mode_value = round(mean,1) No newline at end of file
697 self.mode_value = round(mean,1)
General Comments 0
You need to be logged in to leave comments. Login now