Re: spawn GDAL??? [message #80862] |
Thu, 19 July 2012 12:53 |
anniebryant@gmail.com
Messages: 16 Registered: March 2009
|
Junior Member |
|
|
On Wednesday, July 18, 2012 3:26:15 PM UTC-6, Craig Markwardt wrote:
> On Wednesday, July 18, 2012 4:38:51 PM UTC-4, AB wrote:
> > On Wednesday, July 18, 2012 2:27:30 PM UTC-6, Craig Markwardt wrote:
> ...
> > If the path is being reset... is it possible to avoid that?
> >
> > AB
>
> You have to investigate what your .profile and/or .bashrc does to the various paths.
>
> I would start IDL, then spawn an interactive 'sh' shell from within IDL, and then try again to call the Python program by hand.
>
> You still didn't say what your error message was. The traceback only tells where the error occurred, not what the error was.
That is all I got for an error. i.e. the "traceback method" sentences were all that printed out.
|
|
|
Re: spawn GDAL??? [message #80883 is a reply to message #80862] |
Wed, 18 July 2012 14:26  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Wednesday, July 18, 2012 4:38:51 PM UTC-4, AB wrote:
> On Wednesday, July 18, 2012 2:27:30 PM UTC-6, Craig Markwardt wrote:
...
> If the path is being reset... is it possible to avoid that?
>
> AB
You have to investigate what your .profile and/or .bashrc does to the various paths.
I would start IDL, then spawn an interactive 'sh' shell from within IDL, and then try again to call the Python program by hand.
You still didn't say what your error message was. The traceback only tells where the error occurred, not what the error was.
|
|
|
Re: spawn GDAL??? [message #80884 is a reply to message #80883] |
Wed, 18 July 2012 13:38  |
anniebryant@gmail.com
Messages: 16 Registered: March 2009
|
Junior Member |
|
|
On Wednesday, July 18, 2012 2:27:30 PM UTC-6, Craig Markwardt wrote:
> On Wednesday, July 18, 2012 3:34:32 PM UTC-4, AB wrote:
> > Error Message:
> >
> >
> > Traceback (most recent call last):
> > File "/usr/local/GDAL/usr/bin/gdal_merge.py& quot;, line 31, in ?
> > import gdal
> > File "/usr/local/GDAL/usr/lib64/python2.4/site-packa ges/GDAL-1.8.0-py2.4-linux-x86_64.egg/gdal.py", line 2, in ?
> > from osgeo.gdal import deprecation_warn
> > File "/usr/local/GDAL/usr/lib64/python2.4/site-packa ges/GDAL-1.8.0-py2.4-linux-x86_64.egg/osgeo/__init__.py& amp;quot;, line 24, in ?
> > import _gdal
>
> Sorry, your traceback doesn't show the actual error message.
>
> It looks like a python problem. Divide and conquer; only test one thing at a time. So forget your shell script and forget IDL. Can you call your python script by hand and get the results you expect?
>
> Next, can you create a *simple* 'sh' script which calls your python program - no loops! - and can you make that run and get the results you expect?
>
> The only connection I can see to IDL is that perhaps it calls 'sh' and resets your IDL/sh/python path.
>
> Craig
Hi Craig,
Yes, the python script works like a charm on its own. It also works like a charm called within a shell script. It is when it is called from IDL that there is a problem.
If the path is being reset... is it possible to avoid that?
AB
|
|
|
Re: spawn GDAL??? [message #80885 is a reply to message #80884] |
Wed, 18 July 2012 13:27  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Wednesday, July 18, 2012 3:34:32 PM UTC-4, AB wrote:
> Error Message:
>
>
> Traceback (most recent call last):
> File "/usr/local/GDAL/usr/bin/gdal_merge.py", line 31, in ?
> import gdal
> File "/usr/local/GDAL/usr/lib64/python2.4/site-packages/ GDAL-1.8.0-py2.4-linux-x86_64.egg/gdal.py", line 2, in ?
> from osgeo.gdal import deprecation_warn
> File "/usr/local/GDAL/usr/lib64/python2.4/site-packages/ GDAL-1.8.0-py2.4-linux-x86_64.egg/osgeo/__init__.py" ;, line 24, in ?
> import _gdal
Sorry, your traceback doesn't show the actual error message.
It looks like a python problem. Divide and conquer; only test one thing at a time. So forget your shell script and forget IDL. Can you call your python script by hand and get the results you expect?
Next, can you create a *simple* 'sh' script which calls your python program - no loops! - and can you make that run and get the results you expect?
The only connection I can see to IDL is that perhaps it calls 'sh' and resets your IDL/sh/python path.
Craig
|
|
|
Re: spawn GDAL??? [message #80886 is a reply to message #80885] |
Wed, 18 July 2012 12:24  |
anniebryant@gmail.com
Messages: 16 Registered: March 2009
|
Junior Member |
|
|
On Wednesday, July 18, 2012 11:02:10 AM UTC-6, AB wrote:
> Hi group,
>
> Anyway to call gdal from IDL using SPAWN? Currently I have gdal wrapped up in a small shell script that loops through days of year. Seems like SPAWN has no problem with the shell script, but once it gets to gdal_merge.py, I get error messages.
>
> ________________________________________________________
>
> Here is the call in IDL:
>
> spawn, 'sh /home/scripts/mosaic_8day.sh'
>
>
> Here is the shell script:
>
>
> # Loop through each directory
> for i in `ls -d /usr/local/snow/data/archive/2004/*`
> do
> cd $i
>
> var=$i
>
> #extract date from directory name
> date=${var:64:67}
>
> echo $date
>
> gdal_merge.py MOD09GA.*.h09v05.8DAY.tif MOD09GA.*.h09v04.8DAY.tif MOD09GA.*.h10v04.8DAY.tif -o UCRB.$date.8DAY.tif
>
> done
>
> _______________________________________
>
> Any thoughts?
>
> Thanks!
> Annie
Here is my error:
Traceback (most recent call last):
File "/usr/local/GDAL/usr/bin/gdal_merge.py", line 31, in ?
import gdal
File " /usr/local/GDAL/usr/lib64/python2.4/site-packages/GDAL-1.8.0 -py2.4-linux-x86_64.egg/gdal.py ", line 2, in ?
from osgeo.gdal import deprecation_warn
File " /usr/local/GDAL/usr/lib64/python2.4/site-packages/GDAL-1.8.0 -py2.4-linux-x86_64.egg/osgeo/__init__.py ", line 24, in ?
import _gdal
|
|
|
Re: spawn GDAL??? [message #80887 is a reply to message #80886] |
Wed, 18 July 2012 12:34  |
anniebryant@gmail.com
Messages: 16 Registered: March 2009
|
Junior Member |
|
|
Error Message:
Traceback (most recent call last):
File "/usr/local/GDAL/usr/bin/gdal_merge.py", line 31, in ?
import gdal
File " /usr/local/GDAL/usr/lib64/python2.4/site-packages/GDAL-1.8.0 -py2.4-linux-x86_64.egg/gdal.py ", line 2, in ?
from osgeo.gdal import deprecation_warn
File " /usr/local/GDAL/usr/lib64/python2.4/site-packages/GDAL-1.8.0 -py2.4-linux-x86_64.egg/osgeo/__init__.py ", line 24, in ?
import _gdal
|
|
|
Re: spawn GDAL??? [message #80888 is a reply to message #80886] |
Wed, 18 July 2012 11:58  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Wednesday, July 18, 2012 1:02:10 PM UTC-4, AB wrote:
> Hi group,
>
> Anyway to call gdal from IDL using SPAWN? Currently I have gdal wrapped up in a small shell script that loops through days of year. Seems like SPAWN has no problem with the shell script, but once it gets to gdal_merge.py, I get error messages.
>
> ________________________________________________________
>
> Here is the call in IDL:
>
> spawn, 'sh /home/scripts/mosaic_8day.sh'
>
>
> Here is the shell script:
>
>
> # Loop through each directory
> for i in `ls -d /usr/local/snow/data/archive/2004/*`
> do
> cd $i
>
> var=$i
>
> #extract date from directory name
> date=${var:64:67}
>
> echo $date
>
> gdal_merge.py MOD09GA.*.h09v05.8DAY.tif MOD09GA.*.h09v04.8DAY.tif MOD09GA.*.h10v04.8DAY.tif -o UCRB.$date.8DAY.tif
>
> done
>
> _______________________________________
>
> Any thoughts?
>
> Thanks!
> Annie
It's unfortunate that you didn't post what the error message was. The obvious thing to check is that your path is set correctly within the script and that your 'gdal' is in the path and executable. Also, to make sure that the wildcard patterns in your command line actually match something.
Craig
|
|
|