TNO Intern

Commit 4c3151d9 authored by Hen Brett's avatar Hen Brett 🐔
Browse files

Reorganising the tests

parent 386c4668
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ import xarray as xr
from pythermogis import calculate_doublet_performance
import pytest

test_files_path = Path(__file__).parent / "resources"
test_files_path = Path(__file__).parent.parent / "resources"

def print_min_max(variable: xr.DataArray):
    print(f"{variable.name}, {np.min(variable):.2f}, {np.max(variable):.2f}")
+6 −7
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ def test_example_5():
    from matplotlib import pyplot as plt
    from pathlib import Path
    from os import path
    output_data_path = Path(path.dirname(__file__), "resources") / "test_output" / "example_data"
    output_data_path = Path(__file__).parent.parent / "resources" / "test_output" / "example_data"
    output_data_path.mkdir(parents=True, exist_ok=True)

    input_data = xr.Dataset({
@@ -108,10 +108,10 @@ def test_example_6():
    from os import path

    # the location of the input data: the data can be found in the resources/example_data directory of the repo
    input_data_path = Path(path.dirname(__file__), "resources") / "test_input" / "example_data"
    input_data_path = Path(__file__).parent.parent / "resources" / "test_input" / "example_data"

    # create a directory to write the output files to
    output_data_path = Path(path.dirname(__file__), "resources") / "test_output" / "example_data"
    output_data_path = Path(__file__).parent.parent / "resources" / "test_output" / "example_data"
    output_data_path.mkdir(parents=True, exist_ok=True)

    # if set to True then simulation is always run, otherwise pre-calculated results are read (if available)
@@ -176,10 +176,9 @@ def test_example_7():
    import numpy as np
    import xarray as xr
    from pathlib import Path
    from os import path

    input_data_path = Path(path.dirname(__file__), "resources") / "test_input" / "example_data"
    output_data_path = Path(path.dirname(__file__), "resources") / "test_output" / "example_data"
    input_data_path = Path(__file__).parent.parent / "resources" / "test_input" / "example_data"
    output_data_path = Path(__file__).parent.parent / "resources" / "test_output" / "example_data"
    output_data_path.mkdir(parents=True, exist_ok=True)

    # read in reservoir property maps
@@ -276,7 +275,7 @@ def test_example8():


    # output directory to write output to
    output_data_path = Path(path.dirname(__file__), "resources") / "test_output" / "exceedance_example"
    output_data_path =  Path(__file__).parent.parent / "resources" / "test_output" / "exceedance_example"
    output_data_path.mkdir(parents=True, exist_ok=True)

    # generate simulation samples across desired reservoir properties
+10 −11
Original line number Diff line number Diff line
from os import path

from pythermogis import *

# Create the Markdown table
scenarios_file_path = Path(path.dirname(__file__), "resources") / "test_input" / "scenarios"
scenarios_file_path = Path(__file__).parent.parent / "resources" / "test_input" / "scenarios"
def test_markdown_table():
    # create correspondence table with xml names
    scenario_files = {
        "TG basecase": path.join(scenarios_file_path, "doublet_techno-econ_basecase.xml")
        "TG basecase": scenarios_file_path / "doublet_techno-econ_basecase.xml"
    }
    scenarios_data = {name: xml_to_dict(file) for name, file in scenario_files.items()}
    comparison_table = create_comparison_table(scenarios_data, skipparametername=False)
@@ -17,10 +16,10 @@ def test_markdown_table():

def test_markdown_table_TG():
    scenario_files = {
        "TG basecase": path.join(scenarios_file_path , "doublet_techno-econ_basecase.xml"),
        "TG HP": path.join(scenarios_file_path ,"doublet_techno-econ_HP.xml"),
        "TG STIM": path.join(scenarios_file_path , "doublet_techno-econ_STIM.xml"),
        "TG STIM HP": path.join(scenarios_file_path , "doublet_techno-econ_STIM_HP.xml"),
        "TG basecase": scenarios_file_path / "doublet_techno-econ_basecase.xml",
        "TG HP": scenarios_file_path / "doublet_techno-econ_HP.xml",
        "TG STIM": scenarios_file_path / "doublet_techno-econ_STIM.xml",
        "TG STIM HP": scenarios_file_path / "doublet_techno-econ_STIM_HP.xml",
    }
    scenarios_data = {name: xml_to_dict(file) for name, file in scenario_files.items()}
    # Create the comparison table
@@ -32,10 +31,10 @@ def test_markdown_table_TG():

def test_markdown_table_GA4A():
    scenario_files = {
        "Direct Heat": path.join(scenarios_file_path, "ga4a_directheat_new_config.xml"),
        "Direct Heat HP": path.join(scenarios_file_path, "ga4a_directheatHP_new_config.xml"),
        "Chill": path.join(scenarios_file_path, "ga4a_chiller_new_config.xml"),
        "ORC": path.join(scenarios_file_path, "ga4a_ORC_new_config.xml")
        "Direct Heat": scenarios_file_path / "ga4a_directheat_new_config.xml",
        "Direct Heat HP": scenarios_file_path / "ga4a_directheatHP_new_config.xml",
        "Chill": scenarios_file_path / "ga4a_chiller_new_config.xml",
        "ORC": scenarios_file_path / "ga4a_ORC_new_config.xml"
    }
    scenarios_data = {name: xml_to_dict(file) for name, file in scenario_files.items()};
    # Create the comparison table
Loading