@@ -577,9 +577,12 class WeatherParamsPlot(Plot): | |||||
577 | if hasattr(dataOut, 'dparam'): |
|
577 | if hasattr(dataOut, 'dparam'): | |
578 | tmp = getattr(dataOut, 'data_param') |
|
578 | tmp = getattr(dataOut, 'data_param') | |
579 | else: |
|
579 | else: | |
580 |
|
580 | #print("-------------------self.attr_data[0]",self.attr_data[0]) | ||
581 | if 'S' in self.attr_data[0]: |
|
581 | if 'S' in self.attr_data[0]: | |
|
582 | if self.attr_data[0]=='S': | |||
582 | tmp = 10*numpy.log10(10.0*getattr(dataOut, 'data_param')[:,0,:]/(factor)) |
|
583 | tmp = 10*numpy.log10(10.0*getattr(dataOut, 'data_param')[:,0,:]/(factor)) | |
|
584 | if self.attr_data[0]=='SNR': | |||
|
585 | tmp = 10*numpy.log10(getattr(dataOut, 'data_param')[:,3,:]) | |||
583 | else: |
|
586 | else: | |
584 | tmp = getattr(dataOut, 'data_param')[:,vars[self.attr_data[0]],:] |
|
587 | tmp = getattr(dataOut, 'data_param')[:,vars[self.attr_data[0]],:] | |
585 |
|
588 | |||
@@ -610,6 +613,12 class WeatherParamsPlot(Plot): | |||||
610 |
|
613 | |||
611 | data['azi'] = dataOut.data_azi |
|
614 | data['azi'] = dataOut.data_azi | |
612 | data['ele'] = dataOut.data_ele |
|
615 | data['ele'] = dataOut.data_ele | |
|
616 | ||||
|
617 | if isinstance(dataOut.mode_op, bytes): | |||
|
618 | try: | |||
|
619 | dataOut.mode_op = dataOut.mode_op.decode() | |||
|
620 | except: | |||
|
621 | dataOut.mode_op = str(dataOut.mode_op, 'utf-8') | |||
613 | data['mode_op'] = dataOut.mode_op |
|
622 | data['mode_op'] = dataOut.mode_op | |
614 | self.mode = dataOut.mode_op |
|
623 | self.mode = dataOut.mode_op | |
615 |
|
624 | |||
@@ -687,6 +696,8 class WeatherParamsPlot(Plot): | |||||
687 | gl.ylabel_style = {'size': 8} |
|
696 | gl.ylabel_style = {'size': 8} | |
688 | gl.xlabels_top = False |
|
697 | gl.xlabels_top = False | |
689 | gl.ylabels_right = False |
|
698 | gl.ylabels_right = False | |
|
699 | #self.shapes="/home/soporte/workspace/sirm/volumes/schain/shapes/" | |||
|
700 | #print("self.shapes",self.shapes) | |||
690 | shape_p = os.path.join(self.shapes,'PER_ADM2/PER_ADM2.shp') |
|
701 | shape_p = os.path.join(self.shapes,'PER_ADM2/PER_ADM2.shp') | |
691 | shape_d = os.path.join(self.shapes,'PER_ADM1/PER_ADM1.shp') |
|
702 | shape_d = os.path.join(self.shapes,'PER_ADM1/PER_ADM1.shp') | |
692 | capitales = os.path.join(self.shapes,'CAPITALES/cap_provincia.shp') |
|
703 | capitales = os.path.join(self.shapes,'CAPITALES/cap_provincia.shp') |
@@ -43,7 +43,7 class SpectraPlot(Plot): | |||||
43 | data['spc'] = spc |
|
43 | data['spc'] = spc | |
44 | data['rti'] = dataOut.getPower() |
|
44 | data['rti'] = dataOut.getPower() | |
45 | data['noise'] = 10*numpy.log10(dataOut.getNoise()/dataOut.normFactor) |
|
45 | data['noise'] = 10*numpy.log10(dataOut.getNoise()/dataOut.normFactor) | |
46 |
meta['xrange'] = (dataOut.getFreqRange( |
|
46 | meta['xrange'] = (dataOut.getFreqRange(0)/1000., dataOut.getAcfRange(1), dataOut.getVelRange(0)) | |
47 |
|
47 | |||
48 | if self.CODE == 'spc_moments': |
|
48 | if self.CODE == 'spc_moments': | |
49 | data['moments'] = dataOut.moments |
|
49 | data['moments'] = dataOut.moments |
@@ -26,6 +26,7 from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation, MPDecora | |||||
26 |
|
26 | |||
27 | import pickle |
|
27 | import pickle | |
28 | try: |
|
28 | try: | |
|
29 | os.environ["HDF5_USE_FILE_LOCKING"] = "FALSE" | |||
29 | import digital_rf |
|
30 | import digital_rf | |
30 | except: |
|
31 | except: | |
31 | pass |
|
32 | pass | |
@@ -267,9 +268,14 class DigitalRFReader(ProcessingUnit): | |||||
267 |
|
268 | |||
268 | self.getByBlock = getByBlock |
|
269 | self.getByBlock = getByBlock | |
269 | self.nProfileBlocks = nProfileBlocks |
|
270 | self.nProfileBlocks = nProfileBlocks | |
|
271 | if online: | |||
|
272 | print('Waiting for RF data..') | |||
|
273 | sleep(40) | |||
|
274 | ||||
270 | if not os.path.isdir(path): |
|
275 | if not os.path.isdir(path): | |
271 | raise ValueError("[Reading] Directory %s does not exist" % path) |
|
276 | raise ValueError("[Reading] Directory %s does not exist" % path) | |
272 |
|
277 | |||
|
278 | #print("path",path) | |||
273 | try: |
|
279 | try: | |
274 | self.digitalReadObj = digital_rf.DigitalRFReader( |
|
280 | self.digitalReadObj = digital_rf.DigitalRFReader( | |
275 | path, load_all_metadata=True) |
|
281 | path, load_all_metadata=True) | |
@@ -350,29 +356,27 class DigitalRFReader(ProcessingUnit): | |||||
350 | if startDate: |
|
356 | if startDate: | |
351 | startDatetime = datetime.datetime.combine(startDate, startTime) |
|
357 | startDatetime = datetime.datetime.combine(startDate, startTime) | |
352 | startUTCSecond = ( |
|
358 | startUTCSecond = ( | |
353 | startDatetime - datetime.datetime(1970, 1, 1)).total_seconds() + self.__timezone |
|
359 | startDatetime - datetime.datetime(1970, 1, 1)).total_seconds()# + self.__timezone | |
354 |
|
360 | |||
355 | if endDate: |
|
361 | if endDate: | |
356 | endDatetime = datetime.datetime.combine(endDate, endTime) |
|
362 | endDatetime = datetime.datetime.combine(endDate, endTime) | |
357 | endUTCSecond = (endDatetime - datetime.datetime(1970, |
|
363 | endUTCSecond = (endDatetime - datetime.datetime(1970, | |
358 | 1, 1)).total_seconds() + self.__timezone |
|
364 | 1, 1)).total_seconds()# + self.__timezone | |
359 |
|
365 | start_index, end_index = self.digitalReadObj.get_bounds(channelNameList[channelList[0]]) | ||
360 |
|
366 | if start_index==None or end_index==None: | ||
361 | #print(startUTCSecond,endUTCSecond) |
|
367 | print("Check error No data, start_index: ",start_index,",end_index: ",end_index) | |
362 | start_index, end_index = self.digitalReadObj.get_bounds( |
|
368 | #return 0 | |
363 | channelNameList[channelList[0]]) |
|
|||
364 |
|
||||
365 | #print("*****",start_index,end_index) |
|
|||
366 | if not startUTCSecond: |
|
369 | if not startUTCSecond: | |
367 | startUTCSecond = start_index / self.__sample_rate |
|
370 | startUTCSecond = start_index / self.__sample_rate | |
368 |
|
||||
369 | if start_index > startUTCSecond * self.__sample_rate: |
|
371 | if start_index > startUTCSecond * self.__sample_rate: | |
370 | startUTCSecond = start_index / self.__sample_rate |
|
372 | startUTCSecond = start_index / self.__sample_rate | |
371 |
|
373 | |||
372 | if not endUTCSecond: |
|
374 | if not endUTCSecond: | |
373 | endUTCSecond = end_index / self.__sample_rate |
|
375 | endUTCSecond = end_index / self.__sample_rate | |
|
376 | ||||
374 | if end_index < endUTCSecond * self.__sample_rate: |
|
377 | if end_index < endUTCSecond * self.__sample_rate: | |
375 | endUTCSecond = end_index / self.__sample_rate #Check UTC and LT time |
|
378 | endUTCSecond = end_index / self.__sample_rate #Check UTC and LT time | |
|
379 | ||||
376 | if not nSamples: |
|
380 | if not nSamples: | |
377 | if not ippKm: |
|
381 | if not ippKm: | |
378 | raise ValueError("[Reading] nSamples or ippKm should be defined") |
|
382 | raise ValueError("[Reading] nSamples or ippKm should be defined") | |
@@ -428,6 +432,7 class DigitalRFReader(ProcessingUnit): | |||||
428 |
|
432 | |||
429 | #self.__data_buffer = numpy.zeros( |
|
433 | #self.__data_buffer = numpy.zeros( | |
430 | # (self.__num_subchannels, self.__samples_to_read), dtype=numpy.complex) |
|
434 | # (self.__num_subchannels, self.__samples_to_read), dtype=numpy.complex) | |
|
435 | print("samplestoread",self.__samples_to_read) | |||
431 | self.__data_buffer = numpy.zeros((int(len(channelList)), self.__samples_to_read), dtype=numpy.complex) |
|
436 | self.__data_buffer = numpy.zeros((int(len(channelList)), self.__samples_to_read), dtype=numpy.complex) | |
432 |
|
437 | |||
433 |
|
438 | |||
@@ -442,9 +447,7 class DigitalRFReader(ProcessingUnit): | |||||
442 | )) |
|
447 | )) | |
443 |
|
448 | |||
444 | print("[Reading] Starting process from %s to %s" % (datetime.datetime.utcfromtimestamp(startUTCSecond - self.__timezone), |
|
449 | print("[Reading] Starting process from %s to %s" % (datetime.datetime.utcfromtimestamp(startUTCSecond - self.__timezone), | |
445 | datetime.datetime.utcfromtimestamp( |
|
450 | datetime.datetime.utcfromtimestamp(endUTCSecond - self.__timezone))) | |
446 | endUTCSecond - self.__timezone) |
|
|||
447 | )) |
|
|||
448 | self.oldAverage = None |
|
451 | self.oldAverage = None | |
449 | self.count = 0 |
|
452 | self.count = 0 | |
450 | self.executionTime = 0 |
|
453 | self.executionTime = 0 | |
@@ -532,9 +535,11 class DigitalRFReader(ProcessingUnit): | |||||
532 | for indexSubchannel in range(self.__num_subchannels): |
|
535 | for indexSubchannel in range(self.__num_subchannels): | |
533 | try: |
|
536 | try: | |
534 | t0 = time() |
|
537 | t0 = time() | |
|
538 | #print("thisUNixSample",self.__thisUnixSample) | |||
535 | result = self.digitalReadObj.read_vector_c81d(self.__thisUnixSample, |
|
539 | result = self.digitalReadObj.read_vector_c81d(self.__thisUnixSample, | |
536 | self.__samples_to_read, |
|
540 | self.__samples_to_read, | |
537 | thisChannelName, sub_channel=indexSubchannel) |
|
541 | thisChannelName, sub_channel=indexSubchannel) | |
|
542 | #print("result--------------",result) | |||
538 | self.executionTime = time() - t0 |
|
543 | self.executionTime = time() - t0 | |
539 | if self.oldAverage is None: |
|
544 | if self.oldAverage is None: | |
540 | self.oldAverage = self.executionTime |
|
545 | self.oldAverage = self.executionTime | |
@@ -546,7 +551,21 class DigitalRFReader(ProcessingUnit): | |||||
546 | # read next profile |
|
551 | # read next profile | |
547 | self.__flagDiscontinuousBlock = True |
|
552 | self.__flagDiscontinuousBlock = True | |
548 | print("[Reading] %s" % datetime.datetime.utcfromtimestamp(self.thisSecond - self.__timezone), e) |
|
553 | print("[Reading] %s" % datetime.datetime.utcfromtimestamp(self.thisSecond - self.__timezone), e) | |
|
554 | bot = 0 | |||
|
555 | while(self.__flagDiscontinuousBlock): | |||
|
556 | bot +=1 | |||
|
557 | self.__thisUnixSample += self.__sample_rate | |||
|
558 | try: | |||
|
559 | result = result = self.digitalReadObj.read_vector_c81d(self.__thisUnixSample,self.__samples_to_read,thisChannelName, sub_channel=indexSubchannel) | |||
|
560 | self.__flagDiscontinuousBlock=False | |||
|
561 | print("Searching.. N°: ",bot,"Success",self.__thisUnixSample) | |||
|
562 | except: | |||
|
563 | print("Searching...N°: ",bot,"Fail", self.__thisUnixSample) | |||
|
564 | if self.__flagDiscontinuousBlock==True: | |||
549 | break |
|
565 | break | |
|
566 | else: | |||
|
567 | print("New data index found...",self.__thisUnixSample) | |||
|
568 | #break | |||
550 |
|
569 | |||
551 | if result.shape[0] != self.__samples_to_read: |
|
570 | if result.shape[0] != self.__samples_to_read: | |
552 | self.__flagDiscontinuousBlock = True |
|
571 | self.__flagDiscontinuousBlock = True |
@@ -3950,7 +3950,9 class WeatherRadar(Operation): | |||||
3950 | self.nHeis = dataOut.nHeights |
|
3950 | self.nHeis = dataOut.nHeights | |
3951 | self.min_index= min_index |
|
3951 | self.min_index= min_index | |
3952 | deltaHeight = dataOut.heightList[1] - dataOut.heightList[0] |
|
3952 | deltaHeight = dataOut.heightList[1] - dataOut.heightList[0] | |
3953 | self.Range = numpy.arange(dataOut.nHeights)*deltaHeight + dataOut.heightList[0]+min_index*deltaHeight |
|
3953 | #self.Range = numpy.arange(dataOut.nHeights)*deltaHeight + dataOut.heightList[0]+min_index*deltaHeight | |
|
3954 | self.Range = dataOut.heightList | |||
|
3955 | print(self.Range, flush=True) | |||
3954 | self.Range = self.Range.reshape(1,self.nHeis) |
|
3956 | self.Range = self.Range.reshape(1,self.nHeis) | |
3955 | self.Range = numpy.tile(self.Range,[self.nCh,1]) |
|
3957 | self.Range = numpy.tile(self.Range,[self.nCh,1]) | |
3956 | '''-----------1 Constante del Radar----------''' |
|
3958 | '''-----------1 Constante del Radar----------''' |
@@ -214,7 +214,7 def main(args): | |||||
214 |
|
214 | |||
215 | opObj10 = proc1.addOperation(name="WeatherRadar") |
|
215 | opObj10 = proc1.addOperation(name="WeatherRadar") | |
216 | opObj10.addParameter(name='tauW',value=(1e-6/sample_rate)*len(code[0])) |
|
216 | opObj10.addParameter(name='tauW',value=(1e-6/sample_rate)*len(code[0])) | |
217 |
opObj10.addParameter(name='Pt',value= |
|
217 | opObj10.addParameter(name='Pt',value=200) | |
218 |
|
218 | |||
219 | op = proc1.addOperation(name='PedestalInformation') |
|
219 | op = proc1.addOperation(name='PedestalInformation') | |
220 | op.addParameter(name='path', value=path_ped, format='str') |
|
220 | op.addParameter(name='path', value=path_ped, format='str') | |
@@ -266,7 +266,7 def main(args): | |||||
266 |
|
266 | |||
267 | opObj10 = proc2.addOperation(name="WeatherRadar") |
|
267 | opObj10 = proc2.addOperation(name="WeatherRadar") | |
268 | opObj10.addParameter(name='tauW',value=(1e-6/sample_rate)*len(code[0])) |
|
268 | opObj10.addParameter(name='tauW',value=(1e-6/sample_rate)*len(code[0])) | |
269 |
opObj10.addParameter(name='Pt',value= |
|
269 | opObj10.addParameter(name='Pt',value=200) | |
270 |
|
270 | |||
271 | op = proc2.addOperation(name='PedestalInformation') |
|
271 | op = proc2.addOperation(name='PedestalInformation') | |
272 | op.addParameter(name='path', value=path_ped, format='str') |
|
272 | op.addParameter(name='path', value=path_ped, format='str') |
General Comments 0
You need to be logged in to leave comments.
Login now