From runette at gmail.com Mon May 10 06:15:23 2021 From: runette at gmail.com (Paul Harwood) Date: Mon, 10 May 2021 14:15:23 +0100 Subject: [MDAL-Developer] MDAL, Unity and C# Message-ID: I will just put this here in case anyone is interested and also for future reference and future google searches. As well as the MDAL Conda package and built on top of it, there is also an MDAL Unity Package Manager (UPM) package to allow MDAL to be used in Unity projects (i.e. 3D, AR and VR etc). see https://openupm.com/packages/com.virgis.mdal/ As part of this - there are some scripts for accessing MDAL in C# (Unity uses C#) - see https://github.com/ViRGIS-Team/mdal-upm/blob/main/Runtime/Scripts/Mdal.cs This is not a generic C# interface and is not supported as such. However, it does provide examples of MDAL can be used in C#. Please send any feedback / suggestions to the GH Issues : https://github.com/ViRGIS-Team/mdal-upm/issues Has anyone done anything similar for accessing MDAL form Python - my next challenge? -------------- next part -------------- An HTML attachment was scrubbed... URL: From runette at gmail.com Mon May 10 06:20:32 2021 From: runette at gmail.com (Paul Harwood) Date: Mon, 10 May 2021 14:20:32 +0100 Subject: [MDAL-Developer] MDAL, Unity and C# In-Reply-To: References: Message-ID: Sorry - I also meant to say that the C# interface is documented here https://virgis-team.github.io/mdal-upm/html/index.html On Mon, 10 May 2021 at 14:15, Paul Harwood wrote: > I will just put this here in case anyone is interested and also for future > reference and future google searches. > > As well as the MDAL Conda package and built on top of it, there is also > an MDAL Unity Package Manager (UPM) package to allow MDAL to be used in > Unity projects (i.e. 3D, AR and VR etc). see > https://openupm.com/packages/com.virgis.mdal/ > > As part of this - there are some scripts for accessing MDAL in C# (Unity > uses C#) - see > https://github.com/ViRGIS-Team/mdal-upm/blob/main/Runtime/Scripts/Mdal.cs > > This is not a generic C# interface and is not supported as such. However, > it does provide examples of MDAL can be used in C#. Please send any > feedback / suggestions to the GH Issues : > https://github.com/ViRGIS-Team/mdal-upm/issues > > Has anyone done anything similar for accessing MDAL form Python - my next > challenge? > -------------- next part -------------- An HTML attachment was scrubbed... URL: From peter.petrik at lutraconsulting.co.uk Mon May 10 06:24:38 2021 From: peter.petrik at lutraconsulting.co.uk (Peter Petrik) Date: Mon, 10 May 2021 15:24:38 +0200 Subject: [MDAL-Developer] MDAL, Unity and C# In-Reply-To: References: Message-ID: Hi Paul and thanks for the update. MDAL from python would definitely be a nice addition. So far we been accessing it directly from QGIS and mdalinfo command line tool. Do you plan to have separate repository or you want to keep it in the MDAL repository? Also which python wrapping system you would like to use? Peter On Mon, May 10, 2021 at 3:20 PM Paul Harwood wrote: > Sorry - I also meant to say that the C# interface is documented here > https://virgis-team.github.io/mdal-upm/html/index.html > > On Mon, 10 May 2021 at 14:15, Paul Harwood wrote: > >> I will just put this here in case anyone is interested and also for >> future reference and future google searches. >> >> As well as the MDAL Conda package and built on top of it, there is also >> an MDAL Unity Package Manager (UPM) package to allow MDAL to be used in >> Unity projects (i.e. 3D, AR and VR etc). see >> https://openupm.com/packages/com.virgis.mdal/ >> >> As part of this - there are some scripts for accessing MDAL in C# (Unity >> uses C#) - see >> https://github.com/ViRGIS-Team/mdal-upm/blob/main/Runtime/Scripts/Mdal.cs >> >> This is not a generic C# interface and is not supported as such. However, >> it does provide examples of MDAL can be used in C#. Please send any >> feedback / suggestions to the GH Issues : >> https://github.com/ViRGIS-Team/mdal-upm/issues >> >> Has anyone done anything similar for accessing MDAL form Python - my next >> challenge? >> > _______________________________________________ > 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: From runette at gmail.com Mon May 10 06:37:20 2021 From: runette at gmail.com (Paul Harwood) Date: Mon, 10 May 2021 14:37:20 +0100 Subject: [MDAL-Developer] MDAL, Unity and C# In-Reply-To: References: Message-ID: Well - I was hoping that someone else would have at least some basics as a starting point :( I have a Python program that needs to access basic data. I will give it some thought before I answer your questions - but do you have any preferences? As for the repo - I think that the PDAL and GDAL discussions I have seen would suggest that a "Python bindings" repository would be a much better idea than including it in the main MDAL repo - avoids the need to create new versions of MDAL just because of changes to the bindings. P On Mon, 10 May 2021 at 14:24, Peter Petrik < peter.petrik at lutraconsulting.co.uk> wrote: > Hi Paul and thanks for the update. > > MDAL from python would definitely be a nice addition. So far we been > accessing it directly from QGIS and mdalinfo command line tool. Do you plan > to have separate repository or you want to keep it in the MDAL repository? > Also which python wrapping system you would like to use? > > Peter > > On Mon, May 10, 2021 at 3:20 PM Paul Harwood wrote: > >> Sorry - I also meant to say that the C# interface is documented here >> https://virgis-team.github.io/mdal-upm/html/index.html >> >> On Mon, 10 May 2021 at 14:15, Paul Harwood wrote: >> >>> I will just put this here in case anyone is interested and also for >>> future reference and future google searches. >>> >>> As well as the MDAL Conda package and built on top of it, there is also >>> an MDAL Unity Package Manager (UPM) package to allow MDAL to be used in >>> Unity projects (i.e. 3D, AR and VR etc). see >>> https://openupm.com/packages/com.virgis.mdal/ >>> >>> As part of this - there are some scripts for accessing MDAL in C# (Unity >>> uses C#) - see >>> https://github.com/ViRGIS-Team/mdal-upm/blob/main/Runtime/Scripts/Mdal.cs >>> >>> This is not a generic C# interface and is not supported as such. >>> However, it does provide examples of MDAL can be used in C#. Please send >>> any feedback / suggestions to the GH Issues : >>> https://github.com/ViRGIS-Team/mdal-upm/issues >>> >>> Has anyone done anything similar for accessing MDAL form Python - my >>> next challenge? >>> >> _______________________________________________ >> 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: From runette at gmail.com Mon May 10 07:38:46 2021 From: runette at gmail.com (Paul Harwood) Date: Mon, 10 May 2021 15:38:46 +0100 Subject: [MDAL-Developer] MDAL, Unity and C# In-Reply-To: References: Message-ID: I am tempted to say that it should be based on the same technology stack as PDAL Python : i.e. Cython importing the data in Numpy ndarray with a built in option of importing the mesh as meshio (https://github.com/nschloe/meshio) - mostly because I have already worked out a lot of the quirks in the PDAL interface - see https://github.com/PDAL/python/pull/82/files On Mon, 10 May 2021 at 14:37, Paul Harwood wrote: > Well - I was hoping that someone else would have at least some basics as a > starting point :( > > I have a Python program that needs to access basic data. I will give it > some thought before I answer your questions - but do you have any > preferences? > > As for the repo - I think that the PDAL and GDAL discussions I have seen > would suggest that a "Python bindings" repository would be a much better > idea than including it in the main MDAL repo - avoids the need to create > new versions of MDAL just because of changes to the bindings. > > P > > On Mon, 10 May 2021 at 14:24, Peter Petrik < > peter.petrik at lutraconsulting.co.uk> wrote: > >> Hi Paul and thanks for the update. >> >> MDAL from python would definitely be a nice addition. So far we been >> accessing it directly from QGIS and mdalinfo command line tool. Do you plan >> to have separate repository or you want to keep it in the MDAL repository? >> Also which python wrapping system you would like to use? >> >> Peter >> >> On Mon, May 10, 2021 at 3:20 PM Paul Harwood wrote: >> >>> Sorry - I also meant to say that the C# interface is documented here >>> https://virgis-team.github.io/mdal-upm/html/index.html >>> >>> On Mon, 10 May 2021 at 14:15, Paul Harwood wrote: >>> >>>> I will just put this here in case anyone is interested and also for >>>> future reference and future google searches. >>>> >>>> As well as the MDAL Conda package and built on top of it, there is also >>>> an MDAL Unity Package Manager (UPM) package to allow MDAL to be used in >>>> Unity projects (i.e. 3D, AR and VR etc). see >>>> https://openupm.com/packages/com.virgis.mdal/ >>>> >>>> As part of this - there are some scripts for accessing MDAL in C# >>>> (Unity uses C#) - see >>>> https://github.com/ViRGIS-Team/mdal-upm/blob/main/Runtime/Scripts/Mdal.cs >>>> >>>> This is not a generic C# interface and is not supported as such. >>>> However, it does provide examples of MDAL can be used in C#. Please send >>>> any feedback / suggestions to the GH Issues : >>>> https://github.com/ViRGIS-Team/mdal-upm/issues >>>> >>>> Has anyone done anything similar for accessing MDAL form Python - my >>>> next challenge? >>>> >>> _______________________________________________ >>> 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: From peter.petrik at lutraconsulting.co.uk Tue May 11 00:05:48 2021 From: peter.petrik at lutraconsulting.co.uk (Peter Petrik) Date: Tue, 11 May 2021 09:05:48 +0200 Subject: [MDAL-Developer] MDAL, Unity and C# In-Reply-To: References: Message-ID: sounds good to me P. On Mon, May 10, 2021 at 4:38 PM Paul Harwood wrote: > I am tempted to say that it should be based on the same technology stack > as PDAL Python : > > i.e. Cython importing the data in Numpy ndarray with a built in option of > importing the mesh as meshio (https://github.com/nschloe/meshio) - mostly > because I have already worked out a lot of the quirks in the PDAL interface > - see https://github.com/PDAL/python/pull/82/files > > On Mon, 10 May 2021 at 14:37, Paul Harwood wrote: > >> Well - I was hoping that someone else would have at least some basics as >> a starting point :( >> >> I have a Python program that needs to access basic data. I will give it >> some thought before I answer your questions - but do you have any >> preferences? >> >> As for the repo - I think that the PDAL and GDAL discussions I have seen >> would suggest that a "Python bindings" repository would be a much better >> idea than including it in the main MDAL repo - avoids the need to create >> new versions of MDAL just because of changes to the bindings. >> >> P >> >> On Mon, 10 May 2021 at 14:24, Peter Petrik < >> peter.petrik at lutraconsulting.co.uk> wrote: >> >>> Hi Paul and thanks for the update. >>> >>> MDAL from python would definitely be a nice addition. So far we been >>> accessing it directly from QGIS and mdalinfo command line tool. Do you plan >>> to have separate repository or you want to keep it in the MDAL repository? >>> Also which python wrapping system you would like to use? >>> >>> Peter >>> >>> On Mon, May 10, 2021 at 3:20 PM Paul Harwood wrote: >>> >>>> Sorry - I also meant to say that the C# interface is documented here >>>> https://virgis-team.github.io/mdal-upm/html/index.html >>>> >>>> On Mon, 10 May 2021 at 14:15, Paul Harwood wrote: >>>> >>>>> I will just put this here in case anyone is interested and also for >>>>> future reference and future google searches. >>>>> >>>>> As well as the MDAL Conda package and built on top of it, there is >>>>> also an MDAL Unity Package Manager (UPM) package to allow MDAL to be used >>>>> in Unity projects (i.e. 3D, AR and VR etc). see >>>>> https://openupm.com/packages/com.virgis.mdal/ >>>>> >>>>> As part of this - there are some scripts for accessing MDAL in C# >>>>> (Unity uses C#) - see >>>>> https://github.com/ViRGIS-Team/mdal-upm/blob/main/Runtime/Scripts/Mdal.cs >>>>> >>>>> This is not a generic C# interface and is not supported as such. >>>>> However, it does provide examples of MDAL can be used in C#. Please send >>>>> any feedback / suggestions to the GH Issues : >>>>> https://github.com/ViRGIS-Team/mdal-upm/issues >>>>> >>>>> Has anyone done anything similar for accessing MDAL form Python - my >>>>> next challenge? >>>>> >>>> _______________________________________________ >>>> 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: From runette at gmail.com Sat May 29 05:46:21 2021 From: runette at gmail.com (Paul Harwood) Date: Sat, 29 May 2021 13:46:21 +0100 Subject: [MDAL-Developer] Python-Bindings Message-ID: 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) -------------- next part -------------- An HTML attachment was scrubbed... URL: From runette at gmail.com Sat May 29 05:50:32 2021 From: runette at gmail.com (Paul Harwood) Date: Sat, 29 May 2021 13:50:32 +0100 Subject: [MDAL-Developer] Python-Bindings In-Reply-To: References: Message-ID: the results from the previous code looks like """ MDAL Version: 0.8.0 MDAL Driver Count :16 0 2DM Mesh File XMS Tin Mesh File Selafin File Esri TIN Stanford PLY Ascii Mesh File Flo2D HEC-RAS 2D TUFLOW FV AnuGA UGRID Results GDAL NetCDF GDAL Grib DAT Binary DAT TUFLOW XMDF XDMF ['PLY:"data/ply/test_mesh.ply"'] Driver : PLY Vertex Count : 38487 Face Count : 76294 Largest Face: 3 Edge Count : 0 CRS : Mesh extent : (413630.0, 416783.0, 379766.0, 382410.0) DatasetGroup Count : 4 Driver : PLY Vertex Count : 38487 Face Count : 76294 Largest Face: 3 Edge Count : 0 CRS : Mesh extent : (413630.0, 416783.0, 379766.0, 382410.0) Vertex Array Shape : (38487,) Face Array Shape : (76294,) Edges Array Shape : (0,) DatasetGroup Name : Bed Elevation DatasetGroup Location : 1 Dataset Count : 1 Group has scalar values : True Group has temporal values : False Reference Time : Maximum Vertical Level Count : 0 Minimum / Maximum ; (178.64, 465.043) Metadata : {'Bed Elevation': b'Bed Elevation'} Dataset Shape : (38487,) """ On Sat, 29 May 2021 at 13:46, Paul Harwood 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) > -------------- next part -------------- An HTML attachment was scrubbed... URL: From runette at gmail.com Sat May 29 05:54:28 2021 From: runette at gmail.com (Paul Harwood) Date: Sat, 29 May 2021 13:54:28 +0100 Subject: [MDAL-Developer] Python-Bindings In-Reply-To: References: Message-ID: I have one generic question - since I am looking at the best way to generalise Datasets. One Dataset Group can have multiple Datasets. Is there any occasion other than temporal data when this happens? If there is, what is the way to identify the meaning of the datasets. With temporal data, the different datasets can be identified using the MDAL_D_time function, but are there other equivalents? On Sat, 29 May 2021 at 13:50, Paul Harwood wrote: > the results from the previous code looks like > > """ > > MDAL Version: 0.8.0 > > MDAL Driver Count :16 > > 0 > > 2DM Mesh File > > XMS Tin Mesh File > > Selafin File > > Esri TIN > > Stanford PLY Ascii Mesh File > > Flo2D > > HEC-RAS 2D > > TUFLOW FV > > AnuGA > > UGRID Results > > GDAL NetCDF > > GDAL Grib > > DAT > > Binary DAT > > TUFLOW XMDF > > XDMF > > ['PLY:"data/ply/test_mesh.ply"'] > > Driver : PLY > > Vertex Count : 38487 > > Face Count : 76294 > > Largest Face: 3 > > Edge Count : 0 > > CRS : > > Mesh extent : (413630.0, 416783.0, 379766.0, 382410.0) > > DatasetGroup Count : 4 > > > Driver : PLY > > Vertex Count : 38487 > > Face Count : 76294 > > Largest Face: 3 > > Edge Count : 0 > > CRS : > > Mesh extent : (413630.0, 416783.0, 379766.0, 382410.0) > > Vertex Array Shape : (38487,) > > Face Array Shape : (76294,) > > Edges Array Shape : (0,) > > > DatasetGroup Name : Bed Elevation > > DatasetGroup Location : 1 > > Dataset Count : 1 > > Group has scalar values : True > > Group has temporal values : False > > Reference Time : > > Maximum Vertical Level Count : 0 > > Minimum / Maximum ; (178.64, 465.043) > > Metadata : {'Bed Elevation': b'Bed Elevation'} > > > Dataset Shape : (38487,) > """ > > On Sat, 29 May 2021 at 13:46, Paul Harwood 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) >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From peter.petrik at lutraconsulting.co.uk Sun May 30 22:58:23 2021 From: peter.petrik at lutraconsulting.co.uk (Peter Petrik) Date: Mon, 31 May 2021 07:58:23 +0200 Subject: [MDAL-Developer] Python-Bindings In-Reply-To: References: Message-ID: Hi Paul, great progress! Dataset is indeed only identified by time (MDAL_D_time) function and is used on temporal data. Feel free to create PR on MDAL to add your repository/package to the README and also to the mdal.xyz docs. Peter On Sat, May 29, 2021 at 2:54 PM Paul Harwood wrote: > I have one generic question - since I am looking at the best way to > generalise Datasets. > > One Dataset Group can have multiple Datasets. Is there any occasion other > than temporal data when this happens? > > If there is, what is the way to identify the meaning of the datasets. With > temporal data, the different datasets can be identified using the > MDAL_D_time function, but are there other equivalents? > > On Sat, 29 May 2021 at 13:50, Paul Harwood wrote: > >> the results from the previous code looks like >> >> """ >> >> MDAL Version: 0.8.0 >> >> MDAL Driver Count :16 >> >> 0 >> >> 2DM Mesh File >> >> XMS Tin Mesh File >> >> Selafin File >> >> Esri TIN >> >> Stanford PLY Ascii Mesh File >> >> Flo2D >> >> HEC-RAS 2D >> >> TUFLOW FV >> >> AnuGA >> >> UGRID Results >> >> GDAL NetCDF >> >> GDAL Grib >> >> DAT >> >> Binary DAT >> >> TUFLOW XMDF >> >> XDMF >> >> ['PLY:"data/ply/test_mesh.ply"'] >> >> Driver : PLY >> >> Vertex Count : 38487 >> >> Face Count : 76294 >> >> Largest Face: 3 >> >> Edge Count : 0 >> >> CRS : >> >> Mesh extent : (413630.0, 416783.0, 379766.0, 382410.0) >> >> DatasetGroup Count : 4 >> >> >> Driver : PLY >> >> Vertex Count : 38487 >> >> Face Count : 76294 >> >> Largest Face: 3 >> >> Edge Count : 0 >> >> CRS : >> >> Mesh extent : (413630.0, 416783.0, 379766.0, 382410.0) >> >> Vertex Array Shape : (38487,) >> >> Face Array Shape : (76294,) >> >> Edges Array Shape : (0,) >> >> >> DatasetGroup Name : Bed Elevation >> >> DatasetGroup Location : 1 >> >> Dataset Count : 1 >> >> Group has scalar values : True >> >> Group has temporal values : False >> >> Reference Time : >> >> Maximum Vertical Level Count : 0 >> >> Minimum / Maximum ; (178.64, 465.043) >> >> Metadata : {'Bed Elevation': b'Bed Elevation'} >> >> >> Dataset Shape : (38487,) >> """ >> >> On Sat, 29 May 2021 at 13:46, Paul Harwood 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: From wonder.sk at gmail.com Mon May 31 01:41:45 2021 From: wonder.sk at gmail.com (Martin Dobias) Date: Mon, 31 May 2021 10:41:45 +0200 Subject: [MDAL-Developer] Python-Bindings In-Reply-To: References: Message-ID: 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 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: From runette at gmail.com Mon May 31 02:10:16 2021 From: runette at gmail.com (Paul Harwood) Date: Mon, 31 May 2021 10:10:16 +0100 Subject: [MDAL-Developer] Python-Bindings In-Reply-To: References: Message-ID: 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 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 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: From runette at gmail.com Mon May 31 02:59:19 2021 From: runette at gmail.com (Paul Harwood) Date: Mon, 31 May 2021 10:59:19 +0100 Subject: [MDAL-Developer] Python-Bindings In-Reply-To: References: Message-ID: 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. from mdal import Datasource, Info, last_status print(f"MDAL Version: {Info.version}") print(f"MDAL Driver Count :{Info.driver_count}") print(last_status()) for driver in Info.drivers: print(driver) ds = Datasource("data/ply/test_mesh.ply") print(ds.meshes) mesh = ds.load(0) print(f"Driver : {mesh.driver_name}") print(f"Vertex Count : {mesh.vertex_count}") print(f"Face Count : {mesh.face_count}") print(f"Largest Face: {mesh.largest_face}") print(f"Edge Count : {mesh.edge_count}") print(f"CRS : {mesh.projection}") print(f"Mesh extent : {mesh.extent}") print(f"DatasetGroup Count : {mesh.group_count}") print("") vertex = mesh.vertices print(f"Vertex Array Shape : {vertex.shape}") faces = mesh.faces print(f"Face Array Shape : {faces.shape}") edges = mesh.edges print(f"Edges Array Shape : {edges.shape}") print("") group = mesh.group(0) print(f"DatasetGroup Name : {group.name}") print(f"DatasetGroup Location : {group.location}") print(f"Dataset Count : {group.dataset_count}") print(f"Group has scalar values : {group.has_scalar}") print(f"Group has temporal values : {group.is_temporal}") print(f"Reference Time : {group.reference_time}") print(f"Maximum Vertical Level Count : {group.level_count}") print(f"Minimum / Maximum ; {group.minmax}") print(f"Metadata : {group.metadata}") print("") for i in range(0, group.dataset_count): data = group.data_as_double(i) time = group.dataset_time(i) print(f"Dataset Shape for time {time} : {data.shape}") print("") meshio = mesh.meshio() print(meshio) On Mon, 31 May 2021 at 10:10, Paul Harwood wrote: > 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 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 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: