From 823f291728e9d27a75da1401091e0cd14528158e Mon Sep 17 00:00:00 2001 From: ggman12 Date: Sun, 15 Feb 2026 13:21:51 -0500 Subject: [PATCH] fix errors in daily release due to new .gz file --- src/adsb/combine_chunks_to_csv.py | 7 ++++--- src/get_latest_release.py | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/adsb/combine_chunks_to_csv.py b/src/adsb/combine_chunks_to_csv.py index e9c53bb..13ca536 100644 --- a/src/adsb/combine_chunks_to_csv.py +++ b/src/adsb/combine_chunks_to_csv.py @@ -18,7 +18,7 @@ import os import sys import glob import argparse -from datetime import datetime, timedelta +from datetime import datetime, timedelta, timezone import polars as pl @@ -33,7 +33,7 @@ os.makedirs(FINAL_OUTPUT_DIR, exist_ok=True) def get_target_day() -> datetime: """Get yesterday's date (the day we're processing).""" - return datetime.utcnow() - timedelta(days=1) + return datetime.now(timezone.utc) - timedelta(days=1) def process_single_chunk(chunk_path: str, delete_after_load: bool = False) -> pl.DataFrame: @@ -236,7 +236,8 @@ def main(): # Write final CSV output_path = os.path.join(FINAL_OUTPUT_DIR, output_filename) - combined.write_csv(output_path) + with open(output_path, "wb") as f: + combined.write_csv(f) print(f"Wrote {len(combined)} records to {output_path}") # Cleanup diff --git a/src/get_latest_release.py b/src/get_latest_release.py index 74832d7..793fa32 100644 --- a/src/get_latest_release.py +++ b/src/get_latest_release.py @@ -119,6 +119,7 @@ def download_latest_aircraft_csv( Returns: Path to the downloaded file """ + output_dir = Path(output_dir) assets = get_latest_release_assets(repo, github_token=github_token) try: asset = pick_asset(assets, name_regex=r"^openairframes_faa_.*\.csv$") @@ -164,6 +165,7 @@ def download_latest_aircraft_adsb_csv( Returns: Path to the downloaded file """ + output_dir = Path(output_dir) assets = get_latest_release_assets(repo, github_token=github_token) asset = pick_asset(assets, name_regex=r"^openairframes_adsb_.*\.csv(\.gz)?$") saved_to = download_asset(asset, output_dir / asset.name, github_token=github_token)