mirror of
https://github.com/PlaneQuery/OpenAirframes.git
synced 2026-04-24 03:56:24 +02:00
add hisotircal-adsb-run.yaml
This commit is contained in:
@@ -0,0 +1,115 @@
|
||||
name: Historical ADS-B Run
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
start_date:
|
||||
description: 'YYYY-MM-DD (inclusive)'
|
||||
required: true
|
||||
type: string
|
||||
end_date:
|
||||
description: 'YYYY-MM-DD (exclusive)'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
generate-dates:
|
||||
runs-on: ubuntu-24.04-arm
|
||||
outputs:
|
||||
dates: ${{ steps.generate.outputs.dates }}
|
||||
steps:
|
||||
- name: Generate date list
|
||||
id: generate
|
||||
env:
|
||||
START_DATE: ${{ inputs.start_date }}
|
||||
END_DATE: ${{ inputs.end_date }}
|
||||
run: |
|
||||
python - <<'PY'
|
||||
import json
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
start = datetime.strptime("${START_DATE}", "%Y-%m-%d")
|
||||
end = datetime.strptime("${END_DATE}", "%Y-%m-%d")
|
||||
if end <= start:
|
||||
raise SystemExit("end_date must be after start_date")
|
||||
|
||||
dates = []
|
||||
cur = start
|
||||
while cur < end:
|
||||
dates.append(cur.strftime("%Y-%m-%d"))
|
||||
cur += timedelta(days=1)
|
||||
|
||||
with open("$GITHUB_OUTPUT", "a") as f:
|
||||
f.write(f"dates={json.dumps(dates)}\n")
|
||||
PY
|
||||
|
||||
adsb-day:
|
||||
needs: generate-dates
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
date: ${{ fromJson(needs.generate-dates.outputs.dates) }}
|
||||
uses: ./.github/workflows/historical-adsb.yaml
|
||||
with:
|
||||
date: ${{ matrix.date }}
|
||||
|
||||
adsb-final:
|
||||
needs: adsb-day
|
||||
runs-on: ubuntu-24.04-arm
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: '3.12'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
|
||||
- name: Download daily CSVs
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: openairframes_adsb-*
|
||||
path: outputs/daily/
|
||||
merge-multiple: true
|
||||
|
||||
- name: Concatenate all days to final CSV
|
||||
env:
|
||||
START_DATE: ${{ inputs.start_date }}
|
||||
END_DATE: ${{ inputs.end_date }}
|
||||
run: |
|
||||
python - <<'PY'
|
||||
import re
|
||||
from pathlib import Path
|
||||
import polars as pl
|
||||
|
||||
start = "${START_DATE}"
|
||||
end = "${END_DATE}"
|
||||
daily_dir = Path("outputs/daily")
|
||||
files = sorted(daily_dir.glob("openairframes_adsb_*.csv"))
|
||||
if not files:
|
||||
raise SystemExit("No daily CSVs found")
|
||||
|
||||
def date_key(path: Path) -> str:
|
||||
m = re.match(r"openairframes_adsb_(\d{4}-\d{2}-\d{2})_", path.name)
|
||||
return m.group(1) if m else path.name
|
||||
|
||||
files = sorted(files, key=date_key)
|
||||
frames = [pl.read_csv(p) for p in files]
|
||||
df = pl.concat(frames, how="vertical", rechunk=True)
|
||||
|
||||
output_path = Path("outputs") / f"openairframes_adsb_{start}_{end}.csv"
|
||||
df.write_csv(output_path)
|
||||
print(f"Wrote {output_path} with {df.height} rows")
|
||||
PY
|
||||
|
||||
- name: Upload final CSV
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: openairframes_adsb-${{ inputs.start_date }}-${{ inputs.end_date }}
|
||||
path: outputs/openairframes_adsb_${{ inputs.start_date }}_${{ inputs.end_date }}.csv
|
||||
retention-days: 30
|
||||
@@ -7,6 +7,12 @@ on:
|
||||
description: 'YYYY-MM-DD'
|
||||
required: true
|
||||
type: string
|
||||
workflow_call:
|
||||
inputs:
|
||||
date:
|
||||
description: 'YYYY-MM-DD'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
adsb-extract:
|
||||
|
||||
Reference in New Issue
Block a user