def _sheet_meta_from_regex(m, sheets, old_name, name, ct_paleo, ct_chron):
    """
    Build metadata for a sheet. Receive valid regex match object and use that to create metadata.
    :param obj m: Regex match object
    :param list sheets: Running list of sheet metadata
    :param str old_name: Original sheet name
    :param str name: Data set name
    :param int ct_paleo: Running count of paleoData tables
    :param int ct_chron: Running count of chronData tables
    :return sheets paleo_ct chron_ct: Updated sheets and counts
    """
    try:
        idx_model = None
        idx_table = None
        pc = m.group(1)
        # Get the model idx number from string if it exists
        if m.group(3):
            idx_model = int(m.group(4))
        # check if there's an index (for distribution tables)
        if m.group(6):
            idx_table = int(m.group(6))
        # find out table type
        if pc == "paleodata" or pc == "paleo":
            pc = "paleo"
            ct_paleo += 1
        elif pc == "chrondata" or pc == "chron":
            pc = "chron"
            ct_chron += 1
        # build filename and table name strings. build table name first, then make filename from the table_name
        new_name = "{}{}".format(pc, m.group(2))
        if idx_model:
            new_name = "{}model{}".format(new_name, idx_model)
        new_name = "{}{}".format(new_name, m.group(5))
        if idx_table:
            new_name = "{}{}".format(new_name, m.group(6))
        filename = "{}.csv".format(new_name)
    except Exception as e:
        logger_excel.debug("excel: sheet_meta_from_regex: error during setup, {}".format(e))

    # Standard naming. This matches the regex and the sheet name is how we want it.
    # paleo/chron - idx - table_type - idx
    # Not sure what to do with m.group(2) yet
    # ex: m.groups() = [ paleo, 1, model, 1, ensemble, 1 ]
    try:
        sheets.append({
            "old_name": old_name,
            "new_name": new_name,
            "filename": filename,
            "paleo_chron": pc,
            "idx_pc": int(m.group(2)),
            "idx_model": idx_model,
            "idx_table": idx_table,
            "table_type": m.group(5),
            "data": ""
        })
    except Exception as e:
        print("error: build sheets")
        logger_excel.debug("excel: build_sheet: unable to build sheet, {}".format(e))

    return sheets, ct_paleo, ct_chron
def _sheet_meta_from_regex ( m , sheets , old_name , name , ct_paleo , ct_chron ) : try : idx_model = None idx_table = None pc = m . group ( 1 ) if m . group ( 3 ) : idx_model = int ( m . group ( 4 ) ) if m . group ( 6 ) : idx_table = int ( m . group ( 6 ) ) if pc == "paleodata" or pc == "paleo" : pc = "paleo" ct_paleo += 1 elif pc == "chrondata" or pc == "chron" : pc = "chron" ct_chron += 1 new_name = "{}{}" . format ( pc , m . group ( 2 ) ) if idx_model : new_name = "{}model{}" . format ( new_name , idx_model ) new_name = "{}{}" . format ( new_name , m . group ( 5 ) ) if idx_table : new_name = "{}{}" . format ( new_name , m . group ( 6 ) ) filename = "{}.csv" . format ( new_name ) except Exception as e : logger_excel . debug ( "excel: sheet_meta_from_regex: error during setup, {}" . format ( e ) ) try : sheets . append ( { "old_name" : old_name , "new_name" : new_name , "filename" : filename , "paleo_chron" : pc , "idx_pc" : int ( m . group ( 2 ) ) , "idx_model" : idx_model , "idx_table" : idx_table , "table_type" : m . group ( 5 ) , "data" : "" } ) except Exception as e : print ( "error: build sheets" ) logger_excel . debug ( "excel: build_sheet: unable to build sheet, {}" . format ( e ) ) return sheets , ct_paleo , ct_chron
Build metadata for a sheet. Receive valid regex match object and use that to create metadata.
    :param obj m: Regex match object
    :param list sheets: Running list of sheet metadata
    :param str old_name: Original sheet name
    :param str name: Data set name
    :param int ct_paleo: Running count of paleoData tables
    :param int ct_chron: Running count of chronData tables
    :return sheets paleo_ct chron_ct: Updated sheets and counts