Exemplo n.º 1
0
    def test_with_gen_kw(self):
        case_directory = self.createTestPath('local/snake_oil_no_data/')
        with TestAreaContext('test_enkf_runpath',
                             store_area=True) as work_area:
            work_area.copy_directory(case_directory)
            res_config = ResConfig('snake_oil_no_data/snake_oil.ert')
            main = EnKFMain(res_config)
            iactive = BoolVector(initial_size=main.getEnsembleSize(),
                                 default_value=False)
            iactive[0] = True
            fs = main.getEnkfFsManager().getCurrentFileSystem()
            run_context = main.getRunContextENSEMPLE_EXPERIMENT(fs, iactive)
            main.createRunpath(run_context)
            self.assertFileExists(
                'snake_oil_no_data/storage/snake_oil/runpath/realisation-0/iter-0/parameters.txt'
            )
            self.assertEqual(
                len(os.listdir('snake_oil_no_data/storage/snake_oil/runpath')),
                1)
            self.assertEqual(
                len(
                    os.listdir(
                        'snake_oil_no_data/storage/snake_oil/runpath/realisation-0'
                    )), 1)

            rp = main.create_runpath_list()
            self.assertEqual(len(rp), 0)
            rp.load()
            self.assertEqual(len(rp), 1)
Exemplo n.º 2
0
def test_with_gen_kw(copy_case):
    copy_case("local/snake_oil")
    shutil.rmtree("storage")
    res_config = ResConfig("snake_oil.ert")
    main = EnKFMain(res_config)
    fs = main.getEnkfFsManager().getCurrentFileSystem()
    run_context = main.getRunContextENSEMPLE_EXPERIMENT(fs, [True])
    main.createRunpath(run_context)
    assert os.path.exists("storage/snake_oil/"
                          "runpath/realization-0/iter-0/parameters.txt")
    assert len(os.listdir("storage/snake_oil/runpath")) == 1
    assert len(os.listdir("storage/snake_oil/runpath/realization-0")) == 1

    rp = main.create_runpath_list()
    assert len(rp) == 0
    rp.load()
    assert len(rp), 1