def aggregate(raster, ndv, block_size):
    '''
    Aggregate raster to smaller resolution, by adding cells.
    Usage:
            aggregate(raster, ndv, block_size)

    where:
            raster is a Numpy array created by importing the raster (e.g. geotiff)

            ndv is the NoData Value for the raster (can be read using the get_geo_info function)

            block_size is a duple of factors by which the raster will be shrinked

    Example:
            raster = HMISea.tif

            ndv, xsize, ysize, geot, projection, datatype = get_geo_info(raster)

            costs = load_tiff(raster)

            costs2=aggregate(costs, ndv, (10,10))
    '''
    raster2 = block_reduce(raster, block_size, func=np.ma.sum)
    return raster2