def read_markers_from_csv_file()

in src/loading_manifest/osdu_wellboretop_manifest.py [0:0]


def read_markers_from_csv_file(csv_file):
    marker_name_types = []
    name_top_md = "TOP_MD"
    name_strat_unit_cd = "STRAT_UNIT_CD"
    name_strat_unit_nm = "STRAT_UNIT_NM"
    name_depth_unit = "DEPTH_UNITS"
    col_top_md = 2
    col_strat_unit_cd = 6
    col_strat_unit_nm = 7
    col_depth_unit = 15

    (col_top_md, col_strat_unit_cd, col_strat_unit_nm, col_depth_unit) = \
        cm.csv_colname_to_colindex(csv_file,
                                   (name_top_md, name_strat_unit_cd, name_strat_unit_nm, name_depth_unit),
                                   (col_top_md, col_strat_unit_cd, col_strat_unit_nm, col_depth_unit))

    with open(csv_file, mode='r', encoding='utf-8') as infile:
        reader = csv.reader(infile)
        skip_first_row = True
        for rows in reader:
            if skip_first_row:
                skip_first_row = False
                continue
            marker_top_md = float(rows[col_top_md].strip())
            marker_cd = rows[col_strat_unit_cd].strip()
            marker_nm = rows[col_strat_unit_nm].strip()
            marker_depth_unit = rows[col_depth_unit].strip().lower()
            marker_name_types.append((marker_top_md, marker_depth_unit, marker_nm, marker_cd))

    return marker_name_types