<div dir="auto"><div>Hi, <div dir="auto"><br></div>Did anyone have this problem? Any solution? <br><div class="gmail_extra"><br><div class="gmail_quote">On 30 Mar 2017 5:08 PM, "Idan Miara" <<a href="mailto:idan@miara.com">idan@miara.com</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello, <div><br></div><div>I am trying to read a raster using gdal's ReadAsArray() method in python 3.6. I am using the gdal library provided in Qgis' 2.99 weekly release (QGIS-OSGeo4W-2.99.0-9-Setup-<wbr>x86_64.exe).<div><br></div><div>this sample script:</div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div>import gdal</div></div><div><div>x = gdal.Open(r'D:/Map Samples/1/DTM/n29w098d5dtm.<wbr>tif') #valid tif</div></div><div><div>y = x.ReadAsArray()</div></div><div><div>print(y)</div></div></blockquote><div><br></div><div>produces this error:</div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div>Traceback (most recent call last):</div></div><div><div> File "C:\PROGRA~1\QGIS2~1.99\apps\<wbr>Python36\lib\site-packages\<wbr>osgeo\gdal_array.py", line 16, in swig_import_helper</div></div><div><div> fp, pathname, description = imp.find_module('_gdal_array', [dirname(__file__)])</div></div><div><div> File "C:\PROGRA~1\QGIS2~1.99\apps\<wbr>Python36\lib\imp.py", line 296, in find_module</div></div><div><div> raise ImportError(_ERR_MSG.format(<wbr>name), name=name)</div></div><div><div>ImportError: No module named '_gdal_array'</div></div><div><div><br></div></div><div><div>During handling of the above exception, another exception occurred:</div></div><div><div><br></div></div><div><div>Traceback (most recent call last):</div></div><div><div> File "C:\PROGRA~1\QGIS2~1.99\apps\<wbr>Python36\lib\code.py", line 91, in runcode</div></div><div><div> exec(code, self.locals)</div></div><div><div> File "<input>", line 1, in <module></div></div><div><div> File "<string>", line 3, in <module></div></div><div><div> File "C:\PROGRA~1\QGIS2~1.99\apps\<wbr>Python36\lib\site-packages\<wbr>osgeo\gdal.py", line 1817, in ReadAsArray</div></div><div><div> from . import gdalnumeric</div></div><div><div> File "C:/PROGRA~1/QGIS2~1.99/apps/<wbr>qgis-dev/./python\qgis\utils.<wbr>py", line 647, in _import</div></div><div><div> mod = _builtin_import(name, globals, locals, fromlist, level)</div></div><div><div> File "C:\PROGRA~1\QGIS2~1.99\apps\<wbr>Python36\lib\site-packages\<wbr>osgeo\gdalnumeric.py", line 1, in <module></div></div><div><div> from osgeo.gdal_array import *</div></div><div><div> File "C:/PROGRA~1/QGIS2~1.99/apps/<wbr>qgis-dev/./python\qgis\utils.<wbr>py", line 647, in _import</div></div><div><div> mod = _builtin_import(name, globals, locals, fromlist, level)</div></div><div><div> File "C:\PROGRA~1\QGIS2~1.99\apps\<wbr>Python36\lib\site-packages\<wbr>osgeo\gdal_array.py", line 26, in <module></div></div><div><div> _gdal_array = swig_import_helper()</div></div><div><div> File "C:\PROGRA~1\QGIS2~1.99\apps\<wbr>Python36\lib\site-packages\<wbr>osgeo\gdal_array.py", line 18, in swig_import_helper</div></div><div><div> import _gdal_array</div></div><div><div> File "C:/PROGRA~1/QGIS2~1.99/apps/<wbr>qgis-dev/./python\qgis\utils.<wbr>py", line 647, in _import</div></div><div><div> mod = _builtin_import(name, globals, locals, fromlist, level)</div></div><div><div>ModuleNotFoundError: No module named '_gdal_array'</div></div></blockquote><div><br></div><div>What can i do to use gdal's readAsArray method in my code?</div><div>Thank you.</div></div></div>
</blockquote></div><br></div></div></div>