Skip to content

Commit b4037ca

Browse files
prevent non-S-DAC SAM-EM from throwing exception on non-value
1 parent 02dab56 commit b4037ca

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

src/geophires_x/EconomicsSamCalculations.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ class SamEconomicsCalculations:
8484
investment_tax_credit: OutputParameter = field(default_factory=investment_tax_credit_output_parameter)
8585

8686
capacity_payment_revenue_sources: list[CapacityPaymentRevenueSource] = field(default_factory=list)
87-
s_dac_carbon_extracted_annually: OutputParameter = field(default_factory=carbon_extracted_annually_output_parameter)
87+
s_dac_carbon_extracted_annually: OutputParameter | None = (
88+
None # field(default_factory=carbon_extracted_annually_output_parameter)
89+
)
8890

8991
@property
9092
def _pre_revenue_years_count(self) -> int:
@@ -268,6 +270,9 @@ def _for_operational_years(_row: list[Any]) -> list[Any]:
268270
def _insert_s_dac_line_items(self, cf_ret: list[list[Any]]) -> list[list[Any]]:
269271
ret: list[list[Any]] = cf_ret.copy()
270272

273+
if self.s_dac_carbon_extracted_annually is None:
274+
return ret
275+
271276
def _get_row_index(row_name_: str) -> int:
272277
return [it[0] for it in ret].index(row_name_)
273278

@@ -281,7 +286,7 @@ def _insert_blank_line_before(before_row_name: str) -> None:
281286
_insert_row_before(before_row_name, '', ['' for _it in ret[_get_row_index(before_row_name)]][1:])
282287

283288
REVENUE_CATEGORY_ROW_NAME = 'REVENUE'
284-
ENERGY_CATEGORY_ROW_NAME = 'ENERGY'
289+
# ENERGY_CATEGORY_ROW_NAME = 'ENERGY'
285290

286291
def _for_operational_years(_row: list[Any]) -> list[Any]:
287292
return [*([''] * (self._pre_revenue_years_count - 1)), 0, *_row]

tests/examples/S-DAC-GT-2.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Simulation Metadata
66
----------------------
77
GEOPHIRES Version: 3.13.9
88
Simulation Date: 2026-06-01
9-
Simulation Time: 11:07
10-
Calculation Time: 0.189 sec
9+
Simulation Time: 11:13
10+
Calculation Time: 0.215 sec
1111

1212
***SUMMARY OF RESULTS***
1313

0 commit comments

Comments
 (0)