Spaces:
Sleeping
Sleeping
Download scripts/fetch_historical_weather.py from yyyc/WeatherPred: direct link, hf CLI and curl.
- Browser
- Download file 600 Bytes
-
https://huggingface.co/spaces/yyyc/WeatherPred/resolve/main/scripts/fetch_historical_weather.py
- Command line
-
hf download hf://spaces/yyyc/WeatherPred/scripts/fetch_historical_weather.py
-
curl -L -o fetch_historical_weather.py https://huggingface.co/spaces/yyyc/WeatherPred/resolve/main/scripts/fetch_historical_weather.py
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() | |