##// END OF EJS Templates
HDFWriter writes standard Weather parameters/Now we can run a type OTHER Operation even if flagNoData is True
rflores -
r1459:52714d4d854d
parent child
Show More
@@ -408,6 +408,7 class DigitalRFReader(ProcessingUnit):
408 408
409 409
410 410 self.__samples_to_read = int(nSamples) # FIJO: AHORA 40
411 #self.__samples_to_read = int(1000000) # FIJO: AHORA 40
411 412 self.__nChannels = len(self.__channelList)
412 413 #print("------------------------------------------")
413 414 #print("self.__samples_to_read",self.__samples_to_read)
@@ -522,6 +523,8 class DigitalRFReader(ProcessingUnit):
522 523 for indexSubchannel in range(self.__num_subchannels):
523 524 try:
524 525 t0 = time()
526 #print("Unitindex",self.__thisUnixSample)
527 #print("__samples_to_read",self.__samples_to_read)
525 528 result = self.digitalReadObj.read_vector_c81d(self.__thisUnixSample,
526 529 self.__samples_to_read,
527 530 thisChannelName, sub_channel=indexSubchannel)
@@ -634,6 +637,7 class DigitalRFReader(ProcessingUnit):
634 637 # ojo debo anadir el readNextBLock y el __isBufferEmpty(
635 638 self.dataOut.flagNoData = False
636 639 buffer = self.__data_buffer[:,self.__bufferIndex:self.__bufferIndex + self.__samples_to_read]
640 #print("test",self.__bufferIndex)
637 641 buffer = buffer.reshape((self.__nChannels, self.nProfileBlocks, int(self.__samples_to_read/self.nProfileBlocks)))
638 642 self.dataOut.nProfileBlocks = self.nProfileBlocks
639 643 self.dataOut.data = buffer
@@ -482,6 +482,8 class HDFWriter(Operation):
482 482
483 483 self.dataOut = dataOut
484 484 self.mode = mode
485 self.var = dataList[0]
486
485 487 if not(self.isConfig):
486 488 self.setup(path=path, blocksPerFile=blocksPerFile,
487 489 metadataList=metadataList, dataList=dataList,
@@ -532,33 +534,47 class HDFWriter(Operation):
532 534 setFile,
533 535 ext )
534 536 elif self.setType == "weather":
535 print("HOLA AMIGOS")
536 wr_exp = self.dataOut.wr_exp
537 if wr_exp== "PPI":
538 wr_type = 'E'
539 ang_ = numpy.mean(self.dataOut.elevation)
540 else:
541 wr_type = 'A'
542 ang_ = numpy.mean(self.dataOut.azimuth)
543
544 wr_writer = '%s%s%2.1f%s'%('-',
545 wr_type,
546 ang_,
547 '-')
548 ###print("wr_writer********************",wr_writer)
549 file = '%s%4.4d%2.2d%2.2d%s%2.2d%2.2d%2.2d%s%s%s' % (self.optchar,
550 timeTuple.tm_year,
551 timeTuple.tm_mon,
552 timeTuple.tm_mday,
553 '-',
554 timeTuple.tm_hour,
555 timeTuple.tm_min,
556 timeTuple.tm_sec,
557 wr_writer,
558 type_data,
559 ext )
560 ###print("FILENAME", file)
561 537
538 if self.var.lower() == 'Zdb'.lower():
539 wr_type = 'Z'
540 elif self.var.lower() == 'Zdb_D'.lower():
541 wr_type = 'D'
542 elif self.var.lower() == 'PhiD_P'.lower():
543 wr_type = 'P'
544 elif self.var.lower() == 'RhoHV_R'.lower():
545 wr_type = 'R'
546 elif self.var.lower() == 'velRadial_V'.lower():
547 wr_type = 'V'
548 elif self.var.lower() == 'Sigmav_W'.lower():
549 wr_type = 'S'
550 elif self.var.lower() == 'dataPP_POWER'.lower():
551 wr_type = 'Pow'
552 elif self.var.lower() == 'dataPP_DOP'.lower():
553 wr_type = 'Dop'
554
555
556 #Z_SOPHy_El10.0_20200505_14:02:15.h5
557 #Z_SOPHy_Az40.0_20200505_14:02:15.h5
558 if self.dataOut.flagMode == 1: #'AZI' #PPI
559 ang_type = 'El'
560 ang_ = round(numpy.mean(self.dataOut.data_ele),1)
561 elif self.dataOut.flagMode == 0: #'ELE' #RHI
562 ang_type = 'Az'
563 ang_ = round(numpy.mean(self.dataOut.data_azi),1)
564
565 file = '%s%s%s%2.1f%s%2.2d%2.2d%2.2d%s%2.2d%2.2d%2.2d%s' % (wr_type,
566 '_SOPHy_',
567 ang_type,
568 ang_,
569 '_',
570 timeTuple.tm_year,
571 timeTuple.tm_mon,
572 timeTuple.tm_mday,
573 '_',
574 timeTuple.tm_hour,
575 timeTuple.tm_min,
576 timeTuple.tm_sec,
577 ext )
562 578
563 579 else:
564 580 setFile = timeTuple.tm_hour*60+timeTuple.tm_min
@@ -571,7 +587,7 class HDFWriter(Operation):
571 587 self.filename = os.path.join( path, subfolder, file )
572 588
573 589 #Setting HDF5 File
574
590 print("filename",self.filename)
575 591 self.fp = h5py.File(self.filename, 'w')
576 592 #write metadata
577 593 self.writeMetadata(self.fp)
@@ -682,6 +698,7 class HDFWriter(Operation):
682 698 return
683 699
684 700 def putData(self):
701
685 702 if (self.blockIndex == self.blocksPerFile) or self.timeFlag():# or self.generalFlag_vRF():
686 703 self.closeFile()
687 704 self.setNextFile()
@@ -86,7 +86,17 class ProcessingUnit(object):
86 86 ##### correcion de la declaracion Out
87 87 for op, optype, opkwargs in self.operations:
88 88 aux = self.dataOut.copy()
89 if optype == 'other' and not self.dataOut.flagNoData:
89 '''
90 print("op",op)
91 try:
92 print("runNextOp",self.dataOut.runNextOp)
93 except:
94 pass
95 '''
96 if not hasattr(self.dataOut, 'runNextOp'):
97 self.dataOut.runNextOp = False
98 if optype == 'other' and (not self.dataOut.flagNoData or self.dataOut.runNextOp):
99 #if optype == 'other' and not self.dataOut.flagNoData:
90 100 self.dataOut = op.run(self.dataOut, **opkwargs)
91 101 elif optype == 'external' and not self.dataOut.flagNoData:
92 102 #op.queue.put(self.dataOut)
@@ -4882,7 +4882,7 class Block360_vRF4(Operation):
4882 4882 Add a profile to he __buffer and increase in one the __profiel Index
4883 4883 '''
4884 4884 tmp= getattr(data, attr)
4885 if tmp.shape[0] is not 2:
4885 if tmp.shape[0] != 2:
4886 4886 size_tmp= tmp.shape[0]
4887 4887 tmp=tmp.reshape(1,size_tmp)
4888 4888
@@ -4993,9 +4993,10 class Block360_vRF4(Operation):
4993 4993 if diff_angle > 0: #Subida
4994 4994 return 0
4995 4995
4996 def run(self, dataOut, attr_data='dataPP_POWER', axis=None,**kwargs):
4996 def run(self, dataOut, attr_data='dataPP_POWER', axis=None, runNextOp = False,**kwargs):
4997 4997
4998 4998 dataOut.attr_data = attr_data
4999 dataOut.runNextOp = runNextOp
4999 5000
5000 5001 dataOut.flagMode = axis[0] #Provisional, debería venir del header
5001 5002
@@ -5013,7 +5014,7 class Block360_vRF4(Operation):
5013 5014 dataOut.data_ele = data_e
5014 5015 dataOut.utctime = avgdatatime
5015 5016 dataOut.flagNoData = False
5016 print("********************attr_data********************",attr_data)
5017 #print("********************attr_data********************",attr_data)
5017 5018 #print(data_360.shape)
5018 5019 #print(dataOut.heightList)
5019 5020
@@ -669,7 +669,7 class CohInt(Operation):
669 669 if not dataOut.flagCohInt:
670 670 dataOut.nCohInt *= self.n
671 671 dataOut.flagCohInt = True
672 dataOut.utctime = avgdatatime
672 ####################################dataOut.utctime = avgdatatime
673 673 # print avgdata, avgdatatime
674 674 # raise
675 675 # dataOut.timeInterval = dataOut.ippSeconds * dataOut.nCohInt
@@ -1696,7 +1696,8 class PulsePair_vRF(Operation):
1696 1696 def run(self, dataOut,n = None,removeDC= False, overlapping= False,**kwargs):
1697 1697
1698 1698 if dataOut.flagDataAsBlock:
1699 n = dataOut.nProfiles
1699 n = int(dataOut.nProfiles)
1700 #print("n",n)
1700 1701
1701 1702 if not self.isConfig:
1702 1703 self.setup(dataOut = dataOut, n = n , removeDC=removeDC , **kwargs)
General Comments 0
You need to be logged in to leave comments. Login now