Sentinel2.generate_index(X, expression, interpolate_nan=True, divide_X_by=1, multiply_by=1, dtype=<class 'numpy.float32'>)

Generate index from array

  • X (array) – array where each line is a pixel.

  • 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)


>>> generate_index(X,expression='B8/B2')