Metadata-Version: 2.1
Name: mdal
Version: 0.9.3
Summary: Mesh data processing
Home-page: https://mdal.xyz
Author: Paul Harwood
Author-email: runette@gmail.com
Maintainer: Paul Harwood
Maintainer-email: runette@gmail.com
License: MIT
Keywords: mesh data spatial
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Scientific/Engineering :: GIS
Requires: Python (>=3.0)
Requires: Numpy
Requires: meshio
Description-Content-Type: text/x-rst

================================================================================
MDAL Python Integration
================================================================================

.. image:: https://img.shields.io/conda/vn/conda-forge/mdal-python.svg
   :target: https://anaconda.org/conda-forge/mdal-python

Basics
------

MDAL Python integration allows you to access and manipulation geospatial mesh data sets using `MDAL`_ in Python.

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 ammended.

.. _MDAL: https://www.mdal.xyz/
.. _meshio: https://github.com/nschloe/meshio

Drivers
.......

['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']

Installation
------------

Conda
................................................................................

MDAL Python support is installable via Conda:

.. code-block::

    conda install mdal-python

GitHub
................................................................................

The repository for MDAL's Python extension is available at https://github.com/ViRGIS-Team/mdal-python

Usage
--------------------------------------------------------------------------------

The basic usage can be seen in this code snippet:

.. code-block:: python

    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)

    with ds.load(0) as mesh:
        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("finish first pass")
    print(f"Loading uri {ds.meshes[0]}")


    with ds.load(ds.meshes[0]) as mesh:
        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}")

        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)




Documentation
-------------

The documentation is currently WIP and can be found at https://virgis-team.github.io/mdal-python/html/index.html


Requirements
------------

* MDAL 0.8.0 +
* Python >=3.6
* Cython (eg :code:`pip install cython`)
* Numpy (eg :code:`pip install numpy`)
* Packaging (eg :code:`pip install packaging`)
* scikit-build (eg :code:`pip install scikit-build`)


Credit
------

This package borrowed heavily from the `PDAL-Python`_ package.

.. _PDAL-Python:  https://github.com/PDAL/python


Changes
--------------------------------------------------------------------------------

0.9.0

First release. This is beta software and has not been completely tested yet:

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 ammended.


