@@ -151,13 +151,15 class HDFReader(Reader, ProcessingUnit): | |||
|
151 | 151 | self.__setBlockList() |
|
152 | 152 | |
|
153 | 153 | if 'type' in self.meta: |
|
154 | ##print("Creting dataOut...") | |
|
154 | 155 | self.dataOut = eval(self.meta['type'])() |
|
156 | ##print(vars(self.dataOut)) | |
|
155 | 157 | |
|
156 | 158 | for attr in self.meta: |
|
157 | #print("attr: ", attr) | |
|
159 | ##print("attr: ", attr) | |
|
160 | ##print(type(self.dataOut).__name__) | |
|
158 | 161 | setattr(self.dataOut, attr, self.meta[attr]) |
|
159 | 162 | |
|
160 | ||
|
161 | 163 | self.blockIndex = 0 |
|
162 | 164 | |
|
163 | 165 | return |
@@ -277,12 +279,13 class HDFReader(Reader, ProcessingUnit): | |||
|
277 | 279 | #self.dataOut.error = True TERMINA EL PROGRAMA, removido |
|
278 | 280 | return |
|
279 | 281 | for attr in self.data: |
|
282 | #print("attr ",attr) | |
|
280 | 283 | if self.data[attr].ndim == 1: |
|
281 | 284 | setattr(self.dataOut, attr, self.data[attr][self.blockIndex]) |
|
282 | 285 | else: |
|
283 | 286 | setattr(self.dataOut, attr, self.data[attr][:, self.blockIndex]) |
|
284 | 287 | |
|
285 | self.dataOut.flagNoData = False | |
|
288 | ||
|
286 | 289 | self.blockIndex += 1 |
|
287 | 290 | |
|
288 | 291 | if self.blockIndex == 1: |
@@ -295,7 +298,8 class HDFReader(Reader, ProcessingUnit): | |||
|
295 | 298 | self.blockIndex, |
|
296 | 299 | self.blocksPerFile),self.name) |
|
297 | 300 | |
|
298 | ||
|
301 | self.dataOut.flagNoData = False | |
|
302 | self.dataOut.error = False | |
|
299 | 303 | return |
|
300 | 304 | |
|
301 | 305 | def run(self, **kwargs): |
@@ -385,19 +389,26 class HDFWriter(Operation): | |||
|
385 | 389 | metadataList = None |
|
386 | 390 | currentDay = None |
|
387 | 391 | lastTime = None |
|
392 | typeTime = "ut" | |
|
393 | hourLimit = 3 | |
|
394 | breakDays = True | |
|
388 | 395 | |
|
389 | 396 | def __init__(self): |
|
390 | 397 | |
|
391 | 398 | Operation.__init__(self) |
|
392 | 399 | return |
|
393 | 400 | |
|
394 |
def setup(self, path=None, blocksPerFile=10, metadataList=None, dataList=None, setType=None, |
|
|
401 | def setup(self, path=None, blocksPerFile=10, metadataList=None, dataList=None, setType=None, | |
|
402 | description=None,typeTime = "ut",hourLimit = 3, breakDays=True): | |
|
395 | 403 | self.path = path |
|
396 | 404 | self.blocksPerFile = blocksPerFile |
|
397 | 405 | self.metadataList = metadataList |
|
398 | 406 | self.dataList = [s.strip() for s in dataList] |
|
399 | 407 | self.setType = setType |
|
400 | 408 | self.description = description |
|
409 | self.timeZone = typeTime | |
|
410 | self.hourLimit = hourLimit | |
|
411 | self.breakDays = breakDays | |
|
401 | 412 | |
|
402 | 413 | if self.metadataList is None: |
|
403 | 414 | self.metadataList = self.dataOut.metadata_list |
@@ -431,7 +442,11 class HDFWriter(Operation): | |||
|
431 | 442 | |
|
432 | 443 | def timeFlag(self): |
|
433 | 444 | currentTime = self.dataOut.utctime |
|
434 | timeTuple = time.localtime(currentTime) | |
|
445 | if self.timeZone == "lt": | |
|
446 | timeTuple = time.localtime(currentTime) | |
|
447 | elif self.timeZone == "ut": | |
|
448 | timeTuple = time.gmtime(currentTime) | |
|
449 | ||
|
435 | 450 | dataDay = timeTuple.tm_yday |
|
436 | 451 | #print("time UTC: ",currentTime, self.dataOut.datatime) |
|
437 | 452 | if self.lastTime is None: |
@@ -441,25 +456,22 class HDFWriter(Operation): | |||
|
441 | 456 | |
|
442 | 457 | timeDiff = currentTime - self.lastTime |
|
443 | 458 | |
|
444 |
#Si el dia es diferente o si la diferencia entre un dato y otro supera |
|
|
445 | if dataDay != self.currentDay: | |
|
459 | #Si el dia es diferente o si la diferencia entre un dato y otro supera self.hourLimit | |
|
460 | if (dataDay != self.currentDay) and self.breakDays: | |
|
446 | 461 | self.currentDay = dataDay |
|
447 | 462 | return True |
|
448 |
elif timeDiff > |
|
|
463 | elif timeDiff > self.hourLimit*60*60: | |
|
449 | 464 | self.lastTime = currentTime |
|
450 | 465 | return True |
|
451 | 466 | else: |
|
452 | 467 | self.lastTime = currentTime |
|
453 | 468 | return False |
|
454 | 469 | |
|
455 | def run(self, dataOut, path, blocksPerFile=10, metadataList=None, | |
|
456 | dataList=[], setType=None, description={}): | |
|
470 | def run(self, dataOut,**kwargs): | |
|
457 | 471 | |
|
458 | 472 | self.dataOut = dataOut |
|
459 | 473 | if not(self.isConfig): |
|
460 | self.setup(path=path, blocksPerFile=blocksPerFile, | |
|
461 | metadataList=metadataList, dataList=dataList, | |
|
462 | setType=setType, description=description) | |
|
474 | self.setup(**kwargs) | |
|
463 | 475 | |
|
464 | 476 | self.isConfig = True |
|
465 | 477 | self.setNextFile() |
@@ -472,8 +484,10 class HDFWriter(Operation): | |||
|
472 | 484 | ext = self.ext |
|
473 | 485 | path = self.path |
|
474 | 486 | setFile = self.setFile |
|
475 | ||
|
476 |
timeTuple = time. |
|
|
487 | if self.timeZone == "lt": | |
|
488 | timeTuple = time.localtime(self.dataOut.utctime) | |
|
489 | elif self.timeZone == "ut": | |
|
490 | timeTuple = time.gmtime(self.dataOut.utctime) | |
|
477 | 491 | #print("path: ",timeTuple) |
|
478 | 492 | subfolder = 'd%4.4d%3.3d' % (timeTuple.tm_year,timeTuple.tm_yday) |
|
479 | 493 | fullpath = os.path.join(path, subfolder) |
@@ -121,7 +121,7 class SpectraProc(ProcessingUnit): | |||
|
121 | 121 | self.dataOut.flagShiftFFT = False |
|
122 | 122 | |
|
123 | 123 | def run(self, nProfiles=None, nFFTPoints=None, pairsList=None, ippFactor=None, shift_fft=False): |
|
124 | ||
|
124 | ||
|
125 | 125 | if self.dataIn.type == "Spectra": |
|
126 | 126 | self.dataOut.copy(self.dataIn) |
|
127 | 127 | if shift_fft: |
General Comments 0
You need to be logged in to leave comments.
Login now