Esempio n. 1
0
def lower_boundary(input_file, i):
    with open(input_file) as file:
        csv_reader = reader(file)
        headers = list(csv_reader)[0]
        if "Facies_below" not in headers:
            headers.append("Facies_below")

    with open(input_file) as i_file:
        dict_reader = DictReader(i_file)
        data = list(dict_reader)
        for row in reversed(data):
            group = pick_group(
                divide_group(find_max_lower(row["Unit_index"], data)))
            if group:
                row.update(update_row(row, group))
                row.update({"Facies_below": group["name"] if group else None})

        utils_func.export_to_csv(f"csv/lower_boundary{i}.csv", data, headers)
Esempio n. 2
0
def biostratigraphy():
    with open("csv/special_lithology.csv") as file:
        csv_reader = reader(file)
        headers = list(csv_reader)[0]

    with open("csv/special_lithology.csv") as i_file:
        dict_reader = DictReader(i_file)
        data = list(dict_reader)
        for row in data:
            row.update(update_point.update_fluvial(row))
            row.update(update_point.update_shallow_lacustrine(row))
            row.update(update_point.update_deep_lacustrine(row))
            row.update(update_point.update_marginal_marine(row))
            row.update(update_point.update_shallow_marine(row))
            row.update(update_point.update_deep_marine(row))

    utils_func.export_to_csv("csv/biostratigraphy.csv", data, headers)

    utils_func.export_to_csv("csv/biostratigraphy_unit_by_unit.csv",
                             utils_func.convert_unit_by_unit(data), headers)
Esempio n. 3
0
def special_lithology():
    with open("csv/similar_unit.csv") as i_file:
        csv_reader = reader(i_file)
        headers = list(csv_reader)[0]

    with open("csv/similar_unit.csv") as i_file:
        dict_reader = DictReader(i_file)
        data = list(dict_reader)
        simplifed_unit = simplify_data(data)
        for i in range(len(data)):
            lithologies = find_adjacent_unit_special_lithology(
                data[i]["Unit_index"], simplifed_unit)
            if len(lithologies) > 0:
                for lithology in lithologies:
                    data[i].update(updateRow(data[i], lithology))

    utils_func.export_to_csv("csv/special_lithology.csv", data, headers)

    utils_func.export_to_csv("csv/special_lithology_unit_by_unit.csv",
                             utils_func.convert_unit_by_unit(data), headers)
Esempio n. 4
0
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)
Esempio n. 5
0
def associated_facies(input_file, iter):
    with open(input_file) as file:
        csv_reader = reader(file)
        headers = list(csv_reader)[0]
        if "Facies_group" not in headers:
            headers.append("Facies_group")

    with open(input_file) as i_file:
        dict_reader = DictReader(i_file, )
        data = list(dict_reader)

        simplified_data = simplify_data(data) if iter == 1 else data

        for row in reversed(simplified_data):
            groups = pick_group(divide_group(find_max_radius_30(row["Unit_index"], simplified_data)))
            tmp = []
            for item in groups:
                tmp.append(item["name"])
            if len(groups) > 0:
                row.update(update_row(row, groups))
                row.update({"Facies_group": tmp})

        utils_func.export_to_csv(f"csv/associated_facies{iter}.csv", simplified_data, headers)
Esempio n. 6
0
def stacking_pattern():
    with open("csv/vertical_proximity.csv") as csv_file:
        csv_reader = list(reader(csv_file))
        headers = csv_reader[0]

    with open("csv/vertical_proximity.csv") as csv_file:
        csv_reader = DictReader(csv_file)
        data = list(csv_reader)
        with open("csv/stacking_pattern.csv", "w") as write_file:
            writer = DictWriter(write_file, fieldnames=headers)
            writer.writeheader()

            for row in data:
                row.update(update_point.update_fluvial(row))
                row.update(update_point.update_deep_lacustrine(row))
                row.update(update_point.update_deep_marine(row))
                row.update(update_point.update_marginal_marine(row))
                row.update(update_point.update_shallow_lacustrine(row))
                row.update(update_point.update_shallow_marine(row))

                writer.writerow(row)

    utils_func.export_to_csv("csv/stacking_pattern_unit_by_unit.csv",
                             utils_func.convert_unit_by_unit(data), headers)
Esempio n. 7
0
def vertical_proximity():
    with open("csv/biostratigraphy.csv") as csv_file:
        csv_reader = list(reader(csv_file))
        headers = csv_reader[0]

    with open("csv/biostratigraphy.csv") as csv_file:
        csv_reader = DictReader(csv_file)
        data = list(csv_reader)
        with open("csv/vertical_proximity.csv", "w") as write_file:
            writer = DictWriter(write_file, fieldnames=headers)
            writer.writeheader()

            for row in data:
                row.update({
                    "Alluvial_Fan":
                    update_point.update_alluvial_fan(row),
                    "Fluvial_Channel":
                    update_point.update_fluvial_channel(row),
                    "Fluvial_Point_Bar":
                    update_point.update_fluvial_point_bar(row),
                    "Levee":
                    update_point.update_levee(row),
                    "Crevasse_Splay":
                    update_point.update_crevasse_splay(row),
                    "Fluvial_Floodplain":
                    update_point.update_fluvial_floodplain(row),
                    "Progradational_Lacustrine_Delta":
                    update_point.update_progradational_lacustrine_delta(row),
                    "Lacustrine_Fan_Delta":
                    update_point.update_lacustrine_fan_delta(row),
                    "Progradational_Lacustrine_Shoreface":
                    update_point.update_progradational_lacustrine_shoreface(
                        row),
                    "Transgressive_Lacustrine_Shoreface":
                    update_point.update_transgressive_lacustrine_shoreface(
                        row),
                    "Aggradational_Lacustrine_Shoreface":
                    update_point.update_aggradational_lacustrine_shoreface(
                        row),
                    "Lacustrine_Offshore_Transition":
                    update_point.update_lacustrine_offshore_transition(row),
                    "Lacustrine_Shelf":
                    update_point.update_lacustrine_shelf(row),
                    "Proximal_Sub-Lacustrine_Fan":
                    update_point.update_proximal_sub_lacustrine_fan(row),
                    "Distal_Sub-Lacustrine_Fan":
                    update_point.update_distal_sub_lacustrine_fan(row),
                    "Lacustrine_Turbidite":
                    update_point.update_lacustrine_turbidite(row),
                    "Distal_Lacustrine_Turbidites":
                    update_point.update_distal_lacustrine_turbidites(row),
                    "Lacustrine_Deepwater":
                    update_point.update_lacustrine_deepwater(row),
                    "Marine_Delta":
                    update_point.update_marine_delta(row),
                    "Marine_Fan_Delta":
                    update_point.update_marine_fan_delta(row),
                    "Tidal_Channel_And_Sand_Flat":
                    update_point.update_tidal_channel_and_sand_flat(row),
                    "Sandy_Tidal_Flat":
                    update_point.update_sandy_tidal_flat(row),
                    "Mixed_Tidal_Flat":
                    update_point.update_mixed_tidal_flat(row),
                    "Muddy_Tidal_Flat":
                    update_point.update_muddy_tidal_flat(row),
                    "Lagoon":
                    update_point.update_lagoon(row),
                    "Progradational_Marine_Shoreface":
                    update_point.update_progradational_marine_shoreface(row),
                    "Transgressive_Marine_Shoreface":
                    update_point.update_transgressive_marine_shoreface(row),
                    "Aggradational_Marine_Shoreface":
                    update_point.update_aggradational_marine_shoreface(row),
                    "Marine_Offshore_Transition":
                    update_point.update_marine_offshore_transition(row),
                    "Marine_Shelf":
                    update_point.update_marine_shelf(row),
                    "Proximal_Submarine_Fan":
                    update_point.update_proximal_submarine_fan(row),
                    "Distal_Submarine_Fan":
                    update_point.update_distal_submarine_fan(row),
                    "Marine_Turbidite":
                    update_point.update_marine_turbidite(row),
                    "Distal_Marine_Turbidites":
                    update_point.update_distal_marine_turbidites(row),
                    "Marine_Deepwater":
                    update_point.update_marine_deepwater(row)
                })
                writer.writerow(row)

    utils_func.export_to_csv("csv/vertical_proximity_unit_by_unit.csv",
                             utils_func.convert_unit_by_unit(data), headers)