Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 3.9.49
current_version = 3.9.50
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion .cookiecutterrc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ Free software: `MIT license <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
Expand Down Expand Up @@ -288,7 +288,7 @@ Example-specific web interface deeplinks are listed in the Link column.
- `Fervo_Project_Cape-3.txt <tests/examples/Fervo_Project_Cape-3.txt>`__
- `.out <tests/examples/Fervo_Project_Cape-3.out>`__
- `link <https://gtp.scientificwebservices.com/geophires?geophires-example-id=Fervo_Project_Cape-3>`__
* - Case Study: 500 MWe EGS Project Modeled on Fervo Cape Station (`documentation <https://softwareengineerprogrammer.github.io/GEOPHIRES/Fervo_Project_Cape-4.html>`__)
* - Case Study: 500 MWe EGS Project Modeled on Fervo Cape Station (`documentation <https://nrel.github.io/GEOPHIRES-X/Fervo_Project_Cape-4.html>`__)
- `Fervo_Project_Cape-4.txt <tests/examples/Fervo_Project_Cape-4.txt>`__
- `.out <tests/examples/Fervo_Project_Cape-4.out>`__
- `link <https://gtp.scientificwebservices.com/geophires?geophires-example-id=Fervo_Project_Cape-4>`__
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/geophires_x/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '3.9.49'
__version__ = '3.9.50'
9 changes: 9 additions & 0 deletions src/geophires_x_schema_generator/hip-ra-x-request.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
12 changes: 11 additions & 1 deletion src/hip_ra_x/hip_ra_x.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)',
Expand Down Expand Up @@ -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
Expand Down
26 changes: 26 additions & 0 deletions tests/hip_ra_x_tests/test_hip_ra_x.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import io
import logging
import os
import re
import sys
import tempfile
import unittest
import uuid
from contextlib import redirect_stdout
from pathlib import Path

from geophires_x.Parameter import OutputParameter
Expand Down Expand Up @@ -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)
Expand Down
Loading