def update_marginal_marine(row): points = [] if row["Biostratigraphy"] == "1": points = ["x"] elif row["Biostratigraphy"] == "2": points = ["x"] elif row["Biostratigraphy"] == "3": points = ["x"] elif row["Biostratigraphy"] == "4": points = [3, 1, 0] elif row["Biostratigraphy"] == "5": points = [3, 1, 0] elif row["Biostratigraphy"] == "6": points = [3, 1, 0] elif row["Biostratigraphy"] == "7": points = [-2, -1, 0] if len(points) > 0: if points[0] != "x": point = points[int(row["Reliability"]) - 1] for code in utils_func.get_group_depofacies("Marginal_Marine"): name = utils_func.map_core_depofacies_code_to_name(code) if int(row[name]) > 0: row.update({name: utils_func.handle_addition(int(row[name]) + point)}) else: for code in utils_func.get_group_depofacies("Marginal_Marine"): name = utils_func.map_core_depofacies_code_to_name(code) row.update({name: 0}) return row
def add_point_coal(row): for code in utils_func.get_group_depofacies("Fluvial"): name = utils_func.map_core_depofacies_code_to_name(code) if int(row[name]) > 0: row.update({name: int(row[name]) + 2}) for code in utils_func.get_group_depofacies("Marginal_Marine"): name = utils_func.map_core_depofacies_code_to_name(code) if int(row[name]) > 0: row.update({name: int(row[name]) + 1}) return row
def add_point_marine_non_clastic(row): marines = ["Shallow_Marine", "Marginal_Marine", "Deep_Marine"] for group_name in marines: codes = utils_func.get_group_depofacies(group_name) for code in codes: name = utils_func.map_core_depofacies_code_to_name(code) if int(row[name]) > 0: row.update({name: int(row[name]) + 2}) return row
def similar_unit(): with open("csv/init_point.csv") as file: csv_reader = reader(file) headers = list(csv_reader)[0] with open("csv/init_point.csv") as file: dict_reader = DictReader(file) data = list(dict_reader) simplified = simplify_data(deepcopy(data)) for i in range(len(data)): if data[i]["Number_of_similar_units_50"] != "0" or data[i][ "Core_depofacies"] != "-9999": unit_index = utils_func.convert_string_to_array( data[i]["Index_of_similar_units_50"]) idx = data[i]["Unit_index"] unit_index.append(idx) codes = find_unit_core_depofacies(unit_index, simplified) for code in codes: name = utils_func.map_core_depofacies_code_to_name(code) if name: new_point = handle_point(data[i][name], "0-50") data[i].update({name: new_point}) if data[i]["Number_of_similar_units_100"] != "0": unit_index = utils_func.convert_string_to_array( data[i]["Index_of_similar_units_100"]) codes = find_unit_core_depofacies(unit_index, simplified) for code in codes: name = utils_func.map_core_depofacies_code_to_name(code) if name: new_point = handle_point(data[i][name], "50-100") data[i].update({name: new_point}) utils_func.export_to_csv("csv/similar_unit.csv", data, headers) utils_func.export_to_csv("csv/similar_unit_unit_by_unit.csv", utils_func.convert_unit_by_unit(data), headers)
def update_deep_marine(row): point = 0 if int(row["Stacking_pattern"]) == 1: point = 0 elif int(row["Stacking_pattern"]) == 2: point = 0 codes = utils_func.get_group_depofacies("Deep_Marine") for code in codes: name = utils_func.map_core_depofacies_code_to_name(code) if int(row[name]) > 0: row.update( {name: utils_func.handle_addition(int(row[name]) + point)}) return row