##// END OF EJS Templates
-Added Radial Velocity graphic ...
Julio Valdez -
r511:4883db3dd5a0
parent child
Show More
@@ -455,7 +455,7 class WindProfilerPlot(Figure):
455 # y = dataOut.heightRange
455 # y = dataOut.heightRange
456 y = dataOut.heightRange
456 y = dataOut.heightRange
457
457
458 z = dataOut.winds
458 z = dataOut.winds.copy()
459 nplots = z.shape[0] #Number of wind dimensions estimated
459 nplots = z.shape[0] #Number of wind dimensions estimated
460 nplotsw = nplots
460 nplotsw = nplots
461
461
@@ -573,4 +573,221 class WindProfilerPlot(Figure):
573 if x[1] >= self.axesList[0].xmax:
573 if x[1] >= self.axesList[0].xmax:
574 self.counter_imagwr = wr_period
574 self.counter_imagwr = wr_period
575 self.__isConfig = False
575 self.__isConfig = False
576 self.figfile = None
577
578
579 class RadialVelocityPlot(Figure):
580
581 __isConfig = None
582 __nsubplots = None
583
584 WIDTHPROF = None
585 HEIGHTPROF = None
586 PREFIX = 'rti'
587
588 def __init__(self):
589
590 self.timerange = 2*60*60
591 self.__isConfig = False
592 self.__nsubplots = 1
593
594 self.WIDTH = 800
595 self.HEIGHT = 150
596 self.WIDTHPROF = 120
597 self.HEIGHTPROF = 0
598 self.counter_imagwr = 0
599
600 self.PLOT_CODE = 0
601 self.FTP_WEI = None
602 self.EXP_CODE = None
603 self.SUB_EXP_CODE = None
604 self.PLOT_POS = None
605 self.tmin = None
606 self.tmax = None
607
608 self.xmin = None
609 self.xmax = None
610
611 self.figfile = None
612
613 def getSubplots(self):
614
615 ncol = 1
616 nrow = self.nplots
617
618 return nrow, ncol
619
620 def setup(self, id, nplots, wintitle, showprofile=True, show=True):
621
622 self.__showprofile = showprofile
623 self.nplots = nplots
624
625 ncolspan = 1
626 colspan = 1
627
628 self.createFigure(id = id,
629 wintitle = wintitle,
630 widthplot = self.WIDTH + self.WIDTHPROF,
631 heightplot = self.HEIGHT + self.HEIGHTPROF,
632 show=show)
633
634 nrow, ncol = self.getSubplots()
635
636 counter = 0
637 for y in range(nrow):
638 for x in range(ncol):
639
640 if counter >= self.nplots:
641 break
642
643 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
644
645 if showprofile:
646 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1)
647
648 counter += 1
649
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,
652 SNRmin = None, SNRmax = None, SNRthresh = None, paramIndex = None,
653 save=False, figpath='', lastone=0,figfile=None, ftp=False, wr_period=1, show=True,
654 server=None, folder=None, username=None, password=None,
655 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
656
657 """
658
659 Input:
660 dataOut :
661 id :
662 wintitle :
663 channelList :
664 showProfile :
665 xmin : None,
666 xmax : None,
667 ymin : None,
668 ymax : None,
669 zmin : None,
670 zmax : None
671 """
672
673 if channelList == None:
674 channelIndexList = dataOut.channelIndexList
675 else:
676 channelIndexList = []
677 for channel in channelList:
678 if channel not in dataOut.channelList:
679 raise ValueError, "Channel %d is not in dataOut.channelList"
680 channelIndexList.append(dataOut.channelList.index(channel))
681
682 if timerange != None:
683 self.timerange = timerange
684
685 #tmin = None
686 #tmax = None
687 if paramIndex == None:
688 paramIndex = 1
689 x = dataOut.getTimeRange1()
690 y = dataOut.heightRange
691 z = dataOut.data_param[channelIndexList,paramIndex,:].copy()
692
693 zRange = dataOut.abscissaRange
694 nplots = z.shape[0] #Number of wind dimensions estimated
695 nplotsw = nplots
696
697 if dataOut.SNR != None:
698 nplots += 1
699 SNR = dataOut.SNR
700 SNRavg = numpy.average(SNR, axis=0)
701
702 SNRdB = 10*numpy.log10(SNR)
703 SNRavgdB = 10*numpy.log10(SNRavg)
704
705 if SNRthresh == None: SNRthresh = -5.0
706 ind = numpy.where(SNRavg < 10**(SNRthresh/10))[0]
707
708 for i in range(nplotsw):
709 z[i,ind] = numpy.nan
710 # thisDatetime = dataOut.datatime
711 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
712 title = wintitle + " Radial Velocity" #: %s" %(thisDatetime.strftime("%d-%b-%Y"))
713 xlabel = ""
714 ylabel = "Height (Km)"
715
716 if not self.__isConfig:
717
718 self.setup(id=id,
719 nplots=nplots,
720 wintitle=wintitle,
721 showprofile=showprofile,
722 show=show)
723
724 self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange)
725
726 if ymin == None: ymin = numpy.nanmin(y)
727 if ymax == None: ymax = numpy.nanmax(y)
728 if zmin == None: zmin = numpy.nanmin(zRange)
729 if zmax == None: zmax = numpy.nanmax(zRange)
730 if dataOut.SNR != None:
731 if SNRmin == None: SNRmin = numpy.nanmin(SNRavgdB)
732 if SNRmax == None: SNRmax = numpy.nanmax(SNRavgdB)
733
734 self.FTP_WEI = ftp_wei
735 self.EXP_CODE = exp_code
736 self.SUB_EXP_CODE = sub_exp_code
737 self.PLOT_POS = plot_pos
738
739 self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
740 self.__isConfig = True
741 self.figfile = figfile
742
743 self.setWinTitle(title)
744
745 if ((self.xmax - x[1]) < (x[1]-x[0])):
746 x[1] = self.xmax
747
748 for i in range(nplotsw):
749 title = "Channel %d: %s" %(dataOut.channelList[i]+1, thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
750 if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)):
751 title = title + '_' + 'azimuth,zenith=%2.2f,%2.2f'%(dataOut.azimuth, dataOut.zenith)
752 axes = self.axesList[i*self.__nsubplots]
753 z1 = z[i,:].reshape((1,-1))
754 axes.pcolorbuffer(x, y, z1,
755 xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
756 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,colormap="RdBu_r",
757 ticksize=9, cblabel='', cbsize="1%")
758
759 if dataOut.SNR != None:
760 i += 1
761 title = "Signal Noise Ratio (SNR): %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
762 axes = self.axesList[i*self.__nsubplots]
763
764 SNRavgdB = SNRavgdB.reshape((1,-1))
765
766 axes.pcolorbuffer(x, y, SNRavgdB,
767 xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=SNRmin, zmax=SNRmax,
768 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
769 ticksize=9, cblabel='', cbsize="1%", colormap="jet")
770
771 self.draw()
772
773 if self.figfile == None:
774 str_datetime = thisDatetime.strftime("%Y%m%d_%H%M%S")
775 self.figfile = self.getFilename(name = str_datetime)
776
777 if figpath != '':
778
779 self.counter_imagwr += 1
780 if (self.counter_imagwr>=wr_period):
781 # store png plot to local folder
782 self.saveFigure(figpath, self.figfile)
783 # store png plot to FTP server according to RT-Web format
784 name = self.getNameToFtp(thisDatetime, self.FTP_WEI, self.EXP_CODE, self.SUB_EXP_CODE, self.PLOT_CODE, self.PLOT_POS)
785 ftp_filename = os.path.join(figpath, name)
786 self.saveFigure(figpath, ftp_filename)
787
788 self.counter_imagwr = 0
789
790 if x[1] >= self.axesList[0].xmax:
791 self.counter_imagwr = wr_period
792 self.__isConfig = False
576 self.figfile = None No newline at end of file
793 self.figfile = None
@@ -91,6 +91,7 class ParametersProc(ProcessingUnit):
91 self.buffer = None
91 self.buffer = None
92 self.firstdatatime = None
92 self.firstdatatime = None
93 self.profIndex = 0
93 self.profIndex = 0
94 return
94
95
95 #---------------------- Spectra Data ---------------------------
96 #---------------------- Spectra Data ---------------------------
96
97
@@ -99,11 +100,7 class ParametersProc(ProcessingUnit):
99 self.dataOut.abscissaRange = self.dataIn.getVelRange(1)
100 self.dataOut.abscissaRange = self.dataIn.getVelRange(1)
100 self.dataOut.noise = self.dataIn.getNoise()
101 self.dataOut.noise = self.dataIn.getNoise()
101 self.dataOut.normFactor = self.dataIn.normFactor
102 self.dataOut.normFactor = self.dataIn.normFactor
102
103
103 self.__updateObjFromInput()
104 self.dataOut.flagNoData = False
105 self.firstdatatime = None
106
107 #---------------------- Correlation Data ---------------------------
104 #---------------------- Correlation Data ---------------------------
108
105
109 if self.dataIn.type == "Correlation":
106 if self.dataIn.type == "Correlation":
@@ -117,9 +114,12 class ParametersProc(ProcessingUnit):
117 self.dataOut.SNR = self.dataIn.SNR
114 self.dataOut.SNR = self.dataIn.SNR
118 self.dataOut.pairsList = self.dataIn.pairsList
115 self.dataOut.pairsList = self.dataIn.pairsList
119
116
120 self.__updateObjFromInput()
117
121 self.dataOut.flagNoData = False
118 self.__updateObjFromInput()
122 self.firstdatatime = None
119 self.dataOut.flagNoData = False
120 self.firstdatatime = None
121 self.dataOut.initUtcTime = self.dataIn.ltctime
122 self.dataOut.windsInterval = self.dataIn.timeInterval
123
123
124 #------------------- Get Moments ----------------------------------
124 #------------------- Get Moments ----------------------------------
125 def GetMoments(self, channelList = None):
125 def GetMoments(self, channelList = None):
@@ -143,12 +143,14 class ParametersProc(ProcessingUnit):
143
143
144 data_param = numpy.zeros((data.shape[0], 4, data.shape[2]))
144 data_param = numpy.zeros((data.shape[0], 4, data.shape[2]))
145
145
146 if channelList== None: channelList = self.dataOut.channelList
146 if channelList== None:
147 channelList = self.dataIn.channelList
148 self.dataOut.channelList = channelList
147
149
148 for ind in channelList:
150 for ind in channelList:
149 data_param[ind,:,:] = self.__calculateMoments(data[ind,:,:], absc, noise[ind])
151 data_param[ind,:,:] = self.__calculateMoments(data[ind,:,:], absc, noise[ind])
150
152
151 self.dataOut.data_param = data_param[:,1:]
153 self.dataOut.data_param = data_param[:,1:,:]
152 self.dataOut.SNR = data_param[:,0]
154 self.dataOut.SNR = data_param[:,0]
153 return
155 return
154
156
@@ -1461,8 +1463,6 class WindProfiler(Operation):
1461
1463
1462 velRadial0 = param[:,1,:] #Radial velocity
1464 velRadial0 = param[:,1,:] #Radial velocity
1463 dataOut.winds, dataOut.heightRange, dataOut.SNR = self.techniqueDBS(velRadial0, theta_x, theta_y, azimuth, correctFactor, horizontalOnly, heightRange, SNR) #DBS Function
1465 dataOut.winds, dataOut.heightRange, dataOut.SNR = self.techniqueDBS(velRadial0, theta_x, theta_y, azimuth, correctFactor, horizontalOnly, heightRange, SNR) #DBS Function
1464 dataOut.initUtcTime = dataOut.ltctime
1465 dataOut.windsInterval = dataOut.timeInterval
1466
1466
1467 elif technique == 'SA':
1467 elif technique == 'SA':
1468
1468
@@ -28,8 +28,8 controllerObj.setup(id = '191', name='test01', description=desc)
28 #2014051 20 Feb 2014
28 #2014051 20 Feb 2014
29 path = '/home/soporte/Data/MST/DBS/d2014051'
29 path = '/home/soporte/Data/MST/DBS/d2014051'
30 pathFigure = '/home/soporte/workspace/Graficos/DBS/prueba1/'
30 pathFigure = '/home/soporte/workspace/Graficos/DBS/prueba1/'
31 xmin = '0.0'
31 xmin = '0'
32 xmax = '8.0'
32 xmax = '7.5'
33 startTime = '00:00:00'
33 startTime = '00:00:00'
34 filehdf5 = "DBS_2014051.hdf5"
34 filehdf5 = "DBS_2014051.hdf5"
35
35
@@ -108,6 +108,17 opObj21.addParameter(name='save', value='1', format='bool')
108 opObj21.addParameter(name='figpath', value=pathFigure, format='str')
108 opObj21.addParameter(name='figpath', value=pathFigure, format='str')
109 opObj21.addParameter(name='zmin', value='5', format='int')
109 opObj21.addParameter(name='zmin', value='5', format='int')
110 opObj21.addParameter(name='zmax', value='90', format='int')
110 opObj21.addParameter(name='zmax', value='90', format='int')
111
112 opObj21 = procUnitConfObj2.addOperation(name='RadialVelocityPlot', optype='other')
113 opObj21.addParameter(name='id', value='5', format='int')
114 opObj21.addParameter(name='wintitle', value='Radial Velocity Plot', format='str')
115 opObj21.addParameter(name='save', value='1', format='bool')
116 opObj21.addParameter(name='figpath', value=pathFigure, format='str')
117 opObj21.addParameter(name='SNRmin', value='-10', format='int')
118 opObj21.addParameter(name='SNRmax', value='60', format='int')
119 opObj21.addParameter(name='SNRthresh', value='0', format='float')
120 opObj21.addParameter(name='xmin', value=xmin, format='float')
121 opObj21.addParameter(name='xmax', value=xmax, format='float')
111
122
112 opObj22 = procUnitConfObj2.addOperation(name='WindProfiler', optype='other')
123 opObj22 = procUnitConfObj2.addOperation(name='WindProfiler', optype='other')
113 opObj22.addParameter(name='technique', value='DBS', format='str')
124 opObj22.addParameter(name='technique', value='DBS', format='str')
@@ -19,20 +19,20 controllerObj.setup(id = '191', name='test01', description=desc)
19 #Experimentos
19 #Experimentos
20
20
21 #2014050 19 Feb 2014
21 #2014050 19 Feb 2014
22 # path = '/home/soporte/Documents/MST_Data/SA/d2014050'
22 path = '/home/soporte/Data/MST/SA/d2014050'
23 # pathFigure = '/home/soporte/workspace/Graficos/SA/d2014050_prueba/'
23 pathFigure = '/home/soporte/workspace/Graficos/SA/new1/'
24 # xmin = '15.5'
24 xmin = '15.5'
25 # xmax = '23.99999999'
25 xmax = '24'
26 # startTime = '15:30:00'
26 startTime = '15:30:00'
27 # filehdf5 = "SA_2014050.hdf5"
27 filehdf5 = "SA_2014050.hdf5"
28
28
29 #2014051 20 Feb 2014
29 #2014051 20 Feb 2014
30 path = '/home/soporte/Data/MST/SA/d2014051'
30 # path = '/home/soporte/Data/MST/SA/d2014051'
31 pathFigure = '/home/soporte/workspace/Graficos/SA/prueba1/'
31 # pathFigure = '/home/soporte/workspace/Graficos/SA/new/'
32 xmin = '0.0'
32 # xmin = '0.0'
33 xmax = '8.0'
33 # xmax = '8.0'
34 startTime = '06:00:00'
34 # startTime = '00:00:00'
35 filehdf5 = "SA_2014051.hdf5"
35 # filehdf5 = "SA_2014051.hdf5"
36
36
37 readUnitConfObj = controllerObj.addReadUnit(datatype='VoltageReader',
37 readUnitConfObj = controllerObj.addReadUnit(datatype='VoltageReader',
38 path=path,
38 path=path,
@@ -63,7 +63,7 opObj11.addParameter(name='maxIndex', value='60', format='float')
63 #---------------------------------------------------------------------------------------------------
63 #---------------------------------------------------------------------------------------------------
64 procUnitConfObj1 = controllerObj.addProcUnit(datatype='CorrelationProc', inputId=procUnitConfObj0.getId())
64 procUnitConfObj1 = controllerObj.addProcUnit(datatype='CorrelationProc', inputId=procUnitConfObj0.getId())
65 # procUnitConfObj1.addParameter(name='pairsList', value='(0,0),(1,1),(2,2),(3,3),(1,0),(2,3)', format='pairsList')
65 # procUnitConfObj1.addParameter(name='pairsList', value='(0,0),(1,1),(2,2),(3,3),(1,0),(2,3)', format='pairsList')
66 procUnitConfObj1.addParameter(name='pairsList', value='(0,0),(1,1),(2,2),(3,3),(0,3),(0,2),(1,3),(1,2)', format='pairsList')
66 procUnitConfObj1.addParameter(name='pairsList', value='(0,0),(1,1),(2,2),(3,3),(0,3),(0,2),(1,3),(1,2),(0,1),(2,3)', format='pairsList')
67 procUnitConfObj1.addParameter(name='fullT', value='1', format='bool')
67 procUnitConfObj1.addParameter(name='fullT', value='1', format='bool')
68 procUnitConfObj1.addParameter(name='removeDC', value='1', format='bool')
68 procUnitConfObj1.addParameter(name='removeDC', value='1', format='bool')
69 #procUnitConfObj1.addParameter(name='lagT', value='0,1,2,3', format='intlist')
69 #procUnitConfObj1.addParameter(name='lagT', value='0,1,2,3', format='intlist')
@@ -98,7 +98,7 opObj21.addParameter(name='technique', value='SA', format='str')
98 opObj21.addParameter(name='positionX', value='36,0,36,0', format='floatlist')
98 opObj21.addParameter(name='positionX', value='36,0,36,0', format='floatlist')
99 opObj21.addParameter(name='positionY', value='36,0,0,36', format='floatlist')
99 opObj21.addParameter(name='positionY', value='36,0,0,36', format='floatlist')
100 opObj21.addParameter(name='azimuth', value='51.06', format='float')
100 opObj21.addParameter(name='azimuth', value='51.06', format='float')
101 opObj21.addParameter(name='crosspairsList', value='(0,3),(0,2),(1,3),(1,2)', format='pairsList')#COrregir
101 opObj21.addParameter(name='crosspairsList', value='(0,3),(0,2),(1,3),(1,2),(0,1),(2,3)', format='pairsList')#COrregir
102 #
102 #
103 opObj22 = procUnitConfObj2.addOperation(name='WindProfilerPlot', optype='other')
103 opObj22 = procUnitConfObj2.addOperation(name='WindProfilerPlot', optype='other')
104 opObj22.addParameter(name='id', value='4', format='int')
104 opObj22.addParameter(name='id', value='4', format='int')
General Comments 0
You need to be logged in to leave comments. Login now