museotoolbox.processing.RasterMath.add_function

RasterMath.add_function(function, out_image, out_n_bands=False, out_np_dt=False, out_nodata=False, compress=True, **kwargs)[source]

Add function to rasterMath.

Parameters
  • function (function.) – Function to parse where the first argument is a numpy array similar to what museotoolbox.processing.RasterMath.get_random_block() returns.

  • out_image (str.) – A path to a geotiff extension filename corresponding to a raster image to create.

  • out_n_bands (int or False, optional (default=False)) – If False, will run the given function to find the number of bands to define in the out_image.

  • out_np_dt (int or False, optional (default=False)) – If False, will run the given function to get the datatype.

  • out_nodata (int, float or False, optional (default=False)) – If True or if False (if nodata is present in the init raster), will use the minimum value available for the given or found datatype.

  • compress (bool or str, optional (default=True)) – If True, will use PACKBITS. If ‘high’, will use DEFLATE with ZLEVEL = 9 and PREDICTOR=2.

  • **kwargs – kwargs are keyword arguments you need for the given function.

See also

museotoolbox.processing.RasterMath.get_random_block()

To test your function, parse the first argument with a random block

museotoolbox.processing.convert_dt()

To see conversion between numpy datatype to gdal datatype.

museotoolbox.processing.get_dt_from_minmax_values()

To get the gdal datatype according to a min/max value.