@@ -47,30 +47,8 @@ def PrintOutputs(self, model: Model):
47
47
"""
48
48
model .logger .info (f'Init { str (__class__ )} : { sys ._getframe ().f_code .co_name } ' )
49
49
50
- # Deal with converting Units back to PreferredUnits, if required.
51
- # before we write the outputs, we go thru all the parameters for all of the objects and set the values back
52
- # to the units that the user entered the data in
53
- # We do this because the value may be displayed in the output, and we want the user to recognize their value,
54
- # not some converted value
55
- # for obj in [model.reserv, model.wellbores, model.surfaceplant, model.economics]:
56
- # for key in obj.ParameterDict:
57
- # param = obj.ParameterDict[key]
58
- # if not param.UnitsMatch: ConvertUnitsBack(param, model)
59
-
60
- # now we need to loop through all thw output parameters to update their units to
61
- # whatever units the user has specified.
62
- # i.e., they may have specified that all LENGTH results must be in feet, so we need to convert those
63
- # from whatever LENGTH unit they are to feet.
64
- # same for all the other classes of units (TEMPERATURE, DENSITY, etc).
65
-
66
- #for obj in [model.reserv, model.wellbores, model.surfaceplant, model.economics]:
67
- # for key in obj.OutputParameterDict:
68
- # if key in self.ParameterDict:
69
- # if self.ParameterDict[key] != obj.OutputParameterDict[key].CurrentUnits:
70
- # ConvertOutputUnits(obj.OutputParameterDict[key], self.ParameterDict[key], model)
71
50
72
51
# write results to output file and screen
73
-
74
52
try :
75
53
with open (self .output_file ,'w' , encoding = 'UTF-8' ) as f :
76
54
f .write (' *****************\n ' )
@@ -181,10 +159,10 @@ def PrintOutputs(self, model: Model):
181
159
except BaseException as ex :
182
160
tb = sys .exc_info ()[2 ]
183
161
print (str (ex ))
184
- print ("Error: GEOPHIRES Failed to write the output file. Exiting....Line %i" % tb .tb_lineno )
162
+ msg = "Error: GEOPHIRES Failed to write the output file. Exiting....Line %i" % tb .tb_lineno
163
+ print (msg )
185
164
model .logger .critical (str (ex ))
186
- model .logger .critical ("Error: GEOPHIRES Failed to write the output file. Exiting....Line %i" % tb .tb_lineno )
187
- # FIXME raise exception instead of sys.exit()
188
- sys .exit ()
165
+ model .logger .critical (msg )
166
+ raise RuntimeError (msg )
189
167
190
168
model .logger .info (f'Complete { str (__class__ )} : { sys ._getframe ().f_code .co_name } ' )
0 commit comments