From 8d56ec1d5966a494e5710cf170f98d85c0b418f4 Mon Sep 17 00:00:00 2001 From: softwareengineerprogrammer <4056124+softwareengineerprogrammer@users.noreply.github.com> Date: Tue, 15 Oct 2024 13:33:26 -0700 Subject: [PATCH 1/4] Synchronize currency conversion exception message --- src/geophires_x/Parameter.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/geophires_x/Parameter.py b/src/geophires_x/Parameter.py index f986c870..af0edd9d 100644 --- a/src/geophires_x/Parameter.py +++ b/src/geophires_x/Parameter.py @@ -505,10 +505,10 @@ def ConvertUnits(ParamToModify, strUnit: str, model) -> str: except BaseException as ex: print(str(ex)) msg = ( - f'Error: GEOPHIRES failed to convert your currency for {ParamToModify.Name} to something it ' - f'understands. You gave {strUnit} - Are these currency units defined for forex-python? or perhaps the ' - f'currency server is down? Please change your units to {ParamToModify.PreferredUnits.value} to ' - f'continue. Cannot continue unless you do. Exiting.' + f'Error: GEOPHIRES failed to convert your currency for {ParamToModify.Name} to something it understands. ' + f'You gave {strUnit} - conversion may be affected by https://github.com/NREL/GEOPHIRES-X/issues/236. ' + f'Please change your units to {ParamToModify.PreferredUnits.value} ' + f'to continue. Cannot continue unless you do. Exiting.' ) print(msg) model.logger.critical(str(ex)) From 39d3e5ad2fcde3ace358e735431cff09bfcac334 Mon Sep 17 00:00:00 2001 From: softwareengineerprogrammer <4056124+softwareengineerprogrammer@users.noreply.github.com> Date: Tue, 15 Oct 2024 13:43:47 -0700 Subject: [PATCH 2/4] Disable currency conversion attempt to call forex API per https://github.com/NREL/GEOPHIRES-X/issues/236\?title\=Currency+conversions+disabled\#issuecomment-2414681434 --- src/geophires_x/Parameter.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/geophires_x/Parameter.py b/src/geophires_x/Parameter.py index af0edd9d..b3c5020d 100644 --- a/src/geophires_x/Parameter.py +++ b/src/geophires_x/Parameter.py @@ -19,6 +19,7 @@ from geophires_x.Units import * _ureg = get_unit_registry() +_DISABLE_FOREX_API = True # See https://github.com/NREL/GEOPHIRES-X/issues/236?title=Currency+conversions+disabled#issuecomment-2414681434 class HasQuantity(ABC): @@ -500,6 +501,10 @@ def ConvertUnits(ParamToModify, strUnit: str, model) -> str: try: # if we come here, we have a currency conversion to do (USD->EUR, etc.). + + if _DISABLE_FOREX_API: + raise RuntimeError('Forex API disabled') + cr = CurrencyRates() conv_rate = cr.get_rate(currShort, prefShort) except BaseException as ex: @@ -710,6 +715,9 @@ def _parameter_with_currency_units_converted_back_to_preferred_units(param: Para # start the currency conversion process cc = CurrencyCodes() try: + if _DISABLE_FOREX_API: + raise RuntimeError('Forex API disabled') + cr = CurrencyRates() conv_rate = cr.get_rate(currType, prefType) except BaseException as ex: @@ -966,6 +974,9 @@ def ConvertOutputUnits(oparam: OutputParameter, newUnit: Units, model): raise RuntimeError(msg) try: + if _DISABLE_FOREX_API: + raise RuntimeError('Forex API disabled') + cr = CurrencyRates() conv_rate = cr.get_rate(prefShort, currShort) except BaseException as ex: From 0aca3090e7dbd512c92279f3501bef4dd6870127 Mon Sep 17 00:00:00 2001 From: softwareengineerprogrammer <4056124+softwareengineerprogrammer@users.noreply.github.com> Date: Tue, 15 Oct 2024 14:26:25 -0700 Subject: [PATCH 3/4] Fix deeplink to https://github.com/NREL/GEOPHIRES-X/issues/236\#issuecomment-2414681434 --- src/geophires_x/Parameter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/geophires_x/Parameter.py b/src/geophires_x/Parameter.py index b3c5020d..fd78b1ec 100644 --- a/src/geophires_x/Parameter.py +++ b/src/geophires_x/Parameter.py @@ -19,7 +19,7 @@ from geophires_x.Units import * _ureg = get_unit_registry() -_DISABLE_FOREX_API = True # See https://github.com/NREL/GEOPHIRES-X/issues/236?title=Currency+conversions+disabled#issuecomment-2414681434 +_DISABLE_FOREX_API = True # See https://github.com/NREL/GEOPHIRES-X/issues/236#issuecomment-2414681434 class HasQuantity(ABC): From 50d10f63cb254964ef089dd7a30881ba97896404 Mon Sep 17 00:00:00 2001 From: softwareengineerprogrammer <4056124+softwareengineerprogrammer@users.noreply.github.com> Date: Tue, 15 Oct 2024 14:52:48 -0700 Subject: [PATCH 4/4] =?UTF-8?q?Bump=20version:=203.6.1=20=E2=86=92=203.6.2?= 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 4e5cf9df..d9e91924 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 3.6.1 +current_version = 3.6.2 commit = True tag = True diff --git a/.cookiecutterrc b/.cookiecutterrc index b5bb0c1a..e6cb3326 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.6.1 + version: 3.6.2 version_manager: "bump2version" website: "https://github.com/NREL" year_from: "2023" diff --git a/README.rst b/README.rst index 56d7dd04..6924cd03 100644 --- a/README.rst +++ b/README.rst @@ -51,9 +51,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.6.1.svg +.. |commits-since| image:: https://img.shields.io/github/commits-since/softwareengineerprogrammer/GEOPHIRES-X/v3.6.2.svg :alt: Commits since latest release - :target: https://github.com/softwareengineerprogrammer/GEOPHIRES-X/compare/v3.6.1...main + :target: https://github.com/softwareengineerprogrammer/GEOPHIRES-X/compare/v3.6.2...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 a756f774..d3e9b7ae 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -18,7 +18,7 @@ year = '2024' author = 'NREL' copyright = f'{year}, {author}' -version = release = '3.6.1' +version = release = '3.6.2' pygments_style = 'trac' templates_path = ['./templates'] diff --git a/setup.py b/setup.py index ef77bb37..434bc54f 100755 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ def read(*names, **kwargs): setup( name='geophires-x', - version='3.6.1', + version='3.6.2', 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 bce59824..575236d7 100644 --- a/src/geophires_x/__init__.py +++ b/src/geophires_x/__init__.py @@ -1 +1 @@ -__version__ = '3.6.1' +__version__ = '3.6.2'