TNO Intern

Commit 6c987602 authored by Zanne Korevaar's avatar Zanne Korevaar
Browse files

Add option for user-defined lithology_properties table in the...

Add option for user-defined lithology_properties table in the ProcessLithologyToThermalConductivity object
parent ad25e580
Loading
Loading
Loading
Loading
+14 −12
Original line number Diff line number Diff line
@@ -257,6 +257,7 @@ class ProcessLithologyToThermalConductivity:

    def __init__(
        self,
        lithology_properties_df: pd.DataFrame,
        borehole_df: pd.DataFrame,
        Tg: float,
        Tgrad: float,
@@ -270,8 +271,7 @@ class ProcessLithologyToThermalConductivity:
        out_table: str,
        read_from_table: bool,
    ) -> None:
        # Read lithology properties reference table (Excel)
        self.lithology_props_df = self.load_lithology_properties_df()
        self.lithology_props_df = lithology_properties_df

        self.borehole_df = borehole_df
        self.lithology_props_dict = self.create_lithology_props_dict()
@@ -299,14 +299,6 @@ class ProcessLithologyToThermalConductivity:
        self.out_table = out_table
        self.read_from_table = read_from_table

    @staticmethod
    def load_lithology_properties_df() -> pd.DataFrame:
        return pd.read_excel(
            files("geoloop.lithology.resources").joinpath(
                "lithology_properties.xlsx"
            )
        )

    def create_lithology_props_dict(self) -> dict[int, "ThermalConductivityCalculator"]:
        """
        Creates a dictionary of physical and thermal properties for different lithologies, in the correct format for
@@ -393,12 +385,22 @@ class ProcessLithologyToThermalConductivity:
            Initialized instance.
        """

        borehole_path = config.borehole_lithology_path
        # Read borehole lithology table (Excel)
        borehole_df = pd.read_excel(
            borehole_path, sheet_name=config.borehole_lithology_sheetname
            config.borehole_lithology_path, sheet_name=config.borehole_lithology_sheetname
        )
        # Read lithology properties reference table (Excel)
        if config.lithology_properties_path is not None:
            lithology_properties_df = pd.read_excel(
                config.lithology_properties_path
            )
        else:
            lithology_properties_df = pd.read_excel(
                files("geoloop.lithology.resources").joinpath("lithology_properties.xlsx")
            )

        return cls(
            lithology_properties_df=lithology_properties_df,
            borehole_df=borehole_df,
            Tg=config.Tg,
            Tgrad=config.Tgrad,