File tree Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -738,11 +738,6 @@ def extract_table_header(lines: list) -> list:
738
738
def _get_sam_cash_flow_profile (self ) -> list [Any ]:
739
739
profile_name = 'SAM CASH FLOW PROFILE'
740
740
741
- def _get_sam_cash_flow_profile_lines ():
742
- s1 = f'* { profile_name } *'
743
- s2 = '-' * 50
744
- return '' .join (self ._lines ).split (s1 )[1 ].split (s2 )[0 ].split (s2 )[0 ] # [5:]
745
-
746
741
try :
747
742
s1 = f'* { profile_name } *'
748
743
profile_text = '' .join (self ._lines ).split (s1 )[1 ]
@@ -767,12 +762,12 @@ def _get_sam_cash_flow_profile_entry_display_to_entry_val(entry_display: str) ->
767
762
if entry_display is None :
768
763
return None
769
764
770
- ed_san = entry_display .replace (',' , '' ) if type (entry_display ) is str else entry_display
765
+ ed_san = entry_display .strip (). replace (',' , '' ) if type (entry_display ) is str else entry_display
771
766
if is_float (ed_san ):
772
767
if not math .isnan (float (ed_san )):
773
- return float (ed_san ) if not is_int (ed_san ) else int (ed_san )
768
+ return float (ed_san ) if not is_int (ed_san ) else int (float ( ed_san ) )
774
769
775
- return entry_display
770
+ return entry_display . strip ()
776
771
777
772
def _extract_addons_style_table_data (self , lines : list ):
778
773
"""TODO consolidate with _get_data_from_profile_lines"""
Original file line number Diff line number Diff line change @@ -592,3 +592,13 @@ def test_parse_economic_model(self):
592
592
result_legacy_em ._lines = [' Economic Model = BICYCLE' ]
593
593
em_legacy = result_legacy_em ._get_equal_sign_delimited_field ('Economic Model' )
594
594
self .assertEqual (em_legacy , 'BICYCLE' )
595
+
596
+ def test_parse_sam_cash_flow_profile (self ):
597
+ result = GeophiresXResult (self ._get_test_file_path ('examples/example_SAM-single-owner-PPA.out' ))
598
+ em = result .result ['ECONOMIC PARAMETERS' ]['Economic Model' ]
599
+ self .assertEqual (em , 'SAM Single Owner PPA' )
600
+ self .assertIn ('SAM CASH FLOW PROFILE' , result .result )
601
+
602
+ cash_flow = result .result ['SAM CASH FLOW PROFILE' ]
603
+ self .assertIsNotNone (cash_flow )
604
+ self .assertListEqual (['' ] + [f'Year { y } ' for y in range (21 )], cash_flow [0 ])
You can’t perform that action at this time.
0 commit comments