Skip to content

Commit 6e2be78

Browse files
Read well drilling cost correlation with from_input_string
1 parent e2935d6 commit 6e2be78

File tree

2 files changed

+11
-37
lines changed

2 files changed

+11
-37
lines changed

src/geophires_x/Economics.py

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1857,43 +1857,8 @@ def read_parameters(self, model: Model) -> None:
18571857
self.econmodel.value = EconomicModel.from_input_string(ParameterReadIn.sValue)
18581858

18591859
elif ParameterToModify.Name == "Well Drilling Cost Correlation":
1860-
# TODO WellDrillingCostCorrelation.from_input_string
1861-
if ParameterReadIn.sValue == '1':
1862-
ParameterToModify.value = WellDrillingCostCorrelation.VERTICAL_SMALL
1863-
elif ParameterReadIn.sValue == '2':
1864-
ParameterToModify.value = WellDrillingCostCorrelation.DEVIATED_SMALL
1865-
elif ParameterReadIn.sValue == '3':
1866-
ParameterToModify.value = WellDrillingCostCorrelation.VERTICAL_LARGE
1867-
elif ParameterReadIn.sValue == '4':
1868-
ParameterToModify.value = WellDrillingCostCorrelation.DEVIATED_LARGE
1869-
elif ParameterReadIn.sValue == '5':
1870-
ParameterToModify.value = WellDrillingCostCorrelation.SIMPLE
1871-
elif ParameterReadIn.sValue == '6':
1872-
ParameterToModify.value = WellDrillingCostCorrelation.VERTICAL_SMALL_INT1
1873-
elif ParameterReadIn.sValue == '7':
1874-
ParameterToModify.value = WellDrillingCostCorrelation.VERTICAL_SMALL_INT2
1875-
elif ParameterReadIn.sValue == '8':
1876-
ParameterToModify.value = WellDrillingCostCorrelation.DEVIATED_SMALL_INT1
1877-
elif ParameterReadIn.sValue == '9':
1878-
ParameterToModify.value = WellDrillingCostCorrelation.DEVIATED_SMALL_INT2
1879-
elif ParameterReadIn.sValue == '10':
1880-
ParameterToModify.value = WellDrillingCostCorrelation.VERTICAL_LARGE_INT1
1881-
elif ParameterReadIn.sValue == '11':
1882-
ParameterToModify.value = WellDrillingCostCorrelation.VERTICAL_LARGE_INT2
1883-
elif ParameterReadIn.sValue == '12':
1884-
ParameterToModify.value = WellDrillingCostCorrelation.DEVIATED_LARGE_INT1
1885-
elif ParameterReadIn.sValue == '13':
1886-
ParameterToModify.value = WellDrillingCostCorrelation.DEVIATED_LARGE_INT2
1887-
elif ParameterReadIn.sValue == '14':
1888-
ParameterToModify.value = WellDrillingCostCorrelation.VERTICAL_SMALL_IDEAL
1889-
elif ParameterReadIn.sValue == '15':
1890-
ParameterToModify.value = WellDrillingCostCorrelation.DEVIATED_SMALL_IDEAL
1891-
elif ParameterReadIn.sValue == '16':
1892-
ParameterToModify.value = WellDrillingCostCorrelation.VERTICAL_LARGE_IDEAL
1893-
elif ParameterReadIn.sValue == '17':
1894-
ParameterToModify.value = WellDrillingCostCorrelation.DEVIATED_LARGE_IDEAL
1895-
else:
1896-
ParameterToModify.value = WellDrillingCostCorrelation.SIMPLE # Assuming 'SIMPLE' is still a valid option
1860+
ParameterToModify.value = WellDrillingCostCorrelation.from_input_string(ParameterReadIn.sValue)
1861+
18971862
elif ParameterToModify.Name == "Reservoir Stimulation Capital Cost Adjustment Factor":
18981863
if self.ccstimfixed.Valid and ParameterToModify.Valid:
18991864
print("Warning: Provided reservoir stimulation cost adjustment factor not considered" +

src/geophires_x/OptionList.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,15 @@ def __init__(self, int_value: int, _: str, c2: float, c1: float, c0: float):
185185
def calculate_cost_MUSD(self, meters) -> float:
186186
return (self._c2 * meters ** 2 + self._c1 * meters + self._c0) * 1E-6
187187

188+
@staticmethod
189+
def from_input_string(input_string: str):
190+
for member in __class__:
191+
if input_string == str(member.int_value):
192+
return member
193+
194+
raise ValueError(f'Unknown Well Drilling Cost Correlation input value: {input_string}')
195+
196+
188197

189198
class FractureShape(GeophiresInputEnum):
190199
CIRCULAR_AREA = 1, "Circular fracture with known area"

0 commit comments

Comments
 (0)