def test_truth_and_size(self): actnum = IntVector(initial_size=100, default_value=0) actnum[0:50] = 1 grid = EclGrid.createRectangular((10, 10, 1), (1, 1, 1), actnum=actnum) region = EclRegion(grid, False) self.assertFalse(region) self.assertEqual(0, region.active_size()) self.assertEqual(0, region.global_size()) region.select_all() self.assertTrue(region) self.assertEqual(50, region.active_size()) self.assertEqual(100, region.global_size()) region.deselect_all() self.assertFalse(region) self.assertEqual(0, region.active_size()) self.assertEqual(0, region.global_size()) region = EclRegion(grid, False) region.select_inactive() self.assertTrue(region) self.assertEqual(0, region.active_size()) self.assertEqual(50, region.global_size())
def test_grid_cell_bounding_boxes() -> None: layers = () flowdata = FlowData(_locate_test_case(), layers) # Test one layer for the whole field and no layers equal flowdata._layers = ((1, flowdata.grid.nz),) field_one_layer = flowdata.grid_cell_bounding_boxes(0) flowdata._layers = () field_no_layer = flowdata.grid_cell_bounding_boxes(0) assert_almost_equal(field_one_layer, field_no_layer) # Test zero'th layer id flowdata._layers = ((1, 2), (3, 4)) result = flowdata.grid_cell_bounding_boxes(0) active_cells = EclRegion(flowdata.grid, True) active_cells.select_kslice( *tuple(map(operator.sub, flowdata._layers[0], (1, 1))), intersect=True ) active_cells.select_active(intersect=True) assert result.shape[0] == active_cells.active_size() assert result.shape[1] == 6 # Test last layer id flowdata._layers = ((1, 2), (3, 4)) result = flowdata.grid_cell_bounding_boxes(1) active_cells = EclRegion(flowdata.grid, True) active_cells.select_kslice( *tuple(map(operator.sub, flowdata._layers[-1], (1, 1))), intersect=True ) active_cells.select_active(intersect=True) assert result.shape[0] == active_cells.active_size() assert result.shape[1] == 6
def test_grid_cell_bounding_boxes() -> None: layers = () flowdata = FlowData( _locate_test_case(), layers, "multiple_based_on_workovers", ) # Test no argument and entire field being equal flowdata._layers = ((1, flowdata.grid.nz), ) assert_almost_equal(flowdata._grid_cell_bounding_boxes(), flowdata._grid_cell_bounding_boxes(0)) # Test zero'th layer id flowdata._layers = ((1, 2), (3, 4)) result = flowdata._grid_cell_bounding_boxes(0) active_cells = EclRegion(flowdata.grid, True) active_cells.select_kslice(*tuple( map(operator.sub, flowdata._layers[0], (1, 1))), intersect=True) active_cells.select_active(intersect=True) assert result.shape[0] == active_cells.active_size() assert result.shape[1] == 6 # Test last layer id flowdata._layers = ((1, 2), (3, 4)) result = flowdata._grid_cell_bounding_boxes(1) active_cells = EclRegion(flowdata.grid, True) active_cells.select_kslice(*tuple( map(operator.sub, flowdata._layers[-1], (1, 1))), intersect=True) active_cells.select_active(intersect=True) assert result.shape[0] == active_cells.active_size() assert result.shape[1] == 6
def test_truth_and_size(self): actnum = IntVector( initial_size = 100, default_value = 0) actnum[0:50] = 1 grid = EclGrid.createRectangular( (10,10,1) , (1,1,1), actnum = actnum) region = EclRegion(grid, False) self.assertFalse( region ) self.assertEqual( 0, region.active_size( )) self.assertEqual( 0, region.global_size( )) region.select_all( ) self.assertTrue( region ) self.assertEqual( 50, region.active_size( )) self.assertEqual( 100, region.global_size( )) region.deselect_all() self.assertFalse( region ) self.assertEqual( 0, region.active_size( )) self.assertEqual( 0, region.global_size( )) region = EclRegion(grid, False) region.select_inactive() self.assertTrue( region ) self.assertEqual( 0 , region.active_size( )) self.assertEqual( 50, region.global_size( ))
def main(grid): vmin,vmax = volume_min_max(grid) dz_limit = 0.3 region = EclRegion(grid, False) region.select_thin(dz_limit) print "Smallest cell : %g" % vmin print "Largest cell : %g" % vmax print "Thin active cells : %d" % region.active_size() for ai in region.get_active_list(): c = grid.cell(active_index=ai) print('dz(%2d, %2d, %2d) = %.3f' % (c.i, c.j, c.k, c.dz))