In documentation for gdal_calc it is stated Command line raster calculator with numpy syntax. Later on there are few examples where in one of them:
gdal_calc.py -A input.tif --outfile=result.tif --calc="A*(A>0)" --NoDataValue=0 - means set values of zero and below to null
Unfortunately there is no example on logical operators like:
--calc="A*(A>0 and A>B)"- means keep A if A bigger zero and bigger B and set the rest to null
Based on Numpy/Scipy logic functions I would expect to write logical operators as:
--calc="A*logical_and(A>0,A>B)"
I tried this and it seems to work but I would like to be assured that is correct.
In the similar way if you want minimum of A and B:
--calc="A*(A<=B)+B*(A>B)"
You can just write:
--calc="minimum(A,B)"
My issue is I can't find any cookbook to make sure I get this right. Is there some good cookbook with advanced examples of what is and is not possible with gdal_calc?
--calc=where(condition, if, else)
? See gis.stackexchange.com/q/238397/6998