open-meteo
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseOpen Meteo
Open Meteo
When to use
适用场景
- You need weather forecasts (hourly/daily/current) for coordinates.
- You need air quality / pollen forecasts (hourly/current) for coordinates.
- You need to resolve a user-provided place name to coordinates and timezone (geocoding).
- You need to support multi-location batching (comma-separated lat/lon lists).
- You need a deterministic checklist for Open-Meteo query parameters, response parsing, and error handling.
- 当你需要根据坐标获取天气预报(逐小时/逐日/实时)时。
- 当你需要根据坐标获取空气质量/花粉预报(逐小时/实时)时。
- 当你需要将用户提供的地点名称解析为坐标及时区(地理编码)时。
- 当你需要支持多位置批量处理(逗号分隔的纬度/经度列表)时。
- 当你需要一份关于Open-Meteo查询参数、响应解析和错误处理的确定性检查清单时。
Goal
目标
Provide a reliable, production-friendly way to call Open-Meteo APIs (Forecast, Air Quality, Geocoding), choose variables, control time/units/timezone, and parse responses consistently.
提供一种可靠、适合生产环境的方式来调用Open-Meteo API(预报、空气质量、地理编码),选择变量,控制时间/单位/时区,并一致地解析响应。
Steps
步骤
-
Pick the correct API and base URL
- Forecast:
https://api.open-meteo.com/v1/forecast - Air Quality:
https://air-quality-api.open-meteo.com/v1/air-quality - Geocoding:
https://geocoding-api.open-meteo.com/v1/search
- Forecast:
-
Resolve coordinates (if you only have a name)
- Call Geocoding with and optional
name,language,countryCode.count - Use the returned ,
latitude, andlongitudefor subsequent calls.timezone
- Call Geocoding with
-
Design your time axis (timezone, timeformat, and range)
- Prefer when results must align to local midnight.
timezone=auto - If you request , set
daily=...(docs: daily requires timezone).timezone - Choose for readability, or
timeformat=iso8601for compactness.timeformat=unixtime- If using , remember timestamps are GMT+0 and you must apply
unixtimefor correct local dates.utc_offset_seconds
- If using
- Choose range controls:
- and optional
forecast_days, orpast_days - explicit /
start_date(YYYY-MM-DD), and for sub-dailyend_date/start_hour.end_hour
- Prefer
-
Choose variables minimally (avoid "download everything")
- Forecast: request only the variables you need via ,
hourly=...,daily=....current=... - Air Quality: request only the variables you need via ,
hourly=....current=... - Keep variable names exact; typos return a JSON error with .
error: true
- Forecast: request only the variables you need via
-
Choose units and model selection deliberately
- Forecast units:
- (
temperature_unit/celsius)fahrenheit - (
wind_speed_unit/kmh/ms/mph)kn - (
precipitation_unit/mm)inch
- Forecast model selection:
- default / “Best match” combines the best models.
models=auto - you can explicitly request models via .
models=... - provider-specific forecast endpoints also exist (provider implied by path). See (section "Endpoints vs
references/models.md") for examples and doc links.models= - for provider/model-specific selection tradeoffs, see .
references/models.md
- default
- Air Quality domain selection:
- (default) or
domains=auto/cams_europe.cams_global
- Forecast units:
-
Implement robust request/response handling
- Treat HTTP errors and JSON-level errors separately.
- JSON error format is:
{"error": true, "reason": "..."}
- When requesting multiple locations (comma-separated coordinates), expect the JSON output shape to change to a list of structures.
- Optionally use or
format=csvwhen you need data export.format=xlsx
-
Validate correctness with a “known city” check
- Geocode “Berlin” → Forecast for 1–2 days → verify timezone and array lengths.
hourly=temperature_2m - Air Quality → verify units and presence of
hourly=pm10,pm2_5,european_aqi.hourly_units
- Geocode “Berlin” → Forecast
-
选择正确的API和基础URL
- 预报API:
https://api.open-meteo.com/v1/forecast - 空气质量API:
https://air-quality-api.open-meteo.com/v1/air-quality - 地理编码API:
https://geocoding-api.open-meteo.com/v1/search
- 预报API:
-
解析坐标(若仅知晓地点名称)
- 调用地理编码API时传入以及可选的
name、language、countryCode参数。count - 使用返回的、
latitude和longitude进行后续调用。timezone
- 调用地理编码API时传入
-
设计时间轴(时区、时间格式和范围)
- 当结果需要与当地午夜对齐时,优先使用。
timezone=auto - 若请求参数,必须设置
daily=...(文档说明:逐日数据需要指定时区)。timezone - 为了可读性选择,或为了紧凑性选择
timeformat=iso8601。timeformat=unixtime- 若使用,请记住时间戳为GMT+0时区,需要通过
unixtime调整为正确的当地时间。utc_offset_seconds
- 若使用
- 选择范围控制方式:
- 和可选的
forecast_days,或past_days - 显式设置/
start_date(格式为YYYY-MM-DD),对于亚日级数据可设置end_date/start_hour。end_hour
- 当结果需要与当地午夜对齐时,优先使用
-
最小化选择变量(避免“全量下载”)
- 预报API:仅通过、
hourly=...、daily=...请求所需变量。current=... - 空气质量API:仅通过、
hourly=...请求所需变量。current=... - 变量名称必须完全匹配;拼写错误会返回包含的JSON错误信息。
error: true
- 预报API:仅通过
-
谨慎选择单位和模型
- 预报API单位:
- (
temperature_unit/celsius)fahrenheit - (
wind_speed_unit/kmh/ms/mph)kn - (
precipitation_unit/mm)inch
- 预报API模型选择:
- 默认/ “最佳匹配”会整合最优模型。
models=auto - 可通过显式指定模型。
models=... - 也存在特定服务商的预报端点(服务商由路径隐含)。请查看中的“端点与
references/models.md参数”部分获取示例和文档链接。models= - 关于服务商/模型选择的权衡,请查看。
references/models.md
- 默认
- 空气质量API领域选择:
- (默认)或
domains=auto/cams_europe。cams_global
- 预报API单位:
-
实现健壮的请求/响应处理
- 区分HTTP错误和JSON级错误。
- JSON错误格式为:
{"error": true, "reason": "..."}
- 当请求多个位置(逗号分隔的坐标)时,JSON输出结构会变为结构体列表。
- 当需要导出数据时,可选择使用或
format=csv。format=xlsx
-
通过“已知城市”检查验证正确性
- 对“Berlin”进行地理编码 → 调用预报API并设置,获取1-2天的数据 → 验证时区和数组长度。
hourly=temperature_2m - 调用空气质量API并设置→ 验证单位和
hourly=pm10,pm2_5,european_aqi是否存在。hourly_units
- 对“Berlin”进行地理编码 → 调用预报API并设置
Critical prohibitions
重要禁忌
- Do not include out-of-scope APIs in this skill’s implementation guidance: Historical Weather, Ensemble Models, Seasonal Forecast, Climate Change, Marine, Satellite Radiation, Elevation, Flood.
- Do not omit when requesting
timezonevariables (per docs).daily - Do not assume timestamps are local time; they are GMT+0 and require
unixtimeadjustment.utc_offset_seconds - Do not silently ignore responses; fail fast with the provided
{"error": true}.reason - Do not request huge variable sets by default; keep queries minimal to reduce payload and avoid accidental overuse.
- 请勿将本技能实现指南之外的API纳入范围:历史天气、集合模型、季节预报、气候变化、海洋、卫星辐射、海拔、洪水相关API。
- 请求变量时请勿省略
daily参数(符合文档要求)。timezone - 请勿假设时间戳为当地时间;它们属于GMT+0时区,需要通过
unixtime进行调整。utc_offset_seconds - 请勿忽略响应;应根据提供的
{"error": true}快速终止流程并抛出错误。reason - 默认情况下请勿请求大量变量集;保持查询最小化以减少负载并避免意外过度使用API。
Definition of done
完成标准
- You can geocode a place name and obtain coordinates/timezone.
- You can fetch Forecast data with at least one , one
hourly(with timezone), and onedailyvariable.current - You can fetch Air Quality data for at least one pollutant and one AQI metric.
- Your client code handles both HTTP-level failures and JSON-level with clear messages.
error: true - Attribution requirements from the docs are captured for Air Quality (CAMS) and Geocoding (GeoNames).
- 能够对地点名称进行地理编码并获取坐标/时区。
- 能够获取至少包含一个、一个
hourly(带时区)和一个daily变量的预报数据。current - 能够获取至少包含一种污染物和一项AQI指标的空气质量数据。
- 客户端代码能够处理HTTP级故障和JSON级错误,并返回清晰的提示信息。
error: true - 已记录空气质量(CAMS)和地理编码(GeoNames)所需的归属要求。
Links
链接
- Official docs (in-scope):
- Skill references:
references/forecast-api.mdreferences/models.mdreferences/weather-codes.mdreferences/air-quality-api.mdreferences/geocoding-api.mdreferences/examples.md
- 官方文档(范围内):
- 技能参考文档:
references/forecast-api.mdreferences/models.mdreferences/weather-codes.mdreferences/air-quality-api.mdreferences/geocoding-api.mdreferences/examples.md