[gdal-dev] gdal_calc.py floating point arithmetic

Sam Wilson sam at surfline.com
Fri Jul 15 09:38:31 PDT 2016


Thank you Andrew! That did it.

Cheers,
Sam



On 7/14/16, 11:12 PM, "Andrew C Aitchison" <andrew at aitchison.me.uk> wrote:

>On Fri, 15 Jul 2016, Sam Wilson wrote:
>
>> Hi,
>>
>> I¹m attempting to linearly interpolate two geotiff files using
>>gdal_calc.py.  The geotiff files are 3 hours apart, so for example hour
>>0 and hour 3.  I¹d like to end up with hourly data, so I need hours 1
>>and 2.
>>
>> Below are the commands I¹m using:
>>
>> However, hour1.tif and hour2.tif appear to be the exact same.
>>
>> Does gdal_calc.py not allow using floating point values in the
>>calculation?
>
>I don't know but imagine that there is a scaling either in the
>generation, the comparison or the diplay.
>
>> Or, am I doing something else wrong?
>
>Yes. You ned something like:
>  gdal_calc.py -A hour0.tif -B hour3.tif ‹outfile=hour1.tif
>‹calc=³(A*0.667)+(B*0.333)²
>  gdal_calc.py -A hour0.tif -B hour3.tif ‹outfile=hour2.tif
>‹calc=³(A*0.333)+(B*0.667)²
>
>



More information about the gdal-dev mailing list