Syntax for ImageMath expressions

Issue #475 resolved
Agustin Lobo created an issue

There is no documentation in

https://enmap-box.readthedocs.io/en/latest/usr_section/usr_manual/applications.html#imagemath

and just 2 examples in https://enmap-box.readthedocs.io/en/latest/usr_section/usr_cookbook/imagemath.html

Where could I find doc on the syntax that is needed?

My current need is just to calculate a layer of probability maxima from a multiband probability raster that is output from Predict Class Probability.

(Andreas Rabe kindly provided the way to calculate a mask for those pixels below a certain threshold in Issue #298, but we prefer to explore first the actual values to decide the threshold)

Comments (9)

  1. Andreas Janz

    Unfortunately, we are missing a proper documentation for now. Regarding the NDVI example, enmap is a 3d numpy array, red and nir is a 2d sub-array of the enmap array.

    As syntax, you can use any Numpy operators (+, -, /, *, …) or methodes, see https://numpy.org/doc/stable/reference/

    In fact, the code snippet can be arbitrary Python code.

    Sidenote: for debugging/testing, it may also be helpful to use print outputs, that will show up in the log widget: e.g. print(enmap.shape) will output the array dimensions of the EnMAP raster.

    Hope that helps for now.

  2. Agustin Lobo reporter

    I understand documentation is a huge effort. Perhaps there could be an organized way for users to contribute examples.

  3. Andreas Janz

    Having an example section is a good idea. If you have an interesting example to begin with, just provide it here and I will add it to the docs.

  4. Andreas Janz

    Hi Agus,

    we overhauled ImageMath, which is now called RasterMath. I still want to do a usage tutorial on ReadTheDocs soon. So stay tuned.

    Regards
    Andreas

  5. Log in to comment