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 ba71f17c5..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 @@ -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 `__ 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' 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 ff587220e..ae1ced7b4 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='Provide False if you do not want 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..4ca99dfdd 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 @@ -53,6 +55,30 @@ 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): + def get_stdout_from_running(print_output_to_console: bool | int) -> 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)) + + self.assertIsNotNone(result) + return f.getvalue() + + 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')) self.assertIsNotNone(result.result)