GPU-first raster processing for vibespatial
Project description
vibespatial-raster
GPU-first raster processing for vibeSpatial. Custom NVRTC kernels and CCCL primitives for every operation — algebra, focal, zonal stats, labeling, rasterize, polygonize — with CPU fallbacks via scipy and rasterio.
[!WARNING] vibeSpatial-Raster is very early in development. Operations may be unoptimized or have multiple Host/Device transfers causing reduced performance. File an issue if you hit a problem!
Operations
| Category | Operations | GPU Backend |
|---|---|---|
| IO | GeoTIFF, COG, JPEG2000 read/write | nvImageCodec (zero-copy decode to device) |
| Algebra | add, subtract, multiply, divide, apply, where, classify | CuPy element-wise |
| Focal | convolution, Gaussian filter, slope, aspect | NVRTC shared-memory stencil kernels |
| Zonal | count, sum, mean, min, max, std, median | CCCL segmented reduce |
| Rasterize | vector-to-raster (point-in-polygon) | NVRTC per-pixel PIP kernel |
| Label | connected components (4/8 connectivity) | NVRTC union-find |
| Morphology | erode, dilate, open, close, sieve | NVRTC tiled kernels |
| Polygonize | raster-to-vector (marching squares) | NVRTC classify + emit edges |
Install
pip install vibespatial-raster # core (CPU-only, scipy fallback)
pip install vibespatial-raster[io] # + rasterio for GeoTIFF/COG
pip install vibespatial-raster[cu12] # + CUDA 12, CuPy, nvImageCodec
pip install vibespatial-raster[cu13] # + CUDA 13, CuPy, nvImageCodec
For development:
uv sync --group dev
Usage
from vibespatial.raster import read_raster, raster_slope, zonal_stats
# Read a GeoTIFF (GPU-native decode when available, rasterio fallback)
raster = read_raster("elevation.tif")
# Terrain analysis — NVRTC stencil kernels on GPU
slope = raster_slope(raster)
# Per-zone statistics — CCCL segmented reduce on GPU
stats = zonal_stats(zones, slope, ["mean", "max", "std"])
Connected components + polygonize
from vibespatial.raster import label_connected_components, sieve_filter, polygonize_to_gdf
labels = label_connected_components(binary_raster, connectivity=8)
labels = sieve_filter(labels, min_size=50)
gdf = polygonize_to_gdf(labels)
Zero-copy GPU pipeline
OwnedRasterArray tracks HOST/DEVICE residency. Move data to GPU once, then all operations stay on device:
from vibespatial.raster import from_numpy, raster_add
a = from_numpy(data_a, affine=affine, crs="EPSG:4326")
b = from_numpy(data_b, affine=affine, crs="EPSG:4326")
a.move_to("DEVICE")
b.move_to("DEVICE")
result = raster_add(a, b) # no host-device round-trip
GPU-native IO
When nvImageCodec is available, read_raster() decodes GeoTIFF and JPEG2000 directly to GPU memory — no host copy, no rasterio:
raster = read_raster("large_image.tif") # → OwnedRasterArray(DEVICE)
Architecture
- Namespace package — installs as
vibespatial.rasterviapkgutil.extend_path, independent release cadence from core - Zero-copy NVRTC kernels — no cuCIM, no CuPy ndimage; all GPU ops are custom CCCL/NVRTC
- OwnedRasterArray — mirrors core's
OwnedGeometryArray(HOST/DEVICE residency, diagnostic events, nodata mask) - Dual IO — HYBRID path (rasterio on CPU) + GPU_NATIVE path (nvImageCodec direct-to-device)
- CPU fallback — scipy.ndimage, rasterio.features for every operation; tests validate GPU against CPU
Test
uv run pytest # all CPU tests
uv run pytest -m gpu # GPU kernel tests (requires CUDA)
uv run pytest tests/test_raster_algebra.py # specific module
License
Apache 2.0 — see 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 vibespatial_raster-0.1.7.tar.gz.
File metadata
- Download URL: vibespatial_raster-0.1.7.tar.gz
- Upload date:
- Size: 387.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd38244785e32feb2c8e6c2c65236399c9c1d3feaaafcde8bed278ef6136520c
|
|
| MD5 |
87d3429ebe8327f9d184ddedcc02bd02
|
|
| BLAKE2b-256 |
2c783ac4cbcda5dac41af2d953f296a45245b9a3934de96b5a5cd87a3a7cea7d
|
Provenance
The following attestation bundles were made for vibespatial_raster-0.1.7.tar.gz:
Publisher:
release.yml on jarmak-personal/vibeSpatial-Raster
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vibespatial_raster-0.1.7.tar.gz -
Subject digest:
dd38244785e32feb2c8e6c2c65236399c9c1d3feaaafcde8bed278ef6136520c - Sigstore transparency entry: 1204200796
- Sigstore integration time:
-
Permalink:
jarmak-personal/vibeSpatial-Raster@fca6d10ff40ec5540508771484248008fff924e7 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jarmak-personal
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@fca6d10ff40ec5540508771484248008fff924e7 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file vibespatial_raster-0.1.7-py3-none-any.whl.
File metadata
- Download URL: vibespatial_raster-0.1.7-py3-none-any.whl
- Upload date:
- Size: 145.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c62430fdd95b2723b83c87b23f5ece561307bca68c85d3b112c91668b686d7bb
|
|
| MD5 |
a3578f6f824356702b2ba0f051e4d9e8
|
|
| BLAKE2b-256 |
fa615c9d801aaad2d6a14d355a5f7fc013e4a804dec090757dc0325668796066
|
Provenance
The following attestation bundles were made for vibespatial_raster-0.1.7-py3-none-any.whl:
Publisher:
release.yml on jarmak-personal/vibeSpatial-Raster
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vibespatial_raster-0.1.7-py3-none-any.whl -
Subject digest:
c62430fdd95b2723b83c87b23f5ece561307bca68c85d3b112c91668b686d7bb - Sigstore transparency entry: 1204200882
- Sigstore integration time:
-
Permalink:
jarmak-personal/vibeSpatial-Raster@fca6d10ff40ec5540508771484248008fff924e7 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jarmak-personal
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@fca6d10ff40ec5540508771484248008fff924e7 -
Trigger Event:
workflow_dispatch
-
Statement type: