Skip to content

Commit 99a557d

Browse files
make print_outputs_rich a static method in preparation to move it to OutputsRich
1 parent 9020f10 commit 99a557d

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/geophires_x/Outputs.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -747,12 +747,15 @@ def o(output_param: OutputParameter):
747747
model.logger.critical(msg)
748748
raise RuntimeError(msg) from ex
749749

750-
self.print_outputs_rich(model)
750+
Outputs.print_outputs_rich(self.output_file, self.text_output_file, self.html_output_file, model)
751751

752752
model.logger.info(f'Complete {__class__!s}: {sys._getframe().f_code.co_name}')
753753

754-
def print_outputs_rich(self, model: Model):
755-
#data structures and assignments for HTML and Improved Text Output formats
754+
755+
@staticmethod
756+
def print_outputs_rich(output_file: str, text_output_file: strParameter, html_output_file: strParameter, model: Model):
757+
758+
# data structures and assignments for HTML and Improved Text Output formats
756759
simulation_metadata = []
757760
summary = []
758761
economic_parameters = []
@@ -1602,16 +1605,16 @@ def print_outputs_rich(self, model: Model):
16021605
if model.economics.DoSDACGTCalculations.value:
16031606
sdac_df, sdac_results = model.sdacgtoutputs.PrintOutputs(model)
16041607

1605-
if self.text_output_file.Provided:
1606-
Write_Text_Output(self.output_file, simulation_metadata, summary, economic_parameters,
1608+
if text_output_file.Provided:
1609+
Write_Text_Output(output_file, simulation_metadata, summary, economic_parameters,
16071610
engineering_parameters,
16081611
resource_characteristics, reservoir_parameters, reservoir_stimulation_results, CAPEX,
16091612
OPEX,
16101613
surface_equipment_results, sdac_results, addon_results, hce, ahce, cashflow,
16111614
pumping_power_profiles, sdac_df, addon_df)
16121615

16131616
# Get rid of any trailing spaces in that output file - they are confusing the testing code
1614-
with open(self.output_file, 'r+') as fp:
1617+
with open(output_file, 'r+') as fp:
16151618
lines = fp.readlines()
16161619
fp.seek(0)
16171620
fp.truncate()
@@ -1622,18 +1625,18 @@ def print_outputs_rich(self, model: Model):
16221625
# uncomment these to allow for testing of the HTML output
16231626
# self.html_output_file.value = 'd:\\temp\\test_table_geophires.html'
16241627
# self.html_output_file.Provided = True
1625-
if self.html_output_file.Provided:
1626-
Write_HTML_Output(self.html_output_file.value, simulation_metadata, summary, economic_parameters,
1628+
if html_output_file.Provided:
1629+
Write_HTML_Output(html_output_file.value, simulation_metadata, summary, economic_parameters,
16271630
engineering_parameters, resource_characteristics, reservoir_parameters,
16281631
reservoir_stimulation_results, CAPEX, OPEX, surface_equipment_results, sdac_results,
16291632
addon_results, hce, ahce, cashflow, pumping_power_profiles, sdac_df, addon_df)
16301633

16311634
Plot_Tables_Into_HTML(model.surfaceplant.enduse_option, model.surfaceplant.plant_type,
1632-
self.html_output_file.value, hce, ahce, cashflow, pumping_power_profiles, sdac_df,
1635+
html_output_file.value, hce, ahce, cashflow, pumping_power_profiles, sdac_df,
16331636
addon_df)
16341637
# make district heating plot
16351638
if model.surfaceplant.plant_type.value == PlantType.DISTRICT_HEATING:
1636-
MakeDistrictHeatingPlot(self.html_output_file.value, model.surfaceplant.dh_geothermal_heating.value,
1639+
MakeDistrictHeatingPlot(html_output_file.value, model.surfaceplant.dh_geothermal_heating.value,
16371640
model.surfaceplant.daily_heating_demand.value)
16381641

16391642

0 commit comments

Comments
 (0)