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