本文整理汇总了Python中ert.util.BoolVector._iget方法的典型用法代码示例。如果您正苦于以下问题:Python BoolVector._iget方法的具体用法?Python BoolVector._iget怎么用?Python BoolVector._iget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ert.util.BoolVector
的用法示例。
在下文中一共展示了BoolVector._iget方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_active_masks
# 需要导入模块: from ert.util import BoolVector [as 别名]
# 或者: from ert.util.BoolVector import _iget [as 别名]
def load_active_masks(self, case1, case2 ):
with ErtTestContext("gen_data_config_test", self.config_file) as test_context:
ert = test_context.getErt()
fs1 = ert.getEnkfFsManager().getFileSystem(case1)
config_node = ert.ensembleConfig().getNode("TIMESHIFT")
data_node = EnkfNode(config_node)
data_node.tryLoad(fs1, NodeId(60, 0, EnkfStateType.FORECAST))
active_mask = get_active_mask( config_node.getDataModelConfig() )
first_active_mask_length = len(active_mask)
self.assertEqual(first_active_mask_length, 2560)
fs2 = ert.getEnkfFsManager().getFileSystem(case2)
data_node = EnkfNode(config_node)
data_node.tryLoad(fs2, NodeId(60, 0, EnkfStateType.FORECAST))
active_mask = get_active_mask( config_node.getDataModelConfig() )
second_active_mask_len = len(active_mask)
self.assertEqual(second_active_mask_len, 2560)
self.assertEqual(first_active_mask_length, second_active_mask_len)
# Setting one element to False, load different case, check, reload, and check.
self.assertTrue(BoolVector._iget(active_mask, 10))
active_mask_modified = active_mask.copy()
active_mask_modified[10] = False
# Must switch filesystem, because the update mask (writes to storage)
# functionality uses the current filesystem (current case)
ert.getEnkfFsManager().switchFileSystem(fs2)
update_active_mask(config_node.getDataModelConfig(), 60, active_mask_modified)
active_mask = get_active_mask( config_node.getDataModelConfig() )
self.assertFalse(active_mask[10])
#Load first - check element is true
data_node = EnkfNode(config_node)
data_node.tryLoad(fs1, NodeId(60, 0, EnkfStateType.FORECAST))
active_mask = get_active_mask( config_node.getDataModelConfig() )
self.assertTrue(active_mask[10])
# Reload second again, should now be false at 10, due to the update further up
data_node = EnkfNode(config_node)
data_node.tryLoad(fs2, NodeId(60, 0, EnkfStateType.FORECAST))
active_mask = get_active_mask( config_node.getDataModelConfig() )
self.assertFalse(active_mask[10])