supersampling

supersampling

quark.supersampling

Supersampling utilities for subpixel coordinate generation.

Provides: - SpatialSupersampling: XYZ-based adaptive pixel widths (spherical geometry) - ConstantSupersampling: Fixed meter-based spacing

Classes

Name Description
ConstantSuperSampler Constant-spacing supersampling.
SpatialSuperSampler XYZ-based adaptive supersampling.

ConstantSuperSampler

supersampling.ConstantSuperSampler(factor, pixel_width, project_center=True)

Constant-spacing supersampling.

Uses fixed meter-based pixel width for uniform subpixel spacing.

Parameters

Name Type Description Default
factor int Supersampling factor (integer >= 2). Creates a factor×factor subpixel grid. required
pixel_width str Pixel width string (e.g., “1km”, “500m”) required
project_center bool Whether to project the center pixel (offset 0,0) True

Examples

>>> supersampler = ConstantSupersampling(factor=2, pixel_width="1km")  # 4 subpixels
>>> supersampler = ConstantSupersampling(factor=10, pixel_width="100m")  # 100 subpixels
>>> lat_sub, lon_sub, slices = supersampler.compute_coords(lat, lon, 0, 1)

Methods

Name Description
compute_coords Compute constant-spacing subpixel coordinates.
compute_coords
supersampling.ConstantSuperSampler.compute_coords(lat, lon, i, j)

Compute constant-spacing subpixel coordinates.

SpatialSuperSampler

supersampling.SpatialSuperSampler(factor, project_center=True)

XYZ-based adaptive supersampling.

Computes per-pixel angular widths from 3D Cartesian neighbor distances, accounting for spherical geometry and latitude-dependent spacing. Processes the full grid (no edge exclusion)

Parameters

Name Type Description Default
factor int Supersampling factor (integer >= 2). Creates a factor×factor subpixel grid. required
project_center bool Whether to project the center pixel (offset 0,0) True

Examples

>>> supersampler = SpatialSupersampling(factor=2)  # 4 subpixels
>>> supersampler = SpatialSupersampling(factor=5)  # 25 subpixels
>>> supersampler.prepare(lat, lon)
>>> lat_sub, lon_sub, slices = supersampler.compute_coords(lat, lon, 0, 0)

Methods

Name Description
compute_coords Compute adaptive subpixel coordinates.
prepare Compute pixel widths once per dataset.
compute_coords
supersampling.SpatialSuperSampler.compute_coords(lat, lon, i, j)

Compute adaptive subpixel coordinates.

prepare
supersampling.SpatialSuperSampler.prepare(lat, lon)

Compute pixel widths once per dataset.