def test_create(self): with ErtTestContext("gen_data_test", self.config_file) as test_context: ert = test_context.getErt() fs1 = ert.getEnkfFsManager().getCurrentFileSystem() config_node = ert.ensembleConfig().getNode("TIMESHIFT") data_node = EnkfNode(config_node) data_node.tryLoad(fs1, NodeId(60, 0)) gen_data = data_node.asGenData() data = gen_data.getData() self.assertEqual(len(data), 2560)
def test_create(self): with ErtTestContext("gen_data_test", self.config_file) as test_context: ert = test_context.getErt() fs1 = ert.getEnkfFsManager().getCurrentFileSystem() config_node = ert.ensembleConfig().getNode("SNAKE_OIL_OPR_DIFF") data_node = EnkfNode(config_node) data_node.tryLoad(fs1, NodeId(199, 0)) gen_data = data_node.asGenData() data = gen_data.getData() self.assertEqual(2000, len(data))
def exportMany( cls, config_node, file_format, fs, iens_list, report_step=0, file_type=None, arg=None, ): node = EnkfNode(config_node) for iens in iens_list: filename = file_format % iens node_id = NodeId(report_step, iens) if node.tryLoad(fs, node_id): if node.export(filename, file_type=file_type, arg=arg): print("%s[%03d] -> %s" % (config_node.getKey(), iens, filename)) else: sys.stderr.write( "** ERROR: Could not load realisation:%d - export failed" % iens)