Search code examples
pythonscalasbtgdal

gdal_calc.py does not work under sbt


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>
    main()
  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 command gdal_calc.py in my terminal works well. Running the exact same command line directly in my terminal doesn't work. 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 ? Thanks !


Solution

  • I finally found a solution to my problem : I'm writing my gdal_calc.py command line into a shell script and then executing it thought shell. It's not resolving the problem but bypassing ;)