##// END OF EJS Templates
7 de marzo 2018
ebocanegra -
r1148:fee9f80824df
parent child
Show More
@@ -637,8 +637,6 class Spectra(JROData):
637 637
638 638 def getVelRange(self, extrapoints=0):
639 639
640 print 'VELMAX', self.getVmax()
641 asdasdasd
642 640 deltav = self.getVmax() / (self.nFFTPoints*self.ippFactor)
643 641 velrange = deltav*(numpy.arange(self.nFFTPoints+extrapoints)-self.nFFTPoints/2.) #- deltav/2
644 642
@@ -6,14 +6,14 from figure import Figure, isRealtime, isTimeInHourRange
6 6 from plotting_codes import *
7 7
8 8
9 class FitGauPlot(Figure):
9 class SpcParamPlot(Figure):
10 10
11 11 isConfig = None
12 12 __nsubplots = None
13 13
14 14 WIDTHPROF = None
15 15 HEIGHTPROF = None
16 PREFIX = 'fitgau'
16 PREFIX = 'SpcParam'
17 17
18 18 def __init__(self, **kwargs):
19 19 Figure.__init__(self, **kwargs)
@@ -82,7 +82,7 class FitGauPlot(Figure):
82 82 save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1,
83 83 server=None, folder=None, username=None, password=None,
84 84 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0, realtime=False,
85 xaxis="frequency", colormap='jet', normFactor=None , GauSelector = 0):
85 xaxis="frequency", colormap='jet', normFactor=None , Selector = 0):
86 86
87 87 """
88 88
@@ -118,23 +118,23 class FitGauPlot(Figure):
118 118 # else:
119 119 # factor = normFactor
120 120 if xaxis == "frequency":
121 x = dataOut.spc_range[0]
121 x = dataOut.spcparam_range[0]
122 122 xlabel = "Frequency (kHz)"
123 123
124 124 elif xaxis == "time":
125 x = dataOut.spc_range[1]
125 x = dataOut.spcparam_range[1]
126 126 xlabel = "Time (ms)"
127 127
128 128 else:
129 x = dataOut.spc_range[2]
129 x = dataOut.spcparam_range[2]
130 130 xlabel = "Velocity (m/s)"
131 131
132 132 ylabel = "Range (Km)"
133 133
134 134 y = dataOut.getHeiRange()
135 135
136 z = dataOut.GauSPC[:,GauSelector,:,:] #GauSelector] #dataOut.data_spc/factor
137 print 'GausSPC', z[0,32,10:40]
136 z = dataOut.SPCparam[Selector] #GauSelector] #dataOut.data_spc/factor
137 #print 'GausSPC', z[0,32,10:40]
138 138 z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
139 139 zdB = 10*numpy.log10(z)
140 140
@@ -128,12 +128,6 class SpectraPlot(Figure):
128 128 factor = normFactor
129 129 if xaxis == "frequency":
130 130 x = dataOut.getFreqRange(1)/1000.
131 print 'FRECUENCIA MAXIMA', numpy.amax(x)
132 asfasfasdfaf
133 print '#######################################################'
134 print 'xlen', len(x)
135 print x
136 print '#######################################################'
137 131 xlabel = "Frequency (kHz)"
138 132
139 133 elif xaxis == "time":
@@ -28,6 +28,7 from scipy.optimize import curve_fit
28 28 import warnings
29 29 from numpy import NaN
30 30 from scipy.optimize.optimize import OptimizeWarning
31 from IPython.parallel.controller.scheduler import numpy
31 32 warnings.filterwarnings('ignore')
32 33
33 34
@@ -122,7 +123,7 class ParametersProc(ProcessingUnit):
122 123 print 'self.dataIn.data_spc', self.dataIn.data_spc.shape
123 124 self.dataOut.abscissaList = self.dataIn.getVelRange(1)
124 125 self.dataOut.spc_noise = self.dataIn.getNoise()
125 self.dataOut.spc_range = (self.dataIn.getFreqRange(1) , self.dataIn.getAcfRange(1) , self.dataIn.getVelRange(1) )
126 self.dataOut.spc_range = numpy.asanyarray((self.dataIn.getFreqRange(1) , self.dataIn.getAcfRange(1) , self.dataIn.getVelRange(1) ))
126 127
127 128 self.dataOut.normFactor = self.dataIn.normFactor
128 129 #self.dataOut.outputInterval = self.dataIn.outputInterval
@@ -187,6 +188,117 def target(tups):
187 188 return obj.FitGau(args)
188 189
189 190
191 class SpectralFilters(Operation):
192
193 '''This class allows the Rainfall / Wind Selection for CLAIRE RADAR
194
195 LimitR : It is the limit in m/s of Rainfall
196 LimitW : It is the limit in m/s for Winds
197
198 Input:
199
200 self.dataOut.data_pre : SPC and CSPC
201 self.dataOut.spc_range : To select wind and rainfall velocities
202
203 Affected:
204
205 self.dataOut.data_pre : It is used for the new SPC and CSPC ranges of wind
206 self.dataOut.spcparam_range : Used in SpcParamPlot
207 self.dataOut.SPCparam : Used in PrecipitationProc
208
209
210 '''
211
212 def __init__(self, **kwargs):
213 Operation.__init__(self, **kwargs)
214 self.i=0
215
216 def run(self, dataOut, Rain_Velocity_Limit=1.5, Wind_Velocity_Limit=2.5):
217
218 #Limite de vientos
219 LimitR = Rain_Velocity_Limit
220 LimitW = Wind_Velocity_Limit
221
222 self.spc = dataOut.data_pre[0].copy()
223 self.cspc = dataOut.data_pre[1].copy()
224
225 self.Num_Hei = self.spc.shape[2]
226 self.Num_Bin = self.spc.shape[1]
227 self.Num_Chn = self.spc.shape[0]
228
229 VelRange = dataOut.spc_range[2]
230 TimeRange = dataOut.spc_range[1]
231 FrecRange = dataOut.spc_range[0]
232
233 Vmax= 2*numpy.max(dataOut.spc_range[2])
234 Tmax= 2*numpy.max(dataOut.spc_range[1])
235 Fmax= 2*numpy.max(dataOut.spc_range[0])
236
237 Breaker1R=VelRange[numpy.abs(VelRange-(-LimitR)).argmin()]
238 Breaker1R=numpy.where(VelRange == Breaker1R)
239
240 Breaker1W=VelRange[numpy.abs(VelRange-(-LimitW)).argmin()]
241 Breaker1W=numpy.where(VelRange == Breaker1W)
242
243 Breaker2W=VelRange[numpy.abs(VelRange-(LimitW)).argmin()]
244 Breaker2W=numpy.where(VelRange == Breaker2W)
245
246
247 '''Reacomodando SPCrange'''
248
249 VelRange=numpy.roll(VelRange,-Breaker1R[0],axis=0)
250
251 VelRange[-int(Breaker1R[0]):]+= Vmax
252
253 FrecRange=numpy.roll(FrecRange,-Breaker1R[0],axis=0)
254
255 FrecRange[-int(Breaker1R[0]):]+= Fmax
256
257 TimeRange=numpy.roll(TimeRange,-Breaker1R[0],axis=0)
258
259 TimeRange[-int(Breaker1R[0]):]+= Tmax
260
261 ''' ------------------ '''
262
263 Breaker2R=VelRange[numpy.abs(VelRange-(LimitR)).argmin()]
264 Breaker2R=numpy.where(VelRange == Breaker2R)
265
266
267
268
269 SPCroll = numpy.roll(self.spc,-Breaker1R[0],axis=1)
270
271 SPCcut = SPCroll.copy()
272 for i in range(self.Num_Chn):
273 SPCcut[i,0:int(Breaker2R[0]),:] = dataOut.noise[i]
274
275 self.spc[i, 0:int(Breaker1W[0]) ,:] = dataOut.noise[i]
276 self.spc[i, int(Breaker2W[0]):self.Num_Bin ,:] = dataOut.noise[i]
277
278 self.cspc[i, 0:int(Breaker1W[0]) ,:] = dataOut.noise[i]
279 self.cspc[i, int(Breaker2W[0]):self.Num_Bin ,:] = dataOut.noise[i]
280
281
282 SPC_ch1 = SPCroll
283
284 SPC_ch2 = SPCcut
285
286 SPCparam = (SPC_ch1, SPC_ch2, self.spc)
287 dataOut.SPCparam = numpy.asarray(SPCparam)
288
289 dataOut.data_pre= (self.spc , self.cspc)
290
291 #dataOut.data_preParam = (self.spc , self.cspc)
292
293 dataOut.spcparam_range=numpy.zeros([self.Num_Chn,self.Num_Bin+1])
294
295 dataOut.spcparam_range[2]=VelRange
296 dataOut.spcparam_range[1]=TimeRange
297 dataOut.spcparam_range[0]=FrecRange
298
299
300
301
190 302 class GaussianFit(Operation):
191 303
192 304 '''
@@ -198,7 +310,7 class GaussianFit(Operation):
198 310 self.dataOut.data_pre : SelfSpectra
199 311
200 312 Output:
201 self.dataOut.GauSPC : SPC_ch1, SPC_ch2
313 self.dataOut.SPCparam : SPC_ch1, SPC_ch2
202 314
203 315 '''
204 316 def __init__(self, **kwargs):
@@ -252,7 +364,7 class GaussianFit(Operation):
252 364 objs = [self for __ in range(self.Num_Chn)]
253 365 attrs = zip(objs, args)
254 366 gauSPC = pool.map(target, attrs)
255 dataOut.GauSPC = numpy.asarray(gauSPC)
367 dataOut.SPCparam = numpy.asarray(SPCparam)
256 368
257 369
258 370
@@ -280,7 +392,7 class GaussianFit(Operation):
280 392
281 393 #print 'HEIGHTS', self.Num_Hei
282 394
283 GauSPC = []
395 SPCparam = []
284 396 SPC_ch1 = numpy.empty([self.Num_Bin,self.Num_Hei])
285 397 SPC_ch2 = numpy.empty([self.Num_Bin,self.Num_Hei])
286 398 SPC_ch1[:] = 0#numpy.NaN
@@ -331,7 +443,7 class GaussianFit(Operation):
331 443 snr = numpy.NaN
332 444 SPC_ch1[:,ht] = 0#numpy.NaN
333 445 SPC_ch1[:,ht] = 0#numpy.NaN
334 GauSPC = (SPC_ch1,SPC_ch2)
446 SPCparam = (SPC_ch1,SPC_ch2)
335 447 continue
336 448 #print 'snr',snrdB #, sum(spcs) , tot_noise
337 449
@@ -517,7 +629,7 class GaussianFit(Operation):
517 629 #print 'SPC_ch1.shape',SPC_ch1.shape
518 630 #print 'SPC_ch2.shape',SPC_ch2.shape
519 631 #dataOut.data_param = SPC_ch1
520 GauSPC = (SPC_ch1,SPC_ch2)
632 SPCparam = (SPC_ch1,SPC_ch2)
521 633 #GauSPC[1] = SPC_ch2
522 634
523 635 # print 'shift0', shift0
@@ -581,13 +693,30 class PrecipitationProc(Operation):
581 693
582 694 Parameters affected:
583 695 '''
696 def gaus(self,xSamples,Amp,Mu,Sigma):
697 return ( Amp / ((2*numpy.pi)**0.5 * Sigma) ) * numpy.exp( -( xSamples - Mu )**2 / ( 2 * (Sigma**2) ))
698
699
584 700
701 def Moments(self, ySamples, xSamples):
702 Pot = numpy.nansum( ySamples ) # Potencia, momento 0
703 yNorm = ySamples / Pot
704
705 Vr = numpy.nansum( yNorm * xSamples ) # Velocidad radial, mu, corrimiento doppler, primer momento
706 Sigma2 = abs(numpy.nansum( yNorm * ( xSamples - Vr )**2 )) # Segundo Momento
707 Desv = Sigma2**0.5 # Desv. Estandar, Ancho espectral
708
709 return numpy.array([Pot, Vr, Desv])
585 710
586 711 def run(self, dataOut, radar=None, Pt=5000, Gt=295.1209, Gr=70.7945, Lambda=0.6741, aL=2.5118,
587 712 tauW=4e-06, ThetaT=0.1656317, ThetaR=0.36774087, Km = 0.93, Altitude=3350):
588 713
589 714
590 Velrange = dataOut.abscissaList
715 Velrange = dataOut.spc_range[2]
716 FrecRange = dataOut.spc_range[0]
717
718 dV= Velrange[1]-Velrange[0]
719 dF= FrecRange[1]-FrecRange[0]
591 720
592 721 if radar == "MIRA35C" :
593 722
@@ -599,7 +728,7 class PrecipitationProc(Operation):
599 728
600 729 else:
601 730
602 self.spc = dataOut.GauSPC[1] #dataOut.data_pre[0].copy()
731 self.spc = dataOut.SPCparam[1] #dataOut.data_pre[0].copy() #
603 732 self.Num_Hei = self.spc.shape[2]
604 733 self.Num_Bin = self.spc.shape[1]
605 734 self.Num_Chn = self.spc.shape[0]
@@ -619,60 +748,93 class PrecipitationProc(Operation):
619 748
620 749 Numerator = ( (4*numpy.pi)**3 * aL**2 * 16 * numpy.log(2) )
621 750 Denominator = ( Pt * Gt * Gr * Lambda**2 * SPEED_OF_LIGHT * tauW * numpy.pi * ThetaT * ThetaR)
622 RadarConstant = Numerator / Denominator
751 RadarConstant = 4.1396e+08# Numerator / Denominator
623 752 print '***'
624 753 print '*** RadarConstant' , RadarConstant, '****'
625 754 print '***'
626 755 ''' ============================= '''
627 756
628 757 SPCmean = numpy.mean(self.spc,0)
629 ETA = numpy.zeros(self.Num_Hei,self.Num_Bin)
758 ETAf = numpy.zeros([self.Num_Bin,self.Num_Hei])
759 ETAv = numpy.zeros([self.Num_Bin,self.Num_Hei])
760 ETAd = numpy.zeros([self.Num_Bin,self.Num_Hei])
761
630 762 Pr = self.spc[0,:,:]
631 763
632 764 VelMeteoro = numpy.mean(SPCmean,axis=0)
633 print '==================== Vel SHAPE',VelMeteoro
634 765
635 D_range = numpy.zeros(self.Num_Hei)
636 SIGMA = numpy.zeros(self.Num_Hei)
637 N_dist = numpy.zeros(self.Num_Hei)
638 EqSec = numpy.zeros(self.Num_Hei)
766 #print '==================== Vel SHAPE',VelMeteoro
767
768 D_range = numpy.zeros([self.Num_Bin,self.Num_Hei])
769 SIGMA = numpy.zeros([self.Num_Bin,self.Num_Hei])
770 N_dist = numpy.zeros([self.Num_Bin,self.Num_Hei])
771 D_mean = numpy.zeros(self.Num_Hei)
639 772 del_V = numpy.zeros(self.Num_Hei)
773 Z = numpy.zeros(self.Num_Hei)
774 Ze = numpy.zeros(self.Num_Hei)
775 RR = numpy.zeros(self.Num_Hei)
640 776
641 777
642 778 for R in range(self.Num_Hei):
643 ETA[:,R] = RadarConstant * Pr[:,R] * R**2 #Reflectivity (ETA)
644 779
645 h = R + Altitude #Range from ground to radar pulse altitude
780 h = R*75 + Altitude #Range from ground to radar pulse altitude
646 781 del_V[R] = 1 + 3.68 * 10**-5 * h + 1.71 * 10**-9 * h**2 #Density change correction for velocity
647 782
648 D_range[R] = numpy.log( (9.65 - (VelMeteoro[R]/del_V[R])) / 10.3 ) / -0.6 #Range of Diameter of drops related to velocity
649 SIGMA[R] = numpy.pi**5 / Lambda**4 * Km * D_range[R]**6 #Equivalent Section of drops (sigma)
650 #print '******* D_range ********', self.Num_Hei
651 #print D_range
652 N_dist[R] = ETA[R] / SIGMA[R]
783 D_range[:,R] = numpy.log( (9.65 - (Velrange[0:self.Num_Bin] / del_V[R])) / 10.3 ) / -0.6 #Range of Diameter of drops related to velocity
784
785 ETAf[:,R] = 1/RadarConstant * Pr[:,R] * (R*0.075)**2 #Reflectivity (ETA)
786
787 ETAv[:,R]=ETAf[:,R]*dF/dV
788
789 ETAd[:,R]=ETAv[:,R]*6.18*exp(-0.6*D_range[:,R])
790
791 SIGMA[:,R] = numpy.pi**5 / Lambda**4 * Km * D_range[:,R]**6 #Equivalent Section of drops (sigma)
792
793 N_dist[:,R] = ETAd[:,R] / SIGMA[:,R]
794
795 DMoments = self.Moments(Pr[:,R], D_range[:,R])
653 796
797 try:
798 popt01,pcov = curve_fit(self.gaus, D_range[:,R] , Pr[:,R] , p0=DMoments)
799 except:
800 popt01=numpy.zeros(3)
801 popt01[1]= DMoments[1]
802 D_mean[R]=popt01[1]
654 803
804 Z[R] = numpy.nansum( N_dist[:,R] * D_range[:,R]**6 )
655 805
656 Ze = (ETA * Lambda**4) / (numpy.pi * Km)
657 Z = numpy.sum( N_dist * D_range**6 )
658 #print 'Velrange',len(Velrange), 'D_range', len(D_range)
659 RR = 6*10**-4*numpy.pi * numpy.sum( D_range[R]**3 * N_dist[R] * VelMeteoro[R] ) #Rainfall rate
806 RR[R] = 6*10**-4.*numpy.pi * numpy.nansum( D_range[:,R]**3 * N_dist[:,R] * Velrange[0:self.Num_Bin] ) #Rainfall rate
660 807
808 Ze[R] = (numpy.nansum(ETAd[:,R]) * Lambda**4) / (numpy.pi * Km)
661 809
662 810
663 RR2 = (Ze/200)**(1/1.6)
811
812 RR2 = (Z/200)**(1/1.6)
664 813 dBRR = 10*numpy.log10(RR)
814 dBRR2 = 10*numpy.log10(RR2)
665 815
666 816 dBZe = 10*numpy.log10(Ze)
667 dataOut.data_output = Ze
817 dBZ = 10*numpy.log10(Z)
818
819 dataOut.data_output = Z
668 820 dataOut.data_param = numpy.ones([3,self.Num_Hei])
669 821 dataOut.channelList = [0,1,2]
670 print 'channelList', dataOut.channelList
671 dataOut.data_param[0]=dBZe
672 dataOut.data_param[1]=dBRR
822
823 dataOut.data_param[0]=dBZ
824 dataOut.data_param[1]=dBZe
825 dataOut.data_param[2]=dBRR2
826
673 827 print 'RR SHAPE', dBRR.shape
674 print 'Ze SHAPE', dBZe.shape
675 print 'dataOut.data_param SHAPE', dataOut.data_param.shape
828 #print 'Ze ', dBZe
829 print 'Z ', dBZ
830 print 'RR ', dBRR
831 #print 'RR2 ', dBRR2
832 #print 'D_mean', D_mean
833 #print 'del_V', del_V
834 #print 'D_range',D_range.shape, D_range[:,30]
835 #print 'Velrange', Velrange
836 #print 'numpy.nansum( N_dist[:,R]', numpy.nansum( N_dist, axis=0)
837 #print 'dataOut.data_param SHAPE', dataOut.data_param.shape
676 838
677 839
678 840 def dBZeMODE2(self, dataOut): # Processing for MIRA35C
@@ -747,7 +909,7 class FullSpectralAnalysis(Operation):
747 909
748 910 self.indice=int(numpy.random.rand()*1000)
749 911
750 spc = dataOut.data_pre[0]
912 spc = dataOut.data_pre[0].copy()
751 913 cspc = dataOut.data_pre[1]
752 914
753 915 nChannel = spc.shape[0]
@@ -760,12 +922,7 class FullSpectralAnalysis(Operation):
760 922 else:
761 923 ChanDist = numpy.array([[E01, N01],[E02,N02],[E12,N12]])
762 924
763 #print 'ChanDist', ChanDist
764
765 #if dataOut.VelRange is not None:
766 AbbsisaRange= dataOut.spc_range#dataOut.VelRange
767 #else:
768 # AbbsisaRange= dataOut.spc_range#dataOut.abscissaList
925 FrecRange = dataOut.spc_range[0]
769 926
770 927 ySamples=numpy.ones([nChannel,nProfiles])
771 928 phase=numpy.ones([nChannel,nProfiles])
@@ -773,38 +930,34 class FullSpectralAnalysis(Operation):
773 930 coherence=numpy.ones([nChannel,nProfiles])
774 931 PhaseSlope=numpy.ones(nChannel)
775 932 PhaseInter=numpy.ones(nChannel)
776 dataSNR = dataOut.data_SNR
777
778
933 data_SNR=numpy.zeros([nProfiles])
779 934
780 935 data = dataOut.data_pre
781 936 noise = dataOut.noise
782 #print 'noise',noise
783 #SNRdB = 10*numpy.log10(dataOut.data_SNR)
784 937
785 FirstMoment = dataOut.data_param[0,1,:]#numpy.average(dataOut.data_param[:,1,:],0)
786 SecondMoment = numpy.average(dataOut.data_param[:,2,:],0)
938 dataOut.data_SNR = (numpy.mean(spc,axis=1)- noise[0]) / noise[0]
939
787 940
788 #SNRdBMean = []
789 941
942 print dataOut.data_SNR.shape
943 #FirstMoment = dataOut.moments[0,1,:]#numpy.average(dataOut.data_param[:,1,:],0)
944 #SecondMoment = numpy.average(dataOut.moments[:,2,:],0)
790 945
791 #for j in range(nHeights):
792 # FirstMoment = numpy.append(FirstMoment,numpy.mean([dataOut.data_param[0,1,j],dataOut.data_param[1,1,j],dataOut.data_param[2,1,j]]))
793 # SNRdBMean = numpy.append(SNRdBMean,numpy.mean([SNRdB[0,j],SNRdB[1,j],SNRdB[2,j]]))
946 #SNRdBMean = []
794 947
795 data_output=numpy.ones([3,spc.shape[2]])*numpy.NaN
948 data_output=numpy.ones([spc.shape[0],spc.shape[2]])*numpy.NaN
796 949
797 950 velocityX=[]
798 951 velocityY=[]
799 952 velocityV=[]
800 953 PhaseLine=[]
801 954
802 dbSNR = 10*numpy.log10(dataSNR)
955 dbSNR = 10*numpy.log10(dataOut.data_SNR)
803 956 dbSNR = numpy.average(dbSNR,0)
804 957
805 958 for Height in range(nHeights):
806 959
807 [Vzon,Vmer,Vver, GaussCenter, PhaseSlope, FitGaussCSPC]= self.WindEstimation(dataOut.data_param, spc, cspc, pairsList, ChanDist, Height, noise, AbbsisaRange, dbSNR[Height], SNRlimit)
960 [Vzon,Vmer,Vver, GaussCenter, PhaseSlope, FitGaussCSPC]= self.WindEstimation(spc, cspc, pairsList, ChanDist, Height, noise, dataOut.spc_range.copy(), dbSNR[Height], SNRlimit)
808 961 PhaseLine = numpy.append(PhaseLine, PhaseSlope)
809 962
810 963 if abs(Vzon)<100. and abs(Vzon)> 0.:
@@ -822,7 +975,7 class FullSpectralAnalysis(Operation):
822 975 velocityY=numpy.append(velocityY, numpy.NaN)
823 976
824 977 if dbSNR[Height] > SNRlimit:
825 velocityV=numpy.append(velocityV, FirstMoment[Height])
978 velocityV=numpy.append(velocityV, -Vver)#FirstMoment[Height])
826 979 else:
827 980 velocityV=numpy.append(velocityV, numpy.NaN)
828 981 #FirstMoment[Height]= numpy.NaN
@@ -837,23 +990,22 class FullSpectralAnalysis(Operation):
837 990 data_output[1] = numpy.array(velocityY) #self.moving_average(numpy.array(velocityY) , N=1)
838 991 data_output[2] = -velocityV#FirstMoment
839 992
840 print ' '
841 #print 'FirstMoment'
993 print 'FirstMoment', data_output[2]
842 994 #print FirstMoment
843 print 'velocityX',numpy.shape(data_output[0])
844 print 'velocityX',data_output[0]
845 print ' '
846 print 'velocityY',numpy.shape(data_output[1])
847 print 'velocityY',data_output[1]
848 print 'velocityV',data_output[2]
849 print 'PhaseLine',PhaseLine
995 # print 'velocityX',numpy.shape(data_output[0])
996 # print 'velocityX',data_output[0]
997 # print ' '
998 # print 'velocityY',numpy.shape(data_output[1])
999 # print 'velocityY',data_output[1]
1000 # print 'velocityV',data_output[2]
1001 # print 'PhaseLine',PhaseLine
850 1002 #print numpy.array(velocityY)
851 1003 #print 'SNR'
852 1004 #print 10*numpy.log10(dataOut.data_SNR)
853 1005 #print numpy.shape(10*numpy.log10(dataOut.data_SNR))
854 1006 print ' '
855 1007
856 xFrec=AbbsisaRange[0][0:spc.shape[1]]
1008 xFrec=FrecRange[0:spc.shape[1]]
857 1009
858 1010 dataOut.data_output=data_output
859 1011
@@ -878,11 +1030,11 class FullSpectralAnalysis(Operation):
878 1030
879 1031 return numpy.array([Pot, Vr, Desv])
880 1032
881 def WindEstimation(self, data_param, spc, cspc, pairsList, ChanDist, Height, noise, AbbsisaRange, dbSNR, SNRlimit):
1033 def WindEstimation(self, spc, cspc, pairsList, ChanDist, Height, noise, AbbsisaRange, dbSNR, SNRlimit):
882 1034
883 print ' '
884 print '######################## Height',Height, (1000 + 75*Height), '##############################'
885 print ' '
1035 # print ' '
1036 # print '######################## Height',Height, (1000 + 75*Height), '##############################'
1037 # print ' '
886 1038
887 1039 ySamples=numpy.ones([spc.shape[0],spc.shape[1]])
888 1040 phase=numpy.ones([spc.shape[0],spc.shape[1]])
@@ -956,10 +1108,10 class FullSpectralAnalysis(Operation):
956 1108 #print '##### SUMA de CSPC #####', len(coherence)
957 1109 #print numpy.sum(numpy.abs(CSPCNorm))
958 1110 #print numpy.sum(coherence[0])
959 print 'len',len(xSamples)
960 print 'CSPCmoments', numpy.shape(CSPCmoments)
961 print CSPCmoments
962 print '#######################'
1111 # print 'len',len(xSamples)
1112 # print 'CSPCmoments', numpy.shape(CSPCmoments)
1113 # print CSPCmoments
1114 # print '#######################'
963 1115
964 1116 popt=[1e-10,1e-10,1e-10]
965 1117 popt01, popt02, popt12 = [1e-10,1e-10,1e-10], [1e-10,1e-10,1e-10] ,[1e-10,1e-10,1e-10]
@@ -981,8 +1133,6 class FullSpectralAnalysis(Operation):
981 1133
982 1134
983 1135
984
985
986 1136 '''***Fit Gauss CSPC01***'''
987 1137 if dbSNR > SNRlimit:
988 1138 try:
@@ -1044,54 +1194,23 class FullSpectralAnalysis(Operation):
1044 1194 else:
1045 1195 Fij = xSamples[PointGauCenter] - xSamples[PointFij]
1046 1196
1047 print 'CSPCopt'
1048 print CSPCopt
1049 print 'popt'
1050 print popt
1051 print '#######################################'
1197 # print 'CSPCopt'
1198 # print CSPCopt
1199 # print 'popt'
1200 # print popt
1201 # print '#######################################'
1052 1202 #print 'dataOut.data_param', numpy.shape(data_param)
1053 1203 #print 'dataOut.data_param0', data_param[0,0,Height]
1054 1204 #print 'dataOut.data_param1', data_param[0,1,Height]
1055 1205 #print 'dataOut.data_param2', data_param[0,2,Height]
1056 1206
1057 1207
1058 print 'yMoments', yMoments
1059 print 'Moments', SPCmoments
1060 print 'Fij2 Moment', Fij
1061 #print 'Fij', Fij, 'popt[2]/2',popt[2]/2
1062 print 'Fijcspc',Fijcspc
1063 print '#######################################'
1064
1065
1066 # Range = numpy.empty([3,2])
1067 # GaussCenter = numpy.empty(3)
1068 # FrecRange, VelRange = [[],[],[]],[[],[],[]]
1069 # FrecRange01, FrecRange02, FrecRange12 = numpy.empty(3), numpy.empty(3), numpy.empty(3)
1070 # VelRange01, VelRange02, VelRange12 = numpy.empty(3), numpy.empty(3), numpy.empty(3)
1071 #
1072 # GauWidth = numpy.empty(3)
1073 # ClosRangeMin, ClosRangeMax = numpy.empty(3), numpy.empty(3)
1074 # PointRangeMin, PointRangeMax = numpy.empty(3), numpy.empty(3)
1075 # '''****** Taking frequency ranges from CSPCs ******'''
1076 # for i in range(spc.shape[0]):
1077 #
1078 # GaussCenter[i] = CSPCopt[i][1] #Primer momento 01
1079 # GauWidth[i] = CSPCopt[i][2]*2/2 #Ancho de banda de Gau01
1080 #
1081 # Range[i][0] = GaussCenter[i] - GauWidth[i]
1082 # Range[i][1] = GaussCenter[i] + GauWidth[i]
1083 # #Punto en Eje X de la Gaussiana donde se encuentra ancho de banda (min:max)
1084 # ClosRangeMin[i] = xSamples[numpy.abs(xSamples-Range[i][0]).argmin()]
1085 # ClosRangeMax[i] = xSamples[numpy.abs(xSamples-Range[i][1]).argmin()]
1086 #
1087 # PointRangeMin[i] = numpy.where(xSamples==ClosRangeMin[i])[0][0]
1088 # PointRangeMax[i] = numpy.where(xSamples==ClosRangeMax[i])[0][0]
1089 #
1090 # Range[i]=numpy.array([ PointRangeMin[i], PointRangeMax[i] ])
1091 #
1092 # FrecRange[i] = xFrec[ Range[i][0] : Range[i][1] ]
1093 # VelRange[i] = xVel[ Range[i][0] : Range[i][1] ]
1094
1208 # print 'yMoments', yMoments
1209 # print 'Moments', SPCmoments
1210 # print 'Fij2 Moment', Fij
1211 # #print 'Fij', Fij, 'popt[2]/2',popt[2]/2
1212 # print 'Fijcspc',Fijcspc
1213 # print '#######################################'
1095 1214
1096 1215
1097 1216 '''****** Taking frequency ranges from SPCs ******'''
@@ -1178,9 +1297,9 class FullSpectralAnalysis(Operation):
1178 1297 (cA,cB,cH) = numpy.linalg.solve(WijEijNij, WijResults)
1179 1298
1180 1299 VxVy=numpy.array([[cA,cH],[cH,cB]])
1181
1182 1300 VxVyResults=numpy.array([-cF,-cG])
1183 1301 (Vx,Vy) = numpy.linalg.solve(VxVy, VxVyResults)
1302
1184 1303 #print 'MijResults, cC, PhaseSlope', MijResults, cC, PhaseSlope
1185 1304 #print 'W01,02,12', W01, W02, W12
1186 1305 #print 'WijResult0,1,2',WijResult0, WijResult1, WijResult2, 'Results', WijResults
@@ -1230,7 +1349,7 class FullSpectralAnalysis(Operation):
1230 1349
1231 1350
1232 1351
1233 print 'vzon y vmer', Vzon, Vmer
1352 # print 'vzon y vmer', Vzon, Vmer
1234 1353 return Vzon, Vmer, Vver, GaussCenter, PhaseSlope, FitGaussCSPC
1235 1354
1236 1355 class SpectralMoments(Operation):
@@ -1257,7 +1376,7 class SpectralMoments(Operation):
1257 1376 self.dataOut.noise : Noise level per channel
1258 1377
1259 1378 Affected:
1260 self.dataOut.data_param : Parameters per channel
1379 self.dataOut.moments : Parameters per channel
1261 1380 self.dataOut.data_SNR : SNR per channel
1262 1381
1263 1382 '''
@@ -1274,7 +1393,7 class SpectralMoments(Operation):
1274 1393 for ind in range(nChannel):
1275 1394 data_param[ind,:,:] = self.__calculateMoments( data[ind,:,:] , absc , noise[ind] )
1276 1395
1277 dataOut.data_param = data_param[:,1:,:]
1396 dataOut.moments = data_param[:,1:,:]
1278 1397 dataOut.data_SNR = data_param[:,0]
1279 1398 return
1280 1399
@@ -162,8 +162,7 class SpectraProc(ProcessingUnit):
162 162 self.dataOut.flagNoData = True
163 163 return 0
164 164 else:
165 print 'DATA shape', self.dataIn.data.shape
166 sadsdf
165
167 166 self.buffer[:,self.profIndex,:] = self.dataIn.data.copy()
168 167 self.profIndex += 1
169 168
@@ -1,1 +1,1
1 <Project description="Segundo Test" id="191" name="test01"><ReadUnit datatype="SpectraReader" id="1911" inputId="0" name="SpectraReader"><Operation id="19111" name="run" priority="1" type="self"><Parameter format="str" id="191111" name="datatype" value="SpectraReader" /><Parameter format="str" id="191112" name="path" value="/media/erick/6F60F7113095A154/CLAIRE/CLAIRE_WINDS_2MHZ/DATA/pdatatest/test1024/d2017234" /><Parameter format="date" id="191113" name="startDate" value="2017/08/22" /><Parameter format="date" id="191114" name="endDate" value="2017/08/22" /><Parameter format="time" id="191115" name="startTime" value="02:00:00" /><Parameter format="time" id="191116" name="endTime" value="06:00:00" /><Parameter format="int" id="191118" name="online" value="0" /><Parameter format="int" id="191119" name="walk" value="0" /></Operation><Operation id="19112" name="printInfo" priority="2" type="self" /><Operation id="19113" name="printNumberOfBlock" priority="3" type="self" /></ReadUnit><ProcUnit datatype="Parameters" id="1913" inputId="1912" name="ParametersProc"><Operation id="19131" name="run" priority="1" type="self" /><Operation id="19132" name="SpectralMoments" priority="2" type="other" /><Operation id="19133" name="FullSpectralAnalysis" priority="3" type="other"><Parameter format="float" id="191331" name="SNRlimit" value="-16" /><Parameter format="float" id="191332" name="E01" value="1.500" /><Parameter format="float" id="191333" name="E02" value="1.500" /><Parameter format="float" id="191334" name="E12" value="0" /><Parameter format="float" id="191335" name="N01" value="0.875" /><Parameter format="float" id="191336" name="N02" value="-0.875" /><Parameter format="float" id="191337" name="N12" value="-1.750" /></Operation><Operation id="19134" name="ParamWriter" priority="4" type="other"><Parameter format="str" id="191341" name="path" value="/media/erick/6F60F7113095A154/CLAIRE/CLAIRE_WINDS_2MHZ/DATA/pdatatest/test1024" /><Parameter format="int" id="191342" name="blocksPerFile" value="100" /><Parameter format="list" id="191343" name="metadataList" value="heightList,timeZone,paramInterval" /><Parameter format="list" id="191344" name="dataList" value="data_output,data_SNR,utctime,utctimeInit" /></Operation></ProcUnit><ProcUnit datatype="SpectraProc" id="1912" inputId="1911" name="SpectraProc"><Operation id="19121" name="run" priority="1" type="self"><Parameter format="pairslist" id="191211" name="pairsList" value="(0,1),(0,2),(1,2)" /></Operation><Operation id="19122" name="setRadarFrequency" priority="2" type="self"><Parameter format="float" id="191221" name="frequency" value="445.09e6" /></Operation><Operation id="19123" name="IncohInt" priority="3" type="external"><Parameter format="float" id="191231" name="n" value="5" /></Operation><Operation id="19124" name="SpectraPlot" priority="4" type="external"><Parameter format="int" id="191241" name="id" value="11" /><Parameter format="str" id="191242" name="wintitle" value="SpectraPlot" /><Parameter format="str" id="191243" name="xaxis" value="frequency" /><Parameter format="float" id="191244" name="ymin" value="1" /><Parameter format="int" id="191245" name="ymax" value="5" /><Parameter format="int" id="191246" name="zmin" value="15" /><Parameter format="int" id="191247" name="zmax" value="50" /><Parameter format="int" id="191248" name="save" value="2" /><Parameter format="int" id="191249" name="save" value="5" /><Parameter format="str" id="191250" name="figpath" value="/media/erick/6F60F7113095A154/CLAIRE/CLAIRE_WINDS_2MHZ/Images/FirstResults1024" /></Operation><Operation id="19125" name="CrossSpectraPlot" priority="5" type="other"><Parameter format="int" id="191251" name="id" value="2005" /><Parameter format="str" id="191252" name="wintitle" value="CrossSpectraPlot_ShortPulse" /><Parameter format="str" id="191253" name="xaxis" value="Velocity" /><Parameter format="float" id="191254" name="xmin" value="-10" /><Parameter format="float" id="191255" name="xmax" value="10" /><Parameter format="int" id="191256" name="zmin" value="15" /><Parameter format="int" id="191257" name="zmax" value="50" /><Parameter format="str" id="191258" name="phase_cmap" value="bwr" /><Parameter format="float" id="191259" name="ymin" value="1" /><Parameter format="float" id="191260" name="ymax" value="5" /></Operation></ProcUnit></Project> No newline at end of file
1 <Project description="Segundo Test" id="191" name="test01"><ReadUnit datatype="SpectraReader" id="1911" inputId="0" name="SpectraReader"><Operation id="19111" name="run" priority="1" type="self"><Parameter format="str" id="191111" name="datatype" value="SpectraReader" /><Parameter format="str" id="191112" name="path" value="/media/erick/6F60F7113095A154/CLAIRE/CLAIRE_WINDS_2MHZ/DATA/pdataCLAIRE/Extra" /><Parameter format="date" id="191113" name="startDate" value="2018/02/01" /><Parameter format="date" id="191114" name="endDate" value="2018/02/01" /><Parameter format="time" id="191115" name="startTime" value="17:00:00" /><Parameter format="time" id="191116" name="endTime" value="20:00:00" /><Parameter format="int" id="191118" name="online" value="0" /><Parameter format="int" id="191119" name="walk" value="1" /></Operation><Operation id="19112" name="printInfo" priority="2" type="self" /><Operation id="19113" name="printNumberOfBlock" priority="3" type="self" /></ReadUnit><ProcUnit datatype="Parameters" id="1913" inputId="1912" name="ParametersProc"><Operation id="19131" name="run" priority="1" type="self" /><Operation id="19132" name="SpectralFilters" priority="2" type="other"><Parameter format="float" id="191321" name="Wind_Velocity_Limit" value="2.5" /><Parameter format="float" id="191322" name="Rain_Velocity_Limit" value="1.5" /></Operation><Operation id="19133" name="FullSpectralAnalysis" priority="3" type="other"><Parameter format="float" id="191331" name="SNRlimit" value="-16" /><Parameter format="float" id="191332" name="E01" value="1.500" /><Parameter format="float" id="191333" name="E02" value="1.500" /><Parameter format="float" id="191334" name="E12" value="0" /><Parameter format="float" id="191335" name="N01" value="0.875" /><Parameter format="float" id="191336" name="N02" value="-0.875" /><Parameter format="float" id="191337" name="N12" value="-1.750" /></Operation><Operation id="19134" name="WindProfilerPlot" priority="4" type="other"><Parameter format="int" id="191341" name="id" value="4" /><Parameter format="str" id="191342" name="wintitle" value="Wind Profiler" /><Parameter format="float" id="191343" name="xmin" value="17" /><Parameter format="float" id="191344" name="xmax" value="20" /><Parameter format="float" id="191345" name="ymin" value="0" /><Parameter format="int" id="191346" name="ymax" value="8" /><Parameter format="float" id="191347" name="zmin" value="-20" /><Parameter format="float" id="191348" name="zmax" value="20" /><Parameter format="float" id="191349" name="SNRmin" value="-20" /><Parameter format="float" id="191350" name="SNRmax" value="20" /><Parameter format="float" id="191351" name="zmin_ver" value="-200" /><Parameter format="float" id="191352" name="zmax_ver" value="200" /><Parameter format="float" id="191353" name="SNRthresh" value="-20" /><Parameter format="int" id="191354" name="save" value="1" /><Parameter format="str" id="191355" name="figpath" value="/media/erick/6F60F7113095A154/CLAIRE/CLAIRE_WINDS_2MHZ/DATA/pdataCLAIRE/Extra" /></Operation><Operation id="19135" name="PrecipitationProc" priority="5" type="other" /><Operation id="19136" name="ParametersPlot" priority="6" type="other"><Parameter format="int" id="191361" name="id" value="10" /><Parameter format="str" id="191362" name="wintitle" value="First_gg" /><Parameter format="int" id="191363" name="zmin" value="-20" /><Parameter format="int" id="191364" name="zmax" value="60" /><Parameter format="int" id="191365" name="ymin" value="0" /><Parameter format="int" id="191366" name="ymax" value="8" /><Parameter format="int" id="191367" name="xmin" value="17" /><Parameter format="int" id="191368" name="xmax" value="20" /><Parameter format="int" id="191369" name="save" value="1" /><Parameter format="str" id="191370" name="figpath" value="/media/erick/6F60F7113095A154/CLAIRE/CLAIRE_WINDS_2MHZ/DATA/pdataCLAIRE/Extra" /></Operation><Operation id="19137" name="ParamWriter" priority="7" type="other"><Parameter format="str" id="191371" name="path" value="/media/erick/6F60F7113095A154/CLAIRE/CLAIRE_WINDS_2MHZ/DATA/pdatatest/test1024" /><Parameter format="int" id="191372" name="blocksPerFile" value="100" /><Parameter format="list" id="191373" name="metadataList" value="heightList,timeZone,paramInterval" /><Parameter format="list" id="191374" name="dataList" value="data_output,data_SNR,utctime,utctimeInit" /></Operation></ProcUnit><ProcUnit datatype="SpectraProc" id="1912" inputId="1911" name="SpectraProc"><Operation id="19121" name="run" priority="1" type="self" /><Operation id="19122" name="setRadarFrequency" priority="2" type="self"><Parameter format="float" id="191221" name="frequency" value="445.09e6" /></Operation></ProcUnit></Project> No newline at end of file
@@ -7,8 +7,8 if __name__ == '__main__':
7 7 desc = "Segundo Test"
8 8 filename = "schain.xml"
9 9
10 pathW='/media/erick/6F60F7113095A154/CLAIRE/CLAIRE_WINDS_2MHZ/DATA/pdatatest/test1024'
11 figpath = '/media/erick/6F60F7113095A154/CLAIRE/CLAIRE_WINDS_2MHZ/Images/test1024'
10 pathW='/media/erick/6F60F7113095A154/CLAIRE/CLAIRE_WINDS_2MHZ/DATA/pdataCLAIRE/Extra'
11 figpath = '/media/erick/6F60F7113095A154/CLAIRE/CLAIRE_WINDS_2MHZ/DATA/pdataCLAIRE/Extra'
12 12
13 13 controllerObj = Project()
14 14
@@ -17,10 +17,10 if __name__ == '__main__':
17 17 readUnitConfObj = controllerObj.addReadUnit(datatype='VoltageReader',
18 18 path='/media/erick/6F60F7113095A154/CLAIRE/CLAIRE_WINDS_2MHZ/DATA/',
19 19 #path='/home/erick/Documents/Data/Claire_Data/raw',
20 startDate='2017/08/22',
21 endDate='2017/08/22',
22 startTime='01:00:00',
23 endTime='06:00:00',
20 startDate='2018/02/01',
21 endDate='2018/02/01',
22 startTime='12:00:00',
23 endTime='20:00:00',
24 24 online=0,
25 25 walk=1)
26 26
@@ -54,8 +54,8 if __name__ == '__main__':
54 54 opObj10 = procUnitConfObj0.addOperation(name='setRadarFrequency')
55 55 opObj10.addParameter(name='frequency', value='445.09e6', format='float')
56 56
57 #opObj10 = procUnitConfObj0.addOperation(name='CohInt', optype='external')
58 #opObj10.addParameter(name='n', value='1', format='float')
57 opObj10 = procUnitConfObj0.addOperation(name='CohInt', optype='external')
58 opObj10.addParameter(name='n', value='2', format='float')
59 59
60 60 #opObj10 = procUnitConfObj0.addOperation(name='selectHeights')
61 61 #opObj10.addParameter(name='minHei', value='1', format='float')
@@ -71,13 +71,13 if __name__ == '__main__':
71 71 # Creating a processing object with its parameters
72 72 # schainpy.model.proc.jroproc_spectra.SpectraProc.run()
73 73 # If you need to add more parameters can use the "addParameter method"
74 procUnitConfObj1.addParameter(name='nFFTPoints', value='1024', format='int')
74 procUnitConfObj1.addParameter(name='nFFTPoints', value='256', format='int')
75 75
76 76
77 77 opObj10 = procUnitConfObj1.addOperation(name='removeDC')
78 78 #opObj10 = procUnitConfObj1.addOperation(name='removeInterference')
79 #opObj10 = procUnitConfObj1.addOperation(name='IncohInt', optype='external')
80 #opObj10.addParameter(name='n', value='30', format='float')
79 opObj10 = procUnitConfObj1.addOperation(name='IncohInt', optype='external')
80 opObj10.addParameter(name='n', value='10', format='float')
81 81
82 82
83 83
@@ -151,9 +151,10 if __name__ == '__main__':
151 151 opObj11.addParameter(name='ymax', value='7', format='int')
152 152 opObj11.addParameter(name='showprofile', value='1', format='int')
153 153 # opObj11.addParameter(name='timerange', value=str(5*60*60*60), format='int')
154 opObj11.addParameter(name='xmin', value='1', format='float')
155 opObj11.addParameter(name='xmax', value='6', format='float')
154 #opObj11.addParameter(name='xmin', value='1', format='float')
155 #opObj11.addParameter(name='xmax', value='6', format='float')
156 156 opObj11.addParameter(name='save', value='1', format='int')
157 opObj11.addParameter(name='figpath', value=figpath, format='str')
157 158
158 159
159 160 # '''#########################################################################################'''
General Comments 0
You need to be logged in to leave comments. Login now