Skip to content

Commit

Permalink
Fixes Issue 92: NREL#92
Browse files Browse the repository at this point in the history
  • Loading branch information
malcolm-dsider committed Jan 23, 2024
1 parent f0ff86c commit 24396d5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/geophires_x/Outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ def PrintOutputs(self, model: Model):
for obj in [model.reserv, model.wellbores, model.surfaceplant, model.economics]:
for key in obj.ParameterDict:
param = obj.ParameterDict[key]
if not param.UnitsMatch: ConvertUnitsBack(param, model)
if not param.UnitsMatch:
ConvertUnitsBack(param, model)

# now we need to loop through all thw output parameters to update their units to
# whatever units the user has specified.
Expand Down
9 changes: 6 additions & 3 deletions src/geophires_x/Parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,8 @@ def ConvertUnitsBack(ParamToModify, model):
try:
# update The quantity back to the current units (the units that we started with) units
# so the display will be in the right units
currQ = prefQ.to(currQ)
#currQ = prefQ.to(currQ)
currQ = currQ.to(prefQ)
except BaseException as ex:
print(str(ex))
print("Error: GEOPHIRES failed to convert your units for " + ParamToModify.Name +
Expand All @@ -650,8 +651,10 @@ def ConvertUnitsBack(ParamToModify, model):
" Exiting.")
sys.exit()

# rest the value
ParamToModify.value = currQ.magnitude
# reset the values
if ParamToModify.value != currQ.magnitude:
ParamToModify.value = currQ.magnitude
ParamToModify.CurrentUnits = ParamToModify.PreferredUnits
model.logger.info("Complete " + str(__name__) + ": " + sys._getframe().f_code.co_name)


Expand Down

1 comment on commit 24396d5

@softwareengineerprogrammer

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @malcolm-dsider, I'll incorporate this into softwareengineerprogrammer#3

Please sign in to comment.