<div dir="ltr"><span style="">As promised - I have been working on some Python Bindings. I now have a 0.9.0b1 type release :</span><br style="overflow-wrap: break-word;"><br style="overflow-wrap: break-word;"><span style="">See </span><a href="https://github.com/ViRGIS-Team/mdal-python" target="_blank" style="overflow-wrap: break-word;">https://github.com/ViRGIS-Team/mdal-python</a><br style="overflow-wrap: break-word;"><br style="overflow-wrap: break-word;"><div style="overflow-wrap: break-word;">There is a conda install for this in the process of being created.<br style="overflow-wrap: break-word;"><br style="overflow-wrap: break-word;">There is some documentation in the process of being created.<br style="overflow-wrap: break-word;"></div><div style="overflow-wrap: break-word;"><br style="overflow-wrap: break-word;"></div><div style="overflow-wrap: break-word;">Currently, this integration can:<br style="overflow-wrap: break-word;"><br style="overflow-wrap: break-word;">- read all MDAL compatible file formats,<br style="overflow-wrap: break-word;">- access the metadata for the source,<br style="overflow-wrap: break-word;">- access the vertex, face and edge data as NumPy arrays,<br style="overflow-wrap: break-word;">- access 'double' datasets (both scalar and vector) as NumPy arrays, and<br style="overflow-wrap: break-word;">- convert the MDAL source mesh into a meshio mesh object (with some restrictions currently).</div><div style="overflow-wrap: break-word;">- This version does not currently allow the MDAL source mesh to be written or amended.<br style="overflow-wrap: break-word;"></div><div style="overflow-wrap: break-word;"><br style="overflow-wrap: break-word;"></div><div style="overflow-wrap: break-word;">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 style="overflow-wrap: break-word;"><br style="overflow-wrap: break-word;"></div><div style="overflow-wrap: break-word;">All comments and improvements welcome.</div><div style="overflow-wrap: break-word;"><br style="overflow-wrap: break-word;"></div><div style="overflow-wrap: break-word;">"""</div><div style="overflow-wrap: break-word;"><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 style="overflow-wrap: break-word;">"""</div><div style="overflow-wrap: break-word;">(see next email to see results from this code)</div></div>