##// END OF EJS Templates
last commit
avaldezp -
r1416:4590ae2fa232
parent child
Show More
@@ -0,0 +1,14
1 import numpy
2 a= numpy.array([0,1,2,3,4,5,10,11,12,18,19,20,21,22,23,24,25,26,27,28])
3 print(a)
4 list=[]
5 list2=[]
6 for i in reversed(range(1,len(a))):
7 dif=int(a[i])-int(a[i-1])
8 print(i,a[i],dif )
9 if dif>1:
10 list.append(i-1)
11 list2.append(dif-1)
12 print("result")
13 print(list)
14 print(list2)
@@ -0,0 +1,44
1 #!/usr/bin/python
2
3 from schainpy.controller import Project
4
5 path ="/home/soporte/Downloads/"
6
7 prj = Project()
8
9 read_unit = prj.addReadUnit(
10 datatype='Spectra',
11 path=path,
12 startDate='2013/01/01',
13 endDate='2013/12/31',
14 startTime='00:00:00',
15 endTime='23:59:59',
16 online=0,
17 walk=0
18 )
19
20 proc_unit = prj.addProcUnit(
21 datatype='Spectra',
22 inputId=read_unit.getId()
23 )
24
25
26 op = proc_unit.addOperation(name='IncohInt')
27 op.addParameter(name='n', value='2')
28
29 op = proc_unit.addOperation(name='selectChannels')
30 op.addParameter(name='channelList', value='0,1')
31
32 op = proc_unit.addOperation(name='selectHeights')
33 op.addParameter(name='minHei', value='80')
34 op.addParameter(name='maxHei', value='200')
35
36 #op = proc_unit.addOperation(name='removeDC')
37
38 op = proc_unit.addOperation(name='SpectraPlot')
39 op.addParameter(name='wintitle', value='Spectra', format='str')
40
41 op = proc_unit.addOperation(name='RTIPlot')
42 op.addParameter(name='wintitle', value='RTI', format='str')
43
44 prj.start()
@@ -0,0 +1,55
1 #!/usr/bin/python
2
3 from schainpy.controller import Project
4
5 path ="/home/soporte/Downloads/"
6
7 prj = Project()
8
9 read_unit = prj.addReadUnit(
10 datatype='Voltage',
11 path=path,
12 startDate='2015/01/01',
13 endDate='2015/12/31',
14 startTime='00:00:00',
15 endTime='23:59:59',
16 online=0,
17 walk=0
18 )
19
20 proc_unit1 = prj.addProcUnit(
21 datatype='Voltage',
22 inputId=read_unit.getId()
23 )
24
25 #op = proc_unit1.addOperation(name='ProfileSelector')
26 #op.addParameter( name='rangeList', value="(0,19),(100,119)")
27
28 op = proc_unit1.addOperation(name='MyAverage')
29 op.addParameter(name='n', value='10')
30
31 #op = proc_unit1.addOperation(name='CohInt')
32 #op.addParameter(name='n', value='10')
33
34 #op = proc_unit1.addOperation(name='Decoder')
35 #op.addParameter(name='times', value='10')
36
37
38 op = proc_unit1.addOperation(name='ScopePlot')
39 op.addParameter(name='wintitle', value='Scope', format='str')
40
41 '''
42 proc_unit2 = prj.addProcUnit(
43 datatype='Spectra',
44 inputId=proc_unit1.getId()
45 )
46 proc_unit2.addParameter(name='nFFTPoints', value='64')
47
48
49 op = proc_unit2.addOperation(name='SpectraPlot')
50 op.addParameter(name='wintitle', value='Spectra', format='str')
51
52 op = proc_unit2.addOperation(name='RTIPlot')
53 op.addParameter(name='wintitle', value='RTI', format='str')
54 '''
55 prj.start()
@@ -357,6 +357,8 class HDFWriter(Operation):
357 last_Azipos = None
357 last_Azipos = None
358 last_Elepos = None
358 last_Elepos = None
359 mode = None
359 mode = None
360 #-----------------------
361 Typename = None
360
362
361
363
362
364
@@ -365,6 +367,17 class HDFWriter(Operation):
365 Operation.__init__(self)
367 Operation.__init__(self)
366 return
368 return
367
369
370
371 def set_kwargs(self, **kwargs):
372
373 for key, value in kwargs.items():
374 setattr(self, key, value)
375
376 def set_kwargs_obj(self,obj, **kwargs):
377
378 for key, value in kwargs.items():
379 setattr(obj, key, value)
380
368 def generalFlag(self):
381 def generalFlag(self):
369 ####rint("GENERALFLAG")
382 ####rint("GENERALFLAG")
370 if self.mode== "weather":
383 if self.mode== "weather":
@@ -381,13 +394,21 class HDFWriter(Operation):
381 flag = True
394 flag = True
382 return flag
395 return flag
383
396
384 def setup(self, path=None, blocksPerFile=10, metadataList=None, dataList=None, setType=None, description=None):
397 def setup(self, path=None, blocksPerFile=10, metadataList=None, dataList=None, setType=None, description=None,type_data=None,**kwargs):
385 self.path = path
398 self.path = path
386 self.blocksPerFile = blocksPerFile
399 self.blocksPerFile = blocksPerFile
387 self.metadataList = metadataList
400 self.metadataList = metadataList
388 self.dataList = [s.strip() for s in dataList]
401 self.dataList = [s.strip() for s in dataList]
389 self.setType = setType
402 if self.mode == "weather":
403 self.setType = "weather"
404 #----------------------------------------
405 self.set_kwargs(**kwargs)
406 self.set_kwargs_obj(self.dataOut,**kwargs)
407 #print("-----------------------------------------------------------",self.Typename)
408 #print("hola",self.ContactInformation)
409
390 self.description = description
410 self.description = description
411 self.type_data=type_data
391
412
392 if self.metadataList is None:
413 if self.metadataList is None:
393 self.metadataList = self.dataOut.metadata_list
414 self.metadataList = self.dataOut.metadata_list
@@ -443,14 +464,16 class HDFWriter(Operation):
443 return False
464 return False
444
465
445 def run(self, dataOut, path, blocksPerFile=10, metadataList=None,
466 def run(self, dataOut, path, blocksPerFile=10, metadataList=None,
446 dataList=[], setType=None, description={},mode= None):
467 dataList=[], setType=None, description={},mode= None,type_data=None,**kwargs):
447
468
469 ###print("VOY A ESCRIBIR----------------------")
470 #print("CHECKTHIS------------------------------------------------------------------*****---",**kwargs)
448 self.dataOut = dataOut
471 self.dataOut = dataOut
449 self.mode = mode
472 self.mode = mode
450 if not(self.isConfig):
473 if not(self.isConfig):
451 self.setup(path=path, blocksPerFile=blocksPerFile,
474 self.setup(path=path, blocksPerFile=blocksPerFile,
452 metadataList=metadataList, dataList=dataList,
475 metadataList=metadataList, dataList=dataList,
453 setType=setType, description=description)
476 setType=setType, description=description,type_data=type_data,**kwargs)
454
477
455 self.isConfig = True
478 self.isConfig = True
456 self.setNextFile()
479 self.setNextFile()
@@ -459,10 +482,11 class HDFWriter(Operation):
459 return
482 return
460
483
461 def setNextFile(self):
484 def setNextFile(self):
462
485 ###print("HELLO WORLD--------------------------------")
463 ext = self.ext
486 ext = self.ext
464 path = self.path
487 path = self.path
465 setFile = self.setFile
488 setFile = self.setFile
489 type_data = self.type_data
466
490
467 timeTuple = time.localtime(self.dataOut.utctime)
491 timeTuple = time.localtime(self.dataOut.utctime)
468 subfolder = 'd%4.4d%3.3d' % (timeTuple.tm_year,timeTuple.tm_yday)
492 subfolder = 'd%4.4d%3.3d' % (timeTuple.tm_year,timeTuple.tm_yday)
@@ -487,6 +511,7 class HDFWriter(Operation):
487 os.makedirs(fullpath)
511 os.makedirs(fullpath)
488 setFile = -1 #inicializo mi contador de seteo
512 setFile = -1 #inicializo mi contador de seteo
489
513
514 ###print("**************************",self.setType)
490 if self.setType is None:
515 if self.setType is None:
491 setFile += 1
516 setFile += 1
492 file = '%s%4.4d%3.3d%03d%s' % (self.optchar,
517 file = '%s%4.4d%3.3d%03d%s' % (self.optchar,
@@ -494,6 +519,35 class HDFWriter(Operation):
494 timeTuple.tm_yday,
519 timeTuple.tm_yday,
495 setFile,
520 setFile,
496 ext )
521 ext )
522 elif self.setType == "weather":
523 print("HOLA AMIGOS")
524 wr_exp = self.dataOut.wr_exp
525 if wr_exp== "PPI":
526 wr_type = 'E'
527 ang_ = numpy.mean(self.dataOut.elevation)
528 else:
529 wr_type = 'A'
530 ang_ = numpy.mean(self.dataOut.azimuth)
531
532 wr_writer = '%s%s%2.1f%s'%('-',
533 wr_type,
534 ang_,
535 '-')
536 ###print("wr_writer********************",wr_writer)
537 file = '%s%4.4d%2.2d%2.2d%s%2.2d%2.2d%2.2d%s%s%s' % (self.optchar,
538 timeTuple.tm_year,
539 timeTuple.tm_mon,
540 timeTuple.tm_mday,
541 '-',
542 timeTuple.tm_hour,
543 timeTuple.tm_min,
544 timeTuple.tm_sec,
545 wr_writer,
546 type_data,
547 ext )
548 ###print("FILENAME", file)
549
550
497 else:
551 else:
498 setFile = timeTuple.tm_hour*60+timeTuple.tm_min
552 setFile = timeTuple.tm_hour*60+timeTuple.tm_min
499 file = '%s%4.4d%3.3d%04d%s' % (self.optchar,
553 file = '%s%4.4d%3.3d%04d%s' % (self.optchar,
@@ -505,6 +559,7 class HDFWriter(Operation):
505 self.filename = os.path.join( path, subfolder, file )
559 self.filename = os.path.join( path, subfolder, file )
506
560
507 #Setting HDF5 File
561 #Setting HDF5 File
562
508 self.fp = h5py.File(self.filename, 'w')
563 self.fp = h5py.File(self.filename, 'w')
509 #write metadata
564 #write metadata
510 self.writeMetadata(self.fp)
565 self.writeMetadata(self.fp)
@@ -615,7 +670,7 class HDFWriter(Operation):
615 return
670 return
616
671
617 def putData(self):
672 def putData(self):
618 ####print("**************************PUT DATA***************************************************")
673 ###print("**************************PUT DATA***************************************************")
619 if (self.blockIndex == self.blocksPerFile) or self.timeFlag() or self.generalFlag():
674 if (self.blockIndex == self.blocksPerFile) or self.timeFlag() or self.generalFlag():
620 self.closeFile()
675 self.closeFile()
621 self.setNextFile()
676 self.setNextFile()
@@ -3913,11 +3913,12 class WeatherRadar(Operation):
3913 Parameters affected:
3913 Parameters affected:
3914 '''
3914 '''
3915 isConfig = False
3915 isConfig = False
3916 variableList = None
3916
3917
3917 def __init__(self):
3918 def __init__(self):
3918 Operation.__init__(self)
3919 Operation.__init__(self)
3919
3920
3920 def setup(self,dataOut,Pt=0,Gt=0,Gr=0,lambda_=0, aL=0,
3921 def setup(self,dataOut,variableList= None,Pt=0,Gt=0,Gr=0,lambda_=0, aL=0,
3921 tauW= 0,thetaT=0,thetaR=0,Km =0):
3922 tauW= 0,thetaT=0,thetaR=0,Km =0):
3922 self.nCh = dataOut.nChannels
3923 self.nCh = dataOut.nChannels
3923 self.nHeis = dataOut.nHeights
3924 self.nHeis = dataOut.nHeights
@@ -3938,9 +3939,7 class WeatherRadar(Operation):
3938 Numerator = ((4*numpy.pi)**3 * aL**2 * 16 *numpy.log(2))
3939 Numerator = ((4*numpy.pi)**3 * aL**2 * 16 *numpy.log(2))
3939 Denominator = (Pt * Gt * Gr * lambda_**2 * SPEED_OF_LIGHT * tauW * numpy.pi*thetaT*thetaR)
3940 Denominator = (Pt * Gt * Gr * lambda_**2 * SPEED_OF_LIGHT * tauW * numpy.pi*thetaT*thetaR)
3940 self.RadarConstant = Numerator/Denominator
3941 self.RadarConstant = Numerator/Denominator
3941 '''-----------2 Reflectividad del Radar y Factor de Reflectividad------'''
3942 self.variableList= variableList
3942 self.n_radar = numpy.zeros((self.nCh,self.nHeis))
3943 self.Z_radar = numpy.zeros((self.nCh,self.nHeis))
3944
3943
3945 def setMoments(self,dataOut,i):
3944 def setMoments(self,dataOut,i):
3946
3945
@@ -3960,19 +3959,48 class WeatherRadar(Operation):
3960 data_param[:,2,:] = dataOut.data_WIDTH
3959 data_param[:,2,:] = dataOut.data_WIDTH
3961 data_param[:,3,:] = dataOut.data_SNR
3960 data_param[:,3,:] = dataOut.data_SNR
3962
3961
3963 return data_param[:,i,:]
3962 return data_param[:,i,:]
3964
3963
3964 def getCoeficienteCorrelacionROhv_R(self.dataOut):
3965 type = dataOut.inputUnit
3966 nHeis = dataOut.nHeights
3967 data_RhoHV_R = numpy.zeros((nHeis))
3968 if type == "Voltage":
3969 powa = dataOut.dataPP_POWER[0]
3970 powb = dataOut.dataPP_POWER[1]
3971 ccf = dataOut.dataPP_CCF
3972 avgcoherenceComplex = ccf / numpy.sqrt(powa * powb)
3973 data_RhoHV_R = numpy.abs(avgcoherenceComplex)
3974 if type == "Spectra":
3975 data_RhoHV_R = dataOut.getCoherence()
3965
3976
3966 def run(self,dataOut,Pt=25,Gt=200.0,Gr=50.0,lambda_=0.32, aL=2.5118,
3977 return data_RhoHV_R
3967 tauW= 4.0e-6,thetaT=0.165,thetaR=0.367,Km =0.93):
3968
3978
3969 if not self.isConfig:
3979 def getFasediferencialPhiD_P(self.dataOut,phase= True):
3970 self.setup(dataOut= dataOut,Pt=25,Gt=200.0,Gr=50.0,lambda_=0.32, aL=2.5118,
3980 type = dataOut.inputUnit
3971 tauW= 4.0e-6,thetaT=0.165,thetaR=0.367,Km =0.93)
3981 nHeis = dataOut.nHeights
3972 self.isConfig = True
3982 data_PhiD_P = numpy.zeros((nHeis))
3983 if type == "Voltage":
3984 powa = dataOut.dataPP_POWER[0]
3985 powb = dataOut.dataPP_POWER[1]
3986 ccf = dataOut.dataPP_CCF
3987 avgcoherenceComplex = ccf / numpy.sqrt(powa * powb)
3988 if phase:
3989 data_PhiD_P = numpy.arctan2(avgcoherenceComplex.imag,
3990 avgcoherenceComplex.real) * 180 / numpy.pi
3991 if type == "Spectra":
3992 data_PhiD_P = dataOut.getCoherence(phase = phase)
3993
3994 return data_PhiD_P
3995
3996 def getReflectividad_D(self,dataOut):
3973 '''-----------------------------Potencia de Radar -Signal S-----------------------------'''
3997 '''-----------------------------Potencia de Radar -Signal S-----------------------------'''
3998
3974 Pr = self.setMoments(dataOut,0)
3999 Pr = self.setMoments(dataOut,0)
3975
4000
4001 '''-----------2 Reflectividad del Radar y Factor de Reflectividad------'''
4002 self.n_radar = numpy.zeros((self.nCh,self.nHeis))
4003 self.Z_radar = numpy.zeros((self.nCh,self.nHeis))
3976 for R in range(self.nHeis):
4004 for R in range(self.nHeis):
3977 self.n_radar[:,R] = self.RadarConstant*Pr[:,R]* (self.Range[:,R])**2
4005 self.n_radar[:,R] = self.RadarConstant*Pr[:,R]* (self.Range[:,R])**2
3978
4006
@@ -3981,10 +4009,37 class WeatherRadar(Operation):
3981 '''----------- Factor de Reflectividad Equivalente lamda_ < 10 cm , lamda_= 3.2cm-------'''
4009 '''----------- Factor de Reflectividad Equivalente lamda_ < 10 cm , lamda_= 3.2cm-------'''
3982 Zeh = self.Z_radar
4010 Zeh = self.Z_radar
3983 dBZeh = 10*numpy.log10(Zeh)
4011 dBZeh = 10*numpy.log10(Zeh)
3984 dataOut.factor_Zeh= dBZeh
4012 Zdb_D = dBZeh[0] - dBZeh[1]
3985 self.n_radar = numpy.zeros((self.nCh,self.nHeis))
4013 return Zdb_D
3986 self.Z_radar = numpy.zeros((self.nCh,self.nHeis))
4014
4015 def getRadialVelocity_V(self,dataOut):
4016 velRadial_V = self.setMoments(dataOut,1)
4017 return velRadial_V
4018
4019 def getAnchoEspectral_W(self,dataOut):
4020 Sigmav_W = self.setMoments(dataOut,2)
4021 return Sigmav_W
4022
4023
4024 def run(self,dataOut,variableList=None,Pt=25,Gt=200.0,Gr=50.0,lambda_=0.32, aL=2.5118,
4025 tauW= 4.0e-6,thetaT=0.165,thetaR=0.367,Km =0.93):
3987
4026
4027 if not self.isConfig:
4028 self.setup(dataOut= dataOut,variableList=None,Pt=25,Gt=200.0,Gr=50.0,lambda_=0.32, aL=2.5118,
4029 tauW= 4.0e-6,thetaT=0.165,thetaR=0.367,Km =0.93)
4030 self.isConfig = True
4031
4032 for i in range(len(self.variableList)):
4033 if self.variableList[i]=='ReflectividadDiferencial':
4034 dataOut.Zdb_D =self.getReflectividad_D(dataOut=dataOut)
4035 if self.variableList[i]=='FaseDiferencial':
4036 dataOut.PhiD_P =self.getFasediferencialPhiD_P(dataOut=dataOut, phase=True)
4037 if self.variableList[i] == "CoeficienteCorrelacion":
4038 dataOut.RhoHV_R = self.getCoeficienteCorrelacionROhv_R(dataOut)
4039 if self.variableList[i] =="VelocidadRadial":
4040 dataOut.velRadial_V = self.getRadialVelocity_V(dataOut)
4041 if self.variableList[i] =="AnchoEspectral":
4042 dataOut.Sigmav_W = self.getAnchoEspectral_W(dataOut)
3988 return dataOut
4043 return dataOut
3989
4044
3990 class PedestalInformation(Operation):
4045 class PedestalInformation(Operation):
@@ -4015,7 +4070,7 class PedestalInformation(Operation):
4015 utc_ped_list.append(self.gettimeutcfromDirFilename(path=self.path_ped,file=list_pedestal[i]))
4070 utc_ped_list.append(self.gettimeutcfromDirFilename(path=self.path_ped,file=list_pedestal[i]))
4016
4071
4017 nro_file,utc_ped,utc_ped_1 =self.getNROFile(utc_adq,utc_ped_list)
4072 nro_file,utc_ped,utc_ped_1 =self.getNROFile(utc_adq,utc_ped_list)
4018
4073 ###print("NROFILE************************************", nro_file)
4019 if nro_file < 0:
4074 if nro_file < 0:
4020 return numpy.NaN,numpy.NaN
4075 return numpy.NaN,numpy.NaN
4021 else:
4076 else:
@@ -4092,7 +4147,7 class PedestalInformation(Operation):
4092 c=0
4147 c=0
4093 #print(utc_adq)
4148 #print(utc_adq)
4094 #print(len(utc_ped_list))
4149 #print(len(utc_ped_list))
4095 #print(utc_ped_list)
4150 ###print(utc_ped_list)
4096 for i in range(len(utc_ped_list)):
4151 for i in range(len(utc_ped_list)):
4097 if utc_adq>utc_ped_list[i]:
4152 if utc_adq>utc_ped_list[i]:
4098 #print("mayor")
4153 #print("mayor")
@@ -4111,11 +4166,13 class PedestalInformation(Operation):
4111 pass
4166 pass
4112
4167
4113 #def setup(self,dataOut,path_ped,path_adq,t_Interval_p,n_Muestras_p,blocksPerfile,f_a_p,online):
4168 #def setup(self,dataOut,path_ped,path_adq,t_Interval_p,n_Muestras_p,blocksPerfile,f_a_p,online):
4114 def setup(self,dataOut,path_ped,t_Interval_p):
4169 def setup(self,dataOut,path_ped,t_Interval_p,wr_exp):
4115 self.__dataReady = False
4170 self.__dataReady = False
4116 self.path_ped = path_ped
4171 self.path_ped = path_ped
4117 self.t_Interval_p = t_Interval_p
4172 self.t_Interval_p = t_Interval_p
4118 self.list_pedestal = self.getfirstFilefromPath(path=self.path_ped,meta="PE",ext=".hdf5")
4173 self.list_pedestal = self.getfirstFilefromPath(path=self.path_ped,meta="PE",ext=".hdf5")
4174 dataOut.wr_exp = wr_exp
4175
4119
4176
4120 def setNextFileP(self,dataOut):
4177 def setNextFileP(self,dataOut):
4121 pass
4178 pass
@@ -4129,17 +4186,20 class PedestalInformation(Operation):
4129 def setNextFileonline(self):
4186 def setNextFileonline(self):
4130 pass
4187 pass
4131
4188
4132 def run(self, dataOut,path_ped,t_Interval_p):
4189 def run(self, dataOut,path_ped,t_Interval_p,wr_exp):
4190 ###print("INTEGRATION -----")
4133 if not self.isConfig:
4191 if not self.isConfig:
4134 self.setup(dataOut, path_ped,t_Interval_p)
4192 self.setup(dataOut, path_ped,t_Interval_p,wr_exp)
4135 self.__dataReady = True
4193 self.__dataReady = True
4136 self.isConfig = True
4194 self.isConfig = True
4137 #print("config TRUE")
4195 #print("config TRUE")
4138 utc_adq = dataOut.utctime
4196 utc_adq = dataOut.utctime
4139 ####print("utc_adq---------------",utc_adq)
4197 ###print("utc_adq---------------",utc_adq)
4198
4140 list_pedestal = self.list_pedestal
4199 list_pedestal = self.list_pedestal
4200 #print("list_pedestal",list_pedestal)
4141 angulo,angulo_ele = self.getAnguloProfile(utc_adq=utc_adq,list_pedestal=list_pedestal)
4201 angulo,angulo_ele = self.getAnguloProfile(utc_adq=utc_adq,list_pedestal=list_pedestal)
4142 ####print("angulo**********",angulo)
4202 ###print("angulo**********",angulo)
4143 dataOut.flagNoData = False
4203 dataOut.flagNoData = False
4144 if numpy.isnan(angulo) or numpy.isnan(angulo_ele) :
4204 if numpy.isnan(angulo) or numpy.isnan(angulo_ele) :
4145 dataOut.flagNoData = True
4205 dataOut.flagNoData = True
@@ -4200,6 +4260,8 class Block360(Operation):
4200 self.__buffer3 = numpy.zeros(n)
4260 self.__buffer3 = numpy.zeros(n)
4201
4261
4202
4262
4263
4264
4203 def putData(self,data,mode):
4265 def putData(self,data,mode):
4204 '''
4266 '''
4205 Add a profile to he __buffer and increase in one the __profiel Index
4267 Add a profile to he __buffer and increase in one the __profiel Index
@@ -1377,6 +1377,8 class PulsePair(Operation):
1377 pair0 = self.__buffer*numpy.conj(self.__buffer)
1377 pair0 = self.__buffer*numpy.conj(self.__buffer)
1378 pair0 = pair0.real
1378 pair0 = pair0.real
1379 lag_0 = numpy.sum(pair0,1)
1379 lag_0 = numpy.sum(pair0,1)
1380 #-----------------Calculo de Cscp------------------------------ New
1381 cspc_pair01 = self.__buffer[0]*__self.buffer[1]
1380 #------------------Calculo de Ruido x canal--------------------
1382 #------------------Calculo de Ruido x canal--------------------
1381 self.noise = numpy.zeros(self.__nch)
1383 self.noise = numpy.zeros(self.__nch)
1382 for i in range(self.__nch):
1384 for i in range(self.__nch):
@@ -1391,7 +1393,9 class PulsePair(Operation):
1391 #------------------ P= S+N ,P=lag_0/N ---------------------------------
1393 #------------------ P= S+N ,P=lag_0/N ---------------------------------
1392 #-------------------- Power --------------------------------------------------
1394 #-------------------- Power --------------------------------------------------
1393 data_power = lag_0/(self.n*self.nCohInt)
1395 data_power = lag_0/(self.n*self.nCohInt)
1394 #------------------ Senal ---------------------------------------------------
1396 #--------------------CCF------------------------------------------------------
1397 data_ccf =numpy.sum(cspc_pair01,axis=0)/(self.n*self.nCohInt)
1398 #------------------ Senal --------------------------------------------------
1395 data_intensity = pair0 - noise_buffer
1399 data_intensity = pair0 - noise_buffer
1396 data_intensity = numpy.sum(data_intensity,axis=1)*(self.n*self.nCohInt)#*self.nCohInt)
1400 data_intensity = numpy.sum(data_intensity,axis=1)*(self.n*self.nCohInt)#*self.nCohInt)
1397 #data_intensity = (lag_0-self.noise*self.n)*(self.n*self.nCohInt)
1401 #data_intensity = (lag_0-self.noise*self.n)*(self.n*self.nCohInt)
@@ -1431,7 +1435,7 class PulsePair(Operation):
1431
1435
1432 self.__buffer = numpy.zeros((self.__nch, self.__nProf,self.__nHeis), dtype='complex')
1436 self.__buffer = numpy.zeros((self.__nch, self.__nProf,self.__nHeis), dtype='complex')
1433 self.__profIndex = 0
1437 self.__profIndex = 0
1434 return data_power,data_intensity,data_velocity,data_snrPP,data_specwidth,n
1438 return data_power,data_intensity,data_velocity,data_snrPP,data_specwidth,data_ccf,n
1435
1439
1436
1440
1437 def pulsePairbyProfiles(self,dataOut):
1441 def pulsePairbyProfiles(self,dataOut):
@@ -1442,19 +1446,20 class PulsePair(Operation):
1442 data_velocity = None
1446 data_velocity = None
1443 data_specwidth = None
1447 data_specwidth = None
1444 data_snrPP = None
1448 data_snrPP = None
1449 data_ccf = None
1445 self.putData(data=dataOut.data)
1450 self.putData(data=dataOut.data)
1446 if self.__profIndex == self.n:
1451 if self.__profIndex == self.n:
1447 data_power,data_intensity, data_velocity,data_snrPP,data_specwidth, n = self.pushData(dataOut=dataOut)
1452 data_power,data_intensity, data_velocity,data_snrPP,data_specwidth,data_ccf, n = self.pushData(dataOut=dataOut)
1448 self.__dataReady = True
1453 self.__dataReady = True
1449
1454
1450 return data_power, data_intensity, data_velocity, data_snrPP, data_specwidth
1455 return data_power, data_intensity, data_velocity, data_snrPP,data_specwidth,data_ccf
1451
1456
1452
1457
1453 def pulsePairOp(self, dataOut, datatime= None):
1458 def pulsePairOp(self, dataOut, datatime= None):
1454
1459
1455 if self.__initime == None:
1460 if self.__initime == None:
1456 self.__initime = datatime
1461 self.__initime = datatime
1457 data_power, data_intensity, data_velocity, data_snrPP, data_specwidth = self.pulsePairbyProfiles(dataOut)
1462 data_power, data_intensity, data_velocity, data_snrPP,data_specwidth,data_ccf = self.pulsePairbyProfiles(dataOut)
1458 self.__lastdatatime = datatime
1463 self.__lastdatatime = datatime
1459
1464
1460 if data_power is None:
1465 if data_power is None:
@@ -1464,23 +1469,25 class PulsePair(Operation):
1464 deltatime = datatime - self.__lastdatatime
1469 deltatime = datatime - self.__lastdatatime
1465 self.__initime = datatime
1470 self.__initime = datatime
1466
1471
1467 return data_power, data_intensity, data_velocity, data_snrPP, data_specwidth, avgdatatime
1472 return data_power, data_intensity, data_velocity, data_snrPP,data_specwidth,data_ccf, avgdatatime
1468
1473
1469 def run(self, dataOut,n = None,removeDC= False, overlapping= False,**kwargs):
1474 def run(self, dataOut,n = None,removeDC= False, overlapping= False,**kwargs):
1470
1475
1471 if not self.isConfig:
1476 if not self.isConfig:
1472 self.setup(dataOut = dataOut, n = n , removeDC=removeDC , **kwargs)
1477 self.setup(dataOut = dataOut, n = n , removeDC=removeDC , **kwargs)
1473 self.isConfig = True
1478 self.isConfig = True
1474 data_power, data_intensity, data_velocity,data_snrPP,data_specwidth, avgdatatime = self.pulsePairOp(dataOut, dataOut.utctime)
1479 data_power, data_intensity, data_velocity,data_snrPP,data_specwidth,data_ccf, avgdatatime = self.pulsePairOp(dataOut, dataOut.utctime)
1475 dataOut.flagNoData = True
1480 dataOut.flagNoData = True
1476
1481
1477 if self.__dataReady:
1482 if self.__dataReady:
1483 ###print("READY ----------------------------------")
1478 dataOut.nCohInt *= self.n
1484 dataOut.nCohInt *= self.n
1479 dataOut.dataPP_POW = data_intensity # S
1485 dataOut.dataPP_POW = data_intensity # S
1480 dataOut.dataPP_POWER = data_power # P valor que corresponde a POTENCIA MOMENTO
1486 dataOut.dataPP_POWER = data_power # P valor que corresponde a POTENCIA MOMENTO
1481 dataOut.dataPP_DOP = data_velocity
1487 dataOut.dataPP_DOP = data_velocity
1482 dataOut.dataPP_SNR = data_snrPP
1488 dataOut.dataPP_SNR = data_snrPP
1483 dataOut.dataPP_WIDTH = data_specwidth
1489 dataOut.dataPP_WIDTH = data_specwidth
1490 dataOut.dataPP_CCF = data_ccf
1484 dataOut.PRFbyAngle = self.n #numero de PRF*cada angulo rotado que equivale a un tiempo.
1491 dataOut.PRFbyAngle = self.n #numero de PRF*cada angulo rotado que equivale a un tiempo.
1485 dataOut.nProfiles = int(dataOut.nProfiles/n)
1492 dataOut.nProfiles = int(dataOut.nProfiles/n)
1486 dataOut.utctime = avgdatatime
1493 dataOut.utctime = avgdatatime
@@ -5,19 +5,25 import os, sys
5 import datetime
5 import datetime
6 import time
6 import time
7 import numpy
7 import numpy
8 import json
8 from ext_met import getfirstFilefromPath,getDatavaluefromDirFilename
9 from ext_met import getfirstFilefromPath,getDatavaluefromDirFilename
9 from schainpy.controller import Project
10 from schainpy.controller import Project
10 #-----------------------------------------------------------------------------------------
11 #-----------------------------------------------------------------------------------------
12 # path_ped = "/DATA_RM/TEST_PEDESTAL/P20211110-171003"
13 ## print("PATH PEDESTAL :",path_ped)
14
11 print("[SETUP]-RADAR METEOROLOGICO-")
15 print("[SETUP]-RADAR METEOROLOGICO-")
12 path_ped = "/DATA_RM/TEST_PEDESTAL/P20211110-171003"
16 path_ped = "/DATA_RM/TEST_PEDESTAL/P20211111-173856"
13 print("PATH PEDESTAL :",path_ped)
17 print("PATH PEDESTAL :",path_ped)
14 path_adq = "/DATA_RM/10"
18 path_adq = "/DATA_RM/11"
15 print("PATH DATA :",path_adq)
19 print("PATH DATA :",path_adq)
20
21
16 figpath_pp_rti = "/home/soporte/Pictures/TEST_PP_RTI"
22 figpath_pp_rti = "/home/soporte/Pictures/TEST_PP_RTI"
17 print("PATH PP RTI :",figpath_pp_rti)
23 print("PATH PP RTI :",figpath_pp_rti)
18 figpath_pp_ppi = "/home/soporte/Pictures/TEST_PP_PPI"
24 figpath_pp_ppi = "/home/soporte/Pictures/TEST_PP_PPI"
19 print("PATH PP PPI :",figpath_pp_ppi)
25 print("PATH PP PPI :",figpath_pp_ppi)
20 path_pp_save_int = "/DATA_RM/TEST_SAVE_PP_INT"
26 path_pp_save_int = "/DATA_RM/TEST_NEW_FORMAT"
21 print("PATH SAVE PP INT :",path_pp_save_int)
27 print("PATH SAVE PP INT :",path_pp_save_int)
22 print(" ")
28 print(" ")
23 #-------------------------------------------------------------------------------------------
29 #-------------------------------------------------------------------------------------------
@@ -54,19 +60,33 n= int(1/(VEL*ipp_sec))
54 print("NΒ° Profiles : ", n)
60 print("NΒ° Profiles : ", n)
55 #---------------------------------------------------------------------------------------
61 #---------------------------------------------------------------------------------------
56 plot_rti = 0
62 plot_rti = 0
57 plot_ppi = 1
63 plot_ppi = 0
58 integration = 1
64 integration = 1
59 save = 0
65 save = 1
60 #---------------------------RANGO DE PLOTEO----------------------------------
66 #---------------------------RANGO DE PLOTEO----------------------------------
61 dBmin = '1'
67 dBmin = '1'
62 dBmax = '85'
68 dBmax = '85'
63 xmin = '17'
69 xmin = '14'
64 xmax = '17.25'
70 xmax = '16'
65 ymin = '0'
71 ymin = '0'
66 ymax = '600'
72 ymax = '600'
67 #----------------------------------------------------------------------------
73 #----------------------------------------------------------------------------
68 time.sleep(3)
74 time.sleep(3)
69 #---------------------SIGNAL CHAIN ------------------------------------
75 #---------------------SIGNAL CHAIN ------------------------------------
76 desc_wr= {
77 'Data': {
78 'dataPP_POW': 'Power',
79 'utctime': 'Time',
80 'azimuth': 'az',
81 'elevation':'el'
82 },
83 'Metadata': {
84 'heightList': 'range',
85 'channelList': 'Channels'
86 }
87 }
88
89
70 desc = "USRP_WEATHER_RADAR"
90 desc = "USRP_WEATHER_RADAR"
71 filename = "USRP_processing.xml"
91 filename = "USRP_processing.xml"
72 controllerObj = Project()
92 controllerObj = Project()
@@ -74,9 +94,9 controllerObj.setup(id = '191', name='Test_USRP', description=desc)
74 #---------------------UNIDAD DE LECTURA--------------------------------
94 #---------------------UNIDAD DE LECTURA--------------------------------
75 readUnitConfObj = controllerObj.addReadUnit(datatype='DigitalRFReader',
95 readUnitConfObj = controllerObj.addReadUnit(datatype='DigitalRFReader',
76 path=path_adq,
96 path=path_adq,
77 startDate="2021/11/10",#today,
97 startDate="2021/11/11",#today,
78 endDate="2021/12/30",#today,
98 endDate="2021/12/30",#today,
79 startTime='17:10:25',
99 startTime='17:39:17',
80 endTime='23:59:59',
100 endTime='23:59:59',
81 delay=0,
101 delay=0,
82 #set=0,
102 #set=0,
@@ -111,7 +131,20 if mode_proc==0:
111 opObj11 = procUnitConfObjB.addOperation(name='PedestalInformation')
131 opObj11 = procUnitConfObjB.addOperation(name='PedestalInformation')
112 opObj11.addParameter(name='path_ped', value=path_ped)
132 opObj11.addParameter(name='path_ped', value=path_ped)
113 opObj11.addParameter(name='t_Interval_p', value='0.01', format='float')
133 opObj11.addParameter(name='t_Interval_p', value='0.01', format='float')
114
134 opObj11.addParameter(name='wr_exp', value='PPI')
135 #------------------------------------------------------------------------------
136 '''
137 opObj11.addParameter(name='Datatype', value='RadialSet')
138 opObj11.addParameter(name='Scantype', value='PPI')
139 opObj11.addParameter(name='Latitude', value='-11.96')
140 opObj11.addParameter(name='Longitud', value='-76.54')
141 opObj11.addParameter(name='Heading', value='293')
142 opObj11.addParameter(name='Height', value='293')
143 opObj11.addParameter(name='Waveform', value='OFM')
144 opObj11.addParameter(name='PRF', value='2000')
145 opObj11.addParameter(name='CreatedBy', value='WeatherRadarJROTeam')
146 opObj11.addParameter(name='ContactInformation', value='avaldez@igp.gob.pe')
147 '''
115 if plot_ppi==1:
148 if plot_ppi==1:
116 opObj11 = procUnitConfObjB.addOperation(name='Block360')
149 opObj11 = procUnitConfObjB.addOperation(name='Block360')
117 opObj11.addParameter(name='n', value='10', format='int')
150 opObj11.addParameter(name='n', value='10', format='int')
@@ -125,9 +158,27 if mode_proc==0:
125 opObj10 = procUnitConfObjB.addOperation(name='HDFWriter')
158 opObj10 = procUnitConfObjB.addOperation(name='HDFWriter')
126 opObj10.addParameter(name='path',value=path_pp_save_int)
159 opObj10.addParameter(name='path',value=path_pp_save_int)
127 opObj10.addParameter(name='mode',value="weather")
160 opObj10.addParameter(name='mode',value="weather")
161 opObj10.addParameter(name='type_data',value='F')
128 opObj10.addParameter(name='blocksPerFile',value='360',format='int')
162 opObj10.addParameter(name='blocksPerFile',value='360',format='int')
129 opObj10.addParameter(name='metadataList',value='utctimeInit,timeZone,paramInterval,profileIndex,channelList,heightList,flagDataAsBlock',format='list')
163 #opObj10.addParameter(name='metadataList',value='utctimeInit,paramInterval,channelList,heightList,flagDataAsBlock',format='list')
130 opObj10.addParameter(name='dataList',value='dataPP_POW,dataPP_DOP,azimuth,elevation,utctime',format='list')#,format='list'
164 opObj10.addParameter(name='metadataList',value='heightList,channelList,Typename,Datatype,Scantype,Latitude,Longitud,Heading,Height,Waveform,PRF,CreatedBy,ContactInformation',format='list')
165 #--------------------
166 opObj10.addParameter(name='Typename', value='Differential_Reflectivity')
167 opObj10.addParameter(name='Datatype', value='RadialSet')
168 opObj10.addParameter(name='Scantype', value='PPI')
169 opObj10.addParameter(name='Latitude', value='-11.96')
170 opObj10.addParameter(name='Longitud', value='-76.54')
171 opObj10.addParameter(name='Heading', value='293')
172 opObj10.addParameter(name='Height', value='293')
173 opObj10.addParameter(name='Waveform', value='OFM')
174 opObj10.addParameter(name='PRF', value='2000')
175 opObj10.addParameter(name='CreatedBy', value='WeatherRadarJROTeam')
176 opObj10.addParameter(name='ContactInformation', value='avaldez@igp.gob.pe')
177 #---------------------------------------------------
178 #opObj10.addParameter(name='dataList',value='dataPP_POW,dataPP_DOP,azimuth,elevation,utctime',format='list')#,format='list'
179 #opObj10.addParameter(name='metadataList',value='utctimeInit,timeZone,paramInterval,profileIndex,channelList,heightList,flagDataAsBlock',format='list')
131
180
181 opObj10.addParameter(name='dataList',value='dataPP_POW,azimuth,elevation,utctime',format='list')#,format='list'
182 opObj10.addParameter(name='description',value=json.dumps(desc_wr))
132
183
133 controllerObj.start()
184 controllerObj.start()
General Comments 0
You need to be logged in to leave comments. Login now