split_by_grid.mc function

Split data with a grid