KnowAir Minutely — Minute-Level Precipitation Forecast
Query minute-level precipitation forecast for the next 2 hours using the Caiyun Weather API. Best coverage for major cities in China.
Prerequisites
- A valid Caiyun Weather API token set as
CAIYUN_TOKENenvironment variable, or stored in~/.config/knowair/token. - Coordinates (longitude, latitude) for the target location.
Quick Start
python3 scripts/query_minutely.py --lng 116.3176 --lat 39.9760
Workflow
- Resolve coordinates — convert city name to coordinates if needed.
- Run the script:
python3 scripts/query_minutely.py --lng <LNG> --lat <LAT> - Present results — tell the user when rain starts/stops and the intensity, using the API's natural language description.
Options
| Flag | Description | Default |
|---|---|---|
--lng | Longitude (-180 to 180) | Required |
--lat | Latitude (-90 to 90) | Required |
--lang | Output language: en or zh | en |
Defaults
- Language:
en
Failure Handling
- Missing token → exit code 2 with setup instructions.
- API error → exit code 1 with error details.
- Data unavailable for location → inform user that minutely data is mainly available for China.