@@ -107,16 +107,17 def isFileinThisTime(filename, startTime, endTime): | |||
|
107 | 107 | sts = basicHeaderObj.read(fp) |
|
108 | 108 | fp.close() |
|
109 | 109 | |
|
110 | thisDatetime = basicHeaderObj.datatime | |
|
110 | 111 | thisTime = basicHeaderObj.datatime.time() |
|
111 | 112 | |
|
112 | 113 | if not(sts): |
|
113 | 114 | print "Skipping the file %s because it has not a valid header" %(filename) |
|
114 |
return |
|
|
115 | return None | |
|
115 | 116 | |
|
116 | 117 | if not ((startTime <= thisTime) and (endTime > thisTime)): |
|
117 |
return |
|
|
118 | return None | |
|
118 | 119 | |
|
119 |
return this |
|
|
120 | return thisDatetime | |
|
120 | 121 | |
|
121 | 122 | def getlastFileFromPath(path, ext): |
|
122 | 123 | """ |
@@ -318,6 +319,8 class JRODataReader(JRODataIO, ProcessingUnit): | |||
|
318 | 319 | |
|
319 | 320 | __isFirstTimeOnline = 1 |
|
320 | 321 | |
|
322 | __printInfo = True | |
|
323 | ||
|
321 | 324 | def __init__(self): |
|
322 | 325 | |
|
323 | 326 | """ |
@@ -349,11 +352,10 class JRODataReader(JRODataIO, ProcessingUnit): | |||
|
349 | 352 | walk=True): |
|
350 | 353 | |
|
351 | 354 | pathList = [] |
|
352 | dateList = [] | |
|
353 | 355 | |
|
354 | 356 | if not walk: |
|
355 | 357 | pathList.append(path) |
|
356 |
|
|
|
358 | ||
|
357 | 359 | else: |
|
358 | 360 | dirList = [] |
|
359 | 361 | for thisPath in os.listdir(path): |
@@ -379,7 +381,6 class JRODataReader(JRODataIO, ProcessingUnit): | |||
|
379 | 381 | continue |
|
380 | 382 | |
|
381 | 383 | pathList.append(os.path.join(path,match[0],expLabel)) |
|
382 | dateList.append(thisDate) | |
|
383 | 384 | |
|
384 | 385 | thisDate += datetime.timedelta(1) |
|
385 | 386 | |
@@ -395,7 +396,6 class JRODataReader(JRODataIO, ProcessingUnit): | |||
|
395 | 396 | for i in range(len(pathList)): |
|
396 | 397 | |
|
397 | 398 | thisPath = pathList[i] |
|
398 | thisDate = dateList[i] | |
|
399 | 399 | |
|
400 | 400 | fileList = glob.glob1(thisPath, "*%s" %ext) |
|
401 | 401 | fileList.sort() |
@@ -403,13 +403,13 class JRODataReader(JRODataIO, ProcessingUnit): | |||
|
403 | 403 | for file in fileList: |
|
404 | 404 | |
|
405 | 405 | filename = os.path.join(thisPath,file) |
|
406 |
this |
|
|
406 | thisDatetime = isFileinThisTime(filename, startTime, endTime) | |
|
407 | 407 | |
|
408 |
if |
|
|
408 | if not(thisDatetime): | |
|
409 | 409 | continue |
|
410 | 410 | |
|
411 | 411 | filenameList.append(filename) |
|
412 |
datetimeList.append( |
|
|
412 | datetimeList.append(thisDatetime) | |
|
413 | 413 | |
|
414 | 414 | if not(filenameList): |
|
415 | 415 | print "Any file was found for the time range %s - %s" %(startTime, endTime) |
@@ -452,8 +452,10 class JRODataReader(JRODataIO, ProcessingUnit): | |||
|
452 | 452 | """ |
|
453 | 453 | dirList = [] |
|
454 | 454 | |
|
455 | if walk: | |
|
456 | ||
|
455 | if not walk: | |
|
456 | fullpath = path | |
|
457 | ||
|
458 | else: | |
|
457 | 459 | #Filtra solo los directorios |
|
458 | 460 | for thisPath in os.listdir(path): |
|
459 | 461 | if not os.path.isdir(os.path.join(path,thisPath)): |
@@ -470,9 +472,7 class JRODataReader(JRODataIO, ProcessingUnit): | |||
|
470 | 472 | |
|
471 | 473 | doypath = dirList[-1] |
|
472 | 474 | fullpath = os.path.join(path, doypath, expLabel) |
|
473 | ||
|
474 | else: | |
|
475 | fullpath = path | |
|
475 | ||
|
476 | 476 | |
|
477 | 477 | print "%s folder was found: " %(fullpath ) |
|
478 | 478 | |
@@ -491,8 +491,6 class JRODataReader(JRODataIO, ProcessingUnit): | |||
|
491 | 491 | set = int( filename[8:11] ) |
|
492 | 492 | |
|
493 | 493 | return fullpath, filename, year, doy, set |
|
494 | ||
|
495 | ||
|
496 | 494 | |
|
497 | 495 | def __setNextFileOffline(self): |
|
498 | 496 | |
@@ -940,10 +938,15 class JRODataReader(JRODataIO, ProcessingUnit): | |||
|
940 | 938 | |
|
941 | 939 | def printInfo(self): |
|
942 | 940 | |
|
943 | print self.basicHeaderObj.printInfo() | |
|
944 | print self.systemHeaderObj.printInfo() | |
|
945 | print self.radarControllerHeaderObj.printInfo() | |
|
946 |
|
|
|
941 | if self.__printInfo == False: | |
|
942 | return | |
|
943 | ||
|
944 | self.basicHeaderObj.printInfo() | |
|
945 | self.systemHeaderObj.printInfo() | |
|
946 | self.radarControllerHeaderObj.printInfo() | |
|
947 | self.processingHeaderObj.printInfo() | |
|
948 | ||
|
949 | self.__printInfo = False | |
|
947 | 950 | |
|
948 | 951 | |
|
949 | 952 | def run(self, **kwargs): |
General Comments 0
You need to be logged in to leave comments.
Login now