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