Landsat Agreement¶
Module: spectralbridge.landsat_agreement.
Agreement statistics and true Landsat-footprint aggregation, without fitting calibration.
API glossary ยท Workflow / scientific context
Signatures and documentation below are collected from the current source. Advanced objects are not newly declared stable by inclusion here.
Audience: advanced.
ReferenceGrid
dataclass
¶
ReferenceGrid(crs: str, transform: tuple, width: int, height: int, row_offset: int = 0, col_offset: int = 0)
Describe the common CRS, affine grid, dimensions and support used for Landsat comparisons.
Audience: advanced.
mask_landsat_qa ¶
mask_landsat_qa(qa_pixel, qa_radsat)
L8/9: reject flags 0-5, B1-B7 saturation and terrain occlusion.
Audience: advanced.
scale_landsat_sr ¶
scale_landsat_sr(dn)
Official Collection 2 Level-2 DN contract; never guess from magnitudes.
Audience: advanced.
spectral_angle ¶
spectral_angle(real, synthetic)
Compute spectral angle in degrees along matching seven-channel vectors; zero-norm comparisons yield NaN.
Audience: advanced.
deming_regression ¶
deming_regression(x, y, error_variance_ratio=1.0)
y versus x, lambda=variance(y measurement error)/variance(x error).
Audience: advanced.
compute_agreement_metrics ¶
compute_agreement_metrics(real, synthetic) -> dict
Summarize paired scalar reflectance observations in their supplied units.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
real
|
array - like
|
Reference reflectance values. |
required |
synthetic
|
array - like
|
Same-shape modeled reflectance values. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Finite-pair N/status, bias (synthetic minus real), MAE, RMSE, IQR-normalized RMSE, correlations, identity/Deming fits and residual diagnostics. Undefined sparse/constant statistics are NaN. No clipping or unit conversion occurs; bias/MAE/RMSE retain reflectance units. |
Raises:
| Type | Description |
|---|---|
ValueError
|
Inputs cannot be broadcast/aligned for pairwise evaluation. |
Correlation is not radiometric agreement. This function supplies no population uncertainty; spatial-block intervals are added by the workflow.
Audience: advanced.
spatial_bootstrap_indices ¶
spatial_bootstrap_indices(rows, cols, replicates=499, block_pixels=10, seed=20261014)
Resample spatial blocks, never individual pixels as independent evidence.
Audience: advanced.
aggregate_to_landsat_grid ¶
aggregate_to_landsat_grid(products, grid, *, scale_factors=None, offset_m=(0.0, 0.0), strip_rows=8) -> dict
Aggregate joint seven-band products to actual projected Landsat footprints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
products
|
dict
|
Variant names mapped to seven-band raster paths. |
required |
grid
|
ReferenceGrid
|
Actual north-up projected Landsat grid. |
required |
scale_factors
|
dict
|
Explicit divisor by variant. Otherwise verified raster metadata must declare scale; never infer visually. |
None
|
offset_m
|
tuple[float, float]
|
Declared source registration offset in projected meters; unsupported cross-CRS offsets raise ValueError. |
(0.0, 0.0)
|
strip_rows
|
int
|
Positive destination strip size for bounded reads. |
8
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Variant means/variances in unitless reflectance, source geometry coverage, joint validity/full-footprint coverage, contributing counts, and aggregation method. Unsupported cells have NaN means. |
Raises:
| Type | Description |
|---|---|
ValueError
|
Invalid grid, scale, dimensions, offsets or variant alignment. |
OSError
|
Rasters cannot be read. |
Same-CRS uses interval intersections; cross-CRS uses transformed source-cell polygons. Whole-footprint coverage is not normalized to contributing source overlap. Joint finite/nodata masks keep variants and seven channels paired.