@@ -116,7 +116,7 def isFileinThisTime(filename, startTime, endTime): | |||||
116 | if not ((startTime <= thisTime) and (endTime > thisTime)): |
|
116 | if not ((startTime <= thisTime) and (endTime > thisTime)): | |
117 | return 0 |
|
117 | return 0 | |
118 |
|
118 | |||
119 |
return |
|
119 | return thisTime | |
120 |
|
120 | |||
121 | def getlastFileFromPath(path, ext): |
|
121 | def getlastFileFromPath(path, ext): | |
122 | """ |
|
122 | """ | |
@@ -314,6 +314,8 class JRODataReader(JRODataIO, ProcessingUnit): | |||||
314 |
|
314 | |||
315 | flagNoMoreFiles = 0 |
|
315 | flagNoMoreFiles = 0 | |
316 |
|
316 | |||
|
317 | datetimeList = [] | |||
|
318 | ||||
317 | __isFirstTimeOnline = 1 |
|
319 | __isFirstTimeOnline = 1 | |
318 |
|
320 | |||
319 | def __init__(self): |
|
321 | def __init__(self): | |
@@ -347,6 +349,7 class JRODataReader(JRODataIO, ProcessingUnit): | |||||
347 | walk=True): |
|
349 | walk=True): | |
348 |
|
350 | |||
349 | pathList = [] |
|
351 | pathList = [] | |
|
352 | dateList = [] | |||
350 |
|
353 | |||
351 | if not walk: |
|
354 | if not walk: | |
352 | pathList.append(path) |
|
355 | pathList.append(path) | |
@@ -376,6 +379,8 class JRODataReader(JRODataIO, ProcessingUnit): | |||||
376 | continue |
|
379 | continue | |
377 |
|
380 | |||
378 | pathList.append(os.path.join(path,match[0],expLabel)) |
|
381 | pathList.append(os.path.join(path,match[0],expLabel)) | |
|
382 | dateList.append(thisDate) | |||
|
383 | ||||
379 | thisDate += datetime.timedelta(1) |
|
384 | thisDate += datetime.timedelta(1) | |
380 |
|
385 | |||
381 | if pathList == []: |
|
386 | if pathList == []: | |
@@ -385,7 +390,12 class JRODataReader(JRODataIO, ProcessingUnit): | |||||
385 | print "%d folder(s) was(were) found for the date range: %s-%s" %(len(pathList), startDate, endDate) |
|
390 | print "%d folder(s) was(were) found for the date range: %s - %s" %(len(pathList), startDate, endDate) | |
386 |
|
391 | |||
387 | filenameList = [] |
|
392 | filenameList = [] | |
388 | for thisPath in pathList: |
|
393 | datetimeList = [] | |
|
394 | ||||
|
395 | for i in range(len(pathList)): | |||
|
396 | ||||
|
397 | thisPath = pathList[i] | |||
|
398 | thisDate = dateList[i] | |||
389 |
|
399 | |||
390 | fileList = glob.glob1(thisPath, "*%s" %ext) |
|
400 | fileList = glob.glob1(thisPath, "*%s" %ext) | |
391 | fileList.sort() |
|
401 | fileList.sort() | |
@@ -393,17 +403,26 class JRODataReader(JRODataIO, ProcessingUnit): | |||||
393 | for file in fileList: |
|
403 | for file in fileList: | |
394 |
|
404 | |||
395 | filename = os.path.join(thisPath,file) |
|
405 | filename = os.path.join(thisPath,file) | |
|
406 | thisTime = isFileinThisTime(filename, startTime, endTime) | |||
|
407 | ||||
|
408 | if thisTime == 0: | |||
|
409 | continue | |||
396 |
|
410 | |||
397 | if isFileinThisTime(filename, startTime, endTime): |
|
|||
398 |
|
|
411 | filenameList.append(filename) | |
|
412 | datetimeList.append(datetime.datetime.combine(thisDate,thisTime)) | |||
399 |
|
|
413 | ||
400 | if not(filenameList): |
|
414 | if not(filenameList): | |
401 | print "Any file was found for the time range %s - %s" %(startTime, endTime) |
|
415 | print "Any file was found for the time range %s - %s" %(startTime, endTime) | |
402 | return None, None |
|
416 | return None, None | |
403 |
|
417 | |||
404 | print "%d file(s) was(were) found for the time range: %s - %s" %(len(filenameList), startTime, endTime) |
|
418 | print "%d file(s) was(were) found for the time range: %s - %s" %(len(filenameList), startTime, endTime) | |
|
419 | ||||
|
420 | ||||
|
421 | for i in range(len(filenameList)): | |||
|
422 | print "%s -> [%s]" %(filenameList[i], datetimeList[i].ctime()) | |||
405 |
|
423 | |||
406 | self.filenameList = filenameList |
|
424 | self.filenameList = filenameList | |
|
425 | self.datetimeList = datetimeList | |||
407 |
|
426 | |||
408 | return pathList, filenameList |
|
427 | return pathList, filenameList | |
409 |
|
428 | |||
@@ -917,7 +936,7 class JRODataReader(JRODataIO, ProcessingUnit): | |||||
917 | def printNumberOfBlock(self): |
|
936 | def printNumberOfBlock(self): | |
918 |
|
937 | |||
919 | if self.flagIsNewBlock: |
|
938 | if self.flagIsNewBlock: | |
920 | print "Block No. %04d, Total blocks %04d" %(self.basicHeaderObj.dataBlock, self.nTotalBlocks) |
|
939 | print "Block No. %04d, Total blocks %04d -> %s" %(self.basicHeaderObj.dataBlock, self.nTotalBlocks, self.dataOut.datatime.ctime()) | |
921 |
|
940 | |||
922 | def printInfo(self): |
|
941 | def printInfo(self): | |
923 |
|
942 |
General Comments 0
You need to be logged in to leave comments.
Login now