fix: align WALOUS with official class codes
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:
Codex
2026-07-22 04:30:54 +02:00
parent 20da1d3dd4
commit 86dd1a5689
9 changed files with 144 additions and 53 deletions
+3 -2
View File
@@ -33,6 +33,7 @@ SOURCES = {
}
MAX_ARCHIVE_BYTES = 1_000_000_000
MAX_EXTRACTED_BYTES = 50_000_000_000
WALOUS_CLASS_CODES = {1, 2, 3, 4, 5, 6, 7, 8, 9, 80, 90}
def sha256_file(path: Path) -> str:
@@ -110,9 +111,9 @@ def validate_raster(path: Path) -> dict:
sample_width = min(2048, source.width)
sample = source.read(1, out_shape=(sample_height, sample_width), masked=True, resampling=Resampling.nearest)
values = np.unique(sample.compressed()).astype(int).tolist()
unexpected = sorted(set(values) - set(range(1, 12)))
unexpected = sorted(set(values) - WALOUS_CLASS_CODES)
if unexpected:
raise RuntimeError(f"WALOUS sample contains classes outside 1-11: {unexpected}")
raise RuntimeError(f"WALOUS sample contains classes outside the official 11-class code set: {unexpected}")
return {
"path": str(path),
"crs": str(source.crs),