A Python package for unstructured raster processing and remapping
Project description
uraster: Structured Raster to Unstructured Mesh
Overview
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 dateaset) 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.
💻 Installation
uraster requires GDAL for vector handling and GeoVista (which relies on PyVista/VTK) for 3D visualization.
⚠️ GDAL Note: Installing GDAL's Python bindings can be complex via pip due to platform dependencies. We strongly recommend using Conda for a stable installation of GDAL and all dependencies.
Install via Conda (Recommended)
# Create a new conda environment (recommended)
conda create -n uraster-env python=3.9
conda activate uraster-env
# Install uraster and all dependencies via conda
conda install -c conda-forge uraster
Development Installation
git clone https://github.com/changliao1025/uraster.git
cd uraster
conda install -c conda-forge gdal geovista vtk=9.3.0 pyearth
conda develop .
🚀 Quick Start
Example 1: Basic Zonal Statistics
This example demonstrates how to perform zonal statistics on unstructured mesh data:
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=True)
# Print input information
processor.report_inputs()
# Run zonal statistics
processor.run_remap(iFlag_verbose=True)
# Visualize results
processor.visualize_target_mesh(
sVariable_in='mean',
sFilename_out='output_visualization.png',
sColormap='viridis'
)
Example 2: Global Analysis with Animation
import uraster
from uraster.classes.uraster import uraster
# Configuration for global analysis
config = {
'sFilename_source_mesh': 'global_mesh.geojson',
'aFilename_source_raster': ['global_dem.tif'],
'sFilename_target_mesh': 'global_mesh_with_elevation.geojson'
}
processor = uraster(config)
processor.setup(iFlag_verbose=True)
processor.run_remap()
# Create rotating animation
processor.visualize_target_mesh(
sVariable_in='mean',
sFilename_out='global_elevation.mp4',
sColormap='terrain',
iFlag_create_animation=True,
iAnimation_frames=360,
sAnimation_format='mp4'
)
📊 Supported Formats
- Mesh formats: GeoJSON, Shapefile, any OGR-supported vector format
- Raster formats: GeoTIFF, NetCDF, HDF5, any GDAL-supported raster format
- Output formats: GeoJSON (with computed statistics), PNG/JPG (visualizations), MP4/GIF (animations)
🤝 Contributing & License
We welcome contributions! Please open an issue or submit a pull request on the GitHub repository.
uraster is distributed under the BSD 3-Clause License.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file uraster-0.1.0.tar.gz.
File metadata
- Download URL: uraster-0.1.0.tar.gz
- Upload date:
- Size: 52.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb14d39eb3bf5a874697d849f8a9e4f7a6b1b00d061748c621168fee93c02edf
|
|
| MD5 |
7d1cff1aec18156c418dd32b0a894577
|
|
| BLAKE2b-256 |
b39c7ac229355fb1438430fda08d995f7f93bd6da0d79481de47f61daa8495ff
|
File details
Details for the file uraster-0.1.0-py3-none-any.whl.
File metadata
- Download URL: uraster-0.1.0-py3-none-any.whl
- Upload date:
- Size: 50.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ccd85a49c321c5be13fe8d339ab2f7ac8620c5d06b67620e9501132d9386a833
|
|
| MD5 |
e9a908eee6e73f69a96bf1e74174c8eb
|
|
| BLAKE2b-256 |
ae4256d3fdf358b891f9bccd858d9bb94ab9052cbc77cbe6190428eac8103aba
|