示例#1
0
文件: test_grid.py 项目: kgreg1/ert
    def test_output_units(self):
        n = 10
        a = 1
        grid = GridGen.createRectangular( (n,n,n), (a,a,a))

        with TestAreaContext("python/ecl_grid/units"):
            grid.save_EGRID( "CASE.EGRID" , output_unit = EclUnitTypeEnum.ECL_FIELD_UNITS )
            f = EclFile("CASE.EGRID")
            g = f["GRIDUNIT"][0]
            self.assertEqual( g[0].strip( ) , "FEET" )
            g2 = EclGrid("CASE.EGRID")
            self.assertFloatEqual( g2.cell_volume( global_index = 0 ) , 3.28084*3.28084*3.28084)

            
            grid.save_EGRID( "CASE.EGRID" )
            f = EclFile("CASE.EGRID")
            g = f["GRIDUNIT"][0]
            self.assertEqual( g[0].strip( ) , "METRES" )
            
            grid.save_EGRID( "CASE.EGRID" , output_unit = EclUnitTypeEnum.ECL_LAB_UNITS)
            f = EclFile("CASE.EGRID")
            g = f["GRIDUNIT"][0]
            self.assertEqual( g[0].strip() , "CM" )
            g2 = EclGrid("CASE.EGRID")
            self.assertFloatEqual( g2.cell_volume( global_index = 0 ) , 100*100*100 )
示例#2
0
    def test_create(self):
        ensemble_config = EnsembleConfig()
        obs = EnkfObs(ensemble_config)
        self.assertEqual(len(obs), 0)
        self.assertFalse(obs.load(self.obs_config))
        self.assertEqual(len(obs), 0)

        time_map = TimeMap()
        obs = EnkfObs(ensemble_config, external_time_map=time_map)
        self.assertEqual(len(obs), 0)

        grid = EclGrid(self.grid)
        refcase = EclSum(self.refcase)

        history = History.alloc_from_refcase(refcase, False)
        obs = EnkfObs(ensemble_config, grid=grid, history=history)
        with self.assertRaises(IOError):
            obs.load("/does/not/exist")

        self.assertTrue(obs.load(self.obs_config))
        self.assertEqual(len(obs), 33)
        obs.clear()
        self.assertEqual(len(obs), 0)

        obs.load(self.obs_config)
        self.assertEqual(len(obs), 33)
        self.assertFalse("RFT2" in obs)
        obs.load(self.obs_config2)
        self.assertEqual(len(obs), 35)
        self.assertTrue("RFT2" in obs)
示例#3
0
    def test_rates(self):
        grid_path = self.createTestPath("Statoil/ECLIPSE/Gurbat/ECLIPSE.EGRID")
        rst_path = self.createTestPath("Statoil/ECLIPSE/Gurbat/ECLIPSE.UNRST")
        sum_path = self.createTestPath("Statoil/ECLIPSE/Gurbat/ECLIPSE.SMSPEC")

        grid = EclGrid(grid_path)
        well_info = WellInfo(grid, rst_path)
        sum = EclSum(sum_path)

        for wtl in well_info:
            for well_state in wtl:
                # print "%03d  %g   %g " % (R , well_state.oilRate(), sum.get_from_report( "WOPR:%s" % well , R))
                if wtl.getName() == "OP_4":
                    pass
                    # print well_state.oilRate(), well_state.waterRate(), well_state.gasRate(), well_state.volumeRate()
                    # print well_state.oilRateSI(), well_state.waterRateSI(), well_state.gasRateSI(), well_state.volumeRateSI()
                    self.assertEqual(well_state.oilRate(),
                                     well_state.oilRateSI())
                    self.assertEqual(well_state.waterRate(),
                                     well_state.waterRateSI())
                    self.assertEqual(well_state.gasRate(),
                                     well_state.gasRateSI())
                    self.assertEqual(well_state.volumeRate(),
                                     well_state.volumeRateSI())
                    # print sum.get_from_report("WOPR:%s" % wtl.getName(), 1)
                    # print sum.get_from_report( "WWPR:%s" % wtl.getName(), 30 )

                    for conn in well_state.globalConnections():
                        # print conn.gasRate(), conn.waterRate(), conn.oilRate()
                        # print conn.gasRateSI(), conn.waterRateSI(), conn.oilRateSI()
                        self.assertEqual(conn.gasRate(), conn.gasRateSI())
                        self.assertEqual(conn.waterRate(), conn.waterRateSI())
                        self.assertEqual(conn.oilRate(), conn.oilRateSI())
                        self.assertEqual(conn.volumeRate(),
                                         conn.volumeRateSI())
示例#4
0
 def test_EGRID( self ):
     grid = EclGrid(self.egrid_file())
     self.assertTrue(grid)
     dims = grid.dims
     self.assertEqual(dims[0] , grid.getNX())
     self.assertEqual(dims[1] , grid.getNY())
     self.assertEqual(dims[2] , grid.getNZ())
示例#5
0
    def test_Load(self):
        kw = EclKW.read_grdecl(open(self.src_file, "r"), "PERMX")
        self.assertTrue(kw)

        grid = EclGrid(self.createTestPath("Statoil/ECLIPSE/Gurbat/ECLIPSE"))
        kw = Ecl3DKW.read_grdecl(grid, open(self.src_file, "r"), "PERMX")
        self.assertTrue(isinstance(kw, Ecl3DKW))
示例#6
0
    def getGrid(self):
        if EclWellTest2.grid is None:
            EclWellTest2.grid = EclGrid(
                self.createTestPath(
                    "Statoil/ECLIPSE/Troll/Ref2014/T07-4A-W2014-06.EGRID"))

        return EclWellTest2.grid
示例#7
0
 def test_rect(self):
     with TestAreaContext("python/grid-test/testRect"):
         a1 = 1.0
         a2 = 2.0
         a3 = 3.0
         grid = EclGrid.createRectangular((9, 9, 9), (a1, a2, a3))
         grid.save_EGRID("rect.EGRID")
         grid2 = EclGrid("rect.EGRID")
         self.assertTrue(grid)
         self.assertTrue(grid2)
 
         (x, y, z) = grid.get_xyz(ijk=(4, 4, 4))
         self.assertAlmostEqualList([x, y, z], [4.5 * a1, 4.5 * a2, 4.5 * a3])
 
         v = grid.cell_volume(ijk=(4, 4, 4))
         self.assertFloatEqual(v, a1 * a2 * a3)
 
         z = grid.depth(ijk=(4, 4, 4 ))
         self.assertFloatEqual(z, 4.5 * a3)
 
         g1 = grid.global_index(ijk=(2, 2, 2))
         g2 = grid.global_index(ijk=(4, 4, 4))
         (dx, dy, dz) = grid.distance(g2, g1)
         self.assertAlmostEqualList([dx, dy, dz], [2 * a1, 2 * a2, 2 * a3])
 
         self.assertTrue(grid.cell_contains(2.5 * a1, 2.5 * a2, 2.5 * a3, ijk=(2, 2, 2)))
示例#8
0
 def test_coarse(self):
     #work_area = TestArea("python/grid-test/testCoarse")
     with TestAreaContext("python/grid-test/testCoarse"):
         testGRID = True
         g1 = EclGrid(self.createTestPath("Statoil/ECLIPSE/LGCcase/LGC_TESTCASE2.EGRID"))
 
         g1.save_EGRID("LGC.EGRID")
         g2 = EclGrid("LGC.EGRID")
         self.assertTrue(g1.equal(g2, verbose=True))
 
         if testGRID:
             g1.save_GRID("LGC.GRID")
             g3 = EclGrid("LGC.GRID")
             self.assertTrue(g1.equal(g3, verbose=True))
 
         self.assertTrue(g1.coarse_groups() == 3384)
示例#9
0
def main( eclipse_file_location , opm_file_location ,  base_name , rel_tolerance, abs_tolerance):
    print "Using relative tolerance of: " + str(rel_tolerance)
    print "Using absolute tolerance of: " + str(abs_tolerance)

    eclipse_restart_file = EclFile(eclipse_file_location + base_name + ".UNRST")
    eclipse_grid_file = EclGrid(eclipse_file_location + base_name + ".EGRID")

    opm_restart_file = EclFile(opm_file_location + base_name + ".UNRST")
    opm_grid_file = EclGrid(opm_file_location + base_name + ".EGRID")

    grids_equal = eclipse_grid_file.equal(opm_grid_file, include_lgr=True, verbose=True)
    if not grids_equal:
        print("The grids in files {0} and {1} are not equal!".format(eclipse_grid_file.name, opm_grid_file.name))
        exit(1)

    compareRestartFiles(eclipse_restart_file, opm_restart_file, rel_tolerance, abs_tolerance)
示例#10
0
 def setUp(self):
     self.grid = EclGrid(
         self.createTestPath("Statoil/ECLIPSE/Mariner/MARINER.EGRID"))
     fileH = open(
         self.createTestPath("Statoil/ECLIPSE/Mariner/faultblock.grdecl"))
     self.kw = EclKW.read_grdecl(fileH,
                                 "FAULTBLK",
                                 ecl_type=EclTypeEnum.ECL_INT_TYPE)
示例#11
0
 def test_save(self):
     with TestAreaContext("python/grid-test/testSave"):
         g1 = EclGrid(self.egrid_file())
 
         g1.save_EGRID("test.EGRID")
         g2 = EclGrid("test.EGRID")
         self.assertTrue(g1.equal(g2))
 
         g1.save_GRID("test.GRID")
         g2 = EclGrid("test.GRID")
         self.assertTrue(g1.equal(g2))
 
         fileH = open("test.grdecl", "w")
         g1.save_grdecl(fileH)
         fileH.close()
         g2 = self.create("test.grdecl")
         self.assertTrue(g1.equal(g2))
示例#12
0
文件: wellviz.py 项目: pgdr/wellviz
def main():
    grid = EclGrid('/home/pgdr/statoil/norne/NORNE_ATW2013.EGRID')
    init = EclFile('/home/pgdr/statoil/norne/NORNE_ATW2013.INIT')
    rest = EclFile('/home/pgdr/statoil/norne/NORNE_ATW2013.UNRST')
    wp = Wpath('/home/pgdr/statoil/norne/norne-test-2-mid.w')
    swat, sgas = rest._iget_named_kw('SWAT', 0), rest._iget_named_kw('SGAS', 0)
    permx = init._iget_named_kw('PERMX', 0)

    wall = constructWall(grid, wp, swat, sgas, permx)
    drawWall(wall)
示例#13
0
文件: test_grid.py 项目: bramirex/ert
    def test_truncated_file(self):
        grid = EclGrid.createRectangular((10, 20, 30), (1, 1, 1))
        with TestAreaContext("python/ecl_grid/truncated"):
            grid.save_EGRID("TEST.EGRID")

            size = os.path.getsize("TEST.EGRID")
            with open("TEST.EGRID", "r+") as f:
                f.truncate(size / 2)

            with self.assertRaises(IOError):
                EclGrid("TEST.EGRID")
示例#14
0
    def test_volume_kw(self):
        grid = EclGrid(self.egrid_file())
        vol = grid.createVolumeKeyword( )
        self.assertEqual( len(vol) , grid.getNumActive())
        for active_index , volume in enumerate(vol):
            self.assertEqual( volume , grid.cell_volume( active_index = active_index ))

        vol = grid.createVolumeKeyword( active_size = False )
        self.assertEqual( len(vol) , grid.getGlobalSize())
        for global_index , volume in enumerate(vol):
            self.assertEqual( volume , grid.cell_volume( global_index = global_index ))
示例#15
0
    def test_load(self):
        g = EclGrid(self.grid_file)
        f = EclInitFile(g, self.init_file)

        head = f["INTEHEAD"][0]
        self.assertTrue(isinstance(head, EclKW))

        porv = f["PORV"][0]
        self.assertTrue(isinstance(porv, Ecl3DKW))

        poro = f["PORO"][0]
        self.assertTrue(isinstance(poro, Ecl3DKW))
示例#16
0
    def test_load(self):
        g = EclGrid(self.grid_file)
        f = EclRestartFile(g, self.unrst_file)

        head = f["INTEHEAD"][0]
        self.assertTrue(isinstance(head, EclKW))

        swat = f["SWAT"][0]
        self.assertTrue(isinstance(swat, Ecl3DKW))

        pressure = f["PRESSURE"][0]
        self.assertTrue(isinstance(pressure, Ecl3DKW))
示例#17
0
    def test_heidrun(self):
        root = self.createTestPath("Statoil/ECLIPSE/Heidrun")
        grid = EclGrid("%s/FF12_2013B2_AMAP_AOP-J15_NO62_MOVEX.EGRID" % root)

        polygon = []
        with open("%s/polygon.ply" % root) as fileH:
            for line in fileH.readlines():
                tmp = line.split()
                polygon.append((float(tmp[0]), float(tmp[1])))
        self.assertEqual(len(polygon), 11)

        reg = EclRegion(grid, False)
        reg.select_inside_polygon(polygon)
        self.assertEqual(0, len(reg.global_list) % grid.nz)
示例#18
0
文件: test_grid.py 项目: kgreg1/ert
 def test_repr_and_name(self):
     grid = GridGen.createRectangular((2,2,2), (10,10,10), actnum=[0,0,0,0,1,1,1,1])
     pfx = 'EclGrid('
     rep = repr(grid)
     self.assertEqual(pfx, rep[:len(pfx)])
     self.assertEqual(type(rep), type(''))
     self.assertEqual(type(grid.getName()), type(''))
     with TestAreaContext("python/ecl_grid/repr"):
         grid.save_EGRID("CASE.EGRID")
         g2 = EclGrid("CASE.EGRID")
         r2 = repr(g2)
         self.assertEqual(pfx, r2[:len(pfx)])
         self.assertEqual(type(r2), type(''))
         self.assertEqual(type(g2.getName()), type(''))
示例#19
0
    def getWellInfo(self):
        """ @rtype: WellInfo """
        if EclWellTest.__well_info is None:
            grid_path = self.createTestPath("Statoil/ECLIPSE/Troll/MSW/T07-4A-W2012-16-F3.EGRID")
            rst_path_1 = self.createTestPath("Statoil/ECLIPSE/Troll/MSW/T07-4A-W2012-16-F3.X0135")

            grid = EclGrid(grid_path)

            rst_file = EclFile(rst_path_1, EclFileFlagEnum.ECL_FILE_CLOSE_STREAM)

            EclWellTest.__well_info = WellInfo(grid, rst_file)


        return EclWellTest.__well_info
示例#20
0
    def test_corner(self):
        grid = EclGrid(self.egrid_file())
        nx = grid.getNX()
        ny = grid.getNY()
        nz = grid.getNZ()
        
        (x1,y1,z1) = grid.getCellCorner( 0 , ijk = (0,0,0))
        (x2,y2,z2) = grid.getLayerXYZ( 0 , 0 )
        self.assertEqual(x1,x2)
        self.assertEqual(y1,y2)
        self.assertEqual(z1,z2)

        (x1,y1,z1) = grid.getCellCorner( 0 , ijk = (0,1,0))
        (x2,y2,z2) = grid.getLayerXYZ( (nx + 1) , 0 )
        self.assertEqual(x1,x2)
        self.assertEqual(y1,y2)
        self.assertEqual(z1,z2)

        (x1,y1,z1) = grid.getCellCorner( 1 , ijk = (nx - 1,0,0))
        (x2,y2,z2) = grid.getLayerXYZ( nx , 0 )
        self.assertEqual(x1,x2)
        self.assertEqual(y1,y2)
        self.assertEqual(z1,z2)

        (x1,y1,z1) = grid.getCellCorner( 4 , ijk = (0,0,nz-1))
        (x2,y2,z2) = grid.getLayerXYZ( 0 , nz )
        self.assertEqual(x1,x2)
        self.assertEqual(y1,y2)
        self.assertEqual(z1,z2)

        (x1,y1,z1) = grid.getCellCorner( 7 , ijk = (nx-1,ny-1,nz-1))
        (x2,y2,z2) = grid.getLayerXYZ( (nx + 1)*(ny + 1) - 1 , nz )
        self.assertEqual(x1,x2)
        self.assertEqual(y1,y2)
        self.assertEqual(z1,z2)


    
        with self.assertRaises(IndexError):
            grid.getLayerXYZ( -1 , 0 )

        with self.assertRaises(IndexError):
            grid.getLayerXYZ( (nx + 1)*(ny + 1) , 0 )

        with self.assertRaises(IndexError):
            grid.getLayerXYZ( 0 , -1 )

        with self.assertRaises(IndexError):
            grid.getLayerXYZ( 0 , nz + 1 )
示例#21
0
    def test_no_mapaxes_check_for_nan(self):
        grid_paths = ["Statoil/ECLIPSE/NoMapaxes/ECLIPSE.EGRID", "Statoil/ECLIPSE/NoMapaxes/ECLIPSE.GRID"]

        for grid_path in grid_paths:
            test_grid_path = self.createTestPath(grid_path)
            grid = EclGrid(test_grid_path)

            xyz = grid.get_xyz(ijk=(0, 0, 0))
            self.assertFalse(math.isnan(xyz[0]))
            self.assertFalse(math.isnan(xyz[1]))
            self.assertFalse(math.isnan(xyz[2]))

            xyz = grid.get_xyz(ijk=(1, 1, 1))
            self.assertFalse(math.isnan(xyz[0]))
            self.assertFalse(math.isnan(xyz[1]))
            self.assertFalse(math.isnan(xyz[2]))
示例#22
0
    def test_dual(self):
        with TestAreaContext("python/grid-test/testDual"):
            grid = EclGrid(self.egrid_file())
            self.assertFalse(grid.dualGrid())
            self.assertTrue(grid.getNumActiveFracture() == 0)

            grid2 = EclGrid(self.grid_file())
            self.assertFalse(grid.dualGrid())
            self.assertTrue(grid.getNumActiveFracture() == 0)

            dgrid = EclGrid(
                self.createTestPath(
                    "Statoil/ECLIPSE/DualPoro/DUALPOR_MSW.EGRID"))
            self.assertTrue(
                dgrid.getNumActive() == dgrid.getNumActiveFracture())
            self.assertTrue(dgrid.getNumActive() == 46118)

            dgrid2 = EclGrid(
                self.createTestPath(
                    "Statoil/ECLIPSE/DualPoro/DUALPOR_MSW.GRID"))
            self.assertTrue(
                dgrid.getNumActive() == dgrid.getNumActiveFracture())
            self.assertTrue(dgrid.getNumActive() == 46118)
            self.assertTrue(dgrid.equal(dgrid2))

            # The DUAL_DIFF grid has been manipulated to create a
            # situation where some cells are only matrix active, and some
            # cells are only fracture active.
            dgrid = EclGrid(
                self.createTestPath(
                    "Statoil/ECLIPSE/DualPoro/DUAL_DIFF.EGRID"))
            self.assertTrue(dgrid.getNumActive() == 106)
            self.assertTrue(dgrid.getNumActiveFracture() == 105)

            self.assertTrue(
                dgrid.get_active_fracture_index(global_index=0) == -1)
            self.assertTrue(
                dgrid.get_active_fracture_index(global_index=2) == -1)
            self.assertTrue(
                dgrid.get_active_fracture_index(global_index=3) == 0)
            self.assertTrue(
                dgrid.get_active_fracture_index(global_index=107) == 104)

            self.assertTrue(dgrid.get_active_index(global_index=1) == 1)
            self.assertTrue(dgrid.get_active_index(global_index=105) == 105)
            self.assertTrue(dgrid.get_active_index(global_index=106) == -1)
            self.assertTrue(dgrid.get_global_index1F(2) == 5)

            dgrid.save_EGRID("DUAL_DIFF.EGRID")
            dgrid2 = EclGrid("DUAL_DIFF.EGRID")
            self.assertTrue(dgrid.equal(dgrid2, verbose=True))
    def setUp(self):
        self.grid = EclGrid(
            self.createTestPath("Statoil/ECLIPSE/Mariner/MARINER.EGRID"))

        with open(
                self.createTestPath(
                    "Statoil/ECLIPSE/Mariner/faultblock.grdecl")) as fileH:
            self.kw = EclKW.read_grdecl(fileH,
                                        "FAULTBLK",
                                        ecl_type=EclTypeEnum.ECL_INT_TYPE)

        self.faults = FaultCollection(
            self.grid,
            self.createTestPath("Statoil/ECLIPSE/Mariner/faults.grdecl"))
        self.poly_file1 = self.createTestPath(
            "Statoil/ECLIPSE/Mariner/pol1.xyz")
        self.poly_file2 = self.createTestPath(
            "Statoil/ECLIPSE/Mariner/pol2.xyz")
        self.poly_file3 = self.createTestPath(
            "Statoil/ECLIPSE/Mariner/pol3.xyz")
        self.poly_file4 = self.createTestPath(
            "Statoil/ECLIPSE/Mariner/pol4.xyz")
        self.poly_file5 = self.createTestPath(
            "Statoil/ECLIPSE/Mariner/pol5.xyz")
        self.poly_file6 = self.createTestPath(
            "Statoil/ECLIPSE/Mariner/pol6.xyz")
        self.poly_file7 = self.createTestPath(
            "Statoil/ECLIPSE/Mariner/pol7.xyz")
        self.poly_file8 = self.createTestPath(
            "Statoil/ECLIPSE/Mariner/pol8.xyz")
        self.poly_file9 = self.createTestPath(
            "Statoil/ECLIPSE/Mariner/pol9.xyz")
        self.poly_file10 = self.createTestPath(
            "Statoil/ECLIPSE/Mariner/pol10.xyz")
        self.poly_file11 = self.createTestPath(
            "Statoil/ECLIPSE/Mariner/pol11.xyz")

        self.fault_blocks = []
        for k in range(self.grid.getNZ()):
            blocks = FaultBlockLayer(self.grid, k)
            blocks.scanKeyword(self.kw)
            self.fault_blocks.append(blocks)
示例#24
0
    def test_construction(self):
        grid_path = self.createTestPath("Statoil/ECLIPSE/Gurbat/ECLIPSE.EGRID")
        rst_path_1 = self.createTestPath("Statoil/ECLIPSE/Gurbat/ECLIPSE.X0011")
        rst_path_2 = self.createTestPath("Statoil/ECLIPSE/Gurbat/ECLIPSE.X0022")
        rst_path_3 = self.createTestPath("Statoil/ECLIPSE/Gurbat/ECLIPSE.X0035")
        rst_path_4 = self.createTestPath("Statoil/ECLIPSE/Gurbat/ECLIPSE.X0061")

        grid = EclGrid(grid_path)

        def checkWellInfo(well_info, well_count, report_step_count):
            self.assertEqual(len(well_info), well_count)

            for index, well_time_line in enumerate(well_info):
                self.assertEqual(len(well_time_line), report_step_count[index])

        well_info = WellInfo(grid, rst_path_1)
        checkWellInfo(well_info, well_count=5, report_step_count=[1, 1, 1, 1, 1])

        well_info = WellInfo(grid, EclFile(rst_path_1))
        checkWellInfo(well_info, well_count=5, report_step_count=[1, 1, 1, 1, 1])

        well_info = WellInfo(grid, [rst_path_1, rst_path_2, rst_path_3])
        checkWellInfo(well_info, well_count=8, report_step_count=[3, 3, 3, 3, 3, 2, 2, 2])

        well_info = WellInfo(grid, [EclFile(rst_path_1), EclFile(rst_path_2), rst_path_3, EclFile(rst_path_4)])
        checkWellInfo(well_info, well_count=8, report_step_count=[4, 4, 4, 4, 4, 3, 3, 3])


        well_info = WellInfo(grid)
        well_info.addWellFile(rst_path_1, True)

        checkWellInfo(well_info, well_count=5, report_step_count=[1, 1, 1, 1, 1])

        well_info.addWellFile(EclFile(rst_path_2), True)
        checkWellInfo(well_info, well_count=8, report_step_count=[2, 2, 2, 2, 2, 1, 1, 1])

        well_info.addWellFile(EclFile(rst_path_3), True)
        checkWellInfo(well_info, well_count=8, report_step_count=[3, 3, 3, 3, 3, 2, 2, 2])

        well_info.addWellFile(rst_path_4, True)
        checkWellInfo(well_info, well_count=8, report_step_count=[4, 4, 4, 4, 4, 3, 3, 3])
示例#25
0
    def test_unified(self):
        g = EclGrid(self.grid_file)
        f_unrst = EclRestartFile(g, self.unrst_file)
        f_x0 = EclRestartFile(g, self.xrst_file0)
        f_x10 = EclRestartFile(g, self.xrst_file10)
        f_x20 = EclRestartFile(g, self.xrst_file20)

        self.assertTrue(f_unrst.unified())
        self.assertFalse(f_x0.unified())
        self.assertFalse(f_x10.unified())
        self.assertFalse(f_x20.unified())

        self.assertEqual(
            [(10, datetime.datetime(2000, 10, 1, 0, 0, 0), 274.0)],
            f_x10.timeList())

        unrst_timeList = f_unrst.timeList()
        self.assertEqual(len(unrst_timeList), 63)
        self.assertEqual(
            (62, datetime.datetime(2004, 12, 31, 0, 0, 0), 1826.0),
            unrst_timeList[62])
示例#26
0
 def test_GRID( self ):
     grid = EclGrid(self.grid_file())
     self.assertTrue(grid)
示例#27
0
 def test_valid_geometry(self):
     grid = EclGrid( self.createTestPath("Statoil/ECLIPSE/GRID_INVALID_CELL/PRED_RESEST_0_R_13_0.GRID"))
     self.assertTrue( grid.validCellGeometry( ijk = (27,0,0)) )
     self.assertFalse( grid.validCellGeometry( ijk = (0,0,0)) )
示例#28
0
 def test_type(self):
     g = EclGrid(self.grid_file)
     with self.assertRaises(ValueError):
         f = EclRestartFile(g, "NOT_A_RESTART_FILE")
示例#29
0
 def test_raise_IO_error(self):
     with self.assertRaises(IOError):
         g = EclGrid("/does/not/exist.EGRID")
示例#30
0
 def test_time(self):
     t0 = time.clock()
     g1 = EclGrid(self.egrid_file())
     t1 = time.clock()
     t = t1 - t0
     self.assertTrue(t < 1.0)