<html><head>
<meta name="Generator" content="Novell Groupwise Client (Version 14.2.0 Build: 122092)">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<body style="font: 10pt/normal Segoe UI; font-size-adjust: none; font-stretch: normal;"><div class="GroupWiseMessageBody" id="GroupWiseSection_1513616946000_Jacob.Adams@cachecounty.org_D22C8C8009180000A2B40C0C8530ABB4_"><div>I think I've found a bug in the python bindings, but I want to run it by the list before I open a ticket to make sure I'm not missing anything (I'm assuming you'd rather I check it out on the list first rather than cluttering the ticket system with bugs that aren't actually bugs).</div><div><br></div><div>Environment: gdal 2.2.3, python 3.6, installed from conda-forge via Anaconda Navigator.</div><div><br></div><div>I'm creating an in-memory raster to pass to DEMProcessing() to create a hillshade like thus:</div><div><br></div><div> mem_s_fh = gdal.GetDriverByName("MEM").Create('', temp_cols, temp_rows, 1, gdal.GDT_Float32)<br> mem_s_fh.SetGeoTransform([0, cell_size, 0, 0, 0, cell_size])<br> mem_s_fh.SetNoDataValue(s_nodata)<br> s_band = mem_s_fh.GetRasterBand(1)<br> s_band.WriteArray(in_array)</div><div><br></div><div>Which then bombs out on setting NoData with this error:</div><div><br></div><div>Traceback (most recent call last):<br> File "i:\git\dem_smooth.py", line 299, in <module><br> smooth(smooth_dem, hs_dem, window_size, "hillshade", filter_f, t, n, v)<br> File "i:\git\dem_smooth.py", line 232, in smooth<br> new_data = hillshade(super_array)<br> File "i:\git\dem_smooth.py", line 91, in hillshade<br> mem_s_fh.SetNoDataValue(s_nodata)<br> File "C:\Users\jadams\AppData\Local\conda\conda\envs\gdal\lib\site-packages\osgeo\gdal.py", line 1804, in <lambda><br> __getattr__ = lambda self, name: _swig_getattr(self, Dataset, name)<br> File "C:\Users\jadams\AppData\Local\conda\conda\envs\gdal\lib\site-packages\osgeo\gdal.py", line 74, in _swig_getattr<br> return _swig_getattr_nondynamic(self, class_type, name, 0)<br> File "C:\Users\jadams\AppData\Local\conda\conda\envs\gdal\lib\site-packages\osgeo\gdal.py", line 69, in _swig_getattr_nondynamic<br> return object.__getattr__(self, name)<br>AttributeError: type object 'object' has no attribute '__getattr__'</div><div><br></div><div>My searching turns up this ticket in Swig, but I have no idea if it's relevant or not: <a href="https://github.com/swig/swig/issues/588">https://github.com/swig/swig/issues/588</a>.</div><div><br></div><div>I've tried this under python 2.7 and 3.6 with the same result. Trying it under gdal 2.1.3 gives an "Attribute Error: 'Dataset' object has no attribute value 'SetNoDataValue'" error. s_nodata is set previously, and I've verified it holds the right value (when using SetNoDataValue on my GTiff output raster it works as expected). The MEM driver documentation says memory datasets should support nodata values, and the difference in error messages between 2.2.3 and 2.1.3 seems to indicate this has been implemented. The script runs fine if I comment out the SetNoDataValues() call.</div><div><br></div><div>Jake Adams<br></div></div></body></html>