[ZOO-Discuss] python gdal numpy array question

Gérald Fenoy gerald.fenoy at geolabs.fr
Sat Dec 11 01:39:34 PST 2010


Hi Niels,
nice to hear from you.

I'm not sure to get enough informations to help you in an efficient way but let me try. 

It seems that the instance named "gdal" is undefined or not initialized (the "not scriptable" from the error message shall mean that).

As you experienced the workshop material [1] you probably noticed the specific [env] section of the main.cfg file which let you define any environment variables (on runtime) which are required to run properly your service [2]. So, my first assumption is that maybe your gdal python module is installed in a specific directory or was not found. In such case, you'll have to add the [env] section and then set the PYTHON_PATH variable manualy In there. You can find example on how to setup such variable from the OpenOffice Support page [3].

Another assumption can be that you use different Python versions from ZOO-Kernel than from command line. Please verify this also. You shall be able to check the Python version used by ZOO-Kernel by running ldd on it.

Hope to hear from you,
Best regards,

[1] http://zoo-project.org/trac/wiki/ZooWorkshop/FOSS4GJapan
[2] http://zoo-project.org/trac/wiki/ZooWorkshop/FOSS4GJapan/UsingZooFromOSGeoLiveVM#ZOOKernelInstallation
[3] http://zoo-project.org/trac/wiki/ZooWebSite/ZooKernel/InstallationUsingOO#ConfigureyourZOOKernel
Le 10 déc. 2010 à 21:56, niels hoffmann a écrit :

> zootribe,
> 
> I've got a question about some raster processing using python.
> The code below works when I run it standalone, but not if I run it as a zoo-service.
> Does anybody have a clue why not?
> <==========>
> driver=gdal.GetDriverByName('GTiff')
> driver.Register()
> ds=gdal.Open(filename, GA_ReadOnly)
> 
> cols=ds.RasterXSize
> rows=ds.RasterYSize
> rain_factor=0.85
> 
> r2arr=ds.GetRasterBand(1).ReadAsArray(0,0,cols, rows).astype(float)
> r2rainfactor=dot(rain_factor,r2arr)
> outputs["Result"]["value"]=str(r2rainfactor[100,100])
> <=========>
> TRACE : 'NotImplementedType' object is unsubscriptable
> TRACE : <type 'exceptions.TypeError'>
> Unable to run your python process properly
> 
> So I'm trying to do a numpy scalar*array multiplication with the dot operator, this seems to be working standalone, but not in CGI?
> 
> Cheers, Niels
> _______________________________________________
> Zoo-discuss mailing list
> Zoo-discuss at gisws.media.osaka-cu.ac.jp
> http://gisws.media.osaka-cu.ac.jp/mailman/listinfo/zoo-discuss

Gérald Fenoy
gerald.fenoy at geolabs.fr
Just a ZOO Tribe member
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/zoo-discuss/attachments/20101211/2f1d2e6e/attachment.html>


More information about the Zoo-discuss mailing list