[gdal-dev] Problem calling gdalwarp from within python script

Simon Proud srp at geo.ku.dk
Sun Jan 19 14:27:49 PST 2014


Hi,
I wish to call gdalwarp from within a python script but I cannot get it to
work.

The command I wish to run is:

gdalwarp -q -multi -r cubicspline -t_srs '+proj=geos +lon_0=0.0 +h=35785831'
-te -5568748.2758 -5568748.4774 5568748.2758 5568748.2758 -tr 3000.40316582
3000.40316582 -srcnodata 65535 TEST.tiff TEST2.tiff

I'm running on Ubuntu 12.04. The above command works perfectly when called
from a terminal window and produces a good output image.

But when I run from python I get problems.
First, I tried to run with subprocess.call(["gdalwarp","-q -multi ...
TEST2.tiff"]) then all I see is the default usage instructions. No file is
created. Same if I use popen.

If I use: os.system("gdalwarp -q -multi ... TEST2.tiff") then it does run
and I see the expected text on the screen. However, in this case the output
file is blank - it is the right size and contains the right georeferencing
information but every pixel in the image has a value of zero.

Does anyone have an idea what could be the problem here?
Thanks!



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Problem-calling-gdalwarp-from-within-python-script-tp5098902.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list