"""Acute-shock check: what did NASA FIRMS VIIRS see at the Port of Beirut in 2020? Usage: python beirut_check.py Counts detections within 3 km of the blast site (33.9014 N, 35.5192 E) and prints only dates, times (UTC), distance and fire radiative power. No coordinates are written. """ import json import sys import numpy as np import pandas as pd LAT0, LON0, RADIUS_KM = 33.9014, 35.5192, 3.0 src, out = sys.argv[1], sys.argv[2] d = pd.read_csv(src) d["km"] = np.hypot((d.latitude - LAT0) * 111.0, (d.longitude - LON0) * 111.0 * np.cos(np.radians(LAT0))) near = d[d.km < RADIUS_KM].sort_values(["acq_date", "acq_time"]) rows = [ {"date": r.acq_date, "time_utc": f"{int(r.acq_time):04d}", "km_from_blast_site": round(float(r.km), 2), "frp_mw": float(r.frp), "confidence": r.confidence, "firms_type": int(r.type)} for r in near.itertuples() ] res = {"source": "NASA FIRMS VIIRS S-NPP 375 m, standard archive 2020, Lebanon", "radius_km": RADIUS_KM, "lebanon_detections_2020": int(len(d)), "near_port_detections_2020": len(rows), "near_port": rows} with open(out, "w", encoding="utf-8") as f: json.dump(res, f, indent=2) print(json.dumps(res, indent=2))