##// END OF EJS Templates
En jrodataIO.py se agregan los cambios en searchFilesOffLine para lectura de datos sobre multiples paths. Los datos se ordenan segun el nombre del archivo.
Daniel Valdez -
r449:336ad0c1a9b5
parent child
Show More
@@ -404,35 +404,41 class JRODataReader(JRODataIO, ProcessingUnit):
404 pathList = []
404 pathList = []
405
405
406 if not walk:
406 if not walk:
407 pathList.append(path)
407 #pathList.append(path)
408 multi_path = path.split(',')
409 for single_path in multi_path:
410 pathList.append(single_path)
408
411
409 else:
412 else:
410 dirList = []
413 #dirList = []
411 for thisPath in os.listdir(path):
414 multi_path = path.split(',')
412 if not os.path.isdir(os.path.join(path,thisPath)):
415 for single_path in multi_path:
413 continue
416 dirList = []
414 if not isDoyFolder(thisPath):
417 for thisPath in os.listdir(single_path):
415 continue
418 if not os.path.isdir(os.path.join(single_path,thisPath)):
419 continue
420 if not isDoyFolder(thisPath):
421 continue
416
422
417 dirList.append(thisPath)
423 dirList.append(thisPath)
418
424
419 if not(dirList):
425 if not(dirList):
420 return None, None
426 return None, None
421
427
422 thisDate = startDate
428 thisDate = startDate
423
429
424 while(thisDate <= endDate):
430 while(thisDate <= endDate):
425 year = thisDate.timetuple().tm_year
431 year = thisDate.timetuple().tm_year
426 doy = thisDate.timetuple().tm_yday
432 doy = thisDate.timetuple().tm_yday
427
433
428 matchlist = fnmatch.filter(dirList, '?' + '%4.4d%3.3d' % (year,doy) + '*')
434 matchlist = fnmatch.filter(dirList, '?' + '%4.4d%3.3d' % (year,doy) + '*')
429 if len(matchlist) == 0:
435 if len(matchlist) == 0:
436 thisDate += datetime.timedelta(1)
437 continue
438 for match in matchlist:
439 pathList.append(os.path.join(single_path,match,expLabel))
440
430 thisDate += datetime.timedelta(1)
441 thisDate += datetime.timedelta(1)
431 continue
432 for match in matchlist:
433 pathList.append(os.path.join(path,match,expLabel))
434
435 thisDate += datetime.timedelta(1)
436
442
437 if pathList == []:
443 if pathList == []:
438 print "Any folder was found for the date range: %s-%s" %(startDate, endDate)
444 print "Any folder was found for the date range: %s-%s" %(startDate, endDate)
@@ -442,6 +448,8 class JRODataReader(JRODataIO, ProcessingUnit):
442
448
443 filenameList = []
449 filenameList = []
444 datetimeList = []
450 datetimeList = []
451 pathDict = {}
452 filenameList_to_sort = []
445
453
446 for i in range(len(pathList)):
454 for i in range(len(pathList)):
447
455
@@ -449,7 +457,18 class JRODataReader(JRODataIO, ProcessingUnit):
449
457
450 fileList = glob.glob1(thisPath, "*%s" %ext)
458 fileList = glob.glob1(thisPath, "*%s" %ext)
451 fileList.sort()
459 fileList.sort()
460 pathDict.setdefault(fileList[0])
461 pathDict[fileList[0]] = i
462 filenameList_to_sort.append(fileList[0])
463
464 filenameList_to_sort.sort()
465
466 for file in filenameList_to_sort:
467 thisPath = pathList[pathDict[file]]
452
468
469 fileList = glob.glob1(thisPath, "*%s" %ext)
470 fileList.sort()
471
453 for file in fileList:
472 for file in fileList:
454
473
455 filename = os.path.join(thisPath,file)
474 filename = os.path.join(thisPath,file)
General Comments 0
You need to be logged in to leave comments. Login now