@@ -27,6 +27,12 @@ def __init__(self, field_name: str):
2727 self .field_name : str = field_name
2828
2929
30+ class _UnlabeledStringField :
31+ def __init__ (self , field_name : str , marker_prefixes : list [str ]):
32+ self .field_name : str = field_name
33+ self .marker_prefixes = marker_prefixes
34+
35+
3036class GeophiresXResult :
3137 _RESULT_FIELDS_BY_CATEGORY = MappingProxyType (
3238 {
@@ -173,7 +179,15 @@ class GeophiresXResult:
173179 'Fracture area' ,
174180 'Number of fractures' ,
175181 'Fracture separation' ,
176- # TODO reservoir volume note
182+ _UnlabeledStringField (
183+ 'Reservoir volume calculation note' ,
184+ [
185+ 'Reservoir volume calculated' ,
186+ 'Number of fractures calculated' ,
187+ 'Fracture separation calculated' ,
188+ 'Reservoir volume provided as input' ,
189+ ],
190+ ),
177191 'Reservoir volume' ,
178192 'Reservoir impedance' ,
179193 'Reservoir hydrostatic pressure' ,
@@ -377,6 +391,10 @@ def __init__(self, output_file_path, logger_name=None):
377391 for field in fields :
378392 if isinstance (field , _EqualSignDelimitedField ):
379393 self .result [category ][field .field_name ] = self ._get_equal_sign_delimited_field (field .field_name )
394+ elif isinstance (field , _UnlabeledStringField ):
395+ self .result [category ][field .field_name ] = self ._get_unlabeled_string_field (
396+ field .field_name , field .marker_prefixes
397+ )
380398 else :
381399 is_string_field = isinstance (field , _StringValueField )
382400 field_name = field .field_name if is_string_field else field
@@ -596,6 +614,27 @@ def _get_equal_sign_delimited_field(self, field_name):
596614 self ._logger .error (f'Unexpected error extracting equal sign-delimited field { field_name } ' ) # Shouldn't happen
597615 return None
598616
617+ def _get_unlabeled_string_field (self , field_name : str , marker_prefixes : list [str ]):
618+ matching_lines = set (filter (lambda line : any (m in line for m in marker_prefixes ), self ._lines ))
619+
620+ if len (matching_lines ) == 0 :
621+ self ._logger .debug (f'Unlabeled string field not found: { field_name } ' )
622+ return None
623+
624+ if len (matching_lines ) > 1 :
625+ self ._logger .warning (
626+ f'Found multiple ({ len (matching_lines )} ) entries for unlabeled string field: '
627+ f'{ field_name } \n \t { matching_lines } '
628+ )
629+
630+ matching_line = matching_lines .pop ()
631+ for marker_prefix in marker_prefixes :
632+ if marker_prefix in matching_line :
633+ return matching_line .strip ()
634+
635+ self ._logger .error (f'Unexpected error extracting unlabeled string field { field_name } ' ) # Shouldn't happen
636+ return None
637+
599638 @property
600639 def power_generation_profile (self ):
601640 return self .result ['POWER GENERATION PROFILE' ]
0 commit comments