Python tool for aircraft Doppler audio geolocation using historical ADS-B flight data (Source-available)
Python acoustic-geolocationads-baircraft-trackingairplaneaudio-forensicsdoppler-effectdoppler-shiftgeolocationosintsignal-processing
Constrain selected flight coverage to archive day
Cinna Davis4c1a7115393c
diff --git a/docs/HISTORICAL_INGESTION.md b/docs/HISTORICAL_INGESTION.mdindex f3b70c0..adf67cd 100644--- a/docs/HISTORICAL_INGESTION.md+++ b/docs/HISTORICAL_INGESTION.md@@ -8,8 +8,10 @@ This preserves altitude calibration, segment boundary derivatives and passagesthat cross a query between recorded samples. The conservative continuous boundsand 30-second gap limit match the default `FlightIndex` build; a differentlyconfigured gap limit requires a new selection. The report records that limit.-New Parquet files also embed the selection box, time interval, aircraft-type scope-and gap limit. `FlightIndex.from_parquet` rejects coverage claims beyond those+New Parquet files also embed the selection box, time interval intersected with+the archive's named UTC day, aircraft-type scope and gap limit. An interval with+no overlap has empty declared coverage, even if the source contains neighboring+observations. `FlightIndex.from_parquet` rejects coverage claims beyond thoselimits or an index gap that differs from the selection gap. Older or genericParquet files without this metadata still rely on the caller's coverage evidence.diff --git a/scripts/ingest_adsblol_day.py b/scripts/ingest_adsblol_day.pyindex ed718d7..7052276 100644--- a/scripts/ingest_adsblol_day.py+++ b/scripts/ingest_adsblol_day.py@@ -1,5 +1,6 @@"""Stream a split daily tar archive into a CONUS prop/unknown parquet table."""import argparse+from datetime import date, datetime, time, timezoneimport gzipimport ioimport json@@ -26,6 +27,11 @@ root=Path(__file__).resolve().parents[1]directory=root/"data/adsb"/args.datewest,south,east,north=args.boundstime_range=[unix_time(t) for t in args.time_range] if args.time_range else None+day_start=datetime.combine(date.fromisoformat(args.date),time.min,tzinfo=timezone.utc).timestamp()+day_end=day_start+86400+selected_start=max(day_start,time_range[0]) if time_range else day_start+selected_end=min(day_end,time_range[1]) if time_range else day_end+selected_time=[selected_start,selected_end] if selected_start<=selected_end else []output_path=directory/args.outputreport_path=directory/(Path(args.output).stem+"-ingestion-report.json")if output_path.exists() or report_path.exists():@@ -71,7 +77,7 @@ if len(paths)<2:raise ValueError("Daily archive download is incomplete")stats={"trace_files":0,"known_jets_removed":0,"no_conus_points":0,"retained_aircraft":0,"rows":0,"barometric_rows":0}stats["normalization_scope"]="full_native_trace_before_segment_selection"stats["selection_max_gap_s"]=30.0-selection={"bounds":[west,south,east,north],"time_range_s":time_range,+selection={"bounds":[west,south,east,north],"time_range_s":selected_time,"all_aircraft":args.keep_jets,"max_gap_s":30.0}writer=Nonewith io.BufferedReader(SplitReader(paths),buffer_size=1024*1024) as stream:diff --git a/tests/test_real_flight_selection.py b/tests/test_real_flight_selection.pyindex 6be278d..523d98c 100644--- a/tests/test_real_flight_selection.py+++ b/tests/test_real_flight_selection.py@@ -1,8 +1,12 @@"""Optional integration regression against a local, real ADS-B archive part."""import gzip+import ioimport jsonimport osfrom pathlib import Path+import shutil+import subprocess+import sysimport tarfileimport numpy as np@@ -20,6 +24,7 @@ def test_real_boundary_segments_survive_selection(tmp_path):if not source:pytest.skip("set DOPPLERGEIST_REAL_ARCHIVE_PART to a local readsb tar part")frames = []+ first_member = Nonewith Path(source).open("rb") as stream, tarfile.open(fileobj=stream, mode="r|") as archive:for member in archive:if not member.isfile() or "trace_full_" not in member.name:@@ -29,6 +34,8 @@ def test_real_boundary_segments_survive_selection(tmp_path):frame = adsblol_frame(data)if len(frame) > 50:frames.append(frame)+ if first_member is None:+ first_member = member.name, rawif len(frames) == 10:breakassert len(frames) == 10@@ -81,3 +88,32 @@ def test_real_boundary_segments_survive_selection(tmp_path):untagged = tmp_path / "real-untagged.parquet"pq.write_table(table.replace_schema_metadata(None), untagged)FlightIndex.from_parquet(tmp_path / "untagged.sqlite", untagged, coverage=coverage)++ # Exercise the actual ingest CLI with one unmodified September 8 trace.+ if "2026.09.08" in Path(source).name:+ project = tmp_path / "real-ingest"+ (project / "scripts").mkdir(parents=True)+ shutil.copyfile(Path(__file__).resolve().parents[1] / "scripts/ingest_adsblol_day.py",+ project / "scripts/ingest_adsblol_day.py")+ (project / "data/source").mkdir(parents=True)+ (project / "data/source/icao_aircraft_types.json").write_text("{}")+ day = project / "data/adsb/2026-09-08"+ day.mkdir(parents=True)+ name, raw = first_member+ archive_bytes = io.BytesIO()+ with tarfile.open(fileobj=archive_bytes, mode="w") as archive:+ member = tarfile.TarInfo(name)+ member.size = len(raw)+ archive.addfile(member, io.BytesIO(raw))+ blob = archive_bytes.getvalue()+ (day / "real.tar.aa").write_bytes(blob[:len(blob) // 2])+ (day / "real.tar.ab").write_bytes(blob[len(blob) // 2:])+ for output, extra in (("whole", []), ("wide", ["--time-range", "2026-09-07T23:00:00Z", "2026-09-09T01:00:00Z"])):+ command = [sys.executable, str(project / "scripts/ingest_adsblol_day.py"),+ "2026-09-08", "--keep-jets", "--bounds", "-180", "-90", "180", "90",+ "--output", output + ".parquet", *extra]+ env = dict(os.environ, PYTHONPATH=str(Path(__file__).resolve().parents[1] / "src"))+ completed = subprocess.run(command, env=env, capture_output=True, text=True)+ assert completed.returncode == 0, completed.stderr+ meta = pq.read_schema(day / (output + ".parquet")).metadata[b"dopplergeist.selection.v1"]+ assert json.loads(meta)["time_range_s"] == [1788825600.0, 1788912000.0]