コード例 #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_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 ))