I run a command line gdal_calc.py in a scala script. I run this script with 'sbt run' on my terminal. I got this error :

Traceback (most recent call last):
  File "/usr/local/bin/gdal_calc.py", line 329, in <module>
  File "/usr/local/bin/gdal_calc.py", line 326, in main
    doit(opts, args)
  File "/usr/local/bin/gdal_calc.py", line 282, in doit
    myResult = ((1*(myNDVs==0))*myResult) + (myOutNDV*myNDVs)
TypeError: only integer arrays with one element can be converted to an index

Running the exact same command line directly in my terminal works well. The environment is the same : the gdal library used is the same

The command line runned is the following :

gdal_calc.py --outfile=outfile.tiff -A infile.tiff --overwrite --calc="3*(A==2)"

Can someone explain it ?

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.