本文整理汇总了Python中ert.util.IntVector.active_list方法的典型用法代码示例。如果您正苦于以下问题:Python IntVector.active_list方法的具体用法?Python IntVector.active_list怎么用?Python IntVector.active_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ert.util.IntVector
的用法示例。
在下文中一共展示了IntVector.active_list方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_activeList
# 需要导入模块: from ert.util import IntVector [as 别名]
# 或者: from ert.util.IntVector import active_list [as 别名]
def test_activeList(self):
active_list = IntVector.active_list("1,10,100-105")
self.assertTrue(len(active_list) == 8)
self.assertTrue(active_list[0] == 1)
self.assertTrue(active_list[2] == 100)
self.assertTrue(active_list[7] == 105)
active_list = IntVector.active_list("1,10,100-105X")
self.assertFalse(active_list)
示例2: test_activeList
# 需要导入模块: from ert.util import IntVector [as 别名]
# 或者: from ert.util.IntVector import active_list [as 别名]
def test_activeList(self):
active_list = IntVector.active_list("1,10,100-105")
self.assertTrue(len(active_list) == 8)
self.assertTrue(active_list[0] == 1)
self.assertTrue(active_list[2] == 100)
self.assertTrue(active_list[7] == 105)
self.assertEqual( active_list.count(100) , 1)
active_list.append(100)
active_list.append(100)
self.assertEqual( active_list.count(100) , 3)
active_list = IntVector.active_list("1,10,100-105X")
self.assertFalse(active_list)
示例3: exportFIELD
# 需要导入模块: from ert.util import IntVector [as 别名]
# 或者: from ert.util.IntVector import active_list [as 别名]
def exportFIELD(self, line):
arguments = splitArguments(line)
if len(arguments) >= 1:
ens_config = self.ert().ensembleConfig()
key = arguments[0]
if key in self.supportedFIELDKeys():
config_node = ens_config[key]
if len(arguments) >= 2:
path_fmt = arguments[1]
else:
path_fmt = Export.DEFAULT_EXPORT_PATH % (key, key) + ".grdecl"
if len(arguments) >= 3:
range_string = "".join(arguments[2:])
iens_list = IntVector.active_list(range_string)
else:
ens_size = self.ert().getEnsembleSize()
iens_list = IntVector.createRange(0, ens_size, 1)
fs_manager = self.ert().getEnkfFsManager()
fs = fs_manager.getCurrentFileSystem()
init_file = self.ert().fieldInitFile(config_node)
if init_file:
print('Using init file: %s' % init_file)
EnkfNode.exportMany(config_node, path_fmt, fs, iens_list, arg=init_file)
else:
self.lastCommandFailed("No such FIELD node: %s" % key)
else:
self.lastCommandFailed("Expected at least one argument: <keyword> received: '%s'" % line)
示例4: __init__
# 需要导入模块: from ert.util import IntVector [as 别名]
# 或者: from ert.util.IntVector import active_list [as 别名]
def __init__(self , obs_key , data_config , scalar_value = None , obs_file = None , data_index = None):
c_pointer = GenObservation.cNamespace().alloc( data_config , obs_key )
super(GenObservation, self).__init__(c_pointer)
if scalar_value is None and obs_file is None:
raise ValueError("Exactly one the scalar_value and obs_file arguments must be present")
if scalar_value is not None and obs_file is not None:
raise ValueError("Exactly one the scalar_value and obs_file arguments must be present")
if obs_file is not None:
if not os.path.isfile( obs_file ):
raise IOError("The file with observation data:%s does not exist" % obs_file )
else:
GenObservation.cNamespace().load( self , obs_file )
else:
obs_value , obs_std = scalar_value
GenObservation.cNamespace().scalar_set( self , obs_value , obs_std )
if not data_index is None:
if os.path.isfile( data_index ):
GenObservation.cNamespace().load_data_index( self , data_index )
else:
index_list = IntVector.active_list( data_index )
GenObservation.cNamespace().add_data_index( self , index_list )