Add regional historical land-use operator
GeoIntel CI / docs-smoke (push) Canceled after 0s
GeoIntel CI / contract-smoke (push) Canceled after 0s

This commit is contained in:
Codex
2026-07-15 23:25:15 +02:00
parent acac63a3dd
commit 3a8f6e6cef
13 changed files with 1165 additions and 11 deletions
+37 -4
View File
@@ -1,4 +1,4 @@
"""Synchronize official population and forest time series for one approved scope.
"""Synchronize official population and land-use time series for one approved scope.
This is an explicit operator command, never an application-startup task. It
coordinates the existing Statbel and Departement Omgeving import paths and
@@ -30,6 +30,8 @@ def parse_args() -> argparse.Namespace:
parser.add_argument("--base-url", default=os.environ.get("GEOINTEL_INTERNAL_API_URL", DEFAULT_API_URL))
parser.add_argument("--population-years", default="2021,2022,2023,2024,2025")
parser.add_argument("--landuse-years", default="2013,2016,2019,2022,2025")
parser.add_argument("--historical-years", default="1778,1873,1969")
parser.add_argument("--historical-themes", default="buildings,water,roads")
parser.add_argument(
"--scope-output-root",
type=Path,
@@ -41,10 +43,12 @@ def parse_args() -> argparse.Namespace:
default=Path(os.environ.get("GEOINTEL_REGIONAL_TIMESERIES_OUTPUT_ROOT", DEFAULT_TIMESERIES_OUTPUT_ROOT)),
)
parser.add_argument("--max-landuse-features", type=int, default=500000)
parser.add_argument("--max-historical-features", type=int, default=500000)
parser.add_argument("--request-timeout", type=int, default=300)
parser.add_argument("--import-timeout", type=int, default=3600)
parser.add_argument("--skip-population", action="store_true")
parser.add_argument("--skip-landuse", action="store_true")
parser.add_argument("--skip-historical", action="store_true")
parser.add_argument("--fetch-only", action="store_true")
parser.add_argument("--force", action="store_true")
return parser.parse_args()
@@ -154,8 +158,37 @@ def build_operator_commands(
],
)
)
if not args.skip_historical:
commands.append(
(
"historical_landuse",
[
sys.executable,
str(scripts_dir / "provision_regional_historical_landuse.py"),
"--scope",
scope.key,
"--base-url",
args.base_url,
"--years",
args.historical_years,
"--themes",
args.historical_themes,
"--scope-output-root",
str(args.scope_output_root),
"--output-root",
str(args.output_root / "historical"),
"--request-timeout",
str(args.request_timeout),
"--import-timeout",
str(args.import_timeout),
"--max-total-features",
str(args.max_historical_features),
*common_flags,
],
)
)
if not commands:
raise ValueError("At least one of population or land-use synchronization must remain enabled")
raise ValueError("At least one regional time-series synchronization must remain enabled")
return commands
@@ -177,8 +210,8 @@ def main() -> int:
args = parse_args()
scope = GEOGRAPHIC_SCOPES[args.scope]
try:
if args.max_landuse_features <= 0:
raise ValueError("max-landuse-features must be greater than zero")
if args.max_landuse_features <= 0 or args.max_historical_features <= 0:
raise ValueError("land-use feature safety limits must be greater than zero")
boundary_path, members_path, manifest_path = resolve_boundary(scope, args.scope_output_root)
commands = build_operator_commands(args, scope, boundary_path, members_path)
results = {label: run_operator(label, command) for label, command in commands}