Skip to content

Commit f112096

Browse files
Move OutputTableItem to separate OutputsUtils.py in preparation for refactoring AddOns/S-DAC output/rich output flow
1 parent 130e4b4 commit f112096

File tree

4 files changed

+22
-19
lines changed

4 files changed

+22
-19
lines changed

src/geophires_x/OutputsAddOns.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import sys
22
import pandas as pd
33
from geophires_x.Outputs import Outputs
4-
from geophires_x.OutputsRich import OutputTableItem
4+
from geophires_x.OutputsUtils import OutputTableItem
55

66
NL = "\n"
77

@@ -10,13 +10,13 @@ class OutputsAddOns(Outputs):
1010
"""
1111
Class to handle output of the AddOns values
1212
"""
13-
def PrintOutputs(self, model) -> tuple:
13+
def PrintOutputs(self, model) -> tuple[pd.DataFrame, list]:
1414

1515
"""
1616
The PrintOutputs function prints the results of the AddOns to a text file and to the screen.
1717
:param model: Model: The container class of the application, giving access to everything else, including the logger
1818
:type model: :class:`~geophires_x.Model.Model`
19-
:return: tuple of addon_df, addon_results: list[OutputTableItem]
19+
:return: tuple of addon_df, addon_results
2020
"""
2121
model.logger.info(f'Init {str(__class__)}: {__name__}')
2222

src/geophires_x/OutputsRich.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import dataclasses
21
import datetime
32
import string
43
import time
@@ -20,6 +19,7 @@
2019
from geophires_x.MatplotlibUtils import plt_subplots
2120
from geophires_x.OptionList import EndUseOptions, PlantType, EconomicModel, ReservoirModel, FractureShape, \
2221
ReservoirVolume
22+
from geophires_x.OutputsUtils import OutputTableItem
2323

2424
from geophires_x.Parameter import intParameter, strParameter
2525

@@ -30,20 +30,6 @@
3030
VERTICAL_WELL_DEPTH_OUTPUT_NAME = 'Well depth'
3131

3232

33-
@dataclasses.dataclass
34-
class OutputTableItem:
35-
parameter: str = ''
36-
value: str = ''
37-
units: str = ''
38-
39-
def __init__(self, parameter: str, value: str = '', units: str = ''):
40-
self.parameter = parameter
41-
self.value = value
42-
self.units = units
43-
if self.units:
44-
self.units = UpgradeSymbologyOfUnits(self.units)
45-
46-
4733
def print_outputs_rich(output_file: str, text_output_file: strParameter, html_output_file: strParameter, model: Model):
4834
"""
4935
TODO Implementation of rich output in this method/file is duplicative of Outputs.PrintOutputs. This adds undue

src/geophires_x/OutputsS_DAC_GT.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import sys
22
import pandas as pd
33
from geophires_x.Outputs import Outputs
4-
from geophires_x.OutputsRich import OutputTableItem
4+
from geophires_x.OutputsUtils import OutputTableItem
55

66
NL = "\n"
77

src/geophires_x/OutputsUtils.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import dataclasses
2+
3+
from geophires_x.GeoPHIRESUtils import UpgradeSymbologyOfUnits
4+
5+
6+
@dataclasses.dataclass
7+
class OutputTableItem:
8+
parameter: str = ''
9+
value: str = ''
10+
units: str = ''
11+
12+
def __init__(self, parameter: str, value: str = '', units: str = ''):
13+
self.parameter = parameter
14+
self.value = value
15+
self.units = units
16+
if self.units:
17+
self.units = UpgradeSymbologyOfUnits(self.units)

0 commit comments

Comments
 (0)