Skip to content

Commit 39d3e5a

Browse files
1 parent 8d56ec1 commit 39d3e5a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/geophires_x/Parameter.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from geophires_x.Units import *
2020

2121
_ureg = get_unit_registry()
22+
_DISABLE_FOREX_API = True # See https://github.com/NREL/GEOPHIRES-X/issues/236?title=Currency+conversions+disabled#issuecomment-2414681434
2223

2324
class HasQuantity(ABC):
2425

@@ -500,6 +501,10 @@ def ConvertUnits(ParamToModify, strUnit: str, model) -> str:
500501

501502
try:
502503
# if we come here, we have a currency conversion to do (USD->EUR, etc.).
504+
505+
if _DISABLE_FOREX_API:
506+
raise RuntimeError('Forex API disabled')
507+
503508
cr = CurrencyRates()
504509
conv_rate = cr.get_rate(currShort, prefShort)
505510
except BaseException as ex:
@@ -710,6 +715,9 @@ def _parameter_with_currency_units_converted_back_to_preferred_units(param: Para
710715
# start the currency conversion process
711716
cc = CurrencyCodes()
712717
try:
718+
if _DISABLE_FOREX_API:
719+
raise RuntimeError('Forex API disabled')
720+
713721
cr = CurrencyRates()
714722
conv_rate = cr.get_rate(currType, prefType)
715723
except BaseException as ex:
@@ -966,6 +974,9 @@ def ConvertOutputUnits(oparam: OutputParameter, newUnit: Units, model):
966974

967975
raise RuntimeError(msg)
968976
try:
977+
if _DISABLE_FOREX_API:
978+
raise RuntimeError('Forex API disabled')
979+
969980
cr = CurrencyRates()
970981
conv_rate = cr.get_rate(prefShort, currShort)
971982
except BaseException as ex:

0 commit comments

Comments
 (0)