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

Kurt Schwehr schwehr at gmail.com
Sun Jan 19 15:05:59 PST 2014


> ,"-r cubicspline",


becomes

"-r", "cubicspline",

and so forth

On Jan 19, 2014, at 3:00 PM, Simon Richard Proud <srp at geo.ku.dk> wrote:

> Hi, thanks for the reply.
> 
> I tried changing the call to this: 
> process.call(["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"])
> 
> But still receive just the usage instructions, I can't see any other arguments that can be divided into an element. Setting the "shell=True" option also has no effect.
> 
> /Simon
> 
> ________________________________________
> Fra: Kurt Schwehr [schwehr at gmail.com]
> Sendt: 19. januar 2014 17:47
> Til: Simon Richard Proud
> Cc: gdal-dev at lists.osgeo.org dev
> Emne: Re: [gdal-dev] Problem calling gdalwarp from within python script
> 
> try
> 
>> subprocess.call(["gdalwarp", "-q",  "-multi",   ...   "TEST2.tiff"])
> 
> 
> Each arg must be an element in the list.
> 
> -kurt
> 
> On Jan 19, 2014, at 2:27 PM, Simon Proud <srp at geo.ku.dk> wrote:
> 
>> 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.
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
> 
> 



More information about the gdal-dev mailing list