有没有办法使用栅格特殊功能?

时间:2013-05-07 18:57:13

标签: python scipy arcgis

>>> dd=special.kv(0,Raster("adiff_C1.tif"))
 Runtime error <type 'exceptions.TypeError'>: ufunc 'kv' not supported for the input        types, and the inputs could not be safely coerced to any supported types according to the  casting rule 'safe'

python 2.6 SciPy的-0.7.1-Win32的superpack-python2.6的 numpy的-1.6.1-Win32的superpack-python2.6的 ARCGIS 10

1 个答案:

答案 0 :(得分:0)

你必须convert your Raster object to a numpy array。然后scipy.special.kv将正常工作:

In [9]: x = numpy.array([[1,2,3],[4,5,6]])

In [10]: x
Out[10]: 
array([[1, 2, 3],
       [4, 5, 6]])

In [11]: special.kv(0, x)
Out[11]: 
array([[ 0.42102444,  0.11389387,  0.0347395 ],
       [ 0.01115968,  0.0036911 ,  0.00124399]])