WeatherPred / scripts /fetch_historical_weather.py
yyyc's picture
fist push the app
5194558
Raw
History Blame Contribute Delete
600 Bytes
#!/usr/bin/env python3
"""Fetch and cache 30 years of Tokyo daily weather data."""
from __future__ import annotations
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
from weatherpred.config import HISTORY_CSV_PATH, HISTORY_JSON_PATH
from weatherpred.data import fetch_historical_weather, save_history
def main() -> None:
history = fetch_historical_weather()
save_history(history)
print(f"Wrote {len(history):,} rows to {HISTORY_CSV_PATH}")
print(f"Wrote JSON copy to {HISTORY_JSON_PATH}")
if __name__ == "__main__":
main()