curryer.correction.geolocation_error_stats

Geolocation statistics processor with Xarray inputs and outputs.

This module processes geolocation errors from the GCS image matching algorithm and produces performance verification metrics, specifically the nadir-equivalent geolocation errors which pass when less than 250m.

The main processing pipeline: 1) Convert angular errors to N-S and E-W distances 2) Transform error components to view-plane/cross-view-plane distances 3) Scale to nadir-equivalent using geometric factors 4) Compute statistical performance metrics

Attributes

Classes

GeolocationConfig

Configuration parameters for geolocation processing.

ErrorStatsProcessor

Production-ready processor for geolocation error statistics.

Module Contents

curryer.correction.geolocation_error_stats.logger
class curryer.correction.geolocation_error_stats.GeolocationConfig

Configuration parameters for geolocation processing.

All values should be provided from CorrectionConfig - no hardcoded defaults.

earth_radius_m: float
performance_threshold_m: float
performance_spec_percent: float
minimum_correlation: float | None = None
variable_names: dict[str, str] | None = None
classmethod from_correction_config(correction_config) GeolocationConfig

Create GeolocationConfig from CorrectionConfig.

This is the preferred way to create this config - extracts all settings from the single source of truth (CorrectionConfig).

Parameters:

correction_config – CorrectionConfig instance

Returns:

GeolocationConfig with settings from CorrectionConfig

get_variable_name(semantic_name: str) str

Get actual variable name for a semantic concept.

Parameters:

semantic_name – Semantic name like ‘spacecraft_position’, ‘boresight’, etc.

Returns:

Actual variable name in the dataset

Raises:

ValueError – If variable_names not provided and semantic_name not found

class curryer.correction.geolocation_error_stats.ErrorStatsProcessor(config: GeolocationConfig)

Production-ready processor for geolocation error statistics.

config
_filter_by_correlation(data: xarray.Dataset) xarray.Dataset

Filter measurements by correlation coefficient threshold.

Parameters:

data – Input dataset with optional ‘correlation’ or ‘ccv’ variable

Returns:

Filtered dataset with low-correlation measurements removed

process_geolocation_errors(input_data: xarray.Dataset) xarray.Dataset

Process geolocation errors from input dataset to nadir-equivalent statistics.

Parameters:

input_data – Xarray Dataset with required error measurement variables

Returns:

Xarray Dataset with processed results and statistics

_validate_input_data(data: xarray.Dataset) None

Validate that input dataset contains all required variables.

_transform_boresight_vectors(bhat_hs: numpy.ndarray, t_hs2ctrs: numpy.ndarray) numpy.ndarray

Transform boresight vectors from HS to CTRS coordinate system.

_process_to_nadir_equivalent(ns_error_m: numpy.ndarray, ew_error_m: numpy.ndarray, riss_ctrs: numpy.ndarray, bhat_ctrs: numpy.ndarray, gcp_lat_rad: numpy.ndarray, gcp_lon_rad: numpy.ndarray, n_measurements: int) dict[str, numpy.ndarray]

Process error measurements to nadir-equivalent values.

_create_ctrs_to_uen_transform(lat_rad: float, lon_rad: float) numpy.ndarray

Create transformation matrix from CTRS to Up-East-North coordinates.

_calculate_view_plane_vectors(bhat_uen: numpy.ndarray) tuple[numpy.ndarray, numpy.ndarray]

Calculate view-plane and cross-view-plane unit vectors in UEN coordinates.

_calculate_scaling_factors(riss_ctrs: numpy.ndarray, theta: float) tuple[float, float]

Calculate scaling factors for nadir-equivalent transformation.

_create_output_dataset(input_data: xarray.Dataset, results: dict[str, numpy.ndarray]) xarray.Dataset

Create output Xarray Dataset with processing results.

_calculate_statistics(nadir_equiv_errors_m: numpy.ndarray) dict[str, float | int]

Calculate performance statistics on nadir-equivalent errors.

process_from_netcdf(filepath: str | pathlib.Path, minimum_correlation: float | None = None) xarray.Dataset

Load previous results from NetCDF and reprocess error statistics.

This enables iterative post-processing of Correction results without re-running expensive image matching operations.

Parameters:
  • filepath – Path to NetCDF file from previous Correction run

  • minimum_correlation – Override correlation threshold (if provided)

Returns:

Xarray Dataset with reprocessed error statistics

Example

>>> processor = ErrorStatsProcessor()
>>> # Try different correlation thresholds
>>> results_50 = processor.process_from_netcdf(
...     "correction_results/run_001.nc",
...     minimum_correlation=0.5
... )
>>> results_70 = processor.process_from_netcdf(
...     "correction_results/run_001.nc",
...     minimum_correlation=0.7
... )