Reject same-year post-mosaic building labels
GeoIntel release gates / Compile, test, contracts and builds (push) Canceled after 0s
GeoIntel release gates / Python and npm vulnerability policy (push) Canceled after 0s
GeoIntel release gates / GIS image, SBOM and container scan (push) Canceled after 0s

This commit is contained in:
Jens
2026-07-30 03:35:15 +02:00
parent f7e12230cf
commit 5ac3238c27
2 changed files with 44 additions and 3 deletions
+12 -3
View File
@@ -159,9 +159,16 @@ def normalize(
decisions: list[dict[str, Any]] = []
seen: set[str] = set()
counts: Counter[str] = Counter()
imagery_cutoff = (
datetime.fromisoformat(imagery_valid_to.replace("Z", "+00:00")) if imagery_valid_to else None
)
imagery_dates = [
datetime.fromisoformat(value.replace("Z", "+00:00"))
for value in (imagery_observed_at, imagery_valid_to)
if value
]
# Annual mosaics expose a validity interval but not the flight date for
# each pixel. Using the interval end admits buildings created later in the
# same year that are visibly absent from the mosaic. The earliest governed
# date is therefore the only conservative training-label cutoff.
imagery_cutoff = min(imagery_dates) if imagery_dates else None
with rasterio.open(raster_path) as raster:
if raster.crs is None:
raise SystemExit("Raster CRS is required")
@@ -260,6 +267,8 @@ def normalize(
"min_label_px": min_label_px,
"imagery_observed_at": imagery_observed_at,
"imagery_valid_to": imagery_valid_to,
"imagery_feature_creation_cutoff": imagery_cutoff.isoformat() if imagery_cutoff else None,
"imagery_feature_creation_cutoff_policy": "earliest_governed_imagery_date",
"reference_observed_at": reference_observed_at,
"temporal_mismatch_days": temporal_mismatch_days,
"temporal_alignment_status": temporal_alignment_status,