TNO Intern

Commit fa134a56 authored by Zanne Korevaar's avatar Zanne Korevaar
Browse files

Run ruff formatter in src directory

parent 555c1ca5
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -750,4 +750,3 @@ def thomas_heatloop(

    res2 = result.reshape(len(time), grid.nx, grid.ny, grid.nz)
    return res2
+17 −3
Original line number Diff line number Diff line
@@ -4,7 +4,13 @@ import time

import pandas as pd

from geoloop.configuration import load_single_config, load_nested_config, PlotInputConfig, SingleRunConfig, LithologyConfig
from geoloop.configuration import (
    load_single_config,
    load_nested_config,
    PlotInputConfig,
    SingleRunConfig,
    LithologyConfig,
)
from geoloop.bin.SingleRunSim import SingleRun
from geoloop.lithology.process_lithology import ProcessLithologyToThermalConductivity
from geoloop.plotting.create_plots import PlotResults
@@ -82,7 +88,13 @@ def main_plotmain(config_path: str | Path) -> None:
                        run_name = plotinput.run_names[i]
                        runjson = run_name + ".json"
                        keysneeded = []
                        keysoptional = ["litho_k_param", "loadprofile", "borefield", "variables_config", "flow_data"]
                        keysoptional = [
                            "litho_k_param",
                            "loadprofile",
                            "borefield",
                            "variables_config",
                            "flow_data",
                        ]
                        config_sim = load_nested_config(
                            runjson, keysneeded, keysoptional
                        )
@@ -94,7 +106,9 @@ def main_plotmain(config_path: str | Path) -> None:
                            # in a single run always set the base case to True
                            run_config.litho_k_param["basecase"] = True
                            lithology_to_k = (
                                ProcessLithologyToThermalConductivity.from_config(LithologyConfig(**run_config.litho_k_param))
                                ProcessLithologyToThermalConductivity.from_config(
                                    LithologyConfig(**run_config.litho_k_param)
                                )
                            )
                            lithology_to_k.create_multi_thermcon_profiles()
                            run_config.lithology_to_k = lithology_to_k
+2 −1
Original line number Diff line number Diff line
@@ -15,9 +15,10 @@ command_dict = {
    "Plotmain": main_plotmain,
    "Loadprofile": main_load_profile,
    "Lithology": main_lithology,
    "FlowData": main_flow_data
    "FlowData": main_flow_data,
}


def run_batch_from_json(config_file: str) -> None:
    """
    Execute internal registered command functions defined in a JSON batch file.
+9 −2
Original line number Diff line number Diff line
@@ -2,7 +2,12 @@ import sys
import time
from pathlib import Path

from geoloop.configuration import load_nested_config, SingleRunConfig, LithologyConfig, StochasticRunConfig
from geoloop.configuration import (
    load_nested_config,
    SingleRunConfig,
    LithologyConfig,
    StochasticRunConfig,
)
from geoloop.utils.helpers import save_MCrun_results
from geoloop.utils.RunManager import run_models
from geoloop.lithology.process_lithology import ProcessLithologyToThermalConductivity
@@ -45,7 +50,9 @@ def main_runmain(config_file_path: str | Path) -> None:
    # Optional lithology-based thermal conductivity sample generation
    config.lithology_to_k = None
    if config.litho_k_param:
        lithology_to_k = ProcessLithologyToThermalConductivity.from_config(LithologyConfig(**config.litho_k_param))
        lithology_to_k = ProcessLithologyToThermalConductivity.from_config(
            LithologyConfig(**config.litho_k_param)
        )
        lithology_to_k.create_multi_thermcon_profiles()
        config.lithology_to_k = lithology_to_k

+10 −4
Original line number Diff line number Diff line
@@ -177,8 +177,6 @@ def Jfunc(
    return -retval[-1]




class SingleRunResult:
    """
    Container class holding the results of a single BHE simulation run.
@@ -840,7 +838,13 @@ def main_single_run_sim(config_file_path: Path | str) -> None:

    # Load configuration
    keysneeded = []
    keysoptional = ["litho_k_param", "loadprofile", "borefield", "flow_data", "variables_config"]
    keysoptional = [
        "litho_k_param",
        "loadprofile",
        "borefield",
        "flow_data",
        "variables_config",
    ]
    config_dict = load_nested_config(config_file_path, keysneeded, keysoptional)

    config = SingleRunConfig(**config_dict)  # validated Pydantic object
@@ -850,7 +854,9 @@ def main_single_run_sim(config_file_path: Path | str) -> None:
    if config.litho_k_param:
        # in a single run always set the base case to True
        config.litho_k_param["basecase"] = True
        lithology_to_k = ProcessLithologyToThermalConductivity.from_config(LithologyConfig(**config.litho_k_param))
        lithology_to_k = ProcessLithologyToThermalConductivity.from_config(
            LithologyConfig(**config.litho_k_param)
        )
        lithology_to_k.create_multi_thermcon_profiles()
        config.lithology_to_k = lithology_to_k

Loading