@@ -530,8 +530,8 class WeatherPlot(Plot): | |||
|
530 | 530 | for i in range(len(data)): |
|
531 | 531 | if numpy.isnan(data[i]): |
|
532 | 532 | ####print("NAN") |
|
533 | data_T[i,:]=numpy.ones(data_T.shape[1])*val | |
|
534 |
|
|
|
533 | #data_T[i,:]=numpy.ones(data_T.shape[1])*val | |
|
534 | data_T[i,:]=numpy.ones(data_T.shape[1])*numpy.nan | |
|
535 | 535 | return data_T |
|
536 | 536 | |
|
537 | 537 | def const_ploteo(self,data_weather,data_azi,step,res): |
@@ -4083,12 +4083,7 class PedestalInformation(Operation): | |||
|
4083 | 4083 | return epoc |
|
4084 | 4084 | |
|
4085 | 4085 | def gettimeutcadqfromDirFilename(self,path,file): |
|
4086 | dir_file= path+"/"+file | |
|
4087 | fp = h5py.File(dir_file,'r') | |
|
4088 | epoc = fp['Metadata'].get('utctimeInit')[()] | |
|
4089 | #epoc = fp['Data'].get('utc')[()] | |
|
4090 | fp.close() | |
|
4091 | return epoc | |
|
4086 | pass | |
|
4092 | 4087 | |
|
4093 | 4088 | def getDatavaluefromDirFilename(self,path,file,value): |
|
4094 | 4089 | dir_file= path+"/"+file |
@@ -4097,13 +4092,9 class PedestalInformation(Operation): | |||
|
4097 | 4092 | fp.close() |
|
4098 | 4093 | return array |
|
4099 | 4094 | |
|
4100 | def getFile_KeyP(self,list_pedestal,list_adq): | |
|
4101 | print(list_pedestal) | |
|
4102 | print(list_adq) | |
|
4103 | 4095 | |
|
4104 | 4096 | def getNROFile(self,utc_adq,utc_ped_list): |
|
4105 | 4097 | c=0 |
|
4106 | #print("insidegetNROFile") | |
|
4107 | 4098 | #print(utc_adq) |
|
4108 | 4099 | #print(len(utc_ped_list)) |
|
4109 | 4100 | for i in range(len(utc_ped_list)): |
@@ -4115,290 +4106,55 class PedestalInformation(Operation): | |||
|
4115 | 4106 | return c-1,utc_ped_list[c-1],utc_ped_list[c] |
|
4116 | 4107 | |
|
4117 | 4108 | def verificarNROFILE(self,dataOut,utc_ped,f_a_p,n_Muestras_p): |
|
4118 | var =int(f_a_p/n_Muestras_p) | |
|
4119 | flag=0 | |
|
4120 | for i in range(var): | |
|
4121 | if dataOut.utctime+i==utc_ped: | |
|
4122 | flag==1 | |
|
4123 | break | |
|
4124 | return flag | |
|
4125 | ||
|
4126 | #def setup_offline(self,dataOut,list_pedestal,list_adq): | |
|
4127 | def setup_offline(self,dataOut,list_pedestal): | |
|
4128 | ||
|
4129 | print("SETUP OFFLINE") | |
|
4130 | ####print(self.path_ped) | |
|
4131 | #print(self.path_adq) | |
|
4132 | ####print(len(self.list_pedestal)) | |
|
4133 | #print(len(self.list_adq)) | |
|
4134 | utc_ped_list=[] | |
|
4135 | for i in range(len(self.list_pedestal)): | |
|
4136 | #print(i)# OJO IDENTIFICADOR DE SINCRONISMO | |
|
4137 | utc_ped_list.append(self.gettimeutcfromDirFilename(path=self.path_ped,file=self.list_pedestal[i])) | |
|
4138 | ||
|
4139 | #utc_ped_list= utc_ped_list | |
|
4140 | ###utc_adq = self.gettimeutcadqfromDirFilename(path=self.path_adq,file=self.list_adq[0]) | |
|
4141 | ####print("dios existe donde esta") | |
|
4109 | pass | |
|
4142 | 4110 | |
|
4143 | #####print("utc_ped_list",utc_ped_list) | |
|
4144 | #print("utc_adq",utc_adq) | |
|
4145 | # utc_adq_dataOut | |
|
4146 | utc_adq_dataOut =dataOut.utctime | |
|
4147 | ####print("OFFLINE-UTC_ADQ_dataout",utc_adq_dataOut) | |
|
4148 | ||
|
4149 | nro_file,utc_ped,utc_ped_1 = self.getNROFile(utc_adq=utc_adq_dataOut, utc_ped_list= utc_ped_list) | |
|
4150 | ||
|
4151 | ####print("nro_file",nro_file,"utc_ped",utc_ped) | |
|
4152 | ####print("nro_file",i) | |
|
4153 | nro_key_p = int((utc_adq_dataOut-utc_ped)/self.t_Interval_p)-1 # ojito al -1 estimado alex | |
|
4154 | ####print("nro_key_p",nro_key_p) | |
|
4155 | ||
|
4156 | ff_pedestal = self.list_ | |
|
4157 | pedestal[nro_file] | |
|
4158 | #angulo = self.getDatavaluefromDirFilename(path=self.path_ped,file=ff_pedestal,value="azimuth") | |
|
4159 | angulo = self.getDatavaluefromDirFilename(path=self.path_ped,file=ff_pedestal,value="azi_pos") | |
|
4160 | ||
|
4161 | ####print("utc_pedestal_init :",utc_ped+nro_key_p*self.t_Interval_p) | |
|
4162 | if nro_key_p>0: | |
|
4163 | print("angulo_array :",angulo[nro_key_p]) | |
|
4164 | self.nro_file = nro_file | |
|
4165 | self.nro_key_p = nro_key_p | |
|
4111 | def setup_offline(self,dataOut,list_pedestal): | |
|
4112 | pass | |
|
4166 | 4113 | |
|
4167 | 4114 | def setup_online(self,dataOut): |
|
4168 | utc_adq =dataOut.utctime | |
|
4169 | ####print("Online-utc_adq",utc_adq) | |
|
4170 | ####print(len(self.list_pedestal)) | |
|
4171 | utc_ped_list=[] | |
|
4172 | for i in range(len(self.list_pedestal)): | |
|
4173 | utc_ped_list.append(self.gettimeutcfromDirFilename(path=self.path_ped,file=self.list_pedestal[i])) | |
|
4174 | ####print(utc_ped_list[:20]) | |
|
4175 | ####print(utc_ped_list[488:498]) | |
|
4176 | ####print("ultimo UTC-PEDESTAL",utc_ped_list[-1]) | |
|
4177 | nro_file,utc_ped,utc_ped_1 = self.getNROFile(utc_adq=utc_adq, utc_ped_list= utc_ped_list) | |
|
4178 | ####print("nro_file",nro_file,"utc_ped",utc_ped,"utc_ped_1",utc_ped_1) | |
|
4179 | ####print("name_PEDESTAL",self.list_pedestal[nro_file]) | |
|
4180 | nro_key_p = int((utc_adq-utc_ped)/self.t_Interval_p)-1 | |
|
4181 | ####print("nro_key_p",nro_key_p) | |
|
4182 | ff_pedestal = self.list_pedestal[nro_file] | |
|
4183 | #angulo = self.getDatavaluefromDirFilename(path=self.path_ped,file=ff_pedestal,value="azimuth") | |
|
4184 | angulo = self.getDatavaluefromDirFilename(path=self.path_ped,file=ff_pedestal,value="azi_pos") | |
|
4185 | ||
|
4186 | ####print("utc_pedestal_init :",utc_ped+nro_key_p*self.t_Interval_p) | |
|
4187 | ####print("angulo_array :",angulo[nro_key_p]) | |
|
4188 | self.nro_file = nro_file | |
|
4189 | self.nro_key_p = nro_key_p | |
|
4115 | pass | |
|
4190 | 4116 | |
|
4191 | 4117 | #def setup(self,dataOut,path_ped,path_adq,t_Interval_p,n_Muestras_p,blocksPerfile,f_a_p,online): |
|
4192 | 4118 | def setup(self,dataOut,path_ped,t_Interval_p,n_Muestras_p,blocksPerfile,f_a_p,online): |
|
4193 | print("SETUP PEDESTAL") | |
|
4119 | #print("SETUP PEDESTAL") | |
|
4194 | 4120 | self.__dataReady = False |
|
4195 | 4121 | self.path_ped = path_ped |
|
4196 | 4122 | #self.path_adq = path_adq |
|
4197 | 4123 | self.t_Interval_p = t_Interval_p |
|
4198 | 4124 | self.n_Muestras_p = n_Muestras_p |
|
4199 | 4125 | self.blocksPerfile= blocksPerfile |
|
4200 |
#print(" |
|
|
4126 | #print("self.blocksPerfile",self.blocksPerfile) | |
|
4201 | 4127 | self.f_a_p = f_a_p |
|
4202 | 4128 | self.online = online |
|
4203 | 4129 | self.angulo_adq = numpy.zeros(self.blocksPerfile) |
|
4204 | 4130 | self.__profIndex = 0 |
|
4205 | 4131 | self.tmp = 0 |
|
4206 | 4132 | self.c_ped = 0 |
|
4207 | print(self.path_ped) | |
|
4208 | #print(self.path_adq) | |
|
4133 | #print(self.path_ped) | |
|
4134 | #### print("self.path_adq",self.path_adq) | |
|
4209 | 4135 | self.list_pedestal = self.getfirstFilefromPath(path=self.path_ped,meta="PE",ext=".hdf5") |
|
4210 |
####print(" |
|
|
4211 | #self.list_adq = self.getfirstFilefromPath(path=self.path_adq,meta="D",ext=".hdf5") | |
|
4212 | print("*************Longitud list pedestal****************",len(self.list_pedestal)) | |
|
4213 | ''' | |
|
4214 | if self.online: | |
|
4215 | print("Enable Online") | |
|
4216 | self.setup_online(dataOut) | |
|
4217 | else: | |
|
4218 | #self.setup_offline(dataOut,list_pedestal=self.list_pedestal,list_adq=self.list_adq) | |
|
4219 | self.setup_offline(dataOut,list_pedestal=self.list_pedestal) | |
|
4220 | ''' | |
|
4136 | #### print("self.list_pedestal", self.list_pedestal[:20]) | |
|
4137 | #### self.list_adq = self.getfirstFilefromPath(path=self.path_adq,meta="D",ext=".hdf5") | |
|
4138 | #print("*************Longitud list pedestal****************",len(self.list_pedestal)) | |
|
4221 | 4139 | |
|
4222 | 4140 | def setNextFileP(self,dataOut): |
|
4223 | if self.online: | |
|
4224 | data_pedestal = self.setNextFileonline() | |
|
4225 | else: | |
|
4226 | data_pedestal = self.setNextFileoffline(dataOut) | |
|
4227 | ||
|
4228 | return data_pedestal | |
|
4229 | ||
|
4230 | ||
|
4141 | pass | |
|
4231 | 4142 | |
|
4232 | 4143 | def checkPedFile(self,path,nro_file): |
|
4233 |
|
|
|
4234 | utc_pedestal_now = self.gettimeutcfromDirFilename(path=path,file=self.list_pedestal[nro_file]) | |
|
4235 | utc_pedestal_past = self.gettimeutcfromDirFilename(path=path,file=self.list_pedestal[nro_file-1]) | |
|
4236 | diff_utc = utc_pedestal_now - utc_pedestal_past | |
|
4237 | except: | |
|
4238 | diff_utc = -1 | |
|
4239 | return diff_utc | |
|
4144 | pass | |
|
4240 | 4145 | |
|
4241 | 4146 | def setNextFileoffline(self,dataOut): |
|
4242 | ####print("error") | |
|
4243 | ####print("no entiendo") | |
|
4244 | flag_NOPedfile = False | |
|
4245 | cont_NOPedFile = 0 | |
|
4246 | if self.nro_file<0: | |
|
4247 | ####print("adq empieza antes") | |
|
4248 | return numpy.ones(self.blocksPerfile)*numpy.nan | |
|
4249 | ####print("INICIO-----------------------------------------") | |
|
4250 | sleep(3) | |
|
4251 | for j in range(self.blocksPerfile): | |
|
4252 | ####print(j) | |
|
4253 | iterador = self.nro_key_p + self.f_a_p*self.c_ped | |
|
4254 | self.c_ped = self.c_ped + 1 | |
|
4255 | ####print("Iterador-->", iterador) | |
|
4256 | if iterador < self.n_Muestras_p: | |
|
4257 | self.nro_file = self.nro_file | |
|
4258 | else: | |
|
4259 | if flag_NOPedfile==False: | |
|
4260 | ########################### | |
|
4261 | self.nro_file = self.nro_file +1 | |
|
4262 | ########################### | |
|
4263 | ####print("nro_file",self.nro_file) | |
|
4264 | diff_utc = self.checkPedFile(path=self.path_ped,nro_file=self.nro_file) | |
|
4265 | ####print("diff_utc",diff_utc) | |
|
4266 | if diff_utc==1: | |
|
4267 | utc_ped_setnext=self.gettimeutcfromDirFilename(path=self.path_ped,file=self.list_pedestal[self.nro_file]) | |
|
4268 | utc_adq_setnext=dataOut.utctime | |
|
4269 | ####print("utc_pedestal",utc_ped_setnext) | |
|
4270 | ####print("utc_adq",utc_adq_setnext) | |
|
4271 | ####print("self.c_ped",self.c_ped) | |
|
4272 | #dif = self.blocksPerfile-(self.nro_key_p+self.f_a_p*(self.c_ped-2)) | |
|
4273 | dif = self.n_Muestras_p-(self.nro_key_p+self.f_a_p*(self.c_ped-2)) | |
|
4274 | self.c_ped = 1 | |
|
4275 | ##tmp = j | |
|
4276 | ##print("tmp else",tmp) | |
|
4277 | self.nro_key_p= self.f_a_p-dif | |
|
4278 | iterador = self.nro_key_p | |
|
4279 | ####print("iterador else",iterador) | |
|
4280 | if diff_utc >1: | |
|
4281 | ####print("FALTAN DATOS DEL PEDESTAL AMIGO WAIT") | |
|
4282 | ####sleep(1) | |
|
4283 | #aqui no hay DATA pero creo el nro_key_p "como si existiera" y reinicio el c_ped | |
|
4284 | ####print("continua bro") | |
|
4285 | ####print("self.c_ped",self.c_ped) | |
|
4286 | dif = self.n_Muestras_p-(self.nro_key_p+self.f_a_p*(self.c_ped-2)) | |
|
4287 | self.c_ped = 1 | |
|
4288 | self.nro_key_p = self.f_a_p-dif | |
|
4289 | # | |
|
4290 | iterador = self.nro_key_p | |
|
4291 | print("iterador else",iterador) | |
|
4292 | # | |
|
4293 | utc_ped_nofile = self.gettimeutcfromDirFilename(path=self.path_ped,file=self.list_pedestal[self.nro_file-1])+1 | |
|
4294 | #iterador = self.nro_key_p #no hay iterador pero importa el nro_key_p | |
|
4295 | flag_NOPedfile= True | |
|
4296 | print("q paso") | |
|
4297 | ||
|
4298 | if diff_utc <0: | |
|
4299 | print("No hay mas archivos") | |
|
4300 | self.angulo_adq = numpy.ones(self.blocksPerfile)*numpy.nan | |
|
4301 | else: | |
|
4302 | print("NO EXISTE DATA - IMAGINA") | |
|
4303 | dif = self.n_Muestras_p-(self.nro_key_p+self.f_a_p*(self.c_ped-2)) | |
|
4304 | self.c_ped = 1 | |
|
4305 | ##tmp = j | |
|
4306 | ##print("tmp else",tmp) | |
|
4307 | self.nro_key_p= self.f_a_p-dif | |
|
4308 | ||
|
4309 | ||
|
4310 | ||
|
4311 | ||
|
4312 | if flag_NOPedfile == False: | |
|
4313 | # AQUI NECESITO DOS COSAS "nro_file" y el "iterador" | |
|
4314 | ff_pedestal = self.list_pedestal[self.nro_file] | |
|
4315 | print("ff_pedestal",ff_pedestal) | |
|
4316 | angulo = self.getDatavaluefromDirFilename(path=self.path_ped,file=ff_pedestal,value="azi_pos") | |
|
4317 | save_angulo = angulo[iterador] | |
|
4318 | self.angulo_adq[j]= angulo[iterador] | |
|
4319 | else: | |
|
4320 | print(" DATA SIMULADA------------------------------------",j) | |
|
4321 | self.angulo_adq[j]= numpy.nan | |
|
4322 | cont_NOPedFile = cont_NOPedFile + 1 | |
|
4323 | print("contador:",cont_NOPedFile) | |
|
4324 | sleep(2) | |
|
4325 | if cont_NOPedFile==self.f_a_p: | |
|
4326 | cont_NOPedFile = 0 | |
|
4327 | utc_ped_nofile = utc_ped_nofile+1 | |
|
4328 | utc_ped_setnext= self.gettimeutcfromDirFilename(path=self.path_ped,file=self.list_pedestal[self.nro_file]) | |
|
4329 | if utc_ped_setnext-utc_ped_nofile==1: | |
|
4330 | fladata_pg_NOPedfile=False | |
|
4331 | ||
|
4332 | ||
|
4333 | ||
|
4334 | ||
|
4335 | return self.angulo_adq | |
|
4147 | pass | |
|
4336 | 4148 | |
|
4337 | 4149 | def setNextFileonline(self): |
|
4338 | tmp = 0 | |
|
4339 | self.nTries_p = 3 | |
|
4340 | self.delay = 3 | |
|
4341 | ready = 1 | |
|
4342 | for j in range(self.blocksPerfile): | |
|
4343 | iterador = self.nro_key_p +self.f_a_p*(j-tmp) | |
|
4344 | if iterador < self.n_Muestras_p: | |
|
4345 | self.nro_file = self.nro_file | |
|
4346 | else: | |
|
4347 | self.nro_file = self.nro_file+1 | |
|
4348 | dif = self.blocksPerfile-(self.nro_key_p+self.f_a_p*(j-tmp-1)) | |
|
4349 | tmp = j | |
|
4350 | self.nro_key_p= self.f_a_p-dif | |
|
4351 | iterador = self.nro_key_p | |
|
4352 | #print("nro_file---------------- :",self.nro_file) | |
|
4353 | try: | |
|
4354 | # update list_pedestal | |
|
4355 | self.list_pedestal = self.getfirstFilefromPath(path=self.path_ped,meta="PE",ext=".hdf5") | |
|
4356 | ff_pedestal = self.list_pedestal[self.nro_file] | |
|
4357 | except: | |
|
4358 | ff_pedestal = None | |
|
4359 | ready = 0 | |
|
4360 | for nTries_p in range(self.nTries_p): | |
|
4361 | try: | |
|
4362 | # update list_pedestal | |
|
4363 | self.list_pedestal = self.getfirstFilefromPath(path=self.path_ped,meta="PE",ext=".hdf5") | |
|
4364 | ff_pedestal = self.list_pedestal[self.nro_file] | |
|
4365 | except: | |
|
4366 | ff_pedestal = None | |
|
4367 | if ff_pedestal is not None: | |
|
4368 | ready=1 | |
|
4369 | break | |
|
4370 | log.warning("Waiting %0.2f sec for the next file: \"%s\" , try %02d ..." % (self.delay, self.nro_file, nTries_p + 1)) | |
|
4371 | time.sleep(self.delay) | |
|
4372 | continue | |
|
4373 | #return numpy.ones(self.blocksPerfile)*numpy.nan | |
|
4150 | pass | |
|
4374 | 4151 | |
|
4375 | if ready == 1: | |
|
4376 | #angulo = self.getDatavaluefromDirFilename(path=self.path_ped,file=ff_pedestal,value="azimuth") | |
|
4377 | angulo = self.getDatavaluefromDirFilename(path=self.path_ped,file=ff_pedestal,value="azi_pos") | |
|
4378 | ||
|
4379 | else: | |
|
4380 | print("there is no pedestal file") | |
|
4381 | angulo = numpy.ones(self.n_Muestras_p)*numpy.nan | |
|
4382 | self.angulo_adq[j]= angulo[iterador] | |
|
4383 | ####print("Angulo",self.angulo_adq) | |
|
4384 | ####print("Angulo",len(self.angulo_adq)) | |
|
4385 | #self.nro_key_p=iterador + self.f_a_p | |
|
4386 | #if self.nro_key_p< self.n_Muestras_p: | |
|
4387 | # self.nro_file = self.nro_file | |
|
4388 | #else: | |
|
4389 | # self.nro_file = self.nro_file+1 | |
|
4390 | # self.nro_key_p= self.nro_key_p | |
|
4391 | return self.angulo_adq | |
|
4392 | ||
|
4393 | ||
|
4394 | #def run(self, dataOut,path_ped,path_adq,t_Interval_p,n_Muestras_p,blocksPerfile,f_a_p,online): | |
|
4395 | 4152 | def run(self, dataOut,path_ped,t_Interval_p,n_Muestras_p,blocksPerfile,f_a_p,online): |
|
4396 | 4153 | if not self.isConfig: |
|
4397 | 4154 | self.setup(dataOut, path_ped,t_Interval_p,n_Muestras_p,blocksPerfile,f_a_p,online) |
|
4398 | 4155 | self.__dataReady = True |
|
4399 | 4156 | self.isConfig = True |
|
4400 | 4157 | #print("config TRUE") |
|
4401 | ||
|
4402 | 4158 | utc_adq = dataOut.utctime |
|
4403 | 4159 | ####print("utc_adq---------------",utc_adq) |
|
4404 | 4160 | list_pedestal = self.list_pedestal |
@@ -4411,52 +4167,6 class PedestalInformation(Operation): | |||
|
4411 | 4167 | dataOut.azimuth = angulo |
|
4412 | 4168 | return dataOut |
|
4413 | 4169 | |
|
4414 | ''' | |
|
4415 | if not self.isConfig: | |
|
4416 | print("######################SETUP#########################################") | |
|
4417 | print("CONFIG dataOut.utctime---",dataOut.utctime) | |
|
4418 | #self.setup( dataOut, path_ped,path_adq,t_Interval_p,n_Muestras_p,blocksPerfile,f_a_p,online) | |
|
4419 | self.setup( dataOut, path_ped,t_Interval_p,n_Muestras_p,blocksPerfile,f_a_p,online) | |
|
4420 | print("aqui bro") | |
|
4421 | if self.nro_file>=0: | |
|
4422 | self.isConfig = True | |
|
4423 | else: | |
|
4424 | self.isConfig = False | |
|
4425 | print("RUN---dataOut.utctime---",dataOut.utctime) | |
|
4426 | ||
|
4427 | dataOut.flagNoData = True | |
|
4428 | #sleep(0.5) | |
|
4429 | #print("--------------------------------------------------------------------------------") | |
|
4430 | #print("profIndex",self.__profIndex) | |
|
4431 | ''' | |
|
4432 | ''' | |
|
4433 | if self.__profIndex==0: | |
|
4434 | angulo_adq = self.setNextFileP(dataOut) | |
|
4435 | dataOut.azimuth = angulo_adq | |
|
4436 | print("TIEMPO--------:",dataOut.utctime) | |
|
4437 | print("####################################################################") | |
|
4438 | ####print("angulos",dataOut.azimuth,len(dataOut.azimuth)) | |
|
4439 | self.__dataReady = True | |
|
4440 | ''' | |
|
4441 | ''' | |
|
4442 | self.__profIndex += 1 | |
|
4443 | ####print("TIEMPO_bucle:",dataOut.utctime) | |
|
4444 | #print("profIndex",self.__profIndex) | |
|
4445 | if self.__profIndex== blocksPerfile: | |
|
4446 | self.__dataReady = True | |
|
4447 | self.__profIndex = 0 | |
|
4448 | if self.__dataReady: | |
|
4449 | #print(self.__profIndex,dataOut.azimuth[:10]) | |
|
4450 | angulo_adq = self.setNextFileP(dataOut) | |
|
4451 | dataOut.azimuth = angulo_adq | |
|
4452 | print("TIEMPO--------:",dataOut.utctime) | |
|
4453 | print("####################################################################") | |
|
4454 | ####print("angulos",dataOut.azimuth,len(dataOut.azimuth)) | |
|
4455 | dataOut.flagNoData = False | |
|
4456 | ''' | |
|
4457 | #return dataOut | |
|
4458 | ||
|
4459 | ||
|
4460 | 4170 | class Block360(Operation): |
|
4461 | 4171 | ''' |
|
4462 | 4172 | ''' |
General Comments 0
You need to be logged in to leave comments.
Login now