solar-spark.py
def generateFiles(topdir, year, month):
    """Construct per-year dicts of lists of files"""
    allfiles = {}
    kkey = ""
    patterns = []
    months = []
    # Since some of our data dirs have months as bare numbers and
    # others have a prepended 0, let's match them correctly.
    if month:
        if month < 10:
            months = [month, "0" + str(month)]
        else:
            months = [month]
    if year and month:
        patterns = ["{year}/{monthp}/**".format(year=year, monthp=monthp)
                    for monthp in months]
        kkey = year
    elif year:
        patterns = ["{year}/*/**".format(year=year)]
        kkey = year

    if patterns:
        globs = []
        for pat in patterns:
            globs.extend(glob.glob(os.path.join(topdir, pat)))
        allfiles[kkey] = globs
    else:
        for yy in allYears:
            allfiles[yy] = glob.glob(os.path.join(topdir,
                                                  "{yy}/*/*".format(yy=yy)))
    return allfiles
Construct per-year dicts of lists of files
Construct per-year dicts of lists of files
Construct per - year dicts of lists of files
def generateFiles(topdir, year, month):
    allfiles = {}
    kkey = ""
    patterns = []
    months = []
    if month:
        if month < 10:
            months = [month, "0" + str(month)]
        else:
            months = [month]
    if year and month:
        patterns = ["{year}/{monthp}/**".format(year=year, monthp=monthp)
                    for monthp in months]
        kkey = year
    elif year:
        patterns = ["{year}/*/**".format(year=year)]
        kkey = year
    if patterns:
        globs = []
        for pat in patterns:
            globs.extend(glob.glob(os.path.join(topdir, pat)))
        allfiles[kkey] = globs
    else:
        for yy in allYears:
            allfiles[yy] = glob.glob(os.path.join(topdir,
                                                  "{yy}/*/*".format(yy=yy)))
    return allfiles
def generateFiles ( topdir , year , month ) : allfiles = { } kkey = "" patterns = [ ] months = [ ] if month : if month < 10 : months = [ month , "0" + str ( month ) ] else : months = [ month ] if year and month : patterns = [ "{year}/{monthp}/**" . format ( year = year , monthp = monthp ) for monthp in months ] kkey = year elif year : patterns = [ "{year}/*/**" . format ( year = year ) ] kkey = year if patterns : globs = [ ] for pat in patterns : globs . extend ( glob . glob ( os . path . join ( topdir , pat ) ) ) allfiles [ kkey ] = globs else : for yy in allYears : allfiles [ yy ] = glob . glob ( os . path . join ( topdir , "{yy}/*/*" . format ( yy = yy ) ) ) return allfiles
Construct per-year dicts of lists of files
Construct per - year dicts of lists of files
"""Construct per-year dicts of lists of files""" # Since some of our data dirs have months as bare numbers and # others have a prepended 0, let's match them correctly.
topdir
year
month