##// END OF EJS Templates
Cerrado los archivos hdf5 y corrigiendo el range para acceder a los index de los canales
Alexander Valdez -
r541:4f4ecda68756
parent child
Show More
@@ -4,14 +4,15 Created on Jul 3, 2014
4 @author: roj-com0419
4 @author: roj-com0419
5 '''
5 '''
6
6
7 import os
7 import os,sys
8 import time,datetime
8 import time,datetime
9 import os
10 import h5py
9 import h5py
10 import numpy
11 import re
11 import re
12 import stuffr
12 import stuffr
13
13
14 from model.data.jrodata import *
14 from model.data.jroheaderIO import RadarControllerHeader, SystemHeader
15 from model.data.jrodata import Voltage
15 from model.proc.jroproc_base import ProcessingUnit, Operation
16 from model.proc.jroproc_base import ProcessingUnit, Operation
16
17
17 class HFReader(ProcessingUnit):
18 class HFReader(ProcessingUnit):
@@ -95,8 +96,9 class HFReader(ProcessingUnit):
95 self.__firstHeigth=0
96 self.__firstHeigth=0
96 self.__nSamples=1000
97 self.__nSamples=1000
97 self.__deltaHeigth=1.5
98 self.__deltaHeigth=1.5
98 self.__sample_rate=10e5
99 self.__sample_rate=1e5
99 self.__frequency=2.72e6
100 #self.__frequency=2.72e6
101 self.__frequency=3.64e6
100 self.__online = False
102 self.__online = False
101
103
102
104
@@ -121,6 +123,7 class HFReader(ProcessingUnit):
121 dir_hf_filename= self.path+"/"+hf_dirname_format
123 dir_hf_filename= self.path+"/"+hf_dirname_format
122 fp= h5py.File(dir_hf_filename,'r')
124 fp= h5py.File(dir_hf_filename,'r')
123 hipoc=fp['t'].value
125 hipoc=fp['t'].value
126 fp.close()
124 date_time=stuffr.unix2datestr(hipoc)
127 date_time=stuffr.unix2datestr(hipoc)
125 year =int(date_time[0:4])
128 year =int(date_time[0:4])
126 month=int(date_time[5:7])
129 month=int(date_time[5:7])
@@ -163,6 +166,7 class HFReader(ProcessingUnit):
163 fp= h5py.File(dir_hf_filename,'r')
166 fp= h5py.File(dir_hf_filename,'r')
164 hipoc=fp['t'].value
167 hipoc=fp['t'].value
165 date_time=stuffr.unix2datestr(hipoc)
168 date_time=stuffr.unix2datestr(hipoc)
169 fp.close()
166 year =int(date_time[0:4])
170 year =int(date_time[0:4])
167 month=int(date_time[5:7])
171 month=int(date_time[5:7])
168 dom =int(date_time[8:10])
172 dom =int(date_time[8:10])
@@ -183,7 +187,7 class HFReader(ProcessingUnit):
183 def __selectDataForTimes(self, online=False):
187 def __selectDataForTimes(self, online=False):
184
188
185 if not(self.status):
189 if not(self.status):
186 return none
190 return None
187 self.__getFilenameList()
191 self.__getFilenameList()
188 if not(online):
192 if not(online):
189 if not(self.all):
193 if not(self.all):
@@ -265,6 +269,7 class HFReader(ProcessingUnit):
265 self.filename = filename
269 self.filename = filename
266
270
267 self.hfFilePointer = hfFilePointer
271 self.hfFilePointer = hfFilePointer
272 hfFilePointer.close()
268 self.__t0=epoc
273 self.__t0=epoc
269
274
270
275
@@ -299,8 +304,6 class HFReader(ProcessingUnit):
299 if not(self.status):
304 if not(self.status):
300 return None
305 return None
301
306
302 fp=self.hfFilePointer
303
304 def setup(self, path = None,
307 def setup(self, path = None,
305 startDate = None,
308 startDate = None,
306 endDate = None,
309 endDate = None,
@@ -310,7 +313,7 class HFReader(ProcessingUnit):
310 expLabel = "",
313 expLabel = "",
311 ext = None,
314 ext = None,
312 all=0,
315 all=0,
313 timezone='ut',
316 timezone=0,
314 online = False,
317 online = False,
315 delay = 60,
318 delay = 60,
316 walk = True):
319 walk = True):
@@ -366,6 +369,7 class HFReader(ProcessingUnit):
366
369
367 def __setHeaderDO(self):
370 def __setHeaderDO(self):
368
371
372
369 self.dataOut.radarControllerHeaderObj = RadarControllerHeader()
373 self.dataOut.radarControllerHeaderObj = RadarControllerHeader()
370
374
371 self.dataOut.systemHeaderObj = SystemHeader()
375 self.dataOut.systemHeaderObj = SystemHeader()
@@ -380,7 +384,7 class HFReader(ProcessingUnit):
380
384
381 self.dataOut.heightList = self.__firstHeigth + numpy.arange(self.__nSamples, dtype = numpy.float)*self.__deltaHeigth
385 self.dataOut.heightList = self.__firstHeigth + numpy.arange(self.__nSamples, dtype = numpy.float)*self.__deltaHeigth
382
386
383 self.dataOut.channelList = numpy.arange(self.nChannels)
387 self.dataOut.channelList = range(self.nChannels)
384
388
385 # self.dataOut.channelIndexList = None
389 #self.dataOut.channelIndexList = None
386
390
@@ -397,7 +401,7 class HFReader(ProcessingUnit):
397
401
398 self.dataOut.errorCount = 0
402 self.dataOut.errorCount = 0
399
403
400 self.dataOut.nCohInt = 10
404 self.dataOut.nCohInt = 1
401
405
402 self.dataOut.blocksize = self.dataOut.getNChannels() * self.dataOut.getNHeights()
406 self.dataOut.blocksize = self.dataOut.getNChannels() * self.dataOut.getNHeights()
403
407
@@ -451,9 +455,11 class HFReader(ProcessingUnit):
451
455
452
456
453 def readBlock(self):
457 def readBlock(self):
454 fp=self.hfFilePointer #Puntero que apunta al archivo hdf5
458 fp=h5py.File(self.filename,'r')
459 #Puntero que apunta al archivo hdf5
455 ch0=(fp['ch0']).value #Primer canal (100,1000)--(perfiles,alturas)
460 ch0=(fp['ch0']).value #Primer canal (100,1000)--(perfiles,alturas)
456 ch1=(fp['ch1']).value #Segundo canal (100,1000)--(perfiles,alturas)
461 ch1=(fp['ch1']).value #Segundo canal (100,1000)--(perfiles,alturas)
462 fp.close()
457 ch0= ch0.swapaxes(0,1) #Primer canal (100,1000)--(alturas,perfiles)
463 ch0= ch0.swapaxes(0,1) #Primer canal (100,1000)--(alturas,perfiles)
458 ch1= ch1.swapaxes(0,1) #Segundo canal (100,1000)--(alturas,perfiles)
464 ch1= ch1.swapaxes(0,1) #Segundo canal (100,1000)--(alturas,perfiles)
459 self.datablock = numpy.array([ch0,ch1])
465 self.datablock = numpy.array([ch0,ch1])
@@ -477,7 +483,7 class HFReader(ProcessingUnit):
477 ##############################
483 ##############################
478 ##############################
484 ##############################
479 self.dataOut.data = self.datablock[:,:,self.profileIndex]
485 self.dataOut.data = self.datablock[:,:,self.profileIndex]
480 self.dataOut.utctime= self.__t0 + self.dataOut.ippSeconds*self.profileIndex
486 self.dataOut.utctime= self.__t0 + self.dataOut.ippSeconds*self.profileIndex+self.timezone
481 self.dataOut.profileIndex= self.profileIndex
487 self.dataOut.profileIndex= self.profileIndex
482 self.dataOut.flagNoData=False
488 self.dataOut.flagNoData=False
483 self.profileIndex +=1
489 self.profileIndex +=1
General Comments 0
You need to be logged in to leave comments. Login now