Skip to content

Commit 4944b19

Browse files
Check relevant attributes exist before calculating derivation of drilling_and_completion_costs_per_well in Economics
1 parent ee9d1dc commit 4944b19

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/geophires_x/Economics.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2985,6 +2985,7 @@ def calculate_cashflow(self, model: Model) -> None:
29852985
for i in range(1, model.surfaceplant.plant_lifetime.value + model.surfaceplant.construction_years.value, 1):
29862986
self.TotalCummRevenue.value[i] = self.TotalCummRevenue.value[i-1] + self.TotalRevenue.value[i]
29872987

2988+
# noinspection SpellCheckingInspection
29882989
def _calculate_derived_outputs(self, model: Model) -> None:
29892990
"""
29902991
Subclasses should call _calculate_derived_outputs at the end of their Calculate methods to populate output
@@ -3001,10 +3002,11 @@ def _calculate_derived_outputs(self, model: Model) -> None:
30013002
self.real_discount_rate.value = self.discountrate.quantity().to(convertible_unit(
30023003
self.real_discount_rate.CurrentUnits)).magnitude
30033004

3004-
self.drilling_and_completion_costs_per_well.value = (
3005-
self.Cwell.value /
3006-
(model.wellbores.nprod.value + model.wellbores.ninj.value)
3007-
)
3005+
if hasattr(self, 'Cwell') and hasattr(model.wellbores, 'nprod') and hasattr(model.wellbores, 'ninj'):
3006+
self.drilling_and_completion_costs_per_well.value = (
3007+
self.Cwell.value /
3008+
(model.wellbores.nprod.value + model.wellbores.ninj.value)
3009+
)
30083010

30093011
def __str__(self):
30103012
return "Economics"

0 commit comments

Comments
 (0)