##// END OF EJS Templates
Change save format for sophy parameters & fix position files online reading
jespinoza -
r1466:b9d6d6168dce
parent child
Show More
@@ -545,38 +545,37 class HDFWriter(Operation):
545 elif self.var.lower() == 'velRadial_V'.lower():
545 elif self.var.lower() == 'velRadial_V'.lower():
546 wr_type = 'V'
546 wr_type = 'V'
547 elif self.var.lower() == 'Sigmav_W'.lower():
547 elif self.var.lower() == 'Sigmav_W'.lower():
548 wr_type = 'S'
548 wr_type = 'W'
549 elif self.var.lower() == 'dataPP_POWER'.lower():
549 elif self.var.lower() == 'dataPP_POWER'.lower():
550 wr_type = 'Pow'
550 wr_type = 'S'
551 elif self.var.lower() == 'dataPP_DOP'.lower():
551 elif self.var.lower() == 'dataPP_DOP'.lower():
552 wr_type = 'Dop'
552 wr_type = 'V'
553
553
554
554
555 #Z_SOPHy_El10.0_20200505_14:02:15.h5
555 #SOPHY_20200505_140215_E10.0_Z.h5
556 #Z_SOPHy_Az40.0_20200505_14:02:15.h5
556 #SOPHY_20200505_140215_A40.0_Z.h5
557 if self.dataOut.flagMode == 1: #'AZI' #PPI
557 if self.dataOut.flagMode == 1: #'AZI' #PPI
558 ang_type = 'El'
558 ang_type = 'E'
559 len_aux = int(self.dataOut.data_ele.shape[0]/4)
559 len_aux = int(self.dataOut.data_ele.shape[0]/4)
560 mean = numpy.mean(self.dataOut.data_ele[len_aux:-len_aux])
560 mean = numpy.mean(self.dataOut.data_ele[len_aux:-len_aux])
561 ang_ = round(mean,1)
561 ang_ = round(mean,1)
562 elif self.dataOut.flagMode == 0: #'ELE' #RHI
562 elif self.dataOut.flagMode == 0: #'ELE' #RHI
563 ang_type = 'Az'
563 ang_type = 'A'
564 len_aux = int(self.dataOut.data_azi.shape[0]/4)
564 len_aux = int(self.dataOut.data_azi.shape[0]/4)
565 mean = numpy.mean(self.dataOut.data_azi[len_aux:-len_aux])
565 mean = numpy.mean(self.dataOut.data_azi[len_aux:-len_aux])
566 ang_ = round(mean,1)
566 ang_ = round(mean,1)
567
567
568 file = '%s%s%s%2.1f%s%2.2d%2.2d%2.2d%s%2.2d%2.2d%2.2d%s' % (wr_type,
568 file = '%s_%2.2d%2.2d%2.2d_%2.2d%2.2d%2.2d_%s%2.1f_%s%s' % (
569 '_SOPHy_',
569 'SOPHY',
570 ang_type,
571 ang_,
572 '_',
573 timeTuple.tm_year,
570 timeTuple.tm_year,
574 timeTuple.tm_mon,
571 timeTuple.tm_mon,
575 timeTuple.tm_mday,
572 timeTuple.tm_mday,
576 '_',
577 timeTuple.tm_hour,
573 timeTuple.tm_hour,
578 timeTuple.tm_min,
574 timeTuple.tm_min,
579 timeTuple.tm_sec,
575 timeTuple.tm_sec,
576 ang_type,
577 ang_,
578 wr_type,
580 ext )
579 ext )
581
580
582 else:
581 else:
@@ -4064,7 +4064,7 class PedestalInformation(Operation):
4064 def __init__(self):
4064 def __init__(self):
4065 Operation.__init__(self)
4065 Operation.__init__(self)
4066 self.filename = False
4066 self.filename = False
4067 self.delay = 30
4067 self.delay = 32
4068 self.nTries = 3
4068 self.nTries = 3
4069
4069
4070 def find_file(self, timestamp):
4070 def find_file(self, timestamp):
@@ -4073,7 +4073,7 class PedestalInformation(Operation):
4073 path = os.path.join(self.path, dt.strftime('%Y-%m-%dT%H-00-00'))
4073 path = os.path.join(self.path, dt.strftime('%Y-%m-%dT%H-00-00'))
4074
4074
4075 if not os.path.exists(path):
4075 if not os.path.exists(path):
4076 return False, False
4076 return False
4077 fileList = glob.glob(os.path.join(path, '*.h5'))
4077 fileList = glob.glob(os.path.join(path, '*.h5'))
4078 fileList.sort()
4078 fileList.sort()
4079 return fileList
4079 return fileList
@@ -4092,31 +4092,41 class PedestalInformation(Operation):
4092 if dt.second > 0:
4092 if dt.second > 0:
4093 self.utcfile -= dt.second
4093 self.utcfile -= dt.second
4094 self.utcfile += self.samples*self.interval
4094 self.utcfile += self.samples*self.interval
4095 dt = datetime.datetime.utcfromtimestamp(self.utctime)
4095 dt = datetime.datetime.utcfromtimestamp(self.utcfile)
4096 path = os.path.join(self.path, dt.strftime('%Y-%m-%dT%H-00-00'))
4096 path = os.path.join(self.path, dt.strftime('%Y-%m-%dT%H-00-00'))
4097 self.filename = os.path.join(path, 'pos@{}.000.h5'.format(int(self.utcfile)))
4097 self.filename = os.path.join(path, 'pos@{}.000.h5'.format(int(self.utcfile)))
4098
4098
4099 for n in range(self.nTries):
4099 for i in range(2):
4100 ok = False
4100 ok = False
4101 try:
4101 for j in range(self.nTries):
4102 if not os.path.exists(self.filename):
4102 ok = False
4103 log.warning('Waiting {}s for position files...'.format(self.delay), self.name)
4103 try:
4104 if not os.path.exists(self.filename):
4105 log.warning('Waiting {}s for position files...'.format(self.delay), self.name)
4106 time.sleep(self.delay)
4107 continue
4108 self.fp.close()
4109 self.fp = h5py.File(self.filename, 'r')
4110 log.log('Opening file: {}'.format(self.filename), self.name)
4111 ok = True
4112 break
4113 except Exception as e:
4114 print(e)
4115 log.warning('Waiting {}s for position file to be ready...'.format(self.delay), self.name)
4104 time.sleep(self.delay)
4116 time.sleep(self.delay)
4105 continue
4117 continue
4106 self.fp.close()
4118 if ok:
4107 self.fp = h5py.File(self.filename, 'r')
4108 log.log('Opening file: {}'.format(self.filename), self.name)
4109 ok = True
4110 break
4119 break
4111 except:
4120 log.warning('Trying next file...', self.name)
4112 log.warning('Waiting {}s for position file to be ready...'.format(self.delay), self.name)
4121 self.utcfile += self.samples*self.interval
4113 time.sleep(self.delay)
4122 dt = datetime.datetime.utcfromtimestamp(self.utcfime)
4114 continue
4123 path = os.path.join(self.path, dt.strftime('%Y-%m-%dT%H-00-00'))
4115
4124 self.filename = os.path.join(path, 'pos@{}.000.h5'.format(int(self.utcfile)))
4116 if not ok:
4125 if not ok:
4117 log.error('No new position files found in {}'.format(path))
4126 log.error('No new position files found in {}'.format(path))
4118 raise IOError('No new position files found in {}'.format(path))
4127 raise IOError('No new position files found in {}'.format(path))
4119
4128
4129
4120 def find_mode(self,index):
4130 def find_mode(self,index):
4121 sample_max = 20
4131 sample_max = 20
4122 start = index
4132 start = index
@@ -4177,11 +4187,11 class PedestalInformation(Operation):
4177 else:
4187 else:
4178 index = int((self.utctime-self.utcfile)/self.interval)
4188 index = int((self.utctime-self.utcfile)/self.interval)
4179
4189
4180 if self.flagAskMode:
4190 #if self.flagAskMode:
4181 mode = self.find_mode(index)
4191 # mode = self.find_mode(index)
4182 else:
4192 #else:
4183 mode = self.mode
4193 # mode = self.mode
4184
4194 mode = 'PPI'
4185 if mode is not None:
4195 if mode is not None:
4186 return self.fp['Data']['azi_pos'][index], self.fp['Data']['ele_pos'][index], mode
4196 return self.fp['Data']['azi_pos'][index], self.fp['Data']['ele_pos'][index], mode
4187 else:
4197 else:
General Comments 0
You need to be logged in to leave comments. Login now