##// END OF EJS Templates
ParametersPlot: Corrections and SNR graphic added.
Julio Valdez -
r548:f6f23959bcc9
parent child
Show More
@@ -650,6 +650,8 class ParametersPlot(Figure):
650 def run(self, dataOut, id, wintitle="", channelList=None, showprofile=False,
650 def run(self, dataOut, id, wintitle="", channelList=None, showprofile=False,
651 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,timerange=None,
651 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,timerange=None,
652 parameterIndex = None, onlyPositive = False,
652 parameterIndex = None, onlyPositive = False,
653 SNRthresh = -numpy.inf, SNR = True, SNRmin = None, SNRmax = None,
654
653 zlabel = "", parameterName = "", parameterObject = "data_param",
655 zlabel = "", parameterName = "", parameterObject = "data_param",
654 save=False, figpath='', lastone=0,figfile=None, ftp=False, wr_period=1, show=True,
656 save=False, figpath='', lastone=0,figfile=None, ftp=False, wr_period=1, show=True,
655 server=None, folder=None, username=None, password=None,
657 server=None, folder=None, username=None, password=None,
@@ -678,6 +680,8 class ParametersPlot(Figure):
678 else:
680 else:
679 channelIndexList = numpy.array(channelIndexList)
681 channelIndexList = numpy.array(channelIndexList)
680
682
683 nchan = len(channelIndexList) #Number of channels being plotted
684
681 if timerange != None:
685 if timerange != None:
682 self.timerange = timerange
686 self.timerange = timerange
683
687
@@ -692,11 +696,21 class ParametersPlot(Figure):
692 zRange = dataOut.abscissaList
696 zRange = dataOut.abscissaList
693 nplots = z.shape[0] #Number of wind dimensions estimated
697 nplots = z.shape[0] #Number of wind dimensions estimated
694 # thisDatetime = dataOut.datatime
698 # thisDatetime = dataOut.datatime
699
700 if dataOut.data_SNR != None:
701 SNRarray = dataOut.data_SNR
702 SNRdB = 10*numpy.log10(SNRarray)
703 # SNRavgdB = 10*numpy.log10(SNRavg)
704 ind = numpy.where(SNRdB < 10**(SNRthresh/10))
705 z[ind] = numpy.nan
706
695 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
707 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
696 title = wintitle + " Parameters Plot" #: %s" %(thisDatetime.strftime("%d-%b-%Y"))
708 title = wintitle + " Parameters Plot" #: %s" %(thisDatetime.strftime("%d-%b-%Y"))
697 xlabel = ""
709 xlabel = ""
698 ylabel = "Range (Km)"
710 ylabel = "Range (Km)"
699
711
712 if SNR: nplots = 2*nplots
713
700 if onlyPositive:
714 if onlyPositive:
701 colormap = "jet"
715 colormap = "jet"
702 zmin = 0
716 zmin = 0
@@ -717,6 +731,10 class ParametersPlot(Figure):
717 if zmin == None: zmin = numpy.nanmin(zRange)
731 if zmin == None: zmin = numpy.nanmin(zRange)
718 if zmax == None: zmax = numpy.nanmax(zRange)
732 if zmax == None: zmax = numpy.nanmax(zRange)
719
733
734 if SNR != None:
735 if SNRmin == None: SNRmin = numpy.nanmin(SNRdB)
736 if SNRmax == None: SNRmax = numpy.nanmax(SNRdB)
737
720 self.FTP_WEI = ftp_wei
738 self.FTP_WEI = ftp_wei
721 self.EXP_CODE = exp_code
739 self.EXP_CODE = exp_code
722 self.SUB_EXP_CODE = sub_exp_code
740 self.SUB_EXP_CODE = sub_exp_code
@@ -731,18 +749,32 class ParametersPlot(Figure):
731 if ((self.xmax - x[1]) < (x[1]-x[0])):
749 if ((self.xmax - x[1]) < (x[1]-x[0])):
732 x[1] = self.xmax
750 x[1] = self.xmax
733
751
734 for i in range(nplots):
752 for i in range(nchan):
735 title = "%s Channel %d: %s" %(parameterName, dataOut.channelList[i]+1, thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
753 if SNR: j = 2*i
754 else: j = i
755
756 title = "%s Channel %d: %s" %(parameterName, channelIndexList[i]+1, thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
736
757
737 if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)):
758 if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)):
738 title = title + '_' + 'azimuth,zenith=%2.2f,%2.2f'%(dataOut.azimuth, dataOut.zenith)
759 title = title + '_' + 'azimuth,zenith=%2.2f,%2.2f'%(dataOut.azimuth, dataOut.zenith)
739 axes = self.axesList[i*self.__nsubplots]
760 axes = self.axesList[j*self.__nsubplots]
740 z1 = z[i,:].reshape((1,-1))
761 z1 = z[i,:].reshape((1,-1))
741 axes.pcolorbuffer(x, y, z1,
762 axes.pcolorbuffer(x, y, z1,
742 xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
763 xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
743 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,colormap=colormap,
764 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,colormap=colormap,
744 ticksize=9, cblabel=zlabel, cbsize="1%")
765 ticksize=9, cblabel=zlabel, cbsize="1%")
745
766
767 if SNR:
768 title = "Channel %d Signal Noise Ratio (SNR): %s" %(channelIndexList[i]+1, thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
769 axes = self.axesList[(j + 1)*self.__nsubplots]
770 z1 = SNRdB[i,:].reshape((1,-1))
771 axes.pcolorbuffer(x, y, z1,
772 xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=SNRmin, zmax=SNRmax,
773 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,colormap="jet",
774 ticksize=9, cblabel=zlabel, cbsize="1%")
775
776
777
746 self.draw()
778 self.draw()
747
779
748 if self.figfile == None:
780 if self.figfile == None:
General Comments 0
You need to be logged in to leave comments. Login now