Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def keys(self, pattern=None):
"""
Return a StringList of summary keys matching @pattern.
The matching algorithm is ultimately based on the fnmatch()
function, i.e. normal shell-character syntax is used. With
@pattern == "WWCT:*" you will get a list of watercut keys for
all wells.
If pattern is None you will get all the keys of summary
object.
"""
s = StringList()
self._select_matching_keys(pattern, s)
return s
By default all the vectors in the summary case will be
exported, but by using the optional keys parameter you can
limit the keys which are exported:
ecl_sum = EclSum("CASE")
ecl_sum.exportCSV("case.csv", keys=["W*:OP1", "W*:OP2", "F*T"])
Will export all well related variables for wells 'OP1' and
'OP2' and all total field vectors.
"""
if keys is None:
var_list = self.keys()
else:
var_list = StringList()
for key in keys:
var_list |= self.keys(pattern=key)
self._export_csv(filename, var_list, date_format, sep)
def keys(self, pattern=None):
"""
Return a StringList of summary keys matching @pattern.
The matching algorithm is ultimately based on the fnmatch()
function, i.e. normal shell-character syntax is used. With
@pattern == "WWCT:*" you will get a list of watercut keys for
all wells.
If pattern is None you will get all the keys of summary
object.
"""
s = StringList()
self._select_matching_keys(pattern, s)
return s
By default all the vectors in the summary case will be
exported, but by using the optional keys parameter you can
limit the keys which are exported:
ecl_sum = EclSum("CASE")
ecl_sum.exportCSV("case.csv", keys=["W*:OP1", "W*:OP2", "F*T"])
Will export all well related variables for wells 'OP1' and
'OP2' and all total field vectors.
"""
if keys is None:
var_list = self.keys()
else:
var_list = StringList()
for key in keys:
var_list |= self.keys(pattern=key)
self._export_csv(filename, var_list, date_format, sep)
def load(cls, smspec_file, unsmry_file, key_join_string = ":", include_restart = True):
if not os.path.isfile( smspec_file ):
raise IOError("No such file: %s" % smspec_file)
if not os.path.isfile( unsmry_file ):
raise IOError("No such file: %s" % unsmry_file )
data_files = StringList( )
data_files.append( unsmry_file )
c_ptr = cls._fread_alloc(smspec_file, data_files, key_join_string, include_restart)
if c_ptr is None:
raise IOError("Failed to create summary instance")
ecl_sum = cls.createPythonObject( c_ptr )
ecl_sum._load_case = smspec_file
return ecl_sum