| """Centralized configuration for Aperture.""" | |
| from __future__ import annotations | |
| import os | |
| # Per-product native resolutions (meters) | |
| NDVI_RESOLUTION_M: int = 10 | |
| WATER_RESOLUTION_M: int = 20 | |
| SAR_RESOLUTION_M: int = 10 | |
| BUILDUP_RESOLUTION_M: int = 20 | |
| TRUECOLOR_RESOLUTION_M: int = 10 | |
| # Minimum std thresholds to cap z-scores (avoid division-by-near-zero) | |
| MIN_STD_NDVI: float = 0.02 | |
| MIN_STD_WATER: float = 0.01 | |
| MIN_STD_SAR: float = 0.5 # dB | |
| MIN_STD_BUILDUP: float = 0.01 | |
| # Z-score threshold for significant anomaly | |
| ZSCORE_THRESHOLD: float = 2.0 | |
| # Minimum hotspot cluster size in pixels | |
| MIN_CLUSTER_PIXELS: int = 4 | |
| # Maximum AOI size in km². Soft limit to prevent excessive processing. | |
| MAX_AOI_KM2: int = int(os.environ.get("APERTURE_MAX_AOI_KM2", "500")) | |
| # openEO backend URL. | |
| OPENEO_BACKEND: str = os.environ.get( | |
| "OPENEO_BACKEND", "openeo.dataspace.copernicus.eu" | |
| ) | |
| # CDSE OAuth2 credentials (set as secrets in HF Spaces). | |
| OPENEO_CLIENT_ID: str | None = os.environ.get("OPENEO_CLIENT_ID") | |
| OPENEO_CLIENT_SECRET: str | None = os.environ.get("OPENEO_CLIENT_SECRET") | |
| # Anthropic API key for AOI advisor (Claude-powered region insight). | |
| ANTHROPIC_API_KEY: str | None = os.environ.get("ANTHROPIC_API_KEY") | |
| # Expert weights for the visual overview composite score. | |
| # Normalized to 1.0. Products not selected or skipped are excluded | |
| # and weights are re-normalized. | |
| OVERVIEW_WEIGHTS: dict[str, float] = { | |
| "ndvi": 0.30, | |
| "sar": 0.25, | |
| "water": 0.25, | |
| "buildup": 0.20, | |
| } | |