Choose a reprojection or orthorectification grid#

Supply an output grid when another raster defines its alignment, or let affine reprojection suggest a grid from the source and target CRS. Declare source nodata, interpolation and output fill according to your application.

Reproject an affine raster#

Supply the default shared cugeo-proj dependency, as described in the README feature table. Call cugeo.raster.warp.reproject(source, destination, src_transform=..., src_crs=..., dst_transform=..., dst_crs=...) with NumPy or CuPy arrays. Supplied destination retains exact object identity in (destination, dst_transform). Omit dst_transform to derive it for that output shape. Omit both destination and transform to allocate CHW output, including a singleton channel for an HW source. NumPy source allocates NumPy; CUDA source allocates CuPy in the compatible current context and selected stream. CRS inputs use the complete CRS.from_user_input protocol.

import numpy as np
import cugeo.raster as raster

source = np.arange(12, dtype=np.uint16).reshape(3, 4)
destination, transform = raster.warp.reproject(
    source, src_transform=raster.Affine(20, 0, 500000, 0, -10, 70),
    src_crs=32631, dst_crs=32631, dst_resolution=(10, 10),
)
assert destination.ndim == 3 and destination.shape[0] == 1
assert transform.a == 10 and transform.e == -10

Use dst_resolution only when output and transform are omitted. A consumed resolution conflicts with supplied dimensions; with a supplied transform it has no grid effect. Rotated/sheared sources use their axis-aligned bounds for planning and their original affine for sampling. The suggested-output contract states the admitted coordinate domains and numerical grid rules.

Use the one-shot operation reference for arguments and returned status. NumPy completes synchronously. With a cuda build, CuPy queues on the current or explicit stream and retains its scratch through completion. A receipt request waits. Use lowlevel.Reproject to reuse prepared capacity and caller-owned scratch. The pixel execution contract describes lifetimes and coordinate failures.

Orthorectify RPC imagery with a DEM#

Build with orthorect; add cuda for CuPy output. Supply RPC00B imagery, a raster DEM with an affine grid and EPSG CRS, and an explicit destination grid. plan_rpc_grid can propose a grid from fixed-height boundary samples, but does not guarantee terrain-aware edge coverage.

Declare the DEM’s height units and vertical reference. The ordinary file workflow requires terrain_vertical_reference: "wgs84_ellipsoid" declares WGS84 ellipsoidal heights in metres. Orthometric heights require the supported compound CRS and PROJ grid directory described in the Python orthorectification reference. Supply a decimal-year terrain_coordinate_epoch when the selected height operation is time-dependent. Do not label an orthometric DEM ellipsoidal to make the call proceed. The compound route requires a destination CRS matching the DEM’s geographic horizontal CRS and rejects projected DEMs.

Use the RPC/DEM product demo for the narrow CuPy file route: uncompressed UInt16 C1 imagery, host ROI decode, explicit transfer to CUDA, then geometry and sampling on a non-default stream. Receipts expose that staging and completion waits. The NAVD88 example covers the advanced vertical conversion. Check the orthorectification capability boundary before generalizing a synthetic or local result to a real sensor.