Reject same-year post-mosaic building labels
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user