File size: 1,488 Bytes
364b8f4
 
 
 
 
df6bf75
bfe3c94
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
364b8f4
 
 
 
 
 
 
 
 
 
 
1159329
7534962
 
 
1159329
df6bf75
1159329
 
c42be1f
 
 
 
1159329
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
"""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,
}