raster_tools.focal.correlate#
- raster_tools.focal.correlate(raster, kernel, mode='constant', cval=0.0)[source]#
- Cross-correlate kernel with each band individually. Returns a new Raster. - The kernel is applied to each band in isolation so returned raster has the same shape as the original. - Parameters
- raster (Raster or path str) – The raster to cross-correlate kernel with. Can be multibanded. 
- kernel (array_like) – 2D array of kernel weights 
- mode ({'reflect', 'constant', 'nearest', 'wrap'}, optional) – - Determines how the data is extended beyond its boundaries. The default is ‘constant’. - ’reflect’ (d c b a | a b c d | d c b a)
- The data pixels are reflected at the boundaries. 
- ’constant’ (k k k k | a b c d | k k k k)
- A constant value determined by cval is used to extend the data pixels. 
- ’nearest’ (a a a a | a b c d | d d d d)
- The data is extended using the boundary pixels. 
- ’wrap’ (a b c d | a b c d | a b c d)
- The data is extended by wrapping to the opposite side of the grid. 
 
- cval (scalar, optional) – Value used to fill when mode is ‘constant’. Default is 0.0. 
 
- Returns
- The resulting new Raster. 
- Return type
- Raster