vibespatial.raster.nvimgcodec_io

GPU-native raster decode via NVIDIA nvImageCodec.

Decodes GeoTIFF and JPEG2000 files directly to device memory using nvTIFF and nvJPEG2000 backends. Falls back gracefully when nvImageCodec is unavailable or the format is unsupported.

Install: pip install nvidia-nvimgcodec-cu12[all]

Attributes

Functions

has_nvimgcodec_support(→ bool)

Return True if both nvImageCodec and CuPy are importable.

nvimgcodec_read(→ tuple[object, ...)

Decode a raster file directly to GPU device memory via nvImageCodec.

nvimgcodec_read_metadata(...)

Read raster metadata via nvImageCodec without decoding pixel data.

Module Contents

vibespatial.raster.nvimgcodec_io.has_nvimgcodec_support() bool

Return True if both nvImageCodec and CuPy are importable.

vibespatial.raster.nvimgcodec_io.nvimgcodec_read(path: str | pathlib.Path, *, bands: list[int] | None = None, window: vibespatial.raster.buffers.RasterWindow | None = None, overview_level: int | None = None) tuple[object, vibespatial.raster.buffers.RasterMetadata] | None

Decode a raster file directly to GPU device memory via nvImageCodec.

Parameters

pathstr or Path

Path to a GeoTIFF, JPEG2000, or other nvImageCodec-supported file.

bandslist[int] or None

1-based band indices to select. None returns all bands.

windowRasterWindow or None

Sub-region to decode. None decodes the full raster.

overview_levelint or None

If not None, returns None immediately (overviews are not supported by nvImageCodec; the caller should fall back to rasterio).

Returns

tuple[object, RasterMetadata] or None

(cupy_array, metadata) on success, or None on any failure. The CuPy array shape is (H, W) for single-band or (C, H, W) for multi-band, matching the rasterio convention.

vibespatial.raster.nvimgcodec_io.nvimgcodec_read_metadata(path: str | pathlib.Path) vibespatial.raster.buffers.RasterMetadata | None

Read raster metadata via nvImageCodec without decoding pixel data.

Parameters

pathstr or Path

Path to a GeoTIFF, JPEG2000, or other nvImageCodec-supported file.

Returns

RasterMetadata or None

Extracted metadata, or None if nvImageCodec cannot handle the file.

vibespatial.raster.nvimgcodec_io.logger