[gdal-dev] gdal_calc.py IF ELSE Condition

Antonio Falciano afalciano at yahoo.it
Thu Jun 30 06:50:16 PDT 2016


Il 30/06/2016 15:25, Gabriele N. ha scritto:
> Hi all,
>
> my goal is to apply the following condition:
>
> if map A > 0 then MAP C = arctan((A/B)+180  ELSE MAP C = 90-arctan(A/B)
>
> I tried in several ways, including this:
>
> gdal_calc.py -A u-wind$DATE.tif -B  v-wind$DATE.tif
> --outfile=dir_wind_$DATE.tif --calc="arctan(A/B)+180*(A>0)
> w_dir=90-arctan(A/B))"

Ciao Gabriele,
try with (not tested):

--calc="arctan(A/B)*180/3.141592+180*(A>0)+(3.141592-arctan(A/B))*(A<=0)"

where arctan could be atan or something similar.

Antonio

-- 
Antonio Falciano
http://www.linkedin.com/in/antoniofalciano


More information about the gdal-dev mailing list