##// END OF EJS Templates
Wind and rainfall processing of CLAIRE radar with V3.0
George Yong -
r1205:45d75be01895
parent child
Show More
@@ -526,35 +526,28 class Spectra(JROData):
526 def getFreqRangeTimeResponse(self, extrapoints=0):
526 def getFreqRangeTimeResponse(self, extrapoints=0):
527
527
528 deltafreq = self.getFmaxTimeResponse() / (self.nFFTPoints * self.ippFactor)
528 deltafreq = self.getFmaxTimeResponse() / (self.nFFTPoints * self.ippFactor)
529 freqrange = deltafreq * \
529 freqrange = deltafreq * (numpy.arange(self.nFFTPoints + extrapoints) -self.nFFTPoints / 2.) - deltafreq / 2
530 (numpy.arange(self.nFFTPoints + extrapoints) -
531 self.nFFTPoints / 2.) - deltafreq / 2
532
530
533 return freqrange
531 return freqrange
534
532
535 def getAcfRange(self, extrapoints=0):
533 def getAcfRange(self, extrapoints=0):
536
534
537 deltafreq = 10. / (self.getFmax() / (self.nFFTPoints * self.ippFactor))
535 deltafreq = 10. / (self.getFmax() / (self.nFFTPoints * self.ippFactor))
538 freqrange = deltafreq * \
536 freqrange = deltafreq * (numpy.arange(self.nFFTPoints + extrapoints) -self.nFFTPoints / 2.) - deltafreq / 2
539 (numpy.arange(self.nFFTPoints + extrapoints) -
540 self.nFFTPoints / 2.) - deltafreq / 2
541
537
542 return freqrange
538 return freqrange
543
539
544 def getFreqRange(self, extrapoints=0):
540 def getFreqRange(self, extrapoints=0):
545
541
546 deltafreq = self.getFmax() / (self.nFFTPoints * self.ippFactor)
542 deltafreq = self.getFmax() / (self.nFFTPoints * self.ippFactor)
547 freqrange = deltafreq * \
543 freqrange = deltafreq * (numpy.arange(self.nFFTPoints + extrapoints) -self.nFFTPoints / 2.) - deltafreq / 2
548 (numpy.arange(self.nFFTPoints + extrapoints) -
549 self.nFFTPoints / 2.) - deltafreq / 2
550
544
551 return freqrange
545 return freqrange
552
546
553 def getVelRange(self, extrapoints=0):
547 def getVelRange(self, extrapoints=0):
554
548
555 deltav = self.getVmax() / (self.nFFTPoints * self.ippFactor)
549 deltav = self.getVmax() / (self.nFFTPoints * self.ippFactor)
556 velrange = deltav * (numpy.arange(self.nFFTPoints +
550 velrange = deltav * (numpy.arange(self.nFFTPoints + extrapoints) - self.nFFTPoints / 2.)
557 extrapoints) - self.nFFTPoints / 2.)
558
551
559 if self.nmodes:
552 if self.nmodes:
560 return velrange/self.nmodes
553 return velrange/self.nmodes
@@ -576,8 +569,7 class Spectra(JROData):
576 if self.flagDecodeData:
569 if self.flagDecodeData:
577 pwcode = numpy.sum(self.code[0]**2)
570 pwcode = numpy.sum(self.code[0]**2)
578 #normFactor = min(self.nFFTPoints,self.nProfiles)*self.nIncohInt*self.nCohInt*pwcode*self.windowOfFilter
571 #normFactor = min(self.nFFTPoints,self.nProfiles)*self.nIncohInt*self.nCohInt*pwcode*self.windowOfFilter
579 normFactor = self.nProfiles * self.nIncohInt * \
572 normFactor = self.nProfiles * self.nIncohInt * self.nCohInt * pwcode * self.windowOfFilter
580 self.nCohInt * pwcode * self.windowOfFilter
581
573
582 return normFactor
574 return normFactor
583
575
@@ -597,8 +589,7 class Spectra(JROData):
597
589
598 def getTimeInterval(self):
590 def getTimeInterval(self):
599
591
600 timeInterval = self.ippSeconds * self.nCohInt * \
592 timeInterval = self.ippSeconds * self.nCohInt * self.nIncohInt * self.nProfiles * self.ippFactor
601 self.nIncohInt * self.nProfiles * self.ippFactor
602
593
603 return timeInterval
594 return timeInterval
604
595
@@ -625,8 +616,7 class Spectra(JROData):
625 pairsIndexList.append(self.pairsList.index(pair))
616 pairsIndexList.append(self.pairsList.index(pair))
626 for i in range(len(pairsIndexList)):
617 for i in range(len(pairsIndexList)):
627 pair = self.pairsList[pairsIndexList[i]]
618 pair = self.pairsList[pairsIndexList[i]]
628 ccf = numpy.average(
619 ccf = numpy.average(self.data_cspc[pairsIndexList[i], :, :], axis=0)
629 self.data_cspc[pairsIndexList[i], :, :], axis=0)
630 powa = numpy.average(self.data_spc[pair[0], :, :], axis=0)
620 powa = numpy.average(self.data_spc[pair[0], :, :], axis=0)
631 powb = numpy.average(self.data_spc[pair[1], :, :], axis=0)
621 powb = numpy.average(self.data_spc[pair[1], :, :], axis=0)
632 avgcoherenceComplex = ccf / numpy.sqrt(powa * powb)
622 avgcoherenceComplex = ccf / numpy.sqrt(powa * powb)
@@ -735,7 +735,7 class SkyMapPlot_(Figure):
735
735
736
736
737
737
738
738 @MPDecorator
739 class WindProfilerPlot_(Figure):
739 class WindProfilerPlot_(Figure):
740
740
741 __isConfig = None
741 __isConfig = None
@@ -745,8 +745,8 class WindProfilerPlot_(Figure):
745 HEIGHTPROF = None
745 HEIGHTPROF = None
746 PREFIX = 'wind'
746 PREFIX = 'wind'
747
747
748 def __init__(self, **kwargs):
748 def __init__(self):
749 Figure.__init__(self, **kwargs)
749 Figure.__init__(self)
750 self.timerange = None
750 self.timerange = None
751 self.isConfig = False
751 self.isConfig = False
752 self.__nsubplots = 1
752 self.__nsubplots = 1
@@ -825,6 +825,9 class WindProfilerPlot_(Figure):
825 zmax : None
825 zmax : None
826 """
826 """
827
827
828 if dataOut.flagNoData:
829 return dataOut
830
828 # if timerange is not None:
831 # if timerange is not None:
829 # self.timerange = timerange
832 # self.timerange = timerange
830 #
833 #
@@ -948,6 +951,8 class WindProfilerPlot_(Figure):
948 self.isConfig = False
951 self.isConfig = False
949 update_figfile = True
952 update_figfile = True
950
953
954 return dataOut
955
951 @MPDecorator
956 @MPDecorator
952 class ParametersPlot_(Figure):
957 class ParametersPlot_(Figure):
953
958
@@ -226,7 +226,7 def createPcolor(ax, x, y, z, xmin, xmax, ymin, ymax, zmin, zmax,
226
226
227 z = numpy.ma.masked_invalid(z)
227 z = numpy.ma.masked_invalid(z)
228 cmap = matplotlib.pyplot.get_cmap(colormap)
228 cmap = matplotlib.pyplot.get_cmap(colormap)
229 cmap.set_bad('black', 1.)
229 cmap.set_bad('white', 1.)
230 imesh = ax.pcolormesh(x, y, z.T, vmin=zmin, vmax=zmax, cmap=cmap)
230 imesh = ax.pcolormesh(x, y, z.T, vmin=zmin, vmax=zmax, cmap=cmap)
231 cb = matplotlib.pyplot.colorbar(imesh, cax=ax_cb)
231 cb = matplotlib.pyplot.colorbar(imesh, cax=ax_cb)
232 cb.set_label(cblabel)
232 cb.set_label(cblabel)
@@ -291,7 +291,7 def addpcolorbuffer(ax, x, y, z, zmin, zmax, xlabel='', ylabel='', title='', col
291 z = numpy.ma.masked_invalid(z)
291 z = numpy.ma.masked_invalid(z)
292
292
293 cmap = matplotlib.pyplot.get_cmap(colormap)
293 cmap = matplotlib.pyplot.get_cmap(colormap)
294 cmap.set_bad('black', 1.)
294 cmap.set_bad('white', 1.)
295
295
296 ax.pcolormesh(x, y, z.T, vmin=zmin, vmax=zmax, cmap=cmap)
296 ax.pcolormesh(x, y, z.T, vmin=zmin, vmax=zmax, cmap=cmap)
297
297
@@ -192,10 +192,10 class MADReader(JRODataReader, ProcessingUnit):
192 self.parameters = one + two
192 self.parameters = one + two
193 self.parameters_d = one_d + two_d
193 self.parameters_d = one_d + two_d
194
194
195 log.success('Parameters found: {}'.format(','.join(self.parameters)),
195 log.success('Parameters found: {}'.format(','.join(str(self.parameters))),
196 'MADReader')
196 'MADReader')
197 if s_parameters:
197 if s_parameters:
198 log.success('Spatial parameters: {}'.format(','.join(s_parameters)),
198 log.success('Spatial parameters: {}'.format(','.join(str(s_parameters))),
199 'MADReader')
199 'MADReader')
200
200
201 for param in list(self.oneDDict.keys()):
201 for param in list(self.oneDDict.keys()):
@@ -123,7 +123,7 class ParametersProc(ProcessingUnit):
123 self.dataOut.ippFactor = self.dataIn.ippFactor
123 self.dataOut.ippFactor = self.dataIn.ippFactor
124 self.dataOut.abscissaList = self.dataIn.getVelRange(1)
124 self.dataOut.abscissaList = self.dataIn.getVelRange(1)
125 self.dataOut.spc_noise = self.dataIn.getNoise()
125 self.dataOut.spc_noise = self.dataIn.getNoise()
126 self.dataOut.spc_range = (self.dataIn.getFreqRange(1)/1000. , self.dataIn.getAcfRange(1) , self.dataIn.getVelRange(1))
126 self.dataOut.spc_range = (self.dataIn.getFreqRange(1) , self.dataIn.getAcfRange(1) , self.dataIn.getVelRange(1))
127 # self.dataOut.normFactor = self.dataIn.normFactor
127 # self.dataOut.normFactor = self.dataIn.normFactor
128 self.dataOut.pairsList = self.dataIn.pairsList
128 self.dataOut.pairsList = self.dataIn.pairsList
129 self.dataOut.groupList = self.dataIn.pairsList
129 self.dataOut.groupList = self.dataIn.pairsList
@@ -240,17 +240,17 class SpectralFilters(Operation):
240
240
241 '''Reacomodando SPCrange'''
241 '''Reacomodando SPCrange'''
242
242
243 VelRange=numpy.roll(VelRange,-(self.Num_Bin/2) ,axis=0)
243 VelRange=numpy.roll(VelRange,-(int(self.Num_Bin/2)) ,axis=0)
244
244
245 VelRange[-(self.Num_Bin/2):]+= Vmax
245 VelRange[-(int(self.Num_Bin/2)):]+= Vmax
246
246
247 FrecRange=numpy.roll(FrecRange,-(self.Num_Bin/2),axis=0)
247 FrecRange=numpy.roll(FrecRange,-(int(self.Num_Bin/2)),axis=0)
248
248
249 FrecRange[-(self.Num_Bin/2):]+= Fmax
249 FrecRange[-(int(self.Num_Bin/2)):]+= Fmax
250
250
251 TimeRange=numpy.roll(TimeRange,-(self.Num_Bin/2),axis=0)
251 TimeRange=numpy.roll(TimeRange,-(int(self.Num_Bin/2)),axis=0)
252
252
253 TimeRange[-(self.Num_Bin/2):]+= Tmax
253 TimeRange[-(int(self.Num_Bin/2)):]+= Tmax
254
254
255 ''' ------------------ '''
255 ''' ------------------ '''
256
256
@@ -258,7 +258,7 class SpectralFilters(Operation):
258 Breaker2R=numpy.where(VelRange == Breaker2R)
258 Breaker2R=numpy.where(VelRange == Breaker2R)
259
259
260
260
261 SPCroll = numpy.roll(self.spc,-(self.Num_Bin/2) ,axis=1)
261 SPCroll = numpy.roll(self.spc,-(int(self.Num_Bin/2)) ,axis=1)
262
262
263 SPCcut = SPCroll.copy()
263 SPCcut = SPCroll.copy()
264 for i in range(self.Num_Chn):
264 for i in range(self.Num_Chn):
@@ -285,7 +285,7 class SpectralFilters(Operation):
285 dataOut.spcparam_range[2]=VelRange
285 dataOut.spcparam_range[2]=VelRange
286 dataOut.spcparam_range[1]=TimeRange
286 dataOut.spcparam_range[1]=TimeRange
287 dataOut.spcparam_range[0]=FrecRange
287 dataOut.spcparam_range[0]=FrecRange
288
288 return dataOut
289
289
290 class GaussianFit(Operation):
290 class GaussianFit(Operation):
291
291
@@ -660,7 +660,7 class PrecipitationProc(Operation):
660
660
661 Numerator = ( (4*numpy.pi)**3 * aL**2 * 16 * numpy.log(2) )
661 Numerator = ( (4*numpy.pi)**3 * aL**2 * 16 * numpy.log(2) )
662 Denominator = ( Pt * Gt * Gr * Lambda**2 * SPEED_OF_LIGHT * tauW * numpy.pi * ThetaT * ThetaR)
662 Denominator = ( Pt * Gt * Gr * Lambda**2 * SPEED_OF_LIGHT * tauW * numpy.pi * ThetaT * ThetaR)
663 RadarConstant = 5e-26 * Numerator / Denominator #
663 RadarConstant = 10e-26 * Numerator / Denominator #
664
664
665 ''' ============================= '''
665 ''' ============================= '''
666
666
@@ -753,6 +753,7 class PrecipitationProc(Operation):
753 dataOut.data_param[1]=V_mean
753 dataOut.data_param[1]=V_mean
754 dataOut.data_param[2]=RR
754 dataOut.data_param[2]=RR
755
755
756 return dataOut
756
757
757 def dBZeMODE2(self, dataOut): # Processing for MIRA35C
758 def dBZeMODE2(self, dataOut): # Processing for MIRA35C
758
759
@@ -877,7 +878,7 class FullSpectralAnalysis(Operation):
877
878
878 for Height in range(nHeights):
879 for Height in range(nHeights):
879
880
880 [Vzon,Vmer,Vver, GaussCenter, PhaseSlope, FitGaussCSPC]= self.WindEstimation(spc, cspc, pairsList, ChanDist, Height, noise, dataOut.spc_range.copy(), dbSNR[Height], SNRlimit)
881 [Vzon,Vmer,Vver, GaussCenter, PhaseSlope, FitGaussCSPC]= self.WindEstimation(spc, cspc, pairsList, ChanDist, Height, noise, dataOut.spc_range, dbSNR[Height], SNRlimit)
881 PhaseLine = numpy.append(PhaseLine, PhaseSlope)
882 PhaseLine = numpy.append(PhaseLine, PhaseSlope)
882
883
883 if abs(Vzon)<100. and abs(Vzon)> 0.:
884 if abs(Vzon)<100. and abs(Vzon)> 0.:
@@ -908,7 +909,7 class FullSpectralAnalysis(Operation):
908
909
909 dataOut.data_output=data_output
910 dataOut.data_output=data_output
910
911
911 return
912 return dataOut
912
913
913
914
914 def moving_average(self,x, N=2):
915 def moving_average(self,x, N=2):
General Comments 0
You need to be logged in to leave comments. Login now