SuperAPI AI Directory

weather-search

General & other

View repository

Updated 10-15 21:52

About this skill

Weather Area Query

InputCity or location + Activity radius (km) + Days, automatically performs:

  1. Geocode to locate the center point
  2. Pull forecast and air quality for 9 points: center + 8 directions
  3. Aggregate extreme elements by local date, generate a Markdown report
  4. Agent writes going-out protection suggestions

Dependencies

pip install esflow openmeteo-requests pandas

Usage

# 1. 首跑到 agent_advice 退出(exit 2)
python3 scripts/run.py --query 北京天安门
python3 scripts/run.py --query 北京大兴机场 --days 3 --radius-km 10 [--out ./out]
# stdout: envelope JSON(ok, data.job_dir / analyze_grid_artifact / advice_path)
# stderr: [to_agent] 续跑命令 + [样式] 表格约束

# 2. Agent 读 analyze_grid_artifact,写 data.advice_path

# 3. 续跑落盘
python3 scripts/run.py --resume <job_dir>
# stdout: envelope(ok, data.out_path / data.out_dir / data.job_dir)

The final report path is envelope data.out_path. When --out is not passed, write to export/weather_report.md; when --out <DIR> is passed, write to <DIR>/weather_report.md,--resume automatically inherits the first-run input parameters.

Parameters

Parameter Default Description
--query - City or specific location (required on first run)
--days 1 Forecast days
--radius-km 5 Activity radius km
--out <DIR> - Final report output directory
--resume <job_dir> - Resume-run TO_AGENT node
--schema false Output stdout JSON contract

Exit code:0 ok / 1 runtime / 2 to_agent / 3 validation. esflow events go to stderr and do not pollute the stdout envelope.

Nodes (8)

id depth Responsibility
parse_args 0 query + radius_km + days
geocode 1 Nominatim encoding
build_grid 2 List of center + 8-direction sampling points
fetch_bulk 3 Two-point coordinates bulk:forecast + air-quality, local-day aggregation
analyze_grid 4 Extreme value localization,llm_text / llm_json
format_table 5 Markdown report + independent LLM input
agent_advice 6 TO_AGENT, write advice.md
export 7 Merge and persist to disk

DAG

parse_args → geocode → build_grid → fetch_bulk → analyze_grid → format_table
                                                              ↓
                       export ← agent_advice(TO_AGENT)

TO_AGENT

  1. On first run, pause at agent_advice with exit 2; parse the stdout one-line envelope,data contains job_dir、analyze_grid_artifact、advice_path
  2. Read {job_dir}/.esflow/analyze_grid/artifact.json: prefer llm_text(alert segments take priority), or structured llm_json(alerts、points_merged、daily_reports , etc.); do not rely on the upstream markdown embedded in stderr
  3. Write to agent_advice/advice.mdin the following style (i.e., data.advice_path), do not restate values already present in the report table
  4. python3 scripts/run.py --resume <job_dir> Resume-run export

Going-out suggestion style (consistent with stderr [样式] )

  • Title:## 外出建议
  • Fixed table header:日期 | 风险点 | 外出建议
  • Use short phrases for risk points, one sentence for actions; consecutive dates of the same type may be merged (e.g., 07-10 至 07-11)
  • Do not write summaries outside the table

Technical choices

  • Open-Meteo forecast + air-quality,openmeteo-requests Batch coordinates
  • pandas Perform hourly→daily aggregation and typical times (8/12/16/20)
  • No local response cache (personal use)
  • Nominatim still uses standard-library preflight

Preflight

  • Python >= 3.10
  • Nominatim reachable