@@ -27,6 +27,12 @@ def __init__(self, field_name: str):
27
27
self .field_name : str = field_name
28
28
29
29
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
+
30
36
class GeophiresXResult :
31
37
_RESULT_FIELDS_BY_CATEGORY = MappingProxyType (
32
38
{
@@ -173,7 +179,15 @@ class GeophiresXResult:
173
179
'Fracture area' ,
174
180
'Number of fractures' ,
175
181
'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
+ ),
177
191
'Reservoir volume' ,
178
192
'Reservoir impedance' ,
179
193
'Reservoir hydrostatic pressure' ,
@@ -377,6 +391,10 @@ def __init__(self, output_file_path, logger_name=None):
377
391
for field in fields :
378
392
if isinstance (field , _EqualSignDelimitedField ):
379
393
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
+ )
380
398
else :
381
399
is_string_field = isinstance (field , _StringValueField )
382
400
field_name = field .field_name if is_string_field else field
@@ -596,6 +614,27 @@ def _get_equal_sign_delimited_field(self, field_name):
596
614
self ._logger .error (f'Unexpected error extracting equal sign-delimited field { field_name } ' ) # Shouldn't happen
597
615
return None
598
616
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
+
599
638
@property
600
639
def power_generation_profile (self ):
601
640
return self .result ['POWER GENERATION PROFILE' ]
0 commit comments