<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr"><br>
</div>
<div>Hi, Even!</div>
<div><br>
</div>
<div>  1-D dataset handling in the new HDF5 multi-dimension code is fantastic!</div>
<div>  I could convert 1-d swath into GeoTIFF using the new Python HDF5 multidimensional API.</div>
<div>  Please see python code at the bottom of email.</div>
<div><br>
</div>
<div>  However, I can't run it as an AWS lambda function.</div>
<div>  The below is the error message:</div>
<div><br>
</div>
<div><br>
</div>
<font face="courier new, monospace">'NoneType' object has no attribute 'GetRootGroup': AttributeError<br>
Traceback (most recent call last):<br>
File "/var/task/lambda.py", line 42, in handler<br>
rg = ds.GetRootGroup()<br>
AttributeError: 'NoneType' object has no attribute 'GetRootGroup'</font></div>
<div><br>
</div>
<div dir="ltr"><br>
<div>  The same code worked fine under AWS lambda Docker before it is deployed.<br>
</div>
<div>  I even tested the Python code on Google Colab and could access data on S3 using vsis3.</div>
<div>  Thus, I am quite puzzled. </div>
<div>   Has anyone successfully tested with HDF5 multidimensional with AWS Lambda?</div>
<div><br>
</div>
<div><br>
</div>
<div><font face="courier new, monospace">    # Open dataset using vsis3 interface. fname is obtained from S3 bucket trigger.<br>
</font></div>
<div>
<div><font face="courier new, monospace">    path = '/vsis3/sdt-data/' + fname</font></div>
<div><font face="courier new, monospace">    ds = gdal.OpenEx(path, gdal.OF_MULTIDIM_RASTER)</font></div>
<div><font face="courier new, monospace">    rg = ds.GetRootGroup()</font></div>
<div><font face="courier new, monospace">    hg = rg.OpenGroup('HDFEOS')</font></div>
<div><font face="courier new, monospace">    sg = hg.OpenGroup('SWATHS')</font></div>
<div><font face="courier new, monospace">    mg = sg.OpenGroup('MOP02')</font></div>
<div><font face="courier new, monospace">    gg = mg.OpenGroup('Geolocation Fields')</font></div>
<div><font face="courier new, monospace">    dg = mg.OpenGroup('Data Fields')</font></div>
<div><font face="courier new, monospace">    </font></div>
<div><font face="courier new, monospace">    ar_lat = gg.OpenMDArray('Latitude')</font></div>
<div><font face="courier new, monospace">    lat_data = ar_lat.Read(buffer_datatype = gdal.ExtendedDataType.Create(gdal.GDT_Float32))</font></div>
<div><font face="courier new, monospace">    lats = np.frombuffer(lat_data, dtype=np.float32)</font></div>
</div>
<div>        ...</div>
</div>
</div>
</div>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Fri, Jul 26, 2019 at 9:34 AM Even Rouault <<a href="mailto:even.rouault@spatialys.com">even.rouault@spatialys.com</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
On jeudi 25 juillet 2019 19:57:44 CEST Joe Lee wrote:<br>
> Unsupported number of dimensions<br>
<br>
Ah ok, when exporting to GeoTIFF or a "classic" 2D driver, the <br>
multidimensional-to-classic bridge currently checks that the array is a 2D <br>
one. Here you reduced it to a 1D-slice, hence it rejects it. The bridge could <br>
probably be made a bit more flexible by accepting 1D arrays as well. If you <br>
export to netCDF, this should work fine though (as this won't go through the <br>
bridge, but use directly multidimensional netCDF output capabilities)<br>
<br>
Even<br>
<br>
-- <br>
Spatialys - Geospatial professional services<br>
<a href="http://www.spatialys.com" rel="noreferrer" target="_blank">http://www.spatialys.com</a><br>
</blockquote>
</div>
</body>
</html>