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

Simon Richard Proud srp at geo.ku.dk
Sun Jan 19 16:41:17 PST 2014


Hi,
Unfortunately that produces a file not found error with filename "65535". If I remove both arguments "-srcnodata" and "65535" then I go back to getting the usage guidelines.

/Simon
________________________________________
Fra: Kurt Schwehr [schwehr at gmail.com]
Sendt: 19. januar 2014 19:00
Til: Simon Richard Proud
Cc: gdal-dev at lists.osgeo.org dev
Emne: Re: [gdal-dev] Problem calling gdalwarp from within python script

have not tested this, but I would guess something like this...

['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']


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

> Ok, that gets things a little closer - now it gives an error: "ERROR 1: Translating source or target SRS failed"
> I tried with '+proj=geos +lon_0=0.0 +h=35785831' as one argument and as three. Same result.
> I also tried including the -te and -tr arguments in the one argument along with the proj details - no luck with that either.
>
> /Simon
> ________________________________________
> Fra: Kurt Schwehr [schwehr at gmail.com]
> Sendt: 19. januar 2014 18:05
> Til: Simon Richard Proud
> Cc: gdal-dev at lists.osgeo.org dev
> Emne: Re: [gdal-dev] Problem calling gdalwarp from within python script
>
>> ,"-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