mirror of
https://github.com/PlaneQuery/OpenAirframes.git
synced 2026-07-20 16:50:49 +02:00
stop depue that destroys previous days
This commit is contained in:
@@ -93,13 +93,11 @@ def download_and_merge_base_release(compressed_df: pl.DataFrame) -> tuple[pl.Dat
|
|||||||
from src.get_latest_release import download_latest_aircraft_adsb_csv
|
from src.get_latest_release import download_latest_aircraft_adsb_csv
|
||||||
|
|
||||||
print("Downloading base ADS-B release...")
|
print("Downloading base ADS-B release...")
|
||||||
try:
|
|
||||||
base_path = download_latest_aircraft_adsb_csv(
|
base_path = download_latest_aircraft_adsb_csv(
|
||||||
output_dir="./data/openairframes_base"
|
output_dir="./data/openairframes_base"
|
||||||
)
|
)
|
||||||
print(f"Download returned: {base_path}")
|
print(f"Download returned: {base_path}")
|
||||||
|
|
||||||
if base_path and os.path.exists(str(base_path)):
|
|
||||||
print(f"Loading base release from {base_path}")
|
print(f"Loading base release from {base_path}")
|
||||||
|
|
||||||
# Extract start date from filename (e.g., openairframes_adsb_2025-05-01_2026-02-14.csv.gz)
|
# Extract start date from filename (e.g., openairframes_adsb_2025-05-01_2026-02-14.csv.gz)
|
||||||
@@ -132,23 +130,7 @@ def download_and_merge_base_release(compressed_df: pl.DataFrame) -> tuple[pl.Dat
|
|||||||
combined = pl.concat([base_df, compressed_df])
|
combined = pl.concat([base_df, compressed_df])
|
||||||
print(f"After concat: {len(combined)} records")
|
print(f"After concat: {len(combined)} records")
|
||||||
|
|
||||||
deduplicated = combined.unique(subset=["icao"], keep="last")
|
return combined, earliest_date
|
||||||
|
|
||||||
print(f"Combined with base: {len(combined)} -> {len(deduplicated)} after dedup")
|
|
||||||
|
|
||||||
del base_df, combined
|
|
||||||
gc.collect()
|
|
||||||
|
|
||||||
return deduplicated, earliest_date
|
|
||||||
else:
|
|
||||||
print(f"No base release found at {base_path}, using only new data")
|
|
||||||
return compressed_df, None
|
|
||||||
except Exception as e:
|
|
||||||
import traceback
|
|
||||||
print(f"Failed to download base release: {e}")
|
|
||||||
traceback.print_exc()
|
|
||||||
return compressed_df, None
|
|
||||||
|
|
||||||
|
|
||||||
def cleanup_chunks(output_id: str, chunks_dir: str):
|
def cleanup_chunks(output_id: str, chunks_dir: str):
|
||||||
"""Delete chunk parquet files after successful merge."""
|
"""Delete chunk parquet files after successful merge."""
|
||||||
|
|||||||
Reference in New Issue
Block a user