Skip to content

Python tool for aircraft Doppler audio geolocation using historical ADS-B flight data (Source-available)

Add country profiles and pinned Germany receiver masking

Cinna Davis8dcadcc87d17
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 7e2f351..36aeb07 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -41,6 +41,8 @@ jobs:
run: python scripts/check_benchmark_instrumentation.py
- name: Check prepared-index compatibility with recorded observations
run: python -m pytest -q tests/test_real_prepared_geometry_compatibility.py::test_pinned_legacy_geometry_and_data_source_preserve_real_tracks
+ - name: Check country profiles against the actual BKG land boundary
+ run: python scripts/check_country_profiles.py --online --cache-root "$RUNNER_TEMP/dopplergeist-geography"
- name: CLI smoke check
run: dopplergeist --help
- name: Check installed native validator and packaged browser assets
diff --git a/README.md b/README.md
index 97c6d82..79425cf 100644
--- a/README.md
+++ b/README.md
@@ -27,7 +27,7 @@ Designed for local experimentation, audio forensics research, and investigation
| Configured localization | Event measurement, flight ranking and physical refinement | `dopplergeist run` and `dopplergeist measure` on `main` |
| Automatic acoustic discovery | Whole-recording decoding, frequency-track discovery and harmonic grouping without supplied event windows or bands | `scripts/discover_audio.py`; produces event proposals and diagnostics |
| Historical inputs | Reusable flight indexes, gap-aware trajectory queries and cached terrain/geoid data | [Data acquisition and search APIs](docs/DATA_AND_SCALE.md) on `main` |
-| Geographic search | Parallel, resumable tiles, joint matching across independent flyovers and disk-backed accounting of candidates discarded by ranking limits | [Search](docs/DATA_AND_SCALE.md#search) and [finite-search evidence](docs/FINITE_SEARCH_PRODUCER.md) on `main` |
+| Geographic search | US/CONUS and Germany profiles, parallel resumable tiles, joint matching across independent flyovers and disk-backed candidate accounting | [Country profiles](docs/COUNTRIES.md), [search](docs/DATA_AND_SCALE.md#search) and [finite-search evidence](docs/FINITE_SEARCH_PRODUCER.md) |
| Local upload application | CLI/API orchestration, persistent jobs and inspectable browser results on `main` | `dopplergeist analyze`, `dopplergeist serve` and `dopplergeist job`; see [Local upload workflow](docs/PRODUCT.md) |
| Independent location validation | Real-audio discovery, browser upload and measured-session experiments; no accepted blind real localization | [Real-data verification](#real-data-verification-2026-11-03); [acceptance #13](https://github.com/1337isnot1337/DOPPLERGEIST/issues/13) and [field recordings #53](https://github.com/1337isnot1337/DOPPLERGEIST/issues/53) remain open |
@@ -72,6 +72,13 @@ To limit the geographic search when you have independent regional context, add
`--bounds -98.98 30.29 -98.73 30.47`. The bounds are a search prior, and the
clock window must still be supported by recording metadata or other evidence.
+The default country profile is `US` (CONUS). Add `--country DE` for Germany,
+or select Germany in the upload interface. Bounds then restrict that country's
+profile. Germany uses a pinned BKG land boundary for receiver locations and
+keeps nearby aircraft across borders eligible. Its first online search also
+caches the boundary; offline use requires that cached input. Country support
+does not establish localization accuracy. See [country profiles](docs/COUNTRIES.md).
+
The command prints a job ID when queued. In another terminal, run
`.venv/bin/dopplergeist job JOB_ID --jobs jobs --watch` to follow the reported
pipeline/grid estimate and the count and modification age of coarse/fine search
diff --git a/docs/COUNTRIES.md b/docs/COUNTRIES.md
new file mode 100644
index 0000000..56a0510
--- /dev/null
+++ b/docs/COUNTRIES.md
@@ -0,0 +1,103 @@
+# Country profiles
+
+The automatic request, CLI and upload interface support two receiver regions:
+
+| Country | Coverage | Envelope: west, south, east, north | Search CRS | Receiver region |
+| --- | --- | --- | --- | --- |
+| `US` | `conus` | `-125, 24, -66, 50` | `EPSG:5070` | Existing CONUS rectangle |
+| `DE` | `germany` | `5.5, 47, 15.5, 55.2` | `EPSG:32632` | BKG VG250 Germany land polygon inside the envelope |
+
+The envelope limits optional rectangular subsets. Germany's envelope includes
+foreign territory; the land polygon removes those receiver locations before
+terrain sampling or scoring. Islands, exclaves and polygon holes are preserved.
+The boundary is generalized geographic data, not a survey of a microphone site.
+Country support does not establish German localization accuracy.
+
+## Requests and commands
+
+```bash
+dopplergeist analyze recording.mp3 --country DE --jobs jobs --online \
+ --start-utc "$RECORDING_START_UTC_MIN" --end-utc "$RECORDING_START_UTC_MAX" \
+ --time-source 'Evidence establishing the recording-start interval'
+```
+
+The upload API accepts `"search":{"country":"DE"}`. It also accepts
+`"search":{"coverage":"germany"}`. A normalized request records the coverage;
+an explicitly supplied country is normalized to uppercase. If both are supplied,
+they must agree. `bounds_wsen` and `--bounds` narrow the selected profile. They
+must be an independently justified prior, not the evaluation location.
+
+Omitting country preserves the previous CONUS behavior. Old requests/results
+without a country field remain readable. An older service advertises no country
+catalog, so the new browser offers only CONUS and sends the legacy request shape.
+
+The configured research command also accepts a top-level `country` or a `search`
+object. A supplied `grid.crs` must match the country profile, and `grid.bounds`
+must agree with any `search.bounds_wsen`. That command retains its existing
+configured-event and uncertified-coverage limitations.
+
+## Germany boundary acquisition
+
+The first online German search obtains the country layer `vg250:vg250_sta`,
+filtered to `GF=4`, from the [official BKG WFS](https://sgx.geodatenzentrum.de/wfs_vg250).
+It requests `EPSG:25832` so the original ETRS89 / UTM 32N geometry is retained.
+Receiver coordinates are transformed into that CRS for point-in-polygon tests.
+The search grid and reported projected coordinates use `EPSG:32632` consistently.
+
+The WFS product advertises the 2025-01-01 dataset. The pinned land feature has
+object ID `DEBKGVG200000CKM` and `BEGINN=2025-04-11Z`; it is not described as the
+separate 2026 download product. Its canonical geometry, properties and CRS have
+SHA-256 `b5e9276fe37ca1c0d65b4542a075cc246e97194ed70d3259b0d7900ad944a1d3`.
+The response's request timestamp is excluded from that content identity.
+
+The validated feature is cached at
+`CACHE_ROOT/geography/de-vg250-b5e9276fe37ca1c0.json`. The download is limited to
+8 MiB and written atomically after validation. Offline searches require this
+cache entry. Copying this entry to another machine preserves the same boundary.
+Missing, damaged or changed source data produce an explicit data-unavailable
+outcome. A future WFS update does not silently replace the pinned geometry;
+review its data and update the pin deliberately.
+
+No source simplification is applied. The source's 110 polygon components and
+their holes remain intact. Prepared vector predicates avoid creating a separate
+geometry object for every receiver. The mask is serialized to each search worker.
+
+## Search and checkpoint behavior
+
+The mask applies to serial and parallel coarse tiles, fine tiles, research grids,
+continuous refinement and every sensitivity scenario. A masked-out continuous
+proposal never reaches terrain sampling or acoustic scoring. A valid seed remains
+available when optimization proposes an invalid location. A refinement whose
+explored radius meets the country boundary is marked boundary-limited.
+
+Aircraft are not country-masked. Automatic acquisition retains full historical
+trajectories, and tile queries include the existing audible-range border margin.
+Archive absence or incomplete trajectory/model support remains visible.
+
+German search identities include the boundary content, source, selected CRS and
+Shapely version. Changing those inputs cannot reuse incompatible search results.
+Legacy CONUS requests retain their meaning, but a new code revision does not
+automatically make an old source-pinned checkpoint resumable. Preserve the old
+producer or use a separately verified migration; no identity bypass is added.
+
+## Geographic checks
+
+```bash
+python scripts/check_country_profiles.py --online --cache-root /tmp/dopplergeist-geography
+python scripts/check_country_profiles.py --cache-root /tmp/dopplergeist-geography
+```
+
+The check uses the actual pinned BKG geometry, named geographic points, country
+boundary grids and worker serialization. It generates no audio or flight tracks.
+These are software/geography checks, not an acoustic localization benchmark.
+
+## Boundary license and source
+
+© [BKG](https://www.bkg.bund.de) 2026,
+[dl-de/by-2-0](https://www.govdata.de/dl-de/by-2-0).
+[Data sources](https://sgx.geodatenzentrum.de/web_public/gdz/datenquellen/datenquellen_vg_nuts.pdf).
+[Official product metadata](https://gdz.bkg.bund.de/index.php/default/wfs-verwaltungsgebiete-1-250-000-stand-01-01-wfs-vg250.html).
+
+Processing: selection of the land feature and coordinate transformation for
+receiver tests; no polygon simplification. Boundary data retains its source
+license. The application code retains the repository's PolyForm license.
diff --git a/docs/INTERFACES.md b/docs/INTERFACES.md
index 04fa196..17671d9 100644
--- a/docs/INTERFACES.md
+++ b/docs/INTERFACES.md
@@ -33,8 +33,15 @@ returns `needs_input` with `required_fields: ["time_window"]` if a defensible wi
is still unavailable. Do not fabricate a timestamp. A derived best recording start
is a result field and must not be mislabeled independent timestamp evidence.
-`search.coverage` is `conus` in version 1. Optional `bounds_wsen` further restrict
-the requested search to `[west, south, east, north]` in longitude/latitude degrees.
+`search.country` accepts `US` (CONUS) or `DE` (Germany); lowercase ISO codes are
+normalized. The corresponding `search.coverage` values are `conus` and `germany`.
+Either country or coverage is sufficient, and contradictory values are rejected.
+Legacy `{"coverage":"conus"}` objects keep their serialized shape; the validator
+does not insert a country into old requests. Optional `bounds_wsen` further restrict
+the selected profile to `[west, south, east, north]` in longitude/latitude degrees.
+Bounds must lie inside its declared envelope. Germany's land mask further limits
+receiver points, while neighboring aircraft remain eligible. The capability
+response publishes the supported catalog; see [country profiles](COUNTRIES.md).
Actual data availability may be smaller and must be reported in provenance and
the decision. Bounds must increase; antimeridian crossing is not supported here.
The automatic national acceptance test omits any truth-derived bounding box.
diff --git a/docs/PRODUCT.md b/docs/PRODUCT.md
index df24f06..737d40b 100644
--- a/docs/PRODUCT.md
+++ b/docs/PRODUCT.md
@@ -9,7 +9,8 @@ scope and limitations.
The automatic product path is separate from the historical research `run` and
`measure` commands. Uploads supply audio, an optional defensible UTC window for
-**sample zero**, and declared CONUS search coverage. Event windows, frequency
+**sample zero**, and a declared country profile (US/CONUS by default, or Germany).
+An optional rectangle narrows that profile. Event windows, frequency
bands, flight IDs and ground-truth coordinates are not upload inputs.
Launch the local interface after installing the project:
@@ -79,6 +80,12 @@ dopplergeist resume JOB_ID --server-url http://127.0.0.1:8765
dopplergeist job JOB_ID --jobs jobs --watch
```
+Use `analyze --country DE` or the upload form's country selector for Germany.
+The API equivalent is `"search":{"country":"DE"}`; normalized requests record
+`"coverage":"germany"`. The same country, CRS and receiver mask apply to coarse
+search, parallel workers, fine grids and continuous refinement. See
+[country profiles](COUNTRIES.md) for boundary acquisition, offline use and limits.
+
`analyze` prints the job ID and a monitor command to standard error as soon as
the upload is queued. `job --watch` reports the status-file progress field, the
count/rate of matching coarse and fine search filenames, the newest matching
diff --git a/package.nix b/package.nix
index 0bb7f27..e175d3a 100644
--- a/package.nix
+++ b/package.nix
@@ -24,6 +24,7 @@ python314.pkgs.buildPythonApplication {
matplotlib
requests
pyarrow
+ shapely
];
nativeBuildInputs = [
diff --git a/pyproject.toml b/pyproject.toml
index 6ee112f..af88d87 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -9,7 +9,7 @@ description = "Reproducible physics-based aircraft acoustic geolocation"
license = "PolyForm-Noncommercial-1.0.0"
license-files = ["LICENSE", "licenses/MIT-legacy.txt", "src/dopplergeist/web/leaflet-license.txt"]
requires-python = ">=3.11"
-dependencies = ["numpy", "scipy", "pandas", "soundfile", "pyproj", "rasterio", "matplotlib", "requests", "pyarrow"]
+dependencies = ["numpy", "scipy", "pandas", "soundfile", "pyproj", "rasterio", "matplotlib", "requests", "pyarrow", "shapely>=2.0"]
[project.optional-dependencies]
test = ["pytest>=8"]
diff --git a/scripts/check_country_profiles.py b/scripts/check_country_profiles.py
new file mode 100644
index 0000000..84e2a26
--- /dev/null
+++ b/scripts/check_country_profiles.py
@@ -0,0 +1,229 @@
+#!/usr/bin/env python3
+"""Check country contracts and real BKG receiver geometry without audio or tracks.
+
+Run against an installed package, or set PYTHONPATH=src in a checkout:
+
+ python scripts/check_country_profiles.py --cache-root /path/to/cache
+
+The default is offline. --online permits the production loader to acquire its
+pinned public BKG feature when absent. No historical-flight or terrain download,
+localization run, generated recording, or generated aircraft track is involved.
+"""
+from copy import deepcopy
+import argparse
+import json
+import math
+from pathlib import Path
+import pickle
+import sys
+
+
+class CheckFailure(RuntimeError):
+ pass
+
+
+def require(condition, message):
+ if not condition:
+ raise CheckFailure(message)
+
+
+def check_contracts():
+ from dopplergeist.contracts import validate_request
+ from dopplergeist.geography import profile_for_search, public_profiles
+
+ # This is only request validation. The existing script path is not decoded
+ # or represented as a real recording.
+ request_base = {"schema_version": 1, "audio_path": str(Path(__file__).resolve())}
+ conus_subset = [-90.0, 40.0, -87.0, 43.0]
+ buesingen_subset = [8.66, 47.68, 8.72, 47.72]
+ cases = (
+ ("omitted search", None, {"coverage": "conus"}, "US"),
+ ("legacy CONUS", {"coverage": "conus"}, {"coverage": "conus"}, "US"),
+ ("legacy CONUS subset", {"coverage": "conus", "bounds_wsen": conus_subset},
+ {"coverage": "conus", "bounds_wsen": conus_subset}, "US"),
+ ("US country", {"country": "us"}, {"country": "US", "coverage": "conus"}, "US"),
+ ("DE country", {"country": "de"}, {"country": "DE", "coverage": "germany"}, "DE"),
+ ("Germany coverage", {"coverage": "germany"}, {"coverage": "germany"}, "DE"),
+ ("explicit Germany", {"country": "DE", "coverage": "germany"},
+ {"country": "DE", "coverage": "germany"}, "DE"),
+ ("Germany subset", {"country": "DE", "bounds_wsen": buesingen_subset},
+ {"country": "DE", "coverage": "germany", "bounds_wsen": buesingen_subset}, "DE"),
+ )
+ validated = {}
+ for name, search, expected, country in cases:
+ request = deepcopy(request_base)
+ if search is not None:
+ request["search"] = deepcopy(search)
+ original = deepcopy(request)
+ normalized = validate_request(request)
+ require(request == original, f"{name}: validation changed the input request")
+ require(normalized["search"] == expected, f"{name}: unexpected normalized search")
+ require(profile_for_search(normalized["search"]).country == country,
+ f"{name}: wrong resolved country")
+ serialized = json.loads(json.dumps(normalized, allow_nan=False))
+ require(validate_request(serialized) == normalized,
+ f"{name}: normalization is not stable through a JSON round trip")
+ validated[name] = normalized
+
+ rejected = (
+ {"country": "DE", "coverage": "conus"},
+ {"country": "US", "coverage": "germany"},
+ {"country": "FR"},
+ {"coverage": "custom"},
+ {"country": None},
+ {"coverage": None},
+ {},
+ {"country": "DE", "bounds_wsen": conus_subset},
+ {"country": "US", "bounds_wsen": buesingen_subset},
+ {"country": "DE", "bounds_wsen": [8.72, 47.68, 8.66, 47.72]},
+ {"country": "DE", "bounds_wsen": [8.66, 47.68, math.nan, 47.72]},
+ {"country": "DE", "unsupported_field": True},
+ )
+ for search in rejected:
+ try:
+ validate_request(dict(request_base, search=search))
+ except ValueError:
+ pass
+ else:
+ raise CheckFailure(f"Invalid search was accepted: {search!r}")
+
+ catalog = public_profiles()
+ require(len(catalog) == 2 and {p["country"] for p in catalog} == {"US", "DE"},
+ "Capabilities must describe exactly the supported US and DE profiles")
+ for item in catalog:
+ profile = profile_for_search({"country": item["country"]})
+ require(item["coverage"] == profile.coverage and item["crs"] == profile.crs
+ and item["bounds_wsen"] == list(profile.bounds_wsen),
+ f"Capabilities disagree with the {profile.country} runtime profile")
+ require(profile_for_search().crs == "EPSG:5070", "Legacy CONUS CRS changed")
+ require(profile_for_search({"country": "DE"}).crs == "EPSG:32632",
+ "Germany must use its declared UTM 32N search CRS")
+ print(f"PASS requests: {len(cases)} normalization/JSON round-trip cases; "
+ f"{len(rejected)} invalid declarations rejected; profile catalog agrees")
+ return validated
+
+
+# Fixed real locations, not simulated receivers or localization truth.
+# The small-component controls use coordinates published by their local bodies:
+# Helgoland: https://www.helgoland.de/content/uploads/2024/02/Faltplan-HELGOLAND-GB_web.pdf
+# Sylt: https://www.sylt.de/eventlocation/tui-blue-sylt
+# Buesingen: routing link at https://www.buesingen.de/de/Rathaus/Gemeindeverwaltung
+# Mainland city coordinates are rounded landmarks; they are far from the border.
+LOCATIONS = (
+ ("Berlin centre", 13.4050, 52.5200, True),
+ ("Munich Marienplatz", 11 + 34 / 60 + 31 / 3600, 48 + 8 / 60 + 14 / 3600, True),
+ ("Helgoland", 7 + 53 / 60 + 1 / 3600, 54 + 10 / 60 + 57 / 3600, True),
+ ("Sylt, Rantum", 8.2949, 54.85991, True),
+ ("Buesingen town hall", 8.687434, 47.696354, True),
+ ("Zurich centre", 8.5417, 47.3769, False),
+ ("Prague centre", 14.4378, 50.0755, False),
+ ("Schaffhausen centre", 8.6349, 47.6965, False),
+)
+
+
+def check_mask(cache_root, online, validated):
+ import numpy as np
+ from dopplergeist.geography import (
+ BKG_BOUNDARY_SHA256, BKG_BOUNDARY_URL, profile_for_search, receiver_mask_for_search,
+ )
+
+ require(receiver_mask_for_search(validated["legacy CONUS"]["search"],
+ cache_root=cache_root, offline=True) is None,
+ "The legacy CONUS profile unexpectedly acquired a country polygon")
+ search = validated["DE country"]["search"]
+ mask = receiver_mask_for_search(search, cache_root=cache_root, offline=not online)
+ require(mask is not None, "Germany must not fall back to a rectangular mask")
+ identity = mask.identity
+ require(identity["boundary_sha256"] == BKG_BOUNDARY_SHA256
+ and identity["source_url"] == BKG_BOUNDARY_URL,
+ "Loaded boundary does not identify the pinned BKG source")
+ require(identity["source_crs"] == "EPSG:25832"
+ and identity["search_crs"] == profile_for_search(search).crs,
+ "Boundary/source CRS identity disagrees with the selected search profile")
+
+ lon = np.array([item[1] for item in LOCATIONS])
+ lat = np.array([item[2] for item in LOCATIONS])
+ expected = np.array([item[3] for item in LOCATIONS], dtype=bool)
+ west, south, east, north = profile_for_search(search).bounds_wsen
+ require(bool(np.all((lon >= west) & (lon <= east) & (lat >= south) & (lat <= north))),
+ "Named controls must all be inside the Germany rectangular envelope")
+ actual = np.asarray(mask.contains(lon, lat), dtype=bool)
+ require(actual.shape == expected.shape, "Vector mask changed the coordinate shape")
+ mismatches = [item[0] for item, keep, want in zip(LOCATIONS, actual, expected) if keep != want]
+ require(not mismatches, f"Incorrect land membership: {', '.join(mismatches)}")
+ scalar = np.array([bool(mask.contains(float(x), float(y))) for x, y in zip(lon, lat)])
+ require(np.array_equal(actual, scalar), "Scalar and vector country masks disagree")
+
+ # Workers receive the real polygon through serialization. Also reload the
+ # actual cache offline after acquisition, so a successful online fetch alone
+ # cannot hide an unusable persisted feature.
+ transferred = pickle.loads(pickle.dumps(mask, protocol=pickle.HIGHEST_PROTOCOL))
+ cached = receiver_mask_for_search(search, cache_root=cache_root, offline=True)
+ for name, copy in (("pickled worker mask", transferred), ("offline cache", cached)):
+ require(copy.identity == identity, f"{name}: source identity changed")
+ require(np.array_equal(copy.contains(lon, lat), expected),
+ f"{name}: real-location membership changed")
+ require(not mask.boundary_limited(13.4050, 52.5200, 1000.0),
+ "Central Berlin was incorrectly flagged within 1 km of the country boundary")
+ require(mask.boundary_limited(8.687434, 47.696354, 10000.0),
+ "A 10 km neighbourhood of Buesingen must be boundary-limited")
+ require(mask.boundary_limited(8.5417, 47.3769, 0.0),
+ "An outside-country receiver must be boundary-limited")
+ print(f"PASS BKG mask: {int(expected.sum())} German locations retained "
+ f"(including two islands and Buesingen); {int((~expected).sum())} foreign locations excluded")
+ print("PASS scalar/vector, worker pickle, offline reload and boundary-proximity controls")
+ return mask
+
+
+def check_border_grid(mask, validated):
+ import numpy as np
+ from pyproj import Transformer
+ from dopplergeist.geography import profile_for_search
+ from dopplergeist.tiled_search import _tile_coordinates
+
+ profile = profile_for_search(validated["DE country"]["search"])
+ forward = Transformer.from_crs("EPSG:4326", profile.crs, always_xy=True)
+ # The actual Buesingen exclave and surrounding Swiss territory exercise both
+ # sides of a land border, unlike an inland rectangle-only grid check.
+ centre_x, centre_y = forward.transform(8.687434, 47.696354)
+ subset = validated["Germany subset"]["search"]["bounds_wsen"]
+ summaries = []
+ for spacing in (1000.0, 250.0):
+ cells = (math.floor((centre_x - 6000) / spacing), math.floor((centre_y - 6000) / spacing),
+ math.ceil((centre_x + 6000) / spacing), math.ceil((centre_y + 6000) / spacing))
+ for label, bounds in (("national envelope", profile.bounds_wsen), ("requested subset", subset)):
+ rectangle = _tile_coordinates(cells, spacing, bounds, profile.crs)
+ clipped = _tile_coordinates(cells, spacing, bounds, profile.crs, receiver_mask=mask)
+ require(0 < len(clipped) < len(rectangle),
+ f"Buesingen {spacing:g} m/{label}: clipping did not preserve both border sides")
+ expected = np.asarray(mask.contains(rectangle.lon.to_numpy(), rectangle.lat.to_numpy()), dtype=bool)
+ columns = ["x", "y", "lon", "lat"]
+ require(np.array_equal(clipped[columns].to_numpy(), rectangle.loc[expected, columns].to_numpy()),
+ f"Buesingen {spacing:g} m/{label}: the grid lost or added country cells")
+ projected_x, projected_y = forward.transform(clipped.lon.to_numpy(), clipped.lat.to_numpy())
+ require(np.allclose(projected_x, clipped.x.to_numpy(), rtol=0, atol=1e-5)
+ and np.allclose(projected_y, clipped.y.to_numpy(), rtol=0, atol=1e-5),
+ f"Buesingen {spacing:g} m/{label}: grid x/y disagree with the country CRS")
+ summaries.append(f"{spacing:g} m/{label}: {len(rectangle)} -> {len(clipped)} cells")
+ print("PASS real border-grid clipping and UTM 32N coordinate agreement: " + "; ".join(summaries))
+
+
+def main(argv=None):
+ parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
+ parser.add_argument("--cache-root", required=True, type=Path, help="Existing DOPPLERGEIST data cache")
+ parser.add_argument("--online", action="store_true", help="Allow acquisition of the pinned public BKG feature")
+ args = parser.parse_args(argv)
+ try:
+ validated = check_contracts()
+ mask = check_mask(args.cache_root, args.online, validated)
+ check_border_grid(mask, validated)
+ except (CheckFailure, ImportError, OSError, ValueError, RuntimeError) as error:
+ print(f"FAIL country verification: {error}", file=sys.stderr)
+ return 1
+ print("PASS geographic software checks. Not exercised: flight acquisition/association, terrain sampling, "
+ "job/checkpoint resume, full refinement, or recording localization.")
+ return 0
+
+
+if __name__ == "__main__":
+ raise SystemExit(main())
diff --git a/src/dopplergeist/automatic.py b/src/dopplergeist/automatic.py
index 8e3018e..1c3b4b7 100644
--- a/src/dopplergeist/automatic.py
+++ b/src/dopplergeist/automatic.py
@@ -222,7 +222,8 @@ def _latest_emission(hi, duration, events, filters):
def _search(request, recording, events, output, config, search_progress):
- from .data_access import CONUS, FlightIndex, acquire_inputs
+ from .data_access import FlightIndex, acquire_inputs
+ from .geography import profile_for_search, receiver_mask_for_search
from .matching import prepare_events
from .terrain import Terrain
from .tiled_search import SearchBudget, search_national
@@ -254,6 +255,9 @@ def _search(request, recording, events, output, config, search_progress):
raise MissingData("Recording time window exceeds the configured historical-data acquisition budget. Supply a narrower defensible window.")
ground = config.get("terrain", {})
hashes = {"terrain_configuration": ground}
+ profile = profile_for_search(request["search"])
+ receiver_mask = receiver_mask_for_search(request["search"],
+ cache_root=config.get("cache_root", output / "cache"), offline=config.get("offline", True))
if ground.get("rasters") or "constant_m" in ground:
# Explicit offline/test terrain override; normal provider acquisition stays
# in the data owner's adapter. Never infer flight coverage from this model.
@@ -262,7 +266,7 @@ def _search(request, recording, events, output, config, search_progress):
indexes = [FlightIndex(path) for path in config["flight_indexes"]]
terrain = Terrain(ground.get("rasters", []), ground.get("constant_m"), ground.get("geoid_raster"))
time_range = (earliest, latest)
- bounds = request["search"].get("bounds_wsen", CONUS)
+ bounds = request["search"].get("bounds_wsen", profile.bounds_wsen)
hashes["terrain_rasters"] = {str(path): _digest(path) for path in ground.get("rasters", [])}
else:
bundle = acquire_inputs(request, recording.metadata, cache_root=config.get("cache_root", output / "cache"),
@@ -280,13 +284,18 @@ def _search(request, recording, events, output, config, search_progress):
"recording_start_window_s": [lo, hi]}
if config.get("resume_legacy_first_batch"):
scoring["legacy_first_batch"] = True
+ geographic_options = {"receiver_mask": receiver_mask} if receiver_mask is not None else {}
report = search_national(indexes, terrain, prepared, measurements, time_range_s=time_range, output_dir=output / "search",
bounds=bounds, budget=SearchBudget(**config.get("search_budget", {})),
- scoring=scoring, filters=filters, input_hashes=hashes,
+ scoring=scoring, filters=filters, input_hashes=hashes, crs=profile.crs,
workers=config.get("search_workers"),
- search_progress=search_progress)
- write_json(output / "data-provenance.json", {"flight_indexes": [index.report for index in indexes],
- "terrain": terrain.provenance() if hasattr(terrain, "provenance") else hashes})
+ search_progress=search_progress, **geographic_options)
+ provenance = {"flight_indexes": [index.report for index in indexes],
+ "terrain": terrain.provenance() if hasattr(terrain, "provenance") else hashes}
+ if receiver_mask is not None:
+ provenance["search_geography"] = {"country": profile.country, "coverage": profile.coverage,
+ "bounds_wsen": list(bounds), "crs": profile.crs, "receiver_mask": receiver_mask.identity}
+ write_json(output / "data-provenance.json", provenance)
return report, prepared, measurements, indexes, terrain
@@ -476,7 +485,7 @@ def _decide(search, events, prepared_events, measurements, indexes, terrain, sta
# The confidence producer supplies this adapter; missing decision machinery
# can never turn the highest raw score into a supported location.
from .confidence import decide_location
- from .data_access import CONUS
+ from .geography import profile_for_search, receiver_mask_for_search
from .matching import _cache_ridge_fits, profile_candidate, refine_candidate
# Each finalist and the complete sensitivity profile own an exact-input
# cache. Profile's internal refinements share its scope; other calls do not.
@@ -486,7 +495,12 @@ def _decide(search, events, prepared_events, measurements, indexes, terrain, sta
refined, refinement_failures = [], []
window = state["recording"]["time_window"]
start_window = tuple(utc_timestamp(window[key]).timestamp() for key in ("start_utc", "end_utc"))
- search_bounds = state["coverage"]["requested_area"].get("bounds_wsen", CONUS)
+ search_area = state["coverage"]["requested_area"]
+ profile = profile_for_search(search_area)
+ search_bounds = search_area.get("bounds_wsen", profile.bounds_wsen)
+ receiver_mask = receiver_mask_for_search(search_area,
+ cache_root=config.get("cache_root", output / "cache"), offline=config.get("offline", True))
+ geographic_options = {"receiver_mask": receiver_mask} if receiver_mask is not None else {}
finite = search.get("finite_search_evidence")
assessed_ids = set()
producer_ids = search.get("core_assessed_mode_ids")
@@ -539,7 +553,7 @@ def _decide(search, events, prepared_events, measurements, indexes, terrain, sta
candidate = refine_candidate(row, tracks, prepared_events, measurements, terrain,
radius_m=config.get("refine_radius_m", 500.0),
recording_start_window_s=start_window, c=config.get("sound_speed_mps", 343.0),
- bounds_wsen=search_bounds)
+ bounds_wsen=search_bounds, crs=profile.crs, **geographic_options)
candidate = _comparable_refinement(candidate, row, prepared_events)
refined.append(candidate)
refined_keys.add(key)
@@ -556,7 +570,8 @@ def _decide(search, events, prepared_events, measurements, indexes, terrain, sta
try:
profiled = profile_candidate(leading, track_sets[mode_key(leading)], prepared_events, measurements, terrain,
radius_m=config.get("refine_radius_m", 500.0), recording_start_window_s=start_window,
- c=config.get("sound_speed_mps", 343.0), bounds_wsen=search_bounds)
+ c=config.get("sound_speed_mps", 343.0), bounds_wsen=search_bounds,
+ crs=profile.crs, **geographic_options)
# Full profiling updates this exact hypothesis. Its earlier, limited
# envelope must not compete with incomplete evidence or score roundoff.
raw[0] = _comparable_refinement(profiled, leading, prepared_events)
diff --git a/src/dopplergeist/cli.py b/src/dopplergeist/cli.py
index b4dbb6a..695f295 100644
--- a/src/dopplergeist/cli.py
+++ b/src/dopplergeist/cli.py
@@ -99,8 +99,10 @@ def main():
analyze.add_argument("--start-utc",help="Earliest UTC recording start, including explicit timezone")
analyze.add_argument("--end-utc",help="Latest UTC recording start; defaults to earliest")
analyze.add_argument("--time-source",help="How the recording start window was established")
+ analyze.add_argument("--country",type=str.upper,choices=("US", "DE"),
+ help="Receiver country: US (CONUS, default) or DE (Germany)")
analyze.add_argument("--bounds",type=float,nargs=4,metavar=("WEST", "SOUTH", "EAST", "NORTH"),
- help="Limit the search to a WGS84 rectangle in decimal degrees")
+ help="Limit the selected country profile to a WGS84 rectangle in decimal degrees")
analyze.add_argument("--jobs",default="jobs",help="Persistent job directory")
analyze.add_argument("--config",help="Operator provider/cache/search configuration JSON")
analyze.add_argument("--online",action="store_true",help="Download public data to the local cache; this can require tens of gigabytes and hours")
@@ -154,6 +156,7 @@ def main():
elif args.command=="analyze":
from .jobs import JobManager
from .contracts import validate_request
+ from .geography import profile_for_search
audio=Path(args.audio)
if not audio.is_file():
parser.error(f"Audio file is unavailable or not a regular file: {audio}")
@@ -168,6 +171,9 @@ def main():
if args.end_utc and not args.start_utc:
parser.error("--end-utc requires --start-utc")
request={"schema_version":1,"search":{"coverage":"conus"}}
+ if args.country is not None:
+ profile=profile_for_search({"country":args.country})
+ request["search"]={"country":profile.country,"coverage":profile.coverage}
if args.bounds is not None:
request["search"]["bounds_wsen"]=args.bounds
if args.start_utc:
diff --git a/src/dopplergeist/contracts.py b/src/dopplergeist/contracts.py
index e4a69b3..364f506 100644
--- a/src/dopplergeist/contracts.py
+++ b/src/dopplergeist/contracts.py
@@ -10,6 +10,8 @@ import math
from pathlib import PurePosixPath
from typing import Literal, NotRequired, TypedDict
+from .geography import profile_for_search
+
class RecordingTimeWindow(TypedDict):
start_utc: str
@@ -19,7 +21,8 @@ class RecordingTimeWindow(TypedDict):
class SearchArea(TypedDict):
- coverage: Literal["conus"]
+ country: NotRequired[Literal["US", "DE"]]
+ coverage: NotRequired[Literal["conus", "germany"]]
bounds_wsen: NotRequired[list[float]]
@@ -168,9 +171,17 @@ def validate_request(value):
if "source_detail" in window:
_text(window["source_detail"], "source_detail")
request["time_window"] = window
- search = _record(request.get("search", {"coverage": "conus"}), ("coverage",), ("bounds_wsen",))
- if search["coverage"] != "conus":
- raise ValueError("Version one supports CONUS coverage; supply bounds_wsen for a CONUS subset")
+ search = _record(request.get("search", {"coverage": "conus"}), (), ("country", "coverage", "bounds_wsen"))
+ if "country" not in search and "coverage" not in search:
+ raise ValueError("Search must specify country or coverage")
+ for name in ("country", "coverage"):
+ if name in search:
+ _text(search[name], name)
+ profile = profile_for_search(search)
+ search["coverage"] = profile.coverage
+ # Keep old saved CONUS requests identical when no country was supplied.
+ if "country" in search:
+ search["country"] = profile.country
if "bounds_wsen" in search:
bounds = search["bounds_wsen"]
if not isinstance(bounds, list) or len(bounds) != 4:
@@ -179,8 +190,10 @@ def validate_request(value):
_number(number, "bounds_wsen", -180 if i % 2 == 0 else -90, 180 if i % 2 == 0 else 90)
if bounds[0] >= bounds[2] or bounds[1] >= bounds[3]:
raise ValueError("Bounds must be increasing; antimeridian crossing is unsupported")
- if not (-125 <= bounds[0] < bounds[2] <= -66 and 24 <= bounds[1] < bounds[3] <= 50):
- raise ValueError("bounds_wsen must stay within CONUS: west -125, south 24, east -66, north 50")
+ west, south, east, north = profile.bounds_wsen
+ if not (west <= bounds[0] < bounds[2] <= east and south <= bounds[1] < bounds[3] <= north):
+ name = "CONUS" if profile.coverage == "conus" else profile.name
+ raise ValueError(f"bounds_wsen must stay within {name}: west {west:g}, south {south:g}, east {east:g}, north {north:g}")
request["search"] = search
return request
diff --git a/src/dopplergeist/data_access.py b/src/dopplergeist/data_access.py
index 47c3a12..4c34f95 100644
--- a/src/dopplergeist/data_access.py
+++ b/src/dopplergeist/data_access.py
@@ -1212,6 +1212,7 @@ def acquire_inputs(request, recording, *, cache_root, index_paths=None, offline=
daily all-type archives once and reuses their disk indexes on later jobs.
"""
from .contracts import utc_timestamp, validate_request, validate_recording
+ from .geography import profile_for_search
request, recording = validate_request(request), validate_recording(recording)
window = request.get("time_window") or recording.get("time_window")
if window is None:
@@ -1233,7 +1234,8 @@ def acquire_inputs(request, recording, *, cache_root, index_paths=None, offline=
raise ValueError("Required emission interval must be ordered")
times = (first, last)
root = Path(cache_root)
- bounds = tuple(request["search"].get("bounds_wsen", CONUS))
+ profile = profile_for_search(request["search"])
+ bounds = tuple(request["search"].get("bounds_wsen", profile.bounds_wsen))
if index_paths:
indexes = [FlightIndex(path) for path in index_paths]
else:
diff --git a/src/dopplergeist/geography.py b/src/dopplergeist/geography.py
new file mode 100644
index 0000000..c9f1a5d
--- /dev/null
+++ b/src/dopplergeist/geography.py
@@ -0,0 +1,208 @@
+"""Supported receiver regions and the pinned BKG Germany land boundary.
+
+Country masks restrict receiver locations, never aircraft trajectories. The US
+profile deliberately retains the historical CONUS rectangle and CRS. Germany
+uses BKG VG250 land geometry in its native ETRS89 / UTM 32N coordinates.
+"""
+from copy import deepcopy
+from dataclasses import dataclass
+import hashlib
+import json
+import math
+import os
+from pathlib import Path
+import tempfile
+from urllib.parse import urlencode
+from urllib.request import Request, urlopen
+
+
+@dataclass(frozen=True)
+class SearchProfile:
+ country: str
+ coverage: str
+ name: str
+ bounds_wsen: tuple[float, float, float, float]
+ crs: str
+
+
+_PROFILES = {
+ "US": SearchProfile("US", "conus", "United States (CONUS)",
+ (-125.0, 24.0, -66.0, 50.0), "EPSG:5070"),
+ "DE": SearchProfile("DE", "germany", "Germany",
+ (5.5, 47.0, 15.5, 55.2), "EPSG:32632"),
+}
+_COVERAGE_COUNTRIES = {p.coverage: code for code, p in _PROFILES.items()}
+
+# WFS metadata advertises the 2025-01-01 product; the returned land object's
+# BEGINN is 2025-04-11. Pin the actual feature, not an assumed download vintage.
+# The digest covers canonical {properties, geometry, crs}, excluding the WFS
+# request timestamp. A server update requires deliberate review of a new pin.
+BKG_BOUNDARY_SHA256 = "b5e9276fe37ca1c0d65b4542a075cc246e97194ed70d3259b0d7900ad944a1d3"
+BKG_BOUNDARY_URL = "https://sgx.geodatenzentrum.de/wfs_vg250?" + urlencode({
+ "service": "WFS", "version": "2.0.0", "request": "GetFeature",
+ "typeNames": "vg250:vg250_sta", "outputFormat": "application/json",
+ "srsName": "EPSG:25832", "CQL_FILTER": "gf=4",
+})
+BKG_LICENSE_URL = "https://www.govdata.de/dl-de/by-2-0"
+BKG_SOURCES_URL = "https://sgx.geodatenzentrum.de/web_public/gdz/datenquellen/datenquellen_vg_nuts.pdf"
+_MAX_BOUNDARY_BYTES = 8 * 1024 * 1024
+
+
+def profile_for_search(search=None):
+ """Resolve one supported profile, rejecting contradictory declarations."""
+ if search is None:
+ search = {}
+ if not isinstance(search, dict):
+ raise ValueError("search must be an object")
+ country = search.get("country")
+ coverage = search.get("coverage")
+ if "country" in search:
+ if not isinstance(country, str) or country.upper() not in _PROFILES:
+ raise ValueError("Supported countries are US (CONUS) and DE (Germany)")
+ country = country.upper()
+ if "coverage" in search and (not isinstance(coverage, str) or coverage not in _COVERAGE_COUNTRIES):
+ raise ValueError("Supported coverage values are conus (US/CONUS) and germany (DE)")
+ if country is None:
+ country = _COVERAGE_COUNTRIES.get(coverage, "US")
+ profile = _PROFILES[country]
+ if coverage is not None and coverage != profile.coverage:
+ raise ValueError(f"Country {country} requires coverage {profile.coverage}")
+ return profile
+
+
+def public_profiles():
+ """Return JSON-safe profiles for the CLI/API/browser, with no local paths."""
+ return [{"country": p.country, "coverage": p.coverage, "name": p.name,
+ "bounds_wsen": list(p.bounds_wsen), "crs": p.crs}
+ for p in _PROFILES.values()]
+
+
+def _canonical_bytes(record):
+ return json.dumps(record, sort_keys=True, separators=(",", ":"), allow_nan=False).encode("utf-8")
+
+
+def _checked_record(record):
+ """Validate the exact recorded BKG feature before constructing a mask."""
+ if not isinstance(record, dict) or set(record) != {"properties", "geometry", "crs"}:
+ raise ValueError("Invalid cached Germany boundary record")
+ digest = hashlib.sha256(_canonical_bytes(record)).hexdigest()
+ if digest != BKG_BOUNDARY_SHA256:
+ raise ValueError("Germany boundary differs from the pinned BKG feature; review the source before updating the cache")
+ return record
+
+
+class ReceiverMask:
+ """A pickle-safe prepared land polygon, in its original projected CRS."""
+
+ def __init__(self, record):
+ record = _checked_record(record)
+ from shapely.geometry import shape
+ geometry = shape(record["geometry"])
+ if geometry.geom_type != "MultiPolygon" or geometry.is_empty or not geometry.is_valid:
+ raise ValueError("BKG Germany boundary is not a valid nonempty MultiPolygon")
+ properties = record["properties"]
+ if (properties.get("gf") != 4 or properties.get("lkz") != "DE"
+ or record["crs"].get("properties", {}).get("name") != "urn:ogc:def:crs:EPSG::25832"):
+ raise ValueError("BKG boundary has an unsupported country, component or CRS")
+ self._identity = {
+ "country": "DE", "coverage": "germany", "search_crs": "EPSG:32632",
+ "source_crs": "EPSG:25832", "boundary_sha256": BKG_BOUNDARY_SHA256,
+ "source_url": BKG_BOUNDARY_URL, "source_layer": "vg250:vg250_sta",
+ "selection": "GF=4 (land)", "source_object_id": properties["objid"],
+ "source_begin": properties["beginn"], "advertised_product_date": "2025-01-01",
+ "attribution": "© BKG 2026, dl-de/by-2-0",
+ "license_url": BKG_LICENSE_URL, "data_sources_url": BKG_SOURCES_URL,
+ "processing": "Unmodified land polygon; receiver coordinates transformed from WGS84 to ETRS89 / UTM 32N",
+ }
+ self._initialize_geometry(geometry)
+
+ def _initialize_geometry(self, geometry):
+ import shapely
+ from pyproj import Transformer
+ self._geometry = geometry
+ shapely.prepare(self._geometry)
+ self._boundary = self._geometry.boundary
+ self._to_native = Transformer.from_crs("EPSG:4326", "EPSG:25832", always_xy=True)
+
+ @property
+ def identity(self):
+ return deepcopy(self._identity)
+
+ def contains(self, lon, lat):
+ """Include the polygon boundary, retaining islands and polygon holes."""
+ import shapely
+ x, y = self._to_native.transform(lon, lat)
+ return shapely.intersects_xy(self._geometry, x, y)
+
+ def boundary_limited(self, lon, lat, radius_m):
+ """Conservatively flag a local sensitivity search that meets the mask.
+
+ One percent covers UTM scale variation across this Germany envelope.
+ This is a truncation flag, not a calibrated geographic error bound.
+ """
+ from shapely.geometry import Point
+ if not math.isfinite(radius_m) or radius_m < 0:
+ raise ValueError("Boundary proximity radius must be finite and nonnegative")
+ x, y = self._to_native.transform(lon, lat)
+ if not math.isfinite(x) or not math.isfinite(y):
+ return True
+ point = Point(x, y)
+ return not self._geometry.covers(point) or self._boundary.distance(point) <= 1.01 * radius_m
+
+ def __getstate__(self):
+ from shapely import to_wkb
+ return {"geometry_wkb": to_wkb(self._geometry), "identity": self._identity}
+
+ def __setstate__(self, state):
+ from shapely import from_wkb
+ self._identity = state["identity"]
+ self._initialize_geometry(from_wkb(state["geometry_wkb"]))
+
+
+def receiver_mask_for_search(search, *, cache_root, offline=True):
+ """Load the pinned Germany polygon, acquiring it only when online is allowed.
+
+ No boundary is inferred from a rectangular envelope or a failed download.
+ Existing cache bytes are checked each time; missing or changed data produce
+ an explicit data-unavailable outcome through the acquisition adapter.
+ """
+ if profile_for_search(search).country == "US":
+ return None
+ from .data_access import DataUnavailable
+ path = Path(cache_root) / "geography" / f"de-vg250-{BKG_BOUNDARY_SHA256[:16]}.json"
+ try:
+ if path.exists():
+ with path.open("rb") as handle:
+ data = handle.read(_MAX_BOUNDARY_BYTES + 1)
+ if len(data) > _MAX_BOUNDARY_BYTES:
+ raise ValueError("Cached Germany boundary exceeds the size limit")
+ return ReceiverMask(json.loads(data))
+ if offline:
+ raise DataUnavailable(f"Germany receiver boundary is not cached at {path}; enable online acquisition once to obtain the pinned BKG land mask")
+ request = Request(BKG_BOUNDARY_URL, headers={"User-Agent": "DOPPLERGEIST/0.1 country-boundary"})
+ with urlopen(request, timeout=60) as response:
+ raw = response.read(_MAX_BOUNDARY_BYTES + 1)
+ if len(raw) > _MAX_BOUNDARY_BYTES:
+ raise ValueError("BKG Germany boundary exceeds the download limit")
+ collection = json.loads(raw)
+ features = collection.get("features", [])
+ if collection.get("type") != "FeatureCollection" or len(features) != 1:
+ raise ValueError("Expected exactly one BKG Germany land feature")
+ feature = features[0]
+ record = {"properties": feature["properties"], "geometry": feature["geometry"], "crs": collection["crs"]}
+ mask = ReceiverMask(record)
+ path.parent.mkdir(parents=True, exist_ok=True)
+ temporary = None
+ try:
+ with tempfile.NamedTemporaryFile(dir=path.parent, prefix=path.name + ".", suffix=".tmp", delete=False) as handle:
+ temporary = Path(handle.name)
+ handle.write(_canonical_bytes(record))
+ os.replace(temporary, path)
+ finally:
+ if temporary is not None:
+ temporary.unlink(missing_ok=True)
+ return mask
+ except DataUnavailable:
+ raise
+ except (OSError, ValueError, KeyError, TypeError) as error:
+ raise DataUnavailable(f"Germany receiver boundary unavailable: {error}") from error
diff --git a/src/dopplergeist/index_compatibility.py b/src/dopplergeist/index_compatibility.py
index 1ad24ba..49d1de0 100644
--- a/src/dopplergeist/index_compatibility.py
+++ b/src/dopplergeist/index_compatibility.py
@@ -3,6 +3,17 @@
# The cache-size-only change and this exact compatibility check do not change
# decoded observations or normalization. Any source edit disables this mapping.
PREPARED_DATA_ACCESS_EQUIVALENCE = {
+ # Country selection changes only acquisition bounds and optional row warming;
+ # prepared observation decoding and normalization are unchanged.
+ "23aa4ac1781cb5be921f5243f421886d2f2e549a4ded6dcc1986ade651883f7e": (
+ "d88c4be6668b92c9a1a31b5cd0b4dbdcb3d7cf73c5891ae414f44deca6088644",
+ "77da0d39e1e95476fdf02e29e9a345914545af7e62227a93b4cb6786edb37a71",
+ "ddd77e9734fff6a70cc9195bd1305002f9f78e39ea601f27e0f596dcb336033a",
+ "275e38a37f82993b609b6b78c113d35c4da269083ceb3afcb1d94ada48bdc0d4",
+ "dad02d09d89ad9d267cd8d0424b8e018d0399a28d6b43903b5a55867290b3957",
+ "d664caf4b496599d29a81360c4a9d9736a3248c157e71d885463b349aad6dd36",
+ "ce78ad66f2d478e1f7ea158ea04c0d3b25021339e34f090652740fe55e46e5ec",
+ ),
# Component hashing and exact geometry-source lookup preserve normalization.
"d88c4be6668b92c9a1a31b5cd0b4dbdcb3d7cf73c5891ae414f44deca6088644": (
"77da0d39e1e95476fdf02e29e9a345914545af7e62227a93b4cb6786edb37a71",
diff --git a/src/dopplergeist/matching.py b/src/dopplergeist/matching.py
index d6e9dec..c33d6c5 100644
--- a/src/dopplergeist/matching.py
+++ b/src/dopplergeist/matching.py
@@ -736,7 +736,7 @@ def _geographic_refinement_frame(candidate, radius_m, bounds_wsen):
def refine_candidate(candidate, tracks, events, measurements, terrain, radius_m=500.0,
clock_radius_s=5.0, altitude_offsets_m=(-150.0, 0.0, 150.0),
crs="EPSG:5070", c=343.0, recording_start_window_s=None,
- bounds_wsen=None):
+ bounds_wsen=None, receiver_mask=None):
"""Jointly refine position/shared clock and profile vertical-datum sensitivity.
A vertical offset changes the observer-to-track relative height; it is a
@@ -747,14 +747,17 @@ def refine_candidate(candidate, tracks, events, measurements, terrain, radius_m=
return _refine_candidate(candidate, tracks, events, measurements, terrain,
radius_m=radius_m, clock_radius_s=clock_radius_s,
altitude_offsets_m=altitude_offsets_m, crs=crs, c=c,
- recording_start_window_s=recording_start_window_s, bounds_wsen=bounds_wsen)
+ recording_start_window_s=recording_start_window_s, bounds_wsen=bounds_wsen,
+ receiver_mask=receiver_mask)
def _refine_candidate(candidate, tracks, events, measurements, terrain, radius_m=500.0,
clock_radius_s=5.0, altitude_offsets_m=(-150.0, 0.0, 150.0),
crs="EPSG:5070", c=343.0, recording_start_window_s=None,
- bounds_wsen=None, *, _transformers=None):
+ bounds_wsen=None, receiver_mask=None, *, _transformers=None):
"""Share coordinate operations only within one declared sensitivity profile."""
+ if receiver_mask is not None and not receiver_mask.contains(candidate["lon"], candidate["lat"]):
+ raise ValueError("Refinement seed lies outside the receiver-country mask")
if _transformers is None:
forward = Transformer.from_crs("EPSG:4326", crs, always_xy=True)
inverse = Transformer.from_crs(crs, "EPSG:4326", always_xy=True)
@@ -798,6 +801,10 @@ def _refine_candidate(candidate, tracks, events, measurements, terrain, radius_m
# Clip only roundoff at the closed geographic boundary.
lon = float(np.clip(lon0 + parameters[0]/lon_scale, west, east))
lat = float(np.clip(lat0 + parameters[1]/lat_scale, south, north))
+ # A country boundary restricts receiver locations, including every
+ # sensitivity scenario. Never sample or score a foreign receiver.
+ if receiver_mask is not None and not receiver_mask.contains(lon, lat):
+ return {"score": -np.inf}, lat, lon, np.nan
elevation = float(np.asarray(terrain.sample(lat, lon)))
score = score_ridges(selected, events, measurements, ecef(lat, lon, elevation + offset),
start + dt, c)
@@ -809,13 +816,25 @@ def _refine_candidate(candidate, tracks, events, measurements, terrain, radius_m
return -value if np.isfinite(value) else 1e6
result = minimize(objective, initial, method="Powell", bounds=bounds,
options={"xtol": 0.01, "ftol": 1e-7, "maxiter": 60})
- parameters = result.x if objective(result.x) < objective(initial) else initial
- score, lat, lon, elevation = evaluate(parameters)
+ if receiver_mask is None:
+ parameters = result.x if objective(result.x) < objective(initial) else initial
+ score, lat, lon, elevation = evaluate(parameters)
+ else:
+ # A finite optimization penalty must not make an inadmissible
+ # border proposal preferable to a valid, low-scoring incumbent.
+ initial_fit, optimized_fit = evaluate(initial), evaluate(result.x)
+ improves = (np.isfinite(optimized_fit[0]["score"])
+ and (not np.isfinite(initial_fit[0]["score"])
+ or optimized_fit[0]["score"] > initial_fit[0]["score"]))
+ parameters = result.x if improves else initial
+ score, lat, lon, elevation = optimized_fit if improves else initial_fit
if not np.isfinite(score["score"]):
continue
dt = lower if fixed_clock else parameters[2]
spatial_boundary = any(min(value-lo, hi-value) <= radius_m * 0.02
for value, (lo, hi) in zip(parameters[:2], bounds[:2]))
+ if receiver_mask is not None:
+ spatial_boundary |= bool(receiver_mask.boundary_limited(lon, lat, radius_m))
clock_boundary = bool(not fixed_clock and min(dt-lower, upper-dt) <= (upper-lower)*0.02)
profiles.append(dict(score, lat=lat, lon=lon, elev_m=elevation,
recording_start_time_s=float(start + dt), altitude_offset_m=float(offset),
@@ -844,7 +863,7 @@ _CANONICAL_REFINE_CANDIDATE = refine_candidate
def profile_candidate(candidate, tracks, events, measurements, terrain, *,
recording_start_window_s=None, radius_m=500.0, clock_radius_s=5.0,
altitude_uncertainty_m=150.0, sound_speed_uncertainty_mps=5.0,
- c=343.0, crs="EPSG:5070", bounds_wsen=None):
+ c=343.0, crs="EPSG:5070", bounds_wsen=None, receiver_mask=None):
"""Run declared perturbations, retaining failures and boundary limitations.
These finite engineering scenarios are not a calibrated confidence region.
@@ -857,6 +876,8 @@ def profile_candidate(candidate, tracks, events, measurements, terrain, *,
kwargs = dict(radius_m=radius_m, clock_radius_s=clock_radius_s,
altitude_offsets_m=(0.0,), crs=crs, c=c,
recording_start_window_s=recording_start_window_s, bounds_wsen=bounds_wsen)
+ if receiver_mask is not None:
+ kwargs["receiver_mask"] = receiver_mask
transformers = None
def refine(*args, **options):
diff --git a/src/dopplergeist/parallel_tiles.py b/src/dopplergeist/parallel_tiles.py
index eaf13a9..93e5e62 100644
--- a/src/dopplergeist/parallel_tiles.py
+++ b/src/dopplergeist/parallel_tiles.py
@@ -111,7 +111,7 @@ _worker = None
def initialize_tile_worker(index_paths, terrain_root, terrain_options, events, measurements,
bounds, time_range, budget, parameters, filters, start_window,
- crs, ledger_directory, run_hash, score_kind, terrain_kind="cached"):
+ crs, ledger_directory, run_hash, score_kind, terrain_kind="cached", receiver_mask=None):
"""Initialize read-only indexes and reusable terrain state inside one worker."""
global _worker
if terrain_kind == "cached":
@@ -135,6 +135,7 @@ def initialize_tile_worker(index_paths, terrain_root, terrain_options, events, m
"filters": filters, "start_window": start_window, "crs": crs,
"ledger_directory": Path(ledger_directory), "run_hash": run_hash,
"score_kind": score_kind,
+ "receiver_mask": receiver_mask,
}
_worker["ledger_directory"].mkdir(parents=True, exist_ok=True)
@@ -160,7 +161,7 @@ def score_tile(stage, cells, score_floor=None):
try:
radius = max(event["slant_range_m"][1] for event in state["events"])
- points = _tile_coordinates(cells, budget.spacing_m, state["bounds"], state["crs"])
+ points = _tile_coordinates(cells, budget.spacing_m, state["bounds"], state["crs"], state.get("receiver_mask"))
tracks = []
anchor = _tile_anchor_window(stage.removeprefix("coarse:"), state["start_window"],
state["parameters"], state["filters"], state["events"])
@@ -237,7 +238,7 @@ def score_fine_tile(stage, cells, spacing, exclusions, score_floor=None):
"terrain_failures": getattr(terrain, "failures", [])[failures_before:]}
try:
- points = tile_points(cells, spacing, state["bounds"], terrain, state["crs"])
+ points = tile_points(cells, spacing, state["bounds"], terrain, state["crs"], state.get("receiver_mask"))
keep = np.ones(len(points), dtype=bool)
for left, bottom, right, top in exclusions:
keep &= ~((points.x >= left * spacing) & (points.x < right * spacing)
diff --git a/src/dopplergeist/pipeline.py b/src/dopplergeist/pipeline.py
index 1700e9c..cea2b71 100644
--- a/src/dopplergeist/pipeline.py
+++ b/src/dopplergeist/pipeline.py
@@ -169,6 +169,33 @@ def run(config_path,output_dir):
p=Path(path)
return p if p.is_absolute() else config_path.parent/p
audio=local(config["audio"])
+ grid=config.get("grid",{})
+ bounds=grid.get("bounds")
+ crs=grid.get("crs","EPSG:5070")
+ profile=receiver_mask=None
+ if "country" in config or "search" in config:
+ from .contracts import validate_request
+ from .geography import profile_for_search,receiver_mask_for_search
+ area=config.get("search",{})
+ if not isinstance(area,dict):
+ raise ValueError("Research search must be a country/coverage object")
+ area=dict(area)
+ if "country" in config:
+ if "country" in area and area["country"]!=config["country"]:
+ raise ValueError("Research country and search.country disagree")
+ area["country"]=config["country"]
+ if bounds is not None:
+ if "bounds_wsen" in area and area["bounds_wsen"]!=bounds:
+ raise ValueError("Research grid.bounds and search.bounds_wsen disagree")
+ area["bounds_wsen"]=bounds
+ area=validate_request({"schema_version":1,"audio_path":str(audio),"search":area})["search"]
+ profile=profile_for_search(area)
+ if "crs" in grid and grid["crs"]!=profile.crs:
+ raise ValueError("Research grid.crs must match the selected country profile")
+ bounds=area.get("bounds_wsen",profile.bounds_wsen)
+ crs=profile.crs
+ receiver_mask=receiver_mask_for_search(area,
+ cache_root=local(config.get("cache_root",output/"cache")),offline=config.get("offline",True))
measurements=[]
events=[]
for i,settings in enumerate(config["events"]):
@@ -191,7 +218,6 @@ def run(config_path,output_dir):
tracks=[]
imports=[]
origin=unix_time(config["recording_start_utc"]) if config.get("recording_start_utc") is not None else None
- bounds=config.get("grid",{}).get("bounds")
track_bounds=None
if bounds:
# Preserve enough pre/post-event trajectory to model the entire audible
@@ -214,10 +240,8 @@ def run(config_path,output_dir):
geoid=local(ground["geoid_raster"]) if ground.get("geoid_raster") else None
terrain=(CopernicusTerrain(local(ground["copernicus_cache"]),geoid) if ground.get("copernicus_cache") else
Terrain([local(p) for p in ground.get("rasters",[])],ground.get("constant_m"),geoid))
- grid=config.get("grid",{})
coarse=grid.get("spacing_m",200)
- crs=grid.get("crs","EPSG:5070")
- points=corridor_grid(tracks,events,coarse,terrain,crs,grid.get("bounds"),origin)
+ points=corridor_grid(tracks,events,coarse,terrain,crs,bounds,origin,receiver_mask)
print(f"Grid: {len(points)} points; {len(tracks)} trajectory segments",flush=True)
radius=max(event["slant_range_m"][1] for event in events)
c=config.get("sound_speed_mps",343.0)
@@ -280,7 +304,8 @@ def run(config_path,output_dir):
fine=grid.get("scoring_spacing_m",100)
if candidates and fine<coarse:
ids={candidate["point_id"] for candidate in candidates}
- points=refine_grid(points[points.point_id.isin(ids)],coarse,fine,terrain,crs)
+ points=refine_grid(points[points.point_id.isin(ids)],coarse,fine,terrain,crs,
+ bounds=bounds,receiver_mask=receiver_mask)
candidates,fine_counts=select(points,"scoring-cpa")
else:
fine_counts=counts
@@ -320,7 +345,7 @@ def run(config_path,output_dir):
final_spacing=grid.get("refine_spacing_m",25)
if chosen and final_spacing<fine:
seeds=pd.DataFrame(chosen)
- points2=refine_grid(seeds,fine,final_spacing,terrain,crs)
+ points2=refine_grid(seeds,fine,final_spacing,terrain,crs,bounds=bounds,receiver_mask=receiver_mask)
candidates2,refined_counts=select(points2,"refinement-cpa")
ranked2=rank(candidates2,points2,"refinement-scoring")
ranked=sorted(ranked+ranked2,key=lambda r:r["score"],reverse=True)
@@ -346,6 +371,11 @@ def run(config_path,output_dir):
"Legacy brightness/ridge scores do not report exhaustive clock-trial assessment."],
"elapsed_s":time.monotonic()-began,
"scoring_time_is_locked":True}
+ if profile is not None:
+ report["search_geography"]={"country":profile.country,"coverage":profile.coverage,
+ "bounds_wsen":list(bounds),"crs":crs}
+ if receiver_mask is not None:
+ report["search_geography"]["receiver_mask"]=receiver_mask.identity
dump(output/"report.json",report)
if ranked:
plot_results(output,ranked,tracks,measurements,c)
diff --git a/src/dopplergeist/service.py b/src/dopplergeist/service.py
index 888d240..7a8521b 100644
--- a/src/dopplergeist/service.py
+++ b/src/dopplergeist/service.py
@@ -6,6 +6,7 @@ from importlib.resources import files
from pathlib import Path
from urllib.parse import unquote, urlsplit
+from .geography import public_profiles
from .jobs import JobManager
_EXCLUDED_ARTIFACTS = {"operator.json", "cancel", ".control.lock"}
@@ -49,6 +50,7 @@ class Handler(BaseHTTPRequestHandler):
manager = self.server.manager
if self.command == "GET" and parts == ["api", "capabilities"]:
return self._reply({"schema_version": 1, "coverage": "conus", "max_upload_bytes": manager.max_upload_bytes,
+ "default_country": "US", "countries": public_profiles(),
"max_runtime_s": manager.max_runtime_s, "max_pending": manager.max_pending,
"provider_configured": bool(manager.config.get("cache_root") or manager.config.get("flight_indexes")),
"online_enabled": not bool(manager.config.get("offline", True))})
diff --git a/src/dopplergeist/terrain.py b/src/dopplergeist/terrain.py
index dac01d3..682d38b 100644
--- a/src/dopplergeist/terrain.py
+++ b/src/dopplergeist/terrain.py
@@ -192,7 +192,8 @@ class CopernicusTerrain:
return height.reshape(shape)
-def corridor_grid(tracks, events, spacing_m, terrain, crs="EPSG:5070", bounds=None, time_origin=None):
+def corridor_grid(tracks, events, spacing_m, terrain, crs="EPSG:5070", bounds=None, time_origin=None,
+ receiver_mask=None):
"""Only materialize grid cells near plausible aircraft segments.
Coordinates use one shared CRS and grid origin, so overlapping flight corridors
@@ -224,8 +225,8 @@ def corridor_grid(tracks, events, spacing_m, terrain, crs="EPSG:5070", bounds=No
lon = np.interp(t, track.time, track.lon)
x, y = forward.transform(lon, lat)
anchors = np.unique(np.round(np.column_stack((x, y)) / spacing_m).astype(np.int64), axis=0)
- # EPSG:5070 grid scale is close to unity over CONUS; 10% padding
- # plus an anchor gap protects corridor coverage under distortion.
+ # Padding includes an anchor gap and projection distortion over the
+ # supported search regions. It applies to complete aircraft tracks.
pad = radius * 1.45 + spacing_m
if clipbox:
left,bottom,right,top=clipbox
@@ -256,18 +257,29 @@ def corridor_grid(tracks, events, spacing_m, terrain, crs="EPSG:5070", bounds=No
west, south, east, north = bounds
keep = (lon >= west) & (lon <= east) & (lat >= south) & (lat <= north)
x, y, lon, lat = (a[keep] for a in (x,y,lon,lat))
- height = terrain.sample(lat,lon)
+ if receiver_mask is not None:
+ keep = receiver_mask.contains(lon, lat)
+ x, y, lon, lat = (a[keep] for a in (x, y, lon, lat))
+ height = terrain.sample(lat,lon) if len(lat) else np.array([])
import pandas as pd
return pd.DataFrame({"point_id": np.arange(len(x)), "x":x, "y":y, "lat":lat, "lon":lon, "elev_m":height})
-def refine_grid(points, coarse_spacing, fine_spacing, terrain, crs="EPSG:5070"):
+def refine_grid(points, coarse_spacing, fine_spacing, terrain, crs="EPSG:5070", *,
+ bounds=None, receiver_mask=None):
inverse = Transformer.from_crs(crs, "EPSG:4326", always_xy=True)
radius = int(np.ceil(coarse_spacing / fine_spacing))
dx, dy = np.meshgrid(np.arange(-radius,radius+1),np.arange(-radius,radius+1))
offsets = np.column_stack((dx.ravel(),dy.ravel())) * fine_spacing
coords = np.unique(np.concatenate([np.array([r.x,r.y])+offsets for r in points.itertuples()]),axis=0)
lon,lat = inverse.transform(coords[:,0],coords[:,1])
+ keep = np.ones(len(coords), dtype=bool)
+ if bounds is not None:
+ west, south, east, north = bounds
+ keep &= (lon >= west) & (lon <= east) & (lat >= south) & (lat <= north)
+ if receiver_mask is not None:
+ keep &= receiver_mask.contains(lon, lat)
+ coords, lon, lat = coords[keep], lon[keep], lat[keep]
import pandas as pd
return pd.DataFrame({"point_id":np.arange(len(coords)),"x":coords[:,0],"y":coords[:,1],
- "lat":lat,"lon":lon,"elev_m":terrain.sample(lat,lon)})
+ "lat":lat,"lon":lon,"elev_m":terrain.sample(lat,lon) if len(lat) else np.array([])})
diff --git a/src/dopplergeist/tiled_search.py b/src/dopplergeist/tiled_search.py
index a031421..2ba3309 100644
--- a/src/dopplergeist/tiled_search.py
+++ b/src/dopplergeist/tiled_search.py
@@ -198,12 +198,14 @@ def _to_geographic(crs):
return _cached_to_geographic(crs)
-def _tile_coordinates(cells, spacing, bounds, crs):
+def _tile_coordinates(cells, spacing, bounds, crs, receiver_mask=None):
x0, y0, x1, y1 = cells
x, y = np.meshgrid(np.arange(x0, x1, dtype=np.int64), np.arange(y0, y1, dtype=np.int64))
x, y = x.ravel() * spacing, y.ravel() * spacing
lon, lat = _to_geographic(crs).transform(x, y)
keep = (lon >= bounds[0]) & (lon <= bounds[2]) & (lat >= bounds[1]) & (lat <= bounds[3])
+ if receiver_mask is not None:
+ keep &= receiver_mask.contains(lon, lat)
x, y, lat, lon = (a[keep] for a in (x, y, lat, lon))
return pd.DataFrame({"point_id": np.arange(len(x)), "x": x, "y": y, "lat": lat, "lon": lon})
@@ -235,14 +237,15 @@ def _tile_dem_keys(cells, spacing, bounds, crs, catalog):
return tuple(keys)
-def tile_points(cells, spacing, bounds, terrain, crs):
- return _sample_tile_terrain(_tile_coordinates(cells, spacing, bounds, crs), terrain)
+def tile_points(cells, spacing, bounds, terrain, crs, receiver_mask=None):
+ return _sample_tile_terrain(_tile_coordinates(cells, spacing, bounds, crs, receiver_mask), terrain)
def _expanded_bounds(cells, spacing, radius, crs):
x0, y0, x1, y1 = cells
# Padding includes sound range, spline excursions between gap-limited track
- # samples and CONUS projection distortion. Full payloads remain unmodified.
+ # samples and supported projection distortion. Full payloads remain unmodified;
+ # receiver-country masks must never clip this aircraft query envelope.
margin = 1.6 * radius + 15000
box = (x0 * spacing - margin, y0 * spacing - margin, x1 * spacing + margin, y1 * spacing + margin)
return _to_geographic(crs).transform_bounds(*box, densify_pts=101)
@@ -851,7 +854,7 @@ def _record_support(output, stage, counts, summary):
def search_national(indexes, terrain, events, measurements, *, time_range_s, output_dir,
bounds=CONUS, budget=None, scoring=None, filters=None, crs="EPSG:5070", input_hashes=None,
- workers=None, search_progress=None):
+ workers=None, search_progress=None, receiver_mask=None):
"""Bounded outer driver using existing physical CPA/locked-event scoring.
`events, measurements` come from `matching.prepare_events`. `time_range_s`
@@ -963,6 +966,9 @@ def search_national(indexes, terrain, events, measurements, *, time_range_s, out
"budget": asdict(budget), "scoring": scoring or {}, "filters": filters, "crs": crs, "code": modules,
"coarse_floor_policy": floor_policy,
"runtime": runtime_identity}
+ if receiver_mask is not None:
+ identity["receiver_mask"] = receiver_mask.identity
+ runtime_identity["packages"]["shapely"] = version("shapely")
run_hash = content_hash(identity)
if manifest.exists() and json.loads(manifest.read_text())["run_hash"] != run_hash:
raise DataUnavailable("Checkpoint configuration/input/implementation mismatch; use a new output directory")
@@ -1096,6 +1102,8 @@ def search_national(indexes, terrain, events, measurements, *, time_range_s, out
initargs = ([index.path for index in indexes], terrain_root, terrain_options, events, measurements,
bounds, time_range_s, budget, parameters, filters, start_window, crs,
output / ".tile-workers", run_hash, score_kind, terrain_kind)
+ if receiver_mask is not None:
+ initargs += (receiver_mask,)
context = tile_worker_lanes(workers, initialize_tile_worker, initargs, dem_keys)
else:
context = nullcontext(None)
@@ -1156,7 +1164,7 @@ def search_national(indexes, terrain, events, measurements, *, time_range_s, out
resumed += 1
restore_terrain(payload)
else:
- points = _tile_coordinates(cells, budget.spacing_m, bounds, crs)
+ points = _tile_coordinates(cells, budget.spacing_m, bounds, crs, receiver_mask)
tracks = []
anchor = _tile_anchor_window(tile_id, start_window, parameters, filters, events)
query_time = _partition_query_time_range(time_range_s, events, parameters, filters, anchor)
@@ -1333,7 +1341,7 @@ def search_national(indexes, terrain, events, measurements, *, time_range_s, out
payload = fine_checkpoint(stage, cells, completed_rectangles, floor)
if payload is None:
failures_before = len(getattr(terrain, "failures", ()))
- points = tile_points(cells, fine, bounds, terrain, crs)
+ points = tile_points(cells, fine, bounds, terrain, crs, receiver_mask)
keep = np.ones(len(points), dtype=bool)
for left, bottom, right, top in completed_rectangles:
keep &= ~((points.x >= left * fine) & (points.x < right * fine)
@@ -1381,7 +1389,7 @@ def search_national(indexes, terrain, events, measurements, *, time_range_s, out
coverage = [i.coverage_for(bounds, time_range_s) for i in indexes]
# Aircraft outside the receiver rectangle can still be audible inside it.
# Use a conservative geographic envelope for scope accounting as well as
- # expanded per-tile queries; cropped CONUS inputs have visible border gaps.
+ # expanded per-tile queries; country-cropped inputs have visible border gaps.
angular = (1.6 * radius + 15000) / 110000
lon_margin = angular / max(0.1, math.cos(math.radians(max(abs(bounds[1]), abs(bounds[3])))))
flight_bounds = [max(-180, bounds[0] - lon_margin), max(-90, bounds[1] - angular),
@@ -1441,6 +1449,9 @@ def search_national(indexes, terrain, events, measurements, *, time_range_s, out
"elapsed_s": time.monotonic() - began, "process_peak_rss_mib": process_peak_rss_kib() / 1024,
"bounded_concurrency": workers if parallel else 1, "max_grid_points_per_tile": budget.tile_cells ** 2,
"scoring_time_is_locked": True, "ground_truth_used_by_search": False, "scope": list(bounds)}
+ if receiver_mask is not None:
+ report["receiver_mask"] = receiver_mask.identity
+ report["crs"] = crs
write_json(output / "search-report.json", report)
report_search_progress(1.0, force=True)
return report
diff --git a/src/dopplergeist/web/app.js b/src/dopplergeist/web/app.js
index 7330d47..6c28b4b 100644
--- a/src/dopplergeist/web/app.js
+++ b/src/dopplergeist/web/app.js
@@ -3,6 +3,65 @@ const $ = id => document.getElementById(id);
const terminal = new Set(['needs_input', 'succeeded', 'inconclusive', 'failed', 'cancelled']);
let activeJob = null, renderedJob = null, timer = null, maxBytes = 100 * 1024 * 1024;
const node = (tag, text, cls) => { const n = document.createElement(tag); if (text !== undefined) n.textContent = text; if (cls) n.className = cls; return n; };
+// Older services and unavailable capability responses expose only legacy CONUS.
+const CONUS_PROFILE = {country: 'US', coverage: 'conus', name: 'Contiguous United States (CONUS)', bounds_wsen: [-125, 24, -66, 50]};
+let countryProfiles = [CONUS_PROFILE], areaControl = null, countrySelectionSupported = false;
+const BOUND_INPUTS = ['bbox-w', 'bbox-s', 'bbox-e', 'bbox-n'];
+
+function selectedProfile() {
+ const profile = countryProfiles.find(item => item.country === $('country').value);
+ if (!profile) throw new Error('Choose a country supported by this service.');
+ return profile;
+}
+
+function setCountryProfiles(values, defaultCountry = 'US') {
+ const profiles = values === undefined ? [CONUS_PROFILE] : values;
+ const countries = new Set();
+ if (!Array.isArray(profiles) || !profiles.length || profiles.some(profile => {
+ if (!profile || !/^[A-Z]{2}$/.test(profile.country) || typeof profile.coverage !== 'string' || !profile.coverage
+ || typeof profile.name !== 'string' || !profile.name.trim() || countries.has(profile.country)) return true;
+ countries.add(profile.country);
+ const b = profile.bounds_wsen;
+ return !Array.isArray(b) || b.length !== 4 || b.some(value => !Number.isFinite(value))
+ || !(-180 <= b[0] && b[0] < b[2] && b[2] <= 180 && -90 <= b[1] && b[1] < b[3] && b[3] <= 90);
+ })) throw new Error('The service returned an invalid country catalog.');
+ const previous = countryProfiles.find(profile => profile.country === $('country').value);
+ countryProfiles = profiles.map(profile => ({...profile, bounds_wsen: profile.bounds_wsen.slice()}));
+ countrySelectionSupported = values !== undefined;
+ $('country').replaceChildren(...countryProfiles.map(profile => {
+ const option = node('option', profile.name); option.value = profile.country; return option;
+ }));
+ $('country').value = countries.has(previous?.country) ? previous.country
+ : (countries.has(defaultCountry) ? defaultCountry : countryProfiles[0].country);
+ const current = selectedProfile();
+ const changed = !previous || previous.country !== current.country
+ || previous.bounds_wsen.some((value, index) => value !== current.bounds_wsen[index]);
+ if (areaControl) areaControl.refreshCountry(changed);
+ $('supported-areas').textContent = countryProfiles.map(profile => profile.name).join('; ');
+ if (renderedJob) renderCoverage(renderedJob.coverage);
+}
+
+function renderCoverage(coverage) {
+ $('coverage').replaceChildren();
+ if (!coverage) return;
+ const card = node('div', undefined, 'candidate');
+ card.append(node('strong', 'Search & data coverage'));
+ const area = coverage.requested_area || {coverage: 'conus'};
+ const profile = countryProfiles.find(item => (!area.country || item.country === area.country)
+ && (!area.coverage || item.coverage === area.coverage));
+ const name = profile?.name || ({US: CONUS_PROFILE.name, DE: 'Germany'})[area.country]
+ || ({conus: CONUS_PROFILE.name, germany: 'Germany'})[area.coverage] || area.country || area.coverage || 'unspecified';
+ const bounds = area.bounds_wsen;
+ const full = bounds && profile && bounds.every((value, index) => value === profile.bounds_wsen[index]);
+ const label = bounds && !full
+ ? `Requested ${name} bounds (west, south, east, north): ${bounds.map(value => typeof value === 'number' ? value.toFixed(6) : value).join(', ')}`
+ : `Requested area: ${name}`;
+ card.append(node('p', label));
+ card.append(node('p', `Search ${coverage.search_complete ? 'complete' : 'incomplete'} · Data ${coverage.data_status}`));
+ for (const limitation of coverage.limitations || []) card.append(node('p', limitation));
+ if (coverage.missing_data?.length) card.append(node('p', `Missing: ${coverage.missing_data.join('; ')}`));
+ $('coverage').append(card);
+}
async function api(path, options) {
const response = await fetch(path, options);
const value = await response.json();
@@ -57,22 +116,7 @@ function render(value) {
$('required').hidden = !value.required_fields?.length;
$('required').textContent = value.required_fields?.length ? `Required input: ${value.required_fields.join(', ')}. Add the evidence to a new analysis; this run is preserved.` : '';
$('guidance').replaceChildren(); $('guidance').hidden = true;
- $('coverage').replaceChildren();
- if (value.coverage) {
- const coverage = value.coverage;
- const card = node('div', undefined, 'candidate');
- card.append(node('strong', 'Search & data coverage'));
- const bounds = coverage.requested_area?.bounds_wsen;
- const isFullConus = bounds && bounds[0] === -125 && bounds[1] === 24 && bounds[2] === -66 && bounds[3] === 50;
- const boundsLabel = bounds
- ? (isFullConus ? 'Requested area: Contiguous United States (CONUS)' : `Requested CONUS subset (west, south, east, north): ${bounds.map(x => typeof x === 'number' ? x.toFixed(6) : x).join(', ')}`)
- : 'Requested area: Contiguous United States (CONUS)';
- card.append(node('p', boundsLabel));
- card.append(node('p', `Search ${coverage.search_complete ? 'complete' : 'incomplete'} · Data ${coverage.data_status}`));
- for (const limitation of coverage.limitations || []) card.append(node('p', limitation));
- if (coverage.missing_data?.length) card.append(node('p', `Missing: ${coverage.missing_data.join('; ')}`));
- $('coverage').append(card);
- }
+ renderCoverage(value.coverage);
$('candidates').replaceChildren();
if (value.candidates?.length) {
$('candidates').append(node('h3', value.status === 'succeeded' ? 'Supported location & alternatives' : 'Location hypotheses · result remains inconclusive'));
@@ -168,7 +212,9 @@ $('upload-form').addEventListener('submit', async event => {
let bounds;
try { bounds = readSearchBounds(); }
catch (error) { $('upload-error').textContent = error.message; return; }
- const request = {schema_version: 1, search: {coverage: 'conus', bounds_wsen: bounds}};
+ const profile = selectedProfile();
+ const request = {schema_version: 1, search: {coverage: profile.coverage, bounds_wsen: bounds}};
+ if (countrySelectionSupported) request.search.country = profile.country;
if (start) {
request.time_window = {start_utc: start + 'Z', end_utc: (end || start) + 'Z', source: 'user'};
if ($('time-source').value.trim()) request.time_window.source_detail = $('time-source').value.trim();
@@ -191,6 +237,7 @@ $('resume').addEventListener('click', async () => {
catch (error) { $('connection').textContent = error.message; }
});
api('/api/capabilities').then(value => {
+ setCountryProfiles(value.countries, value.default_country);
maxBytes = value.max_upload_bytes;
$('limits').textContent = `Up to ${(maxBytes / 1024 / 1024).toFixed(0)} MB per file. Analysis budget: ${(value.max_runtime_s / 60).toFixed(0)} minutes per job.`;
if (value.provider_configured === false) {
@@ -200,15 +247,14 @@ api('/api/capabilities').then(value => {
$('data-setup').textContent = 'Public flight and terrain data may be downloaded to the local cache. Archives and indexes can require tens of gigabytes or more and hours.';
$('data-setup').hidden = false;
}
-}).catch(error => { $('upload-error').textContent = error.message; });
+}).catch(error => {
+ setCountryProfiles(undefined);
+ $('upload-error').textContent = `Could not read service settings: ${error.message}. Only CONUS is available.`;
+});
renderRecent();
const savedJob = new URLSearchParams(location.search).get('job');
if (savedJob && /^[0-9a-f]{32}$/.test(savedJob)) selectJob(savedJob);
-// The automatic pipeline currently supports CONUS and explicit subsets of it.
-const CONUS_BOUNDS = [-125, 24, -66, 50];
-const BOUND_INPUTS = ['bbox-w', 'bbox-s', 'bbox-e', 'bbox-n'];
-
function validateSearchBounds(bounds) {
if (bounds.length !== 4 || bounds.some(value => !Number.isFinite(value))) {
throw new Error('Enter all four search coordinates as finite numbers.');
@@ -217,8 +263,10 @@ function validateSearchBounds(bounds) {
if (w >= e || s >= n) {
throw new Error('West must be less than east and south less than north. Antimeridian crossing is unsupported.');
}
- if (w < CONUS_BOUNDS[0] || s < CONUS_BOUNDS[1] || e > CONUS_BOUNDS[2] || n > CONUS_BOUNDS[3]) {
- throw new Error('Choose an area within CONUS: west −125°, south 24°, east −66°, north 50°.');
+ const profile = selectedProfile();
+ const [west, south, east, north] = profile.bounds_wsen;
+ if (w < west || s < south || e > east || n > north) {
+ throw new Error(`Choose an area within ${profile.name}: west ${west}°, south ${south}°, east ${east}°, north ${north}°.`);
}
return bounds;
}
@@ -236,7 +284,7 @@ function boundsMessage(message = '') {
function initMap() {
let map, rectangle, preview, drawOrigin, panStart;
- let selectedBounds = CONUS_BOUNDS.slice();
+ let selectedBounds = selectedProfile().bounds_wsen.slice();
function setBounds(bounds, fit = false, updateInputs = true) {
selectedBounds = validateSearchBounds(bounds.slice());
@@ -253,23 +301,49 @@ function initMap() {
boundsMessage();
}
+ function refreshCountry(reset = true) {
+ const profile = selectedProfile();
+ const [w, s, e, n] = profile.bounds_wsen;
+ BOUND_INPUTS.forEach((id, index) => {
+ $(id).min = String(index % 2 === 0 ? w : s);
+ $(id).max = String(index % 2 === 0 ? e : n);
+ });
+ $('country-help').textContent = `Choose the full ${profile.name} area or a smaller rectangle.`
+ + (profile.country === 'DE' ? ' Only locations within Germany are searched; nearby aircraft across its borders remain eligible.' : '');
+ if (profile.country === 'DE') {
+ const source = node('a', '© BKG 2026'); source.href = 'https://www.bkg.bund.de';
+ const license = node('a', 'dl-de/by-2-0'); license.href = 'https://www.govdata.de/dl-de/by-2-0';
+ for (const link of [source, license]) { link.target = '_blank'; link.rel = 'noopener noreferrer'; }
+ $('country-help').append(' Boundary data: ', source, ', ', license, '.');
+ }
+ if (map) {
+ const dx = Math.max(1, (e - w) * 0.1), dy = Math.max(1, (n - s) * 0.15);
+ map.setMaxBounds([[Math.max(-90, s - dy), Math.max(-180, w - dx)],
+ [Math.min(90, n + dy), Math.min(180, e + dx)]]);
+ }
+ if (reset) {
+ panStart = null;
+ clearDrawing();
+ setBounds(profile.bounds_wsen, true);
+ }
+ }
+ areaControl = {refreshCountry};
+ $('country').addEventListener('change', () => refreshCountry(true));
BOUND_INPUTS.forEach(id => {
$(id).addEventListener('input', () => {
try { setBounds(readSearchBounds(), false, false); }
catch (error) { boundsMessage(error.message); }
});
});
- $('reset-bounds').addEventListener('click', () => setBounds(CONUS_BOUNDS, true));
+ $('reset-bounds').addEventListener('click', () => setBounds(selectedProfile().bounds_wsen, true));
+ refreshCountry(true);
if (typeof L === 'undefined') {
$('map-container').hidden = true;
$('map-status').textContent = 'The map could not load. Enter search coordinates below.';
return;
}
- map = L.map('map', {
- center: [38.5, -96], zoom: 4,
- maxBounds: [[20, -130], [54, -61]], maxBoundsViscosity: 1
- });
+ map = L.map('map', {maxBoundsViscosity: 1});
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 18, noWrap: true,
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
@@ -277,7 +351,7 @@ function initMap() {
$('map-status').textContent = 'Map tiles are unavailable. Coordinates and the selection rectangle still work.';
}).addTo(map);
map.dragging.disable(); // Left-drag draws; right-drag or Shift-drag pans.
- setBounds(selectedBounds, true);
+ refreshCountry(true);
const container = map.getContainer();
container.addEventListener('contextmenu', event => event.preventDefault());
diff --git a/src/dopplergeist/web/index.html b/src/dopplergeist/web/index.html
index 652c8c7..64648cd 100644
--- a/src/dopplergeist/web/index.html
+++ b/src/dopplergeist/web/index.html
@@ -4,7 +4,7 @@
<body>
<header><a href="/" class="brand">DOPPLER<span>GEIST</span></a><span class="tag">Aircraft sound → location evidence</span></header>
<main>
-<section class="intro"><p class="eyebrow">ACOUSTIC GEOLOCATION</p><h1>Find the flights.<br>Test the location.</h1><p>Upload a recording to discover aircraft Doppler curves, search historical flight tracks, and inspect the evidence. When the evidence cannot support a location, the result is inconclusive.</p><p class="scope">Search coverage: <strong>contiguous United States (CONUS), including smaller selected areas</strong>. Location goal: 100–500 m or better preferred; up to 1,000 m acceptable. Nationwide accuracy remains under evaluation.</p></section>
+<section class="intro"><p class="eyebrow">ACOUSTIC GEOLOCATION</p><h1>Find the flights.<br>Test the location.</h1><p>Upload a recording to discover aircraft Doppler curves, search historical flight tracks, and inspect the evidence. When the evidence cannot support a location, the result is inconclusive.</p><p class="scope">Search coverage: <strong id="supported-areas">contiguous United States (CONUS)</strong>, including smaller selected areas. Location goal: 100–500 m or better preferred; up to 1,000 m acceptable. Localization accuracy remains under evaluation.</p></section>
<div class="layout">
<section class="panel" aria-labelledby="upload-heading"><h2 id="upload-heading">New analysis</h2><form id="upload-form">
<p id="data-setup" class="notice" hidden></p>
@@ -12,7 +12,10 @@
<fieldset><legend>When did the recording start?</legend><p class="help">Enter UTC, including the date. A window is allowed. File creation and upload times do not establish recording time. Leave blank if unknown; analysis will request this evidence before searching.</p><label for="start">Earliest start (UTC)</label><input id="start" type="datetime-local" step="1"><label for="end">Latest start (UTC)</label><input id="end" type="datetime-local" step="1"><label for="time-source">How is this time known? <span class="muted">Optional</span></label><input id="time-source" type="text" maxlength="500" placeholder="For example, recorder clock synchronized before recording"></fieldset>
<fieldset class="search-region">
<legend>Search area</legend>
-<p class="help">Choose all of CONUS or a smaller area. Enter coordinates, or left-drag on the map to draw a box. Right-drag or Shift-drag pans; scroll zooms. Areas outside CONUS and antimeridian crossings are unsupported.</p>
+<label for="country">Country profile</label>
+<select id="country" name="country"><option value="US">Contiguous United States (CONUS)</option></select>
+<p id="country-help" class="help">Choose all of CONUS or a smaller area.</p>
+<p class="help">Enter coordinates, or left-drag on the map to draw a box. Right-drag or Shift-drag pans; scroll zooms. The rectangle must stay within the selected profile's bounds. Antimeridian crossings are unsupported.</p>
<div id="map-container"><div id="map" aria-label="Search area map"></div></div>
<p id="map-status" class="help" role="status"></p>
<div class="bounds-grid">
@@ -22,7 +25,7 @@
<div><label for="bbox-n">North latitude</label><input id="bbox-n" type="number" step="any" min="24" max="50" value="50" required></div>
</div>
<p id="bounds-error" class="validation-error" role="alert" hidden></p>
-<button id="reset-bounds" class="secondary" type="button">Reset to CONUS</button>
+<button id="reset-bounds" class="secondary" type="button">Reset to full area</button>
<p class="help"><a href="/leaflet-license.txt">Leaflet license</a>. Map tiles &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors.</p>
</fieldset>
<p id="limits" class="help"></p><button id="submit" type="submit">Upload &amp; analyze <span aria-hidden="true">→</span></button><p id="upload-error" role="alert"></p>
diff --git a/src/dopplergeist/web/style.css b/src/dopplergeist/web/style.css
index 82088d3..7ac8d8d 100644
--- a/src/dopplergeist/web/style.css
+++ b/src/dopplergeist/web/style.css
@@ -1,4 +1,4 @@
-:root{color-scheme:dark;--bg:#101719;--panel:#192326;--edge:#334247;--muted:#a6b8bd;--accent:#baf078;--ink:#f3f8f5;font-family:Inter,ui-sans-serif,system-ui,sans-serif;font-size:15px}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink)}header{min-height:85px;display:flex;align-items:center;justify-content:space-between;gap:20px;border-bottom:1px solid var(--edge);padding:20px max(6vw,24px)}a{color:var(--accent);text-underline-offset:3px}.brand{font-weight:850;font-size:21px;letter-spacing:.04em;text-decoration:none;color:var(--ink)}.brand span{color:var(--accent)}.tag,.muted,.help,footer{color:var(--muted)}.tag{font-size:13px}main{max-width:1350px;margin:auto;padding:52px max(6vw,24px) 24px}.intro{max-width:820px;margin-bottom:36px}.eyebrow{color:var(--accent);font-size:11px;font-weight:700;letter-spacing:.18em}h1{font-size:clamp(34px,5vw,58px);line-height:1.04;letter-spacing:-.045em;margin:18px 0 22px}.intro>p:not(.eyebrow){font-size:16px;line-height:1.65;color:#bccbd0}.intro .scope{font-size:13px!important;border-left:2px solid var(--accent);padding-left:14px}.layout{display:grid;grid-template-columns:minmax(300px,1fr) minmax(320px,1.3fr);gap:22px;align-items:start}.panel{border:1px solid var(--edge);background:var(--panel);border-radius:14px;padding:26px;min-width:0}h2{font-size:18px;letter-spacing:-.02em;margin:0 0 24px}h3{font-size:16px;margin:25px 0 12px}.drop{display:flex;align-items:center;text-align:center;gap:10px;flex-direction:column;padding:22px;border:1px dashed #72898e;border-radius:10px;cursor:pointer;background:#142023}.drop span:last-of-type{font-size:12px;color:var(--muted)}.upload-symbol{color:var(--accent);font-size:28px}.drop input{font-size:12px;width:100%;max-width:290px;margin-top:5px}fieldset{padding:0;margin:30px 0 20px;border:0}legend{font-size:15px;font-weight:650;padding:0}.help{font-size:12px;line-height:1.6}label:not(.drop){display:block;font-size:12px;font-weight:600;margin:16px 0 7px}input:not([type=file]){width:100%;border:1px solid #52666c;border-radius:6px;background:#111c1f;color:var(--ink);padding:11px;font:inherit;font-size:13px}input:focus,button:focus,a:focus{outline:2px solid var(--accent);outline-offset:3px}button{font:inherit;font-size:13px;font-weight:700;border:0;border-radius:7px;padding:13px 17px;color:#1b2916;background:var(--accent);cursor:pointer}button:disabled{opacity:.5;cursor:wait}button[type=submit]{width:100%;display:flex;justify-content:space-between}.secondary{border:1px solid var(--edge);background:transparent;color:var(--ink);padding:8px 11px;font-size:11px}.section-row{display:flex;justify-content:space-between;align-items:center;gap:12px}.section-row h2{margin:0}.results>.section-row{margin-bottom:24px}.results{min-height:400px}.mono{font-family:ui-monospace,monospace;font-size:11px;color:var(--muted);overflow-wrap:anywhere}.wave{font-size:65px;color:#739b64;letter-spacing:6px;margin-bottom:20px}#empty{text-align:center;padding:50px 18px}#empty p{font-size:13px;line-height:1.7;color:var(--muted)}progress{display:block;width:100%;height:7px;margin:18px 0;accent-color:var(--accent)}#message{font-size:14px;line-height:1.65}#status{text-transform:capitalize;color:var(--accent)}#stage{font-size:11px}.notice{background:#393222;border:1px solid #72613b;color:#f1dfaf;border-radius:7px;padding:13px;font-size:13px}.candidate{overflow-wrap:anywhere;padding:15px;background:#111b1e;border:1px solid var(--edge);border-radius:8px;margin:10px 0;font-size:13px;line-height:1.7}.candidate strong{font-size:16px;display:block}.candidate p{margin:5px 0;color:var(--muted)}.event{border-top:1px solid var(--edge);padding:12px 0;font-size:12px;color:var(--muted)}.diagnostic{margin:15px 0}.diagnostic img{display:block;width:100%;border-radius:5px;background:#111}.diagnostic figcaption{font-size:11px;margin-top:7px;color:var(--muted)}details{border-top:1px solid var(--edge);padding-top:18px;margin-top:24px;font-size:12px}summary{cursor:pointer;color:var(--accent)}ul{padding-left:20px}li{margin:9px 0;overflow-wrap:anywhere}#upload-error,#connection{color:#ffb9ac;font-size:13px}.recent{margin-top:30px}.recent h2{font-size:14px}.recent ul{display:flex;flex-wrap:wrap;gap:15px;list-style:none;padding:0;font-size:12px}footer{border-top:1px solid var(--edge);margin-top:42px;padding-top:22px;font-size:11px;line-height:1.7}[hidden]{display:none!important}@media(max-width:760px){header{padding:20px 22px}.tag{display:none}main{padding:30px 18px}.layout{grid-template-columns:1fr}.panel{padding:22px}h1{font-size:42px}.results{min-height:300px}#empty{padding:20px 8px}}
+:root{color-scheme:dark;--bg:#101719;--panel:#192326;--edge:#334247;--muted:#a6b8bd;--accent:#baf078;--ink:#f3f8f5;font-family:Inter,ui-sans-serif,system-ui,sans-serif;font-size:15px}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink)}header{min-height:85px;display:flex;align-items:center;justify-content:space-between;gap:20px;border-bottom:1px solid var(--edge);padding:20px max(6vw,24px)}a{color:var(--accent);text-underline-offset:3px}.brand{font-weight:850;font-size:21px;letter-spacing:.04em;text-decoration:none;color:var(--ink)}.brand span{color:var(--accent)}.tag,.muted,.help,footer{color:var(--muted)}.tag{font-size:13px}main{max-width:1350px;margin:auto;padding:52px max(6vw,24px) 24px}.intro{max-width:820px;margin-bottom:36px}.eyebrow{color:var(--accent);font-size:11px;font-weight:700;letter-spacing:.18em}h1{font-size:clamp(34px,5vw,58px);line-height:1.04;letter-spacing:-.045em;margin:18px 0 22px}.intro>p:not(.eyebrow){font-size:16px;line-height:1.65;color:#bccbd0}.intro .scope{font-size:13px!important;border-left:2px solid var(--accent);padding-left:14px}.layout{display:grid;grid-template-columns:minmax(300px,1fr) minmax(320px,1.3fr);gap:22px;align-items:start}.panel{border:1px solid var(--edge);background:var(--panel);border-radius:14px;padding:26px;min-width:0}h2{font-size:18px;letter-spacing:-.02em;margin:0 0 24px}h3{font-size:16px;margin:25px 0 12px}.drop{display:flex;align-items:center;text-align:center;gap:10px;flex-direction:column;padding:22px;border:1px dashed #72898e;border-radius:10px;cursor:pointer;background:#142023}.drop span:last-of-type{font-size:12px;color:var(--muted)}.upload-symbol{color:var(--accent);font-size:28px}.drop input{font-size:12px;width:100%;max-width:290px;margin-top:5px}fieldset{padding:0;margin:30px 0 20px;border:0}legend{font-size:15px;font-weight:650;padding:0}.help{font-size:12px;line-height:1.6}label:not(.drop){display:block;font-size:12px;font-weight:600;margin:16px 0 7px}input:not([type=file]),select{width:100%;border:1px solid #52666c;border-radius:6px;background:#111c1f;color:var(--ink);padding:11px;font:inherit;font-size:13px}input:focus,select:focus,button:focus,a:focus{outline:2px solid var(--accent);outline-offset:3px}button{font:inherit;font-size:13px;font-weight:700;border:0;border-radius:7px;padding:13px 17px;color:#1b2916;background:var(--accent);cursor:pointer}button:disabled{opacity:.5;cursor:wait}button[type=submit]{width:100%;display:flex;justify-content:space-between}.secondary{border:1px solid var(--edge);background:transparent;color:var(--ink);padding:8px 11px;font-size:11px}.section-row{display:flex;justify-content:space-between;align-items:center;gap:12px}.section-row h2{margin:0}.results>.section-row{margin-bottom:24px}.results{min-height:400px}.mono{font-family:ui-monospace,monospace;font-size:11px;color:var(--muted);overflow-wrap:anywhere}.wave{font-size:65px;color:#739b64;letter-spacing:6px;margin-bottom:20px}#empty{text-align:center;padding:50px 18px}#empty p{font-size:13px;line-height:1.7;color:var(--muted)}progress{display:block;width:100%;height:7px;margin:18px 0;accent-color:var(--accent)}#message{font-size:14px;line-height:1.65}#status{text-transform:capitalize;color:var(--accent)}#stage{font-size:11px}.notice{background:#393222;border:1px solid #72613b;color:#f1dfaf;border-radius:7px;padding:13px;font-size:13px}.candidate{overflow-wrap:anywhere;padding:15px;background:#111b1e;border:1px solid var(--edge);border-radius:8px;margin:10px 0;font-size:13px;line-height:1.7}.candidate strong{font-size:16px;display:block}.candidate p{margin:5px 0;color:var(--muted)}.event{border-top:1px solid var(--edge);padding:12px 0;font-size:12px;color:var(--muted)}.diagnostic{margin:15px 0}.diagnostic img{display:block;width:100%;border-radius:5px;background:#111}.diagnostic figcaption{font-size:11px;margin-top:7px;color:var(--muted)}details{border-top:1px solid var(--edge);padding-top:18px;margin-top:24px;font-size:12px}summary{cursor:pointer;color:var(--accent)}ul{padding-left:20px}li{margin:9px 0;overflow-wrap:anywhere}#upload-error,#connection{color:#ffb9ac;font-size:13px}.recent{margin-top:30px}.recent h2{font-size:14px}.recent ul{display:flex;flex-wrap:wrap;gap:15px;list-style:none;padding:0;font-size:12px}footer{border-top:1px solid var(--edge);margin-top:42px;padding-top:22px;font-size:11px;line-height:1.7}[hidden]{display:none!important}@media(max-width:760px){header{padding:20px 22px}.tag{display:none}main{padding:30px 18px}.layout{grid-template-columns:1fr}.panel{padding:22px}h1{font-size:42px}.results{min-height:300px}#empty{padding:20px 8px}}
.search-region{max-width:100%;overflow:hidden}
#map-container{width:100%;height:260px;overflow:hidden;border-radius:8px;border:1px solid var(--edge);margin:12px 0;position:relative}