I am posting a response I got from Graeme B. Bell:
To get "1 if zero, or A" you do:
--calc="(A==0)*1 + (A>0)*A"
Don't make 1 your nodata value if it's actually a data value here
G
--
View this message in context:
http://osgeo-org.1560.x6.nabble.com/gdal-calc-py-else-not-0-tp5162590p5162914
I found a workaround for my problem:
First get all zeros in the original file with:
gdal_calc.py -A original_file.tif --outfile=zeros.tif --calc=A==0
--> results in a file where ther former zero cells have a value of 1 and all
other cells 0
Then combine the temporary file with the original file:
I am trying to reassign 0 values in my raster to 1 and leave all the other
values as they are.
gdal_calc.py -A infile.tif --outfile=outfile.tif --calc="A* logical_or(A <
0, A > 0)" --overwrite --NoDataValue=1
The problem I am encountering is, that I cannot reassign the zeros. In my
calculation I