1

hello I try to follow this post and Friend commend :

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)
  • 2
    What is the datatype of your tiff? Check the maximum values of bands and estimate if the results from (5*A)+(5*B)+(2*C) can fit into the valid range for that datatype. – user30184 Nov 16 '17 at 7:20
  • @user30184 all datatype is float32.my datasets is DEM , slope ,aspect has different maximum values – jessie jes Nov 16 '17 at 7:41
  • @user30184 but one dataset have different no data value that is the problem ? – jessie jes Nov 16 '17 at 7:50
  • 1
    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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.