Sentinel2.generate_raster(input_raster, output_raster, expression, interpolate_nan=True, divide_X_by=1, multiply_by=1, dtype=<class 'numpy.float32'>)

Generate index from raster

  • intput_raster (path) – path of the raster file.

  • output_raster (path) – path to save the raster file. (e.g. ‘/tmp/myIndex.tif’)

  • expression (str or dict) – If str, contains only the expression (e.g. ‘B8/B2’) If dict, please generate it from add_index function.

  • inteprolate_nan (boolean, default True) – If nan value a linear interpolation is done.

  • divide_X_by (integer or float, default 1) – Value to divide X before computing the index

  • multiply_by (integer or float, default 1.) – Value to multiply the result (e.g. 100 to set the NDVI between -100 and 100)

  • dtype (numpy dtype, default np.float32) – dtype of the output (e.g. np.int16 to store the NDVI in integer value)


>>> generateRaster(raster,'/tmp/my_index.tif',expression='B8/B2')