##// 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 404 pathList = []
405 405
406 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 412 else:
410 dirList = []
411 for thisPath in os.listdir(path):
412 if not os.path.isdir(os.path.join(path,thisPath)):
413 continue
414 if not isDoyFolder(thisPath):
415 continue
413 #dirList = []
414 multi_path = path.split(',')
415 for single_path in multi_path:
416 dirList = []
417 for thisPath in os.listdir(single_path):
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):
420 return None, None
425 if not(dirList):
426 return None, None
421 427
422 thisDate = startDate
428 thisDate = startDate
423 429
424 while(thisDate <= endDate):
425 year = thisDate.timetuple().tm_year
426 doy = thisDate.timetuple().tm_yday
427
428 matchlist = fnmatch.filter(dirList, '?' + '%4.4d%3.3d' % (year,doy) + '*')
429 if len(matchlist) == 0:
430 while(thisDate <= endDate):
431 year = thisDate.timetuple().tm_year
432 doy = thisDate.timetuple().tm_yday
433
434 matchlist = fnmatch.filter(dirList, '?' + '%4.4d%3.3d' % (year,doy) + '*')
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 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 443 if pathList == []:
438 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 449 filenameList = []
444 450 datetimeList = []
451 pathDict = {}
452 filenameList_to_sort = []
445 453
446 454 for i in range(len(pathList)):
447 455
@@ -449,7 +457,18 class JRODataReader(JRODataIO, ProcessingUnit):
449 457
450 458 fileList = glob.glob1(thisPath, "*%s" %ext)
451 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 472 for file in fileList:
454 473
455 474 filename = os.path.join(thisPath,file)
General Comments 0
You need to be logged in to leave comments. Login now