weather-observation-fetching
它能做什么
这个工具可以从官方数据源获取并检索实际的天气观测数据,例如航空天气报告(METAR)和历史数据。它会确保重要信息得以保留,比如气象站的身份、观测时间、单位以及质量标识。
适用场景
- ✓当你需要特定机场的最新天气报告时。
- ✓当你需要获取某个地区或国家的历史地面数据时。
- ✓当你需要了解气象站的位置、设备或历史信息时。
技能链接
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/weather-observation-fetching/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请提供圣保罗(CG24)和里约热内卢(SBGL)两个机场过去 2 小时内的 METAR 报告。”
每周 5 个新技能,1 分钟读完。
工作原理
工具会连接到可靠的天气数据源,例如政府 API。它会搜索所需的数据,保留所有原始细节,并以有条理的方式呈现出来。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Weather Observation Fetching
Overview
Retrieve measured surface and upper-air weather reports without losing station identity, observation time, units, raw values, or provider quality flags. Pick the source by observation type and retention need, then validate the returned records before normalization.
This skill covers METARs, historical surface observations, radiosondes, and station metadata. It excludes model output, radar volumes, and satellite imagery.
When to Use This Skill
- A task needs recent METAR observations for named stations or a small region.
- Historical hourly or synoptic surface data is needed from NOAA NCEI.
- A sounding workflow needs observed radiosonde profiles rather than model profiles.
- Station identifiers, relocations, instruments, or metadata must be resolved.
- A fetch returned duplicate, stale, unit-ambiguous, or quality-flagged values.
Do not use forecast products as observations, and do not substitute a nearby model grid point for a missing station report without explicit approval.
Choose the Source
| Need | Preferred source | Notes |
|---|---|---|
| Recent aviation surface reports | NOAA Aviation Weather Center Data API | Query a small station/time set; use published cache files for bulk current data. |
| Historical global surface reports | NOAA NCEI Integrated Surface Database (ISD) | Preserve USAF/WBAN identity, units, and QC fields. |
| Historical or recent radiosondes | NOAA NCEI IGRA | Use the station inventory and retain level and QC metadata. |
| Station history and identifier changes | NOAA NCEI station history/HOMR | Resolve moves, renames, and observing-platform changes. |
Prefer an existing project adapter when it already handles the provider's schema, retries, and cache. Record the exact endpoint or archive object used.
Define the Observation Request
Resolve these values before fetching:
- observation type and variables;
- station identifier system, not just the identifier string;
- start and end instants in UTC, including interval inclusivity;
- maximum acceptable observation age;
- raw, decoded, or both output forms;
- required quality flags and policy for rejected values;
- output units and missing-value representation;
- cache location and retention.
For spatial queries, also define the search geometry, distance limit, and how a station is selected. Return the selected station and distance rather than silently using the nearest report.
Fetch Recent METARs
The Aviation Weather Center exposes machine-readable METAR data under
/api/data/metar. Send a descriptive user agent, keep the query narrow, and
handle a valid 204 No Content separately from an error.
import json
from urllib.error import HTTPError
from urllib.parse import urlencode
from urllib.request import Request, urlopen
def fetch_metars(stations, hours=2):
station_ids = sorted({station.strip().upper() for station in stations})
if not station_ids or any(len(station) != 4 for station in station_ids):
raise ValueError("use one or more four-character ICAO station IDs")
if not 1 <= hours <= 24:
raise ValueError("hours must be between 1 and 24 for this narrow query")
query = urlencode({
"ids": ",".join(station_ids),
"format": "json",
"hours": hours,
})
request = Request(
f"https://aviationweather.gov/api/data/metar?{query}",
headers={"User-Agent": "weather-observation-fetching/1.0 contact@example.org"},
)
try:
with urlopen(request, timeout=30) as response:
if response.status == 204:
return []
records = json.load(response)
except HTTPError as exc:
if exc.code == 429:
raise RuntimeError("AWC rate limit reached; honor Retry-After") from exc
raise
if not isinstance(records, list):
raise RuntimeError("unexpected METAR response shape")
return records
Replace the example contact address with an appropriate project contact. For a large current snapshot, download the provider's compressed cache file once instead of issuing many station queries.
Fetch Historical Surface Data
For ISD:
- Resolve the station using the current station inventory and its USAF/WBAN identifiers.
- Confirm that the station's coverage overlaps the requested time range.
- Use bulk HTTPS files for a large historical request; avoid one network call per observation.
…
常见问题
什么是 METAR?
METAR 是机场天气观测的标准化报告,主要用于航空领域。
这个工具能获取哪些类型的天气数据?
它可以获取地面观测数据(例如 METAR)和高空数据(探空气球数据),以及气象站的元数据。它不获取预报数据,也不获取卫星图像。
为什么要保留“气象站身份”和“质量标识”?
保留身份信息可以让你清楚地知道数据来自哪里。质量标识则能告诉你数据是否可靠,或者是否可能存在问题。
详情
作者的原始描述
Retrieve surface and upper-air weather observations from authoritative APIs and archives with station identity, time, units, and quality flags preserved.
热度
- GitHub 星标
- 48k
- 排名
- #6148
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
00-andruia-consultant
48k帮你的智能体启动或改进 AI 项目。它可以分析代码、推荐工具,并用西班牙语制定行动计划。
007
48k让你的智能体执行安全审计和威胁建模。它有助于保护项目免受攻击和漏洞的威胁。
10-andruia-skill-smith
48k帮你的智能体创建或改进 AI 工具。它可以定义工具的工作方式、编写文档,并验证其结构。
20-andruia-niche-intelligence
48k让你的智能体创建某个特定行业的摘要。它有助于借助可靠的信息来源,了解项目的背景、规则、使用模式和风险。