2

I am trying to follow Error when using gdal_calc.py and Friend commented:

import os
gdal_calc =  'python C:/PROGRA~2/GDAL/gdal_calc.py -A d:/mnt_5x5.tif --outfile=d:/test.tif --calc="A+1"'
os.system(gdal_calc)

but I take error :

..<string>:1: RuntimeWarning: overflow encountered in multiply
    C:/OSGeo4W64/bin/gdal_calc.py:296: RuntimeWarning: invalid value encountered in multiply

here complete message :

0 ..<string>:1: RuntimeWarning: overflow encountered in multiply
C:/OSGeo4W64/bin/gdal_calc.py:296: RuntimeWarning: invalid value encountered in multiply
  myResult = ((1*(myNDVs==0))*myResult) + (myOutNDV*myNDVs)
 10 .. 20 .. 30 .. 40 .. 50 .. 60 .. 70 .. 80 .. 90 .. 100 - Done

Any idea why I take this error?

I take new image for output but I am not sure if this image is correct after this error .

here my complete code :

gdal_calc =  'python C:/OSGeo4W64/bin/gdal_calc.py -A {0} -B {1} -C {2} --outfile=test.tif --calc="(5*A)+(5*B)+(2*C)"'.format(a,b,c)
os.system(gdal_calc)
PolyGeo
  • 65,136
  • 29
  • 109
  • 338
jessie jes
  • 1,061
  • 8
  • 21
  • 3
    What is the datatype of your tiff? Check the maximum values of bands and estimate if the results from (5A)+(5B)+(2*C) can fit into the valid range for that datatype. – user30184 Nov 16 '17 at 07:20
  • @user30184 all datatype is float32.my datasets is DEM , slope ,aspect has different maximum values – jessie jes Nov 16 '17 at 07:41
  • @user30184 but one dataset have different no data value that is the problem ? – jessie jes Nov 16 '17 at 07:50
  • 2
    Could be. Is that value some very small negative number? We know that the error is "overflow encountered in multiply". – user30184 Nov 16 '17 at 13:41
  • @user30184 what value you mean ?and if you know that error where is solution ? :) – jessie jes Nov 16 '17 at 14:26
  • 1
    You wrote about different nodata values. I know the error because I read it from the error message. About solving the problem, I know very little about gdal_ calc. – user30184 Nov 16 '17 at 18:50

0 Answers0