From d8959ab36af928ff4d16e10524aea6fb6d796382 Mon Sep 17 00:00:00 2001 From: softwareengineerprogrammer <4056124+softwareengineerprogrammer@users.noreply.github.com> Date: Wed, 20 Aug 2025 12:40:55 -0700 Subject: [PATCH 1/6] Update Fervo_Project_Cape-4 documentation link in examples table to main repo pages URL --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index ba71f17c5..0e1828e63 100644 --- a/README.rst +++ b/README.rst @@ -288,7 +288,7 @@ Example-specific web interface deeplinks are listed in the Link column. - `Fervo_Project_Cape-3.txt `__ - `.out `__ - `link `__ - * - Case Study: 500 MWe EGS Project Modeled on Fervo Cape Station (`documentation `__) + * - Case Study: 500 MWe EGS Project Modeled on Fervo Cape Station (`documentation `__) - `Fervo_Project_Cape-4.txt `__ - `.out `__ - `link `__ From 1c08315eaf71878ded6101dff2ba242aaedc3859 Mon Sep 17 00:00:00 2001 From: softwareengineerprogrammer <4056124+softwareengineerprogrammer@users.noreply.github.com> Date: Fri, 22 Aug 2025 13:30:34 -0700 Subject: [PATCH 2/6] Support Print Output to Console in HIP-RA-X. WIP to capture/assert logs in unit test --- src/hip_ra_x/hip_ra_x.py | 12 +++++++++++- tests/hip_ra_x_tests/test_hip_ra_x.py | 19 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/hip_ra_x/hip_ra_x.py b/src/hip_ra_x/hip_ra_x.py index ff587220e..2752ca402 100644 --- a/src/hip_ra_x/hip_ra_x.py +++ b/src/hip_ra_x/hip_ra_x.py @@ -27,6 +27,7 @@ from geophires_x.Parameter import Parameter from geophires_x.Parameter import ParameterEntry from geophires_x.Parameter import ReadParameter +from geophires_x.Parameter import boolParameter from geophires_x.Parameter import floatParameter from geophires_x.Parameter import intParameter from geophires_x.Parameter import strParameter @@ -353,6 +354,15 @@ def parameter_dict_entry(param: Parameter) -> Parameter: ) ) + self.print_output_to_console = parameter_dict_entry( + boolParameter( + 'Print Output to Console', + DefaultValue=True, + UnitType=Units.NONE, + ToolTipText='Whether to print output to the console ', + ) + ) + # Output parameters self.reservoir_volume = self.OutputParameterDict[self.reservoir_volume.Name] = OutputParameter( Name='Reservoir Volume (reservoir)', @@ -925,7 +935,7 @@ def render_scientific(p: Parameter) -> str: if self.html_output_file.Provided: # write the outputs to the output file as HTML and the screen as a table self.PrintOutputsHTML(case_data_inputs, case_data_results, self.html_output_file.value) - else: + elif self.print_output_to_console.value: # copy the output file to the screen with open(outputfile, encoding='UTF-8') as f: content = f.readlines() # store all output in one long list diff --git a/tests/hip_ra_x_tests/test_hip_ra_x.py b/tests/hip_ra_x_tests/test_hip_ra_x.py index d73f08833..a664dd97e 100644 --- a/tests/hip_ra_x_tests/test_hip_ra_x.py +++ b/tests/hip_ra_x_tests/test_hip_ra_x.py @@ -53,6 +53,25 @@ def get_output_file_for_example(example_file: Path): # TODO # self.assertFileContentsEqual(expected_result_output_file_path, result.output_file_path) + def test_print_output_to_console(self): + example_files = self._list_test_files_dir(test_files_dir='./examples') + assert len(example_files) > 0 # test integrity check - no files means something is misconfigured + + params = { + 'Reservoir Temperature': 250.0, + 'Rejection Temperature': 60.0, + 'Reservoir Porosity': 10.0, + 'Reservoir Area': 55.0, + 'Reservoir Thickness': 0.25, + 'Reservoir Life Cycle': 25, + 'Print Output to Console': False, + } + + result: HipRaResult = HipRaXClient().get_hip_ra_result(HipRaInputParameters(params)) + self.assertIsNotNone(result) + + # FIXME WIP verify output not printed to console + def test_result_parsing_1(self): result = HipRaResult(self._get_test_file_path('hip-result_example-1.out')) self.assertIsNotNone(result.result) From 2f48232b13b933353b25fd5039030b4f2b47b62f Mon Sep 17 00:00:00 2001 From: softwareengineerprogrammer <4056124+softwareengineerprogrammer@users.noreply.github.com> Date: Fri, 22 Aug 2025 13:41:51 -0700 Subject: [PATCH 3/6] capture stdout and assert output is/isn't present according to Print Output to Console parameter --- tests/hip_ra_x_tests/test_hip_ra_x.py | 32 +++++++++++++++++---------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/tests/hip_ra_x_tests/test_hip_ra_x.py b/tests/hip_ra_x_tests/test_hip_ra_x.py index a664dd97e..a9122e961 100644 --- a/tests/hip_ra_x_tests/test_hip_ra_x.py +++ b/tests/hip_ra_x_tests/test_hip_ra_x.py @@ -1,3 +1,4 @@ +import io import logging import os import re @@ -5,6 +6,7 @@ import tempfile import unittest import uuid +from contextlib import redirect_stdout from pathlib import Path from geophires_x.Parameter import OutputParameter @@ -57,20 +59,26 @@ def test_print_output_to_console(self): example_files = self._list_test_files_dir(test_files_dir='./examples') assert len(example_files) > 0 # test integrity check - no files means something is misconfigured - params = { - 'Reservoir Temperature': 250.0, - 'Rejection Temperature': 60.0, - 'Reservoir Porosity': 10.0, - 'Reservoir Area': 55.0, - 'Reservoir Thickness': 0.25, - 'Reservoir Life Cycle': 25, - 'Print Output to Console': False, - } + def get_stdout_from_running(print_output_to_console: bool) -> str: + params = { + 'Reservoir Temperature': 250.0, + 'Rejection Temperature': 60.0, + 'Reservoir Porosity': 10.0, + 'Reservoir Area': 55.0, + 'Reservoir Thickness': 0.25, + 'Reservoir Life Cycle': 25, + 'Print Output to Console': print_output_to_console, + } + + f = io.StringIO() + with redirect_stdout(f): + result: HipRaResult = HipRaXClient().get_hip_ra_result(HipRaInputParameters(params)) - result: HipRaResult = HipRaXClient().get_hip_ra_result(HipRaInputParameters(params)) - self.assertIsNotNone(result) + self.assertIsNotNone(result) + return f.getvalue() - # FIXME WIP verify output not printed to console + self.assertIn('***HIP CASE REPORT***', get_stdout_from_running(True)) + self.assertNotIn('***HIP CASE REPORT***', get_stdout_from_running(False)) def test_result_parsing_1(self): result = HipRaResult(self._get_test_file_path('hip-result_example-1.out')) From 08fb86e05f7ca8171ddd6ec83e27b37504a87907 Mon Sep 17 00:00:00 2001 From: softwareengineerprogrammer <4056124+softwareengineerprogrammer@users.noreply.github.com> Date: Fri, 22 Aug 2025 13:46:58 -0700 Subject: [PATCH 4/6] make tooltip text consistent with GEOPHIRES version of param, update schema --- src/geophires_x_schema_generator/hip-ra-x-request.json | 9 +++++++++ src/hip_ra_x/hip_ra_x.py | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/geophires_x_schema_generator/hip-ra-x-request.json b/src/geophires_x_schema_generator/hip-ra-x-request.json index 054a49dd3..49bbcf56e 100644 --- a/src/geophires_x_schema_generator/hip-ra-x-request.json +++ b/src/geophires_x_schema_generator/hip-ra-x-request.json @@ -168,6 +168,15 @@ "default": "HIP.html", "minimum": null, "maximum": null + }, + "Print Output to Console": { + "description": "Provide False if you do not want to print output to the console", + "type": "boolean", + "units": null, + "category": null, + "default": true, + "minimum": null, + "maximum": null } } } diff --git a/src/hip_ra_x/hip_ra_x.py b/src/hip_ra_x/hip_ra_x.py index 2752ca402..ae1ced7b4 100644 --- a/src/hip_ra_x/hip_ra_x.py +++ b/src/hip_ra_x/hip_ra_x.py @@ -359,7 +359,7 @@ def parameter_dict_entry(param: Parameter) -> Parameter: 'Print Output to Console', DefaultValue=True, UnitType=Units.NONE, - ToolTipText='Whether to print output to the console ', + ToolTipText='Provide False if you do not want to print output to the console', ) ) From 49e736df7bbed7981a09daf8a8c247f0ce073895 Mon Sep 17 00:00:00 2001 From: softwareengineerprogrammer <4056124+softwareengineerprogrammer@users.noreply.github.com> Date: Sat, 23 Aug 2025 10:32:56 -0700 Subject: [PATCH 5/6] Unit test that 1/0 behave the same as True/False --- tests/hip_ra_x_tests/test_hip_ra_x.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/hip_ra_x_tests/test_hip_ra_x.py b/tests/hip_ra_x_tests/test_hip_ra_x.py index a9122e961..4ca99dfdd 100644 --- a/tests/hip_ra_x_tests/test_hip_ra_x.py +++ b/tests/hip_ra_x_tests/test_hip_ra_x.py @@ -56,10 +56,7 @@ def get_output_file_for_example(example_file: Path): # self.assertFileContentsEqual(expected_result_output_file_path, result.output_file_path) def test_print_output_to_console(self): - example_files = self._list_test_files_dir(test_files_dir='./examples') - assert len(example_files) > 0 # test integrity check - no files means something is misconfigured - - def get_stdout_from_running(print_output_to_console: bool) -> str: + def get_stdout_from_running(print_output_to_console: bool | int) -> str: params = { 'Reservoir Temperature': 250.0, 'Rejection Temperature': 60.0, @@ -79,6 +76,8 @@ def get_stdout_from_running(print_output_to_console: bool) -> str: self.assertIn('***HIP CASE REPORT***', get_stdout_from_running(True)) self.assertNotIn('***HIP CASE REPORT***', get_stdout_from_running(False)) + self.assertIn('***HIP CASE REPORT***', get_stdout_from_running(1)) + self.assertNotIn('***HIP CASE REPORT***', get_stdout_from_running(0)) def test_result_parsing_1(self): result = HipRaResult(self._get_test_file_path('hip-result_example-1.out')) From b9823e6d8dce3187ed6c5851c7f983a37e2b4894 Mon Sep 17 00:00:00 2001 From: softwareengineerprogrammer <4056124+softwareengineerprogrammer@users.noreply.github.com> Date: Sat, 23 Aug 2025 10:36:44 -0700 Subject: [PATCH 6/6] =?UTF-8?q?Bump=20version:=203.9.49=20=E2=86=92=203.9.?= =?UTF-8?q?50?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- .cookiecutterrc | 2 +- README.rst | 4 ++-- docs/conf.py | 2 +- setup.py | 2 +- src/geophires_x/__init__.py | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index bbfb19a0d..7ac651a82 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 3.9.49 +current_version = 3.9.50 commit = True tag = True diff --git a/.cookiecutterrc b/.cookiecutterrc index e7273725f..ea7e86193 100644 --- a/.cookiecutterrc +++ b/.cookiecutterrc @@ -54,7 +54,7 @@ default_context: sphinx_doctest: "no" sphinx_theme: "sphinx-py3doc-enhanced-theme" test_matrix_separate_coverage: "no" - version: 3.9.49 + version: 3.9.50 version_manager: "bump2version" website: "https://github.com/NREL" year_from: "2023" diff --git a/README.rst b/README.rst index 0e1828e63..cb1e0ad86 100644 --- a/README.rst +++ b/README.rst @@ -58,9 +58,9 @@ Free software: `MIT license `__ :alt: Supported implementations :target: https://pypi.org/project/geophires-x -.. |commits-since| image:: https://img.shields.io/github/commits-since/softwareengineerprogrammer/GEOPHIRES-X/v3.9.49.svg +.. |commits-since| image:: https://img.shields.io/github/commits-since/softwareengineerprogrammer/GEOPHIRES-X/v3.9.50.svg :alt: Commits since latest release - :target: https://github.com/softwareengineerprogrammer/GEOPHIRES-X/compare/v3.9.49...main + :target: https://github.com/softwareengineerprogrammer/GEOPHIRES-X/compare/v3.9.50...main .. |docs| image:: https://readthedocs.org/projects/GEOPHIRES-X/badge/?style=flat :target: https://nrel.github.io/GEOPHIRES-X diff --git a/docs/conf.py b/docs/conf.py index 307c63b7a..c0ee8601b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -18,7 +18,7 @@ year = '2025' author = 'NREL' copyright = f'{year}, {author}' -version = release = '3.9.49' +version = release = '3.9.50' pygments_style = 'trac' templates_path = ['./templates'] diff --git a/setup.py b/setup.py index 621462eec..bddc0ac95 100755 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ def read(*names, **kwargs): setup( name='geophires-x', - version='3.9.49', + version='3.9.50', license='MIT', description='GEOPHIRES is a free and open-source geothermal techno-economic simulator.', long_description='{}\n{}'.format( diff --git a/src/geophires_x/__init__.py b/src/geophires_x/__init__.py index 85acfc075..09754ba9f 100644 --- a/src/geophires_x/__init__.py +++ b/src/geophires_x/__init__.py @@ -1 +1 @@ -__version__ = '3.9.49' +__version__ = '3.9.50'