TNO Intern

Commit 5226e34d authored by Hen Brett's avatar Hen Brett 🐔
Browse files

Updating the example data and fixing the docstrings

parent 9b0d1062
Loading
Loading
Loading
Loading
+87 −49
Original line number Diff line number Diff line
@@ -146,9 +146,16 @@ def calculate_doublet_performance(input_data: xr.Dataset,

def validate_input_data(input_data: xr.Dataset):
    """
    Ensure that the input_data Dataset contains the minimum required variables
    :param input_data:
    :return:
    Ensure that the input_data Dataset contains the minimum required variables.

    Parameters
    ----------
    input_data : xr.Dataset
        Input dataset that must contain the required ThermoGIS variables.

    Returns
    -------
    None
    """
    missing_variables = []
    for variable in ["thickness_mean", "thickness_sd", "porosity", "ntg", "depth", "ln_permeability_mean", "ln_permeability_sd"]:
@@ -169,29 +176,46 @@ def validate_input_data(input_data: xr.Dataset):
def calculate_performance_of_single_location(mask: float, depth: float, thickness: float, porosity: float, ntg: float, temperature: float, transmissivity: float, transmissivity_with_ntg: float, doublet: JClass = None ,
                                             utc_properties: JClass = None) -> float:
    """
        Calculate the performance of a doublet at a single location
    :param utc_properties:
    :param mask:
        mask value, if not nan set all output to 0.0
    :param depth:
        depth of the aquifer
    :param thickness:
        thickness of the aquifer
    :param porosity:
        porosity of the aquifer
    :param ntg:
        net-to-gross of the aquifer
    :param temperature:
        temperature of the aquifer
    :param transmissivity:
        transmissivity of the aquifer
    :param transmissivity_with_ntg:
        transmissivity * ntg of the aquifer
    :param doublet:
        a ThermoGIS doublet class
    :return:
        the values "power", "heat_pump_power", "capex", "opex", "utc", "npv", "hprod", "cop", "cophp", "pres", "flow_rate", "welld" from the doublet calculation
    Calculate the performance of a doublet at a single location.

    Parameters
    ----------
    utc_properties : dict
        Dictionary containing UTC (Underground Thermal Capacity) properties.
    mask : float
        Mask value; if not NaN, all output values will be set to 0.0.
    depth : float
        Depth of the aquifer in meters.
    thickness : float
        Thickness of the aquifer in meters.
    porosity : float
        Porosity of the aquifer (fraction).
    ntg : float
        Net-to-gross ratio of the aquifer (fraction).
    temperature : float
        Temperature of the aquifer in degrees Celsius.
    transmissivity : float
        Transmissivity of the aquifer.
    transmissivity_with_ntg : float
        Product of transmissivity and net-to-gross.
    doublet : object
        An instance of the ThermoGIS doublet class.

    Returns
    -------
    These parameters as a tuple:
    - "power"
    - "heat_pump_power"
    - "capex"
    - "opex"
    - "utc"
    - "npv"
    - "hprod"
    - "cop"
    - "cophp"
    - "pres"
    - "flow_rate"
    - "welld"
    """

    if np.isnan(thickness):
@@ -240,12 +264,21 @@ def calculate_performance_of_single_location(mask: float, depth: float, thicknes

def instantiate_thermogis_doublet(utc_properties, rng_seed: int = None) -> JClass:
    """
    Instantiate a ThermoGIS Doublet class, with a set random seed if provided
    :param utc_properties: A UTCProperties instance, with different input parameters
    :param rng_seed: An integer to set the random number generator
    :return:
        doublet, a JPype instantiated object of the ThermoGISDoublet class
    Instantiate a ThermoGIS Doublet class, optionally using a specified random seed.

    Parameters
    ----------
    utc_properties : UTCProperties
        Instance containing the input parameters required for the doublet simulation.
    rng_seed : int
        Optional random seed for reproducibility.

    Returns
    -------
    doublet : object
        A JPype-instantiated object of the ThermoGISDoublet class.
    """

    # Instantiate doublet class
    Logger = JClass("logging.Logger")
    Mockito = JClass("org.mockito.Mockito")
@@ -269,16 +302,30 @@ def instantiate_thermogis_doublet(utc_properties, rng_seed: int = None) -> JClas

def set_doublet_parameters(doublet, transmissivity_with_ntg: float, depth: float, porosity: float, ntg: float, temperature: float, utc_properties: JClass):
    """
    For a single location sets the necessary data on the doublet class, to then run a doublet simulation
    :param utc_properties:
    :param doublet:
    :param transmissivity_with_ntg:
    :param depth:
    :param porosity:
    :param ntg:
    :param temperature:
    :return:
    Set necessary data on the doublet class for a single location prior to simulation.

    Parameters
    ----------
    utc_properties : dict
        Dictionary containing UTC properties.
    doublet : object
        An instance of the ThermoGIS doublet class.
    transmissivity_with_ntg : float
        Product of transmissivity and net-to-gross.
    depth : float
        Depth of the aquifer in meters.
    porosity : float
        Porosity of the aquifer (fraction).
    ntg : float
        Net-to-gross ratio of the aquifer (fraction).
    temperature : float
        Temperature of the aquifer in degrees Celsius.

    Returns
    -------
    None
    """

    if not utc_properties.useStimulation() or transmissivity_with_ntg > utc_properties.stimKhMax():
        doublet.setNoStimulation()

@@ -294,12 +341,3 @@ def set_doublet_parameters(doublet, transmissivity_with_ntg: float, depth: float
            doublet.doubletCalc1DData.setInjectionTemp(np.max([temperature - utc_properties.maxCoolingTempRange(), utc_properties.hpMinimumInjectionTemperature()]))
    else:
        doublet.doubletCalc1DData.setInjectionTemp(np.max([temperature - utc_properties.maxCoolingTempRange(), utc_properties.dhReturnTemp()]))
 No newline at end of file

    # # old:
    # if not utc_properties.useHeatPump():
    #     doublet.doubletCalc1DData.setInjectionTemp(np.max([temperature - utc_properties.maxCoolingTempRange(), utc_properties.dhReturnTemp()]))
    # elif utc_properties.useHeatPump() and utc_properties.calculateCop() and not utc_properties.hpApplicationMode():
    #     doublet.doubletCalc1DData.setInjectionTemp(doublet.calculateInjectionTempWithHeatPump(temperature, utc_properties.hpDirectHeatInputTemp()))
    # else:
    #     doublet.doubletCalc1DData.setInjectionTemp(np.max([temperature - utc_properties.maxCoolingTempRange(), utc_properties.hpMinimumInjectionTemperature()]))
+659 −0

File added.

Preview size limit exceeded, changes collapsed.