[MDAL-Developer] Python-Bindings

Paul Harwood runette at gmail.com
Mon May 31 02:10:16 PDT 2021


good feedback ...

I may have been spending too much of my time in the C# universe recently :(

On Mon, 31 May 2021 at 09:41, Martin Dobias <wonder.sk at gmail.com> wrote:

> Hi Paul
>
> Looking great!
>
> 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?
>
> Regards
> Martin
>
>
> On Sat, May 29, 2021 at 2:46 PM Paul Harwood <runette at gmail.com> wrote:
>
>> As promised - I have been working on some Python Bindings. I now have a
>> 0.9.0b1 type release :
>>
>> See https://github.com/ViRGIS-Team/mdal-python
>>
>> There is a conda install for this in the process of being created.
>>
>> There is some documentation in the process of being created.
>>
>> Currently, this integration can:
>>
>> - read all MDAL compatible file formats,
>> - access the metadata for the source,
>> - access the vertex, face and edge data as NumPy arrays,
>> - access 'double' datasets (both scalar and vector) as NumPy arrays, and
>> - convert the MDAL source mesh into a meshio mesh object (with some
>> restrictions currently).
>> - This version does not currently allow the MDAL source mesh to be
>> written or amended.
>>
>> 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.
>>
>> All comments and improvements welcome.
>>
>> """
>>
>> import mdalfrom mdal import Datasource
>> print(f"MDAL Version:  {mdal.getVersionString()}")print(f"MDAL Driver Count :{mdal.getDriverCount()}")print(mdal.getLastStatus())
>> for driver in mdal.getDrivers():
>>     print(driver.long_name)
>>
>> ds = Datasource("data/ply/test_mesh.ply")print(ds.meshes)
>> mesh = ds.load(0)print(f"Driver : {mesh.driverName}")print(f"Vertex Count : {mesh.vertexCount}")print(f"Face Count : {mesh.faceCount}")print(f"Largest Face: {mesh.largestFace}")print(f"Edge Count : {mesh.edgeCount}")print(f"CRS : {mesh.projection}")print(f"Mesh extent : {mesh.extent}")print(f"DatasetGroup Count : {mesh.groupCount}")print("")
>> mesh = ds.load(ds.meshes[0])print(f"Driver : {mesh.driverName}")print(f"Vertex Count : {mesh.vertexCount}")print(f"Face Count : {mesh.faceCount}")print(f"Largest Face: {mesh.largestFace}")print(f"Edge Count : {mesh.edgeCount}")print(f"CRS : {mesh.projection}")print(f"Mesh extent : {mesh.extent}")
>> vertex = mesh.getVertices()print(f"Vertex Array Shape : {vertex.shape}")
>> faces = mesh.getFaces()print(f"Face Array Shape : {faces.shape}")
>> edges = mesh.getEdges()print(f"Edges Array Shape : {edges.shape}")
>> print("")
>> group = mesh.getGroup(0)print(f"DatasetGroup Name : {group.name}")print(f"DatasetGroup Location : {group.location}")print(f"Dataset Count : {group.datasetCount}")print(f"Group has scalar values : {group.hasScalar}")print(f"Group has temporal values : {group.isTemporal}")print(f"Reference Time : {group.referenceTime}")print(f"Maximum Vertical Level Count : {group.levelCount}")print(f"Minimum / Maximum ; {group.minmax}")print(f"Metadata : {group.getMetadata()}")
>> print("")
>> data = group.getDataAsDouble(0)print(f"Dataset Shape : {data.shape}")
>>
>> """
>> (see next email to see results from this code)
>> _______________________________________________
>> MDAL-Developer mailing list
>> MDAL-Developer at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/mdal-developer
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mdal-developer/attachments/20210531/9c43c9e3/attachment-0001.html>


More information about the MDAL-Developer mailing list