Loading pixi.lock +1 −1 Original line number Diff line number Diff line Loading @@ -4963,7 +4963,7 @@ packages: - pypi: ./ name: pythermogis version: 2.0.0 sha256: 62c8f61362f64c2628d6d0b92f40380a288b3eb5855a2862426d23bb5197ef78 sha256: b8a47879b44712b971b5345d4a7fa26d86a21f8b5094e644ac27d68704a06574 requires_dist: - jpype1>=1.5.2,<2 - xarray==2024.9.0.* Loading pyproject.toml +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ test = "PYTHONPATH=pythermogis pytest -s tests/" test_java_installation = "PYTHONPATH=pytest -s tests/test_java_installation.py" build = "pixi run python -m build" publish = "pixi run twine upload -r gitlab-pythermogis dist/*" pytg = "PYTHONPATH=pixi run python pythermogis/main.py" pytg = "python pythermogis/cli.py" [tool.pixi.dependencies] python = ">=3.13.2,<3.14" Loading pythermogis/cli.py +11 −16 Original line number Diff line number Diff line Loading @@ -2,9 +2,9 @@ import json from pathlib import Path import typer import xarray as xr from pythermogis.doublet import calculate_doublet_performance from pytg3.aquifer import Aquifer from pytg3.doublet import ThermoGISDoublet from pythermogis.potential import calculate_potential from pythermogis.properties import instantiate_thermogis_parameters Loading Loading @@ -55,25 +55,20 @@ def simulate_doublet( ) -> None: """Simulate a Geothermal Doublet, with no stochastics (only a P50 simulation)""" # instantiate the input_data dataset from the input input_data = xr.Dataset( { "depth": depth, "thickness": thickness, "ntg": ntg, "porosity": porosity, "permeability": permeability, } aquifer = Aquifer( depth=depth, thickness=thickness, ntg=ntg, porosity=porosity, permeability=permeability, temperature=temperature, ) if temperature is not None: input_data["temperature"] = temperature if verbose: print("\n---simulation input---") print(input_data) print(aquifer) output_data = calculate_doublet_performance(input_data) output_data = ThermoGISDoublet(aquifer=aquifer).simulate().to_dataset() if verbose: print("\n---simulation output---") Loading tests/test_doublet.py +10 −32 Original line number Diff line number Diff line Loading @@ -333,41 +333,19 @@ class PyThermoGISScenarios(TestCase): def test_doublet_single_values(self): # Tests that the python API runs on a simple set of input with single values input_data = xr.Dataset( { "thickness_mean": ((), 300), "thickness_sd": ((), 50), "ntg": ((), 0.5), "porosity": ((), 0.5), "depth": ((), 5000), "ln_permeability_mean": ((), 5), "ln_permeability_sd": ((), 0.5), } aquifer = StochasticAquifer( thickness_mean=300, thickness_sd=50, ntg=0.5, porosity=0.5, depth=5000, ln_permeability_mean=5, ln_permeability_sd=0.5 ) calculate_doublet_performance_stochastic( input_data, p_values=[10, 20, 30, 40, 50, 60, 70, 80, 90] ) ThermoGISDoublet(aquifer=aquifer).simulate(p_values=[10, 20, 30, 40, 50, 60, 70, 80, 90]) # Assert: asserting that it actually ran self.assertTrue(True) # def test_doublet_missing_input(self): # input_data = xr.Dataset( # { # "thickness_sd": ((), 50), # "ntg": ((), 0.5), # "porosity": ((), 0.5), # "depth": ((), 5000), # "ln_permeability_mean": ((), 5), # "ln_permeability_sd": ((), 0.5), # } # ) # # # Act & Assert # with self.assertRaises(ValueError): # calculate_doublet_performance_stochastic(input_data) # def assert_output_and_benchmark_is_close( self, benchmark_path, output_grids, p_value, scenario ): Loading Loading
pixi.lock +1 −1 Original line number Diff line number Diff line Loading @@ -4963,7 +4963,7 @@ packages: - pypi: ./ name: pythermogis version: 2.0.0 sha256: 62c8f61362f64c2628d6d0b92f40380a288b3eb5855a2862426d23bb5197ef78 sha256: b8a47879b44712b971b5345d4a7fa26d86a21f8b5094e644ac27d68704a06574 requires_dist: - jpype1>=1.5.2,<2 - xarray==2024.9.0.* Loading
pyproject.toml +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ test = "PYTHONPATH=pythermogis pytest -s tests/" test_java_installation = "PYTHONPATH=pytest -s tests/test_java_installation.py" build = "pixi run python -m build" publish = "pixi run twine upload -r gitlab-pythermogis dist/*" pytg = "PYTHONPATH=pixi run python pythermogis/main.py" pytg = "python pythermogis/cli.py" [tool.pixi.dependencies] python = ">=3.13.2,<3.14" Loading
pythermogis/cli.py +11 −16 Original line number Diff line number Diff line Loading @@ -2,9 +2,9 @@ import json from pathlib import Path import typer import xarray as xr from pythermogis.doublet import calculate_doublet_performance from pytg3.aquifer import Aquifer from pytg3.doublet import ThermoGISDoublet from pythermogis.potential import calculate_potential from pythermogis.properties import instantiate_thermogis_parameters Loading Loading @@ -55,25 +55,20 @@ def simulate_doublet( ) -> None: """Simulate a Geothermal Doublet, with no stochastics (only a P50 simulation)""" # instantiate the input_data dataset from the input input_data = xr.Dataset( { "depth": depth, "thickness": thickness, "ntg": ntg, "porosity": porosity, "permeability": permeability, } aquifer = Aquifer( depth=depth, thickness=thickness, ntg=ntg, porosity=porosity, permeability=permeability, temperature=temperature, ) if temperature is not None: input_data["temperature"] = temperature if verbose: print("\n---simulation input---") print(input_data) print(aquifer) output_data = calculate_doublet_performance(input_data) output_data = ThermoGISDoublet(aquifer=aquifer).simulate().to_dataset() if verbose: print("\n---simulation output---") Loading
tests/test_doublet.py +10 −32 Original line number Diff line number Diff line Loading @@ -333,41 +333,19 @@ class PyThermoGISScenarios(TestCase): def test_doublet_single_values(self): # Tests that the python API runs on a simple set of input with single values input_data = xr.Dataset( { "thickness_mean": ((), 300), "thickness_sd": ((), 50), "ntg": ((), 0.5), "porosity": ((), 0.5), "depth": ((), 5000), "ln_permeability_mean": ((), 5), "ln_permeability_sd": ((), 0.5), } aquifer = StochasticAquifer( thickness_mean=300, thickness_sd=50, ntg=0.5, porosity=0.5, depth=5000, ln_permeability_mean=5, ln_permeability_sd=0.5 ) calculate_doublet_performance_stochastic( input_data, p_values=[10, 20, 30, 40, 50, 60, 70, 80, 90] ) ThermoGISDoublet(aquifer=aquifer).simulate(p_values=[10, 20, 30, 40, 50, 60, 70, 80, 90]) # Assert: asserting that it actually ran self.assertTrue(True) # def test_doublet_missing_input(self): # input_data = xr.Dataset( # { # "thickness_sd": ((), 50), # "ntg": ((), 0.5), # "porosity": ((), 0.5), # "depth": ((), 5000), # "ln_permeability_mean": ((), 5), # "ln_permeability_sd": ((), 0.5), # } # ) # # # Act & Assert # with self.assertRaises(ValueError): # calculate_doublet_performance_stochastic(input_data) # def assert_output_and_benchmark_is_close( self, benchmark_path, output_grids, p_value, scenario ): Loading