uraster: Structured Raster to Unstructured Mesh

PyPI version Conda version CI Status Coverage Status

uraster is a Python package to convert or transfer structured raster dataset into unstructured mesh formats, designed to bridge the gap between structured raster data and unstructured mesh-based numerical models. It leverages GDAL/OGR for robust data handling.

Core Features

  • GDAL-Native Vector Handling: Uses the standard GDAL/OGR engine for defining unstructured mesh cells, and performing projection-aware geospatial operations.

  • Standard Vector I/O: Instead of directly operating on various mesh standards, it utilizes standard geographic information system vector formats (e.g., GeoJSON) for mesh operations, ensuring broad compatibility. It supports transformation APIs between existing meshes and standard vector formats.

  • Projection-Aware Operations: Handles (raster dataset) map projection differences to ensure accurate aggregation of raster values within each polygon.

  • Interactive GeoVista API: Offers simple functions to visualize the input and the output vector layers on a 3D sphere.

Quick Start

import uraster
from uraster.classes.uraster import uraster

# Configuration
config = {
    'sFilename_source_mesh': 'path/to/your/mesh.geojson',
    'aFilename_source_raster': ['path/to/your/raster.tif'],
    'sFilename_target_mesh': 'path/to/output/mesh_with_stats.geojson'
}

# Create uraster instance
processor = uraster(config)

# Setup and validate inputs
processor.setup(iFlag_verbose_in=True)

# Run zonal statistics
processor.run_remap(iFlag_verbose_in=True)

# Visualize results
processor.visualize_target_mesh(
    sVariable_in='mean',
    sFilename_out='output_visualization.png',
    sColormap='viridis'
)

Indices and tables