<div dir="ltr">Version 0.9.1 with a more pythonic API - it is better (thanks Martin). Apart from doc changes, I will probably leave it as is now for the time being - it does what I need and I have to complete my app.<br><br>from mdal import Datasource, Info, last_status<br><br>print(f"MDAL Version:  {Info.version}")<br>print(f"MDAL Driver Count :{Info.driver_count}")<br>print(last_status())<br><br>for driver in Info.drivers:<br>    print(driver)<br><br><br>ds = Datasource("data/ply/test_mesh.ply")<br>print(ds.meshes)<br><br>mesh = ds.load(0)<br>print(f"Driver : {mesh.driver_name}")<br>print(f"Vertex Count : {mesh.vertex_count}")<br>print(f"Face Count : {mesh.face_count}")<br>print(f"Largest Face: {mesh.largest_face}")<br>print(f"Edge Count : {mesh.edge_count}")<br>print(f"CRS : {mesh.projection}")<br>print(f"Mesh extent : {mesh.extent}")<br>print(f"DatasetGroup Count : {mesh.group_count}")<br>print("")<br><br>vertex = mesh.vertices<br>print(f"Vertex Array Shape : {vertex.shape}")<br><br>faces = mesh.faces<br>print(f"Face Array Shape : {faces.shape}")<br><br>edges = mesh.edges<br>print(f"Edges Array Shape : {edges.shape}")<br><br>print("")<br><br>group = mesh.group(0)<br>print(f"DatasetGroup Name : {<a href="http://group.name">group.name</a>}")<br>print(f"DatasetGroup Location : {group.location}")<br>print(f"Dataset Count : {group.dataset_count}")<br>print(f"Group has scalar values : {group.has_scalar}")<br>print(f"Group has temporal values : {group.is_temporal}")<br>print(f"Reference Time : {group.reference_time}")<br>print(f"Maximum Vertical Level Count : {group.level_count}")<br>print(f"Minimum / Maximum ; {group.minmax}")<br>print(f"Metadata : {group.metadata}")<br><br>print("")<br>for i in range(0, group.dataset_count):<br>    data = group.data_as_double(i)<br>    time = group.dataset_time(i)<br>    print(f"Dataset Shape for time {time} : {data.shape}")<br><br>print("")<br><br>meshio = mesh.meshio()<br>print(meshio)<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 31 May 2021 at 10:10, Paul Harwood <<a href="mailto:runette@gmail.com" target="_blank">runette@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">good feedback ...<div><br></div><div>I may have been spending too much of my time in the C# universe recently :(</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 31 May 2021 at 09:41, Martin Dobias <<a href="mailto:wonder.sk@gmail.com" target="_blank">wonder.sk@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi Paul</div><div><br></div><div>Looking great!</div><div><br></div><div>I understand this is still work in progress, may I just suggest to make the API look more pythonic, by using snake case (face_count) instead of camel case (faceCount)... Maybe also avoid using "get" prefix in getters?</div><div><br></div><div>Regards</div><div>Martin</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, May 29, 2021 at 2:46 PM Paul Harwood <<a href="mailto:runette@gmail.com" target="_blank">runette@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><span>As promised - I have been working on some Python Bindings. I now have a 0.9.0b1 type release :</span><br><br><span>See </span><a href="https://github.com/ViRGIS-Team/mdal-python" target="_blank">https://github.com/ViRGIS-Team/mdal-python</a><br><br><div>There is a conda install for this in the process of being created.<br><br>There is some documentation in the process of being created.<br></div><div><br></div><div>Currently, this integration can:<br><br>- read all MDAL compatible file formats,<br>- access the metadata for the source,<br>- access the vertex, face and edge data as NumPy arrays,<br>- access 'double' datasets (both scalar and vector) as NumPy arrays, and<br>- convert the MDAL source mesh into a meshio mesh object (with some restrictions currently).</div><div>- This version does not currently allow the MDAL source mesh to be written or amended.<br></div><div><br></div><div>Note this very much beta and has not been comprehensively tested. The following script has been run successfully on a number of different test files and shows the usage.</div><div><br></div><div>All comments and improvements welcome.</div><div><br></div><div>"""</div><div><pre style="white-space:pre-wrap;box-sizing:border-box;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:13.6px;margin-top:0px;margin-bottom:0px;padding:16px;overflow:auto;line-height:1.45;border-radius:6px;word-break:normal;color:rgb(36,41,46)"><span style="box-sizing:border-box">import</span> <span style="box-sizing:border-box">mdal</span>
<span style="box-sizing:border-box">from</span> <span style="box-sizing:border-box">mdal</span> <span style="box-sizing:border-box">import</span> <span style="box-sizing:border-box">Datasource</span>

<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">f"MDAL Version:  <span style="box-sizing:border-box"><span style="box-sizing:border-box">{</span><span style="box-sizing:border-box">mdal</span>.<span style="box-sizing:border-box">getVersionString</span>()<span style="box-sizing:border-box">}</span></span>"</span>)
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">f"MDAL Driver Count :<span style="box-sizing:border-box"><span style="box-sizing:border-box">{</span><span style="box-sizing:border-box">mdal</span>.<span style="box-sizing:border-box">getDriverCount</span>()<span style="box-sizing:border-box">}</span></span>"</span>)
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">mdal</span>.<span style="box-sizing:border-box">getLastStatus</span>())

<span style="box-sizing:border-box">for</span> <span style="box-sizing:border-box">driver</span> <span style="box-sizing:border-box">in</span> <span style="box-sizing:border-box">mdal</span>.<span style="box-sizing:border-box">getDrivers</span>():
    <span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">driver</span>.<span style="box-sizing:border-box">long_name</span>)


<span style="box-sizing:border-box">ds</span> <span style="box-sizing:border-box">=</span> <span style="box-sizing:border-box">Datasource</span>(<span style="box-sizing:border-box">"data/ply/test_mesh.ply"</span>)
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">ds</span>.<span style="box-sizing:border-box">meshes</span>)

<span style="box-sizing:border-box">mesh</span> <span style="box-sizing:border-box">=</span> <span style="box-sizing:border-box">ds</span>.<span style="box-sizing:border-box">load</span>(<span style="box-sizing:border-box">0</span>)
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">f"Driver : <span style="box-sizing:border-box"><span style="box-sizing:border-box">{</span><span style="box-sizing:border-box">mesh</span>.<span style="box-sizing:border-box">driverName</span><span style="box-sizing:border-box">}</span></span>"</span>)
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">f"Vertex Count : <span style="box-sizing:border-box"><span style="box-sizing:border-box">{</span><span style="box-sizing:border-box">mesh</span>.<span style="box-sizing:border-box">vertexCount</span><span style="box-sizing:border-box">}</span></span>"</span>)
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">f"Face Count : <span style="box-sizing:border-box"><span style="box-sizing:border-box">{</span><span style="box-sizing:border-box">mesh</span>.<span style="box-sizing:border-box">faceCount</span><span style="box-sizing:border-box">}</span></span>"</span>)
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">f"Largest Face: <span style="box-sizing:border-box"><span style="box-sizing:border-box">{</span><span style="box-sizing:border-box">mesh</span>.<span style="box-sizing:border-box">largestFace</span><span style="box-sizing:border-box">}</span></span>"</span>)
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">f"Edge Count : <span style="box-sizing:border-box"><span style="box-sizing:border-box">{</span><span style="box-sizing:border-box">mesh</span>.<span style="box-sizing:border-box">edgeCount</span><span style="box-sizing:border-box">}</span></span>"</span>)
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">f"CRS : <span style="box-sizing:border-box"><span style="box-sizing:border-box">{</span><span style="box-sizing:border-box">mesh</span>.<span style="box-sizing:border-box">projection</span><span style="box-sizing:border-box">}</span></span>"</span>)
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">f"Mesh extent : <span style="box-sizing:border-box"><span style="box-sizing:border-box">{</span><span style="box-sizing:border-box">mesh</span>.<span style="box-sizing:border-box">extent</span><span style="box-sizing:border-box">}</span></span>"</span>)
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">f"DatasetGroup Count : <span style="box-sizing:border-box"><span style="box-sizing:border-box">{</span><span style="box-sizing:border-box">mesh</span>.<span style="box-sizing:border-box">groupCount</span><span style="box-sizing:border-box">}</span></span>"</span>)
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">""</span>)

<span style="box-sizing:border-box">mesh</span> <span style="box-sizing:border-box">=</span> <span style="box-sizing:border-box">ds</span>.<span style="box-sizing:border-box">load</span>(<span style="box-sizing:border-box">ds</span>.<span style="box-sizing:border-box">meshes</span>[<span style="box-sizing:border-box">0</span>])
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">f"Driver : <span style="box-sizing:border-box"><span style="box-sizing:border-box">{</span><span style="box-sizing:border-box">mesh</span>.<span style="box-sizing:border-box">driverName</span><span style="box-sizing:border-box">}</span></span>"</span>)
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">f"Vertex Count : <span style="box-sizing:border-box"><span style="box-sizing:border-box">{</span><span style="box-sizing:border-box">mesh</span>.<span style="box-sizing:border-box">vertexCount</span><span style="box-sizing:border-box">}</span></span>"</span>)
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">f"Face Count : <span style="box-sizing:border-box"><span style="box-sizing:border-box">{</span><span style="box-sizing:border-box">mesh</span>.<span style="box-sizing:border-box">faceCount</span><span style="box-sizing:border-box">}</span></span>"</span>)
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">f"Largest Face: <span style="box-sizing:border-box"><span style="box-sizing:border-box">{</span><span style="box-sizing:border-box">mesh</span>.<span style="box-sizing:border-box">largestFace</span><span style="box-sizing:border-box">}</span></span>"</span>)
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">f"Edge Count : <span style="box-sizing:border-box"><span style="box-sizing:border-box">{</span><span style="box-sizing:border-box">mesh</span>.<span style="box-sizing:border-box">edgeCount</span><span style="box-sizing:border-box">}</span></span>"</span>)
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">f"CRS : <span style="box-sizing:border-box"><span style="box-sizing:border-box">{</span><span style="box-sizing:border-box">mesh</span>.<span style="box-sizing:border-box">projection</span><span style="box-sizing:border-box">}</span></span>"</span>)
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">f"Mesh extent : <span style="box-sizing:border-box"><span style="box-sizing:border-box">{</span><span style="box-sizing:border-box">mesh</span>.<span style="box-sizing:border-box">extent</span><span style="box-sizing:border-box">}</span></span>"</span>)

<span style="box-sizing:border-box">vertex</span> <span style="box-sizing:border-box">=</span> <span style="box-sizing:border-box">mesh</span>.<span style="box-sizing:border-box">getVertices</span>()
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">f"Vertex Array Shape : <span style="box-sizing:border-box"><span style="box-sizing:border-box">{</span><span style="box-sizing:border-box">vertex</span>.<span style="box-sizing:border-box">shape</span><span style="box-sizing:border-box">}</span></span>"</span>)

<span style="box-sizing:border-box">faces</span> <span style="box-sizing:border-box">=</span> <span style="box-sizing:border-box">mesh</span>.<span style="box-sizing:border-box">getFaces</span>()
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">f"Face Array Shape : <span style="box-sizing:border-box"><span style="box-sizing:border-box">{</span><span style="box-sizing:border-box">faces</span>.<span style="box-sizing:border-box">shape</span><span style="box-sizing:border-box">}</span></span>"</span>)

<span style="box-sizing:border-box">edges</span> <span style="box-sizing:border-box">=</span> <span style="box-sizing:border-box">mesh</span>.<span style="box-sizing:border-box">getEdges</span>()
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">f"Edges Array Shape : <span style="box-sizing:border-box"><span style="box-sizing:border-box">{</span><span style="box-sizing:border-box">edges</span>.<span style="box-sizing:border-box">shape</span><span style="box-sizing:border-box">}</span></span>"</span>)

<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">""</span>)

<span style="box-sizing:border-box">group</span> <span style="box-sizing:border-box">=</span> <span style="box-sizing:border-box">mesh</span>.<span style="box-sizing:border-box">getGroup</span>(<span style="box-sizing:border-box">0</span>)
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">f"DatasetGroup Name : <span style="box-sizing:border-box"><span style="box-sizing:border-box">{</span><span style="box-sizing:border-box">group</span>.<span style="box-sizing:border-box">name</span><span style="box-sizing:border-box">}</span></span>"</span>)
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">f"DatasetGroup Location : <span style="box-sizing:border-box"><span style="box-sizing:border-box">{</span><span style="box-sizing:border-box">group</span>.<span style="box-sizing:border-box">location</span><span style="box-sizing:border-box">}</span></span>"</span>)
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">f"Dataset Count : <span style="box-sizing:border-box"><span style="box-sizing:border-box">{</span><span style="box-sizing:border-box">group</span>.<span style="box-sizing:border-box">datasetCount</span><span style="box-sizing:border-box">}</span></span>"</span>)
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">f"Group has scalar values : <span style="box-sizing:border-box"><span style="box-sizing:border-box">{</span><span style="box-sizing:border-box">group</span>.<span style="box-sizing:border-box">hasScalar</span><span style="box-sizing:border-box">}</span></span>"</span>)
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">f"Group has temporal values : <span style="box-sizing:border-box"><span style="box-sizing:border-box">{</span><span style="box-sizing:border-box">group</span>.<span style="box-sizing:border-box">isTemporal</span><span style="box-sizing:border-box">}</span></span>"</span>)
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">f"Reference Time : <span style="box-sizing:border-box"><span style="box-sizing:border-box">{</span><span style="box-sizing:border-box">group</span>.<span style="box-sizing:border-box">referenceTime</span><span style="box-sizing:border-box">}</span></span>"</span>)
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">f"Maximum Vertical Level Count : <span style="box-sizing:border-box"><span style="box-sizing:border-box">{</span><span style="box-sizing:border-box">group</span>.<span style="box-sizing:border-box">levelCount</span><span style="box-sizing:border-box">}</span></span>"</span>)
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">f"Minimum / Maximum ; <span style="box-sizing:border-box"><span style="box-sizing:border-box">{</span><span style="box-sizing:border-box">group</span>.<span style="box-sizing:border-box">minmax</span><span style="box-sizing:border-box">}</span></span>"</span>)
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">f"Metadata : <span style="box-sizing:border-box"><span style="box-sizing:border-box">{</span><span style="box-sizing:border-box">group</span>.<span style="box-sizing:border-box">getMetadata</span>()<span style="box-sizing:border-box">}</span></span>"</span>)

<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">""</span>)

<span style="box-sizing:border-box">data</span> <span style="box-sizing:border-box">=</span> <span style="box-sizing:border-box">group</span>.<span style="box-sizing:border-box">getDataAsDouble</span>(<span style="box-sizing:border-box">0</span>)
<span style="box-sizing:border-box">print</span>(<span style="box-sizing:border-box">f"Dataset Shape : <span style="box-sizing:border-box"><span style="box-sizing:border-box">{</span><span style="box-sizing:border-box">data</span>.<span style="box-sizing:border-box">shape</span><span style="box-sizing:border-box">}</span></span>"</span>)</pre></div><div>"""</div><div>(see next email to see results from this code)</div></div>
_______________________________________________<br>
MDAL-Developer mailing list<br>
<a href="mailto:MDAL-Developer@lists.osgeo.org" target="_blank">MDAL-Developer@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/mdal-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/mdal-developer</a><br>
</blockquote></div>
</blockquote></div>
</blockquote></div>