I'm trying to use GDAL calc to convert values in a .tif file, I've done this before with GDAL calc but for converting to a single value. Now I'm trying to convert multiple values in this fashion:
0.0 - 0.2 -> 1
0.2 - 0.4 -> 2
0.4 - 0.6 -> 3
etc
I've tried this:
calculation='((0.0<A<0.2)*1)+((0.2<A<0.4)*2)+((0.4<A<0.6)*3)+
((0.6<A<0.8)*4)+((0.8<A<1.0)*5)+((1.0<A<1.5)*6)+((1.5<A<2.0)*7)+
((2.0<A<2.5)*8)+((2.5<A<3.0)*9)+((3.0<A<9999)*10)'
call([sys.executable, 'C:\Program Files (x86)\GDAL\gdal_calc.py', '-A',
inraster, "--outfile=" + outraster, '--calc='+calculation,'--
NoDataValue=-9999','--overwrite'])
This results in the following error:
0 .. evaluation of calculation [thecalculation] failed
Any ideas? Maybe I need to split up the steps of converting but this could add significantly to the run time.