hk-weather

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
Fetch live Hong Kong weather data from HKO Open Data API for: $ARGUMENTS
通过HKO Open Data API获取香港实时天气数据,支持以下参数:$ARGUMENTS

Step 1: Parse Arguments

步骤1:解析参数

Split
$ARGUMENTS
by spaces into tokens. Separate into keywords and language:
  • Language tokens:
    en
    (English),
    tc
    (Traditional Chinese, default),
    sc
    (Simplified Chinese) — if found, use as
    lang
    parameter. Default:
    tc
  • Keywords (case-insensitive):
    • detail
      → detailed mode (all stations + forecast)
    • stations
      → all station readings only
    • forecast
      → 9-day forecast mode
    • warning
      → warnings mode
    • rainfall
      → hourly rainfall mode
    • all
      → fetch everything
    • No keywords → default mode: quick weather summary
$ARGUMENTS
按空格分割为多个标记,区分关键词语言
  • 语言标记
    en
    (英文)、
    tc
    (繁体中文,默认)、
    sc
    (简体中文)——如果匹配到,将其作为
    lang
    参数使用。默认值:
    tc
  • 关键词(不区分大小写):
    • detail
      → 详细模式(包含所有站点数据+预报)
    • stations
      → 仅获取所有站点观测数据
    • forecast
      → 9天预报模式
    • warning
      → 天气预警模式
    • rainfall
      → 每小时降雨量模式
    • all
      → 获取全部数据
    • 无关键词 → 默认模式:快速天气摘要

Step 1b: Natural Language Intent Detection

步骤1b:自然语言意图识别

Only run this step if no mode keyword was matched in Step 1.
If
$ARGUMENTS
contains no recognized keyword (step 1 set no mode), check the full raw
$ARGUMENTS
string for intent patterns. Check in priority order — the first matching pattern wins. Language tokens (
en
,
tc
,
sc
) must still be extracted first in Step 1, before this check runs.
仅当步骤1中未匹配到任何模式关键词时,才执行此步骤。
如果
$ARGUMENTS
中未包含可识别的关键词(步骤1未设置任何模式),则检查完整的原始
$ARGUMENTS
字符串是否符合意图模式。按优先级顺序检查——第一个匹配的模式生效。在执行此检查前,必须先在步骤1中提取语言标记(
en
tc
sc
)。

Intent Pattern Matching

意图模式匹配

  1. Rain intent → set mode to
    rain_query
    if
    $ARGUMENTS
    contains any of:
    • Chinese:
      落雨
      ,
      下雨
      ,
      會唔會落
      ,
      會不會落
      ,
      有冇雨
      ,
      有沒有雨
      ,
      幾時落雨
      ,
      幾時下雨
      ,
      落雨機會
      ,
      下雨機會
      ,
      降雨
      ,
      雨勢
    • English (case-insensitive):
      rain
      ,
      raining
      ,
      rainfall
      ,
      will it rain
      ,
      going to rain
      ,
      chance of rain
      ,
      precipitation
  2. Forecast intent → set mode to
    forecast
    if
    $ARGUMENTS
    contains any of:
    • Chinese:
      預報
      ,
      天氣預測
      ,
      未來天氣
      ,
      9天
      ,
      九天
      ,
      幾天天氣
      ,
      下星期天氣
      ,
      本週天氣
      ,
      下週天氣
      ,
      天氣展望
      ,
      明天天氣
      ,
      後天天氣
      ,
      預計天氣
    • English (case-insensitive):
      forecast
      ,
      9-day
      ,
      9 day
      ,
      nine day
      ,
      next week weather
      ,
      this week weather
      ,
      tomorrow weather
      ,
      weather tomorrow
      ,
      weather outlook
      ,
      coming days
  3. Temperature intent → set mode to
    stations
    if
    $ARGUMENTS
    contains any of:
    • Chinese:
      氣溫
      ,
      幾度
      ,
      溫度
      ,
      熱唔熱
      ,
      凍唔凍
      ,
      係唔係熱
      ,
      係唔係凍
      ,
      好熱
      ,
      好凍
      ,
      熱嗎
      ,
      凍嗎
      ,
      天氣熱
      ,
      天氣凍
      ,
      現時溫度
    • English (case-insensitive):
      temperature
      ,
      how hot
      ,
      how cold
      ,
      temp
      ,
      degrees
      ,
      celsius
      ,
      warm today
      ,
      cold today
      ,
      is it hot
      ,
      is it cold
  4. UV intent → set mode to
    stations
    if
    $ARGUMENTS
    contains any of:
    • Chinese:
      紫外線
      ,
      UV
      ,
      ,
      防曬
      ,
      紫外
      ,
      UV指數
    • English (case-insensitive):
      uv
      ,
      ultraviolet
      ,
      uv index
      ,
      sun protection
      ,
      sunburn
  5. Humidity intent → set mode to
    stations
    if
    $ARGUMENTS
    contains any of:
    • Chinese:
      濕度
      ,
      潮濕
      ,
      幾濕
      ,
      濕唔濕
      ,
      濕嗎
    • English (case-insensitive):
      humidity
      ,
      humid
      ,
      how humid
      ,
      moisture
  6. Typhoon intent → set mode to
    warning
    if
    $ARGUMENTS
    contains any of:
    • Chinese:
      颱風
      ,
      台風
      ,
      風球
      ,
      幾號風球
      ,
      掛幾號
      ,
      打風
      ,
      熱帶氣旋
      ,
      風暴
      ,
      強風警告
      ,
      颶風
    • English (case-insensitive):
      typhoon
      ,
      tropical cyclone
      ,
      signal
      ,
      wind signal
      ,
      t8
      ,
      t3
      ,
      no.8
      ,
      no. 8
      ,
      typhoon signal
      ,
      storm signal
  7. Warning intent → set mode to
    warning
    if
    $ARGUMENTS
    contains any of:
    • Chinese:
      警告
      ,
      有冇警告
      ,
      有沒有警告
      ,
      黃色
      ,
      紅色
      ,
      黑色
      ,
      暴雨警告
      ,
      雷暴
      ,
      霜凍
      ,
      水浸
    • English (case-insensitive):
      warning
      ,
      alert
      ,
      red rain
      ,
      black rain
      ,
      yellow rain
      ,
      thunderstorm warning
      ,
      frost warning
If no pattern matched → set mode to default.
  1. 降雨意图 → 如果
    $ARGUMENTS
    包含以下任一内容,将模式设置为
    rain_query
    • 中文:
      落雨
      ,
      下雨
      ,
      會唔會落
      ,
      會不會落
      ,
      有冇雨
      ,
      有沒有雨
      ,
      幾時落雨
      ,
      幾時下雨
      ,
      落雨機會
      ,
      下雨機會
      ,
      降雨
      ,
      雨勢
    • 英文(不区分大小写):
      rain
      ,
      raining
      ,
      rainfall
      ,
      will it rain
      ,
      going to rain
      ,
      chance of rain
      ,
      precipitation
  2. 预报意图 → 如果
    $ARGUMENTS
    包含以下任一内容,将模式设置为
    forecast
    • 中文:
      預報
      ,
      天氣預測
      ,
      未來天氣
      ,
      9天
      ,
      九天
      ,
      幾天天氣
      ,
      下星期天氣
      ,
      本週天氣
      ,
      下週天氣
      ,
      天氣展望
      ,
      明天天氣
      ,
      後天天氣
      ,
      預計天氣
    • 英文(不区分大小写):
      forecast
      ,
      9-day
      ,
      9 day
      ,
      nine day
      ,
      next week weather
      ,
      this week weather
      ,
      tomorrow weather
      ,
      weather tomorrow
      ,
      weather outlook
      ,
      coming days
  3. 气温意图 → 如果
    $ARGUMENTS
    包含以下任一内容,将模式设置为
    stations
    • 中文:
      氣溫
      ,
      幾度
      ,
      溫度
      ,
      熱唔熱
      ,
      凍唔凍
      ,
      係唔係熱
      ,
      係唔係凍
      ,
      好熱
      ,
      好凍
      ,
      熱嗎
      ,
      凍嗎
      ,
      天氣熱
      ,
      天氣凍
      ,
      現時溫度
    • 英文(不区分大小写):
      temperature
      ,
      how hot
      ,
      how cold
      ,
      temp
      ,
      degrees
      ,
      celsius
      ,
      warm today
      ,
      cold today
      ,
      is it hot
      ,
      is it cold
  4. 紫外线意图 → 如果
    $ARGUMENTS
    包含以下任一内容,将模式设置为
    stations
    • 中文:
      紫外線
      ,
      UV
      ,
      ,
      防曬
      ,
      紫外
      ,
      UV指數
    • 英文(不区分大小写):
      uv
      ,
      ultraviolet
      ,
      uv index
      ,
      sun protection
      ,
      sunburn
  5. 湿度意图 → 如果
    $ARGUMENTS
    包含以下任一内容,将模式设置为
    stations
    • 中文:
      濕度
      ,
      潮濕
      ,
      幾濕
      ,
      濕唔濕
      ,
      濕嗎
    • 英文(不区分大小写):
      humidity
      ,
      humid
      ,
      how humid
      ,
      moisture
  6. 台风意图 → 如果
    $ARGUMENTS
    包含以下任一内容,将模式设置为
    warning
    • 中文:
      颱風
      ,
      台風
      ,
      風球
      ,
      幾號風球
      ,
      掛幾號
      ,
      打風
      ,
      熱帶氣旋
      ,
      風暴
      ,
      強風警告
      ,
      颶風
    • 英文(不区分大小写):
      typhoon
      ,
      tropical cyclone
      ,
      signal
      ,
      wind signal
      ,
      t8
      ,
      t3
      ,
      no.8
      ,
      no. 8
      ,
      typhoon signal
      ,
      storm signal
  7. 预警意图 → 如果
    $ARGUMENTS
    包含以下任一内容,将模式设置为
    warning
    • 中文:
      警告
      ,
      有冇警告
      ,
      有沒有警告
      ,
      黃色
      ,
      紅色
      ,
      黑色
      ,
      暴雨警告
      ,
      雷暴
      ,
      霜凍
      ,
      水浸
    • 英文(不区分大小写):
      warning
      ,
      alert
      ,
      red rain
      ,
      black rain
      ,
      yellow rain
      ,
      thunderstorm warning
      ,
      frost warning
如果没有匹配到任何模式 → 设置为默认模式。

Step 2: Fetch Data

步骤2:获取数据

Base URL:
https://data.weather.gov.hk/weatherAPI/opendata/
IMPORTANT — parallel fetching: When a mode requires multiple endpoints, fetch them ALL in a single Bash command using background processes (
&
) and
wait
. Write each response to a temp file, then read them all. This avoids slow sequential tool calls.
基础URL:
https://data.weather.gov.hk/weatherAPI/opendata/
重要提示——并行获取:当某个模式需要调用多个接口时,使用后台进程(
&
)和
wait
命令,在单个Bash命令中同时获取所有接口数据。将每个响应写入临时文件,之后统一读取。这样可以避免缓慢的串行调用。

Default Mode — quick summary (single endpoint):

默认模式——快速摘要(单接口):

bash
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=flw&lang={lang}"
Key fields:
generalSituation
,
forecastPeriod
,
forecastDesc
,
outlook
,
updateTime
bash
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=flw&lang={lang}"
关键字段:
generalSituation
,
forecastPeriod
,
forecastDesc
,
outlook
,
updateTime

Stations Mode — all station readings (single endpoint):

站点模式——所有站点观测数据(单接口):

bash
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=rhrread&lang={lang}"
Key fields:
temperature.data[]
(place, value),
humidity.data[]
(place, value),
rainfall.data[]
(place, max, min),
uvindex
,
icon
,
warningMessage
,
updateTime
bash
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=rhrread&lang={lang}"
关键字段:
temperature.data[]
(地点、数值),
humidity.data[]
(地点、数值),
rainfall.data[]
(地点、最大值、最小值),
uvindex
,
icon
,
warningMessage
,
updateTime

Detail Mode — fetch two in parallel:

详细模式——并行获取两个接口:

bash
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=rhrread&lang={lang}" > /tmp/hko_rhrread.json &
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=flw&lang={lang}" > /tmp/hko_flw.json &
wait
echo "===RHRREAD===" && cat /tmp/hko_rhrread.json && echo ""
echo "===FLW===" && cat /tmp/hko_flw.json && echo ""
rm -f /tmp/hko_rhrread.json /tmp/hko_flw.json
bash
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=rhrread&lang={lang}" > /tmp/hko_rhrread.json &
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=flw&lang={lang}" > /tmp/hko_flw.json &
wait
echo "===RHRREAD===" && cat /tmp/hko_rhrread.json && echo ""
echo "===FLW===" && cat /tmp/hko_flw.json && echo ""
rm -f /tmp/hko_rhrread.json /tmp/hko_flw.json

Forecast Mode — 9-day forecast (single endpoint):

预报模式——9天预报(单接口):

bash
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=fnd&lang={lang}"
Key fields:
weatherForecast[]
— each has
forecastDate
,
week
,
forecastWeather
,
forecastMaxtemp.value
,
forecastMintemp.value
,
forecastMaxrh.value
,
forecastMinrh.value
,
forecastWind
,
PSR
,
ForecastIcon
bash
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=fnd&lang={lang}"
关键字段:
weatherForecast[]
—— 每个对象包含
forecastDate
,
week
,
forecastWeather
,
forecastMaxtemp.value
,
forecastMintemp.value
,
forecastMaxrh.value
,
forecastMinrh.value
,
forecastWind
,
PSR
,
ForecastIcon

Warnings Mode — fetch both in parallel:

预警模式——并行获取两个接口:

bash
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=warnsum&lang={lang}" > /tmp/hko_warnsum.json &
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=warningInfo&lang={lang}" > /tmp/hko_warninfo.json &
wait
echo "===WARNSUM===" && cat /tmp/hko_warnsum.json && echo ""
echo "===WARNINGINFO===" && cat /tmp/hko_warninfo.json && echo ""
rm -f /tmp/hko_warnsum.json /tmp/hko_warninfo.json
warningInfo
returns
details[]
with
contents[]
(array of text lines),
warningStatementCode
, optional
subtype
,
updateTime
bash
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=warnsum&lang={lang}" > /tmp/hko_warnsum.json &
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=warningInfo&lang={lang}" > /tmp/hko_warninfo.json &
wait
echo "===WARNSUM===" && cat /tmp/hko_warnsum.json && echo ""
echo "===WARNINGINFO===" && cat /tmp/hko_warninfo.json && echo ""
rm -f /tmp/hko_warnsum.json /tmp/hko_warninfo.json
warningInfo
返回包含
details[]
的结果,其中每个详情包含
contents[]
(文本行数组)、
warningStatementCode
、可选的
subtype
updateTime

Rainfall Mode — hourly rainfall (single endpoint):

降雨量模式——每小时降雨量(单接口):

bash
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/hourlyRainfall.php?lang={lang}"
Key fields:
obsTime
,
hourlyRainfall[]
— each has
automaticWeatherStation
,
value
,
unit
bash
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/hourlyRainfall.php?lang={lang}"
关键字段:
obsTime
,
hourlyRainfall[]
—— 每个对象包含
automaticWeatherStation
,
value
,
unit

All Mode — fetch all endpoints in parallel:

全量模式——并行获取所有接口:

bash
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=rhrread&lang={lang}" > /tmp/hko_rhrread.json &
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=warnsum&lang={lang}" > /tmp/hko_warnsum.json &
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=flw&lang={lang}" > /tmp/hko_flw.json &
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=fnd&lang={lang}" > /tmp/hko_fnd.json &
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=warningInfo&lang={lang}" > /tmp/hko_warninfo.json &
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/hourlyRainfall.php?lang={lang}" > /tmp/hko_rainfall.json &
wait
echo "===RHRREAD===" && cat /tmp/hko_rhrread.json && echo ""
echo "===WARNSUM===" && cat /tmp/hko_warnsum.json && echo ""
echo "===FLW===" && cat /tmp/hko_flw.json && echo ""
echo "===FND===" && cat /tmp/hko_fnd.json && echo ""
echo "===WARNINGINFO===" && cat /tmp/hko_warninfo.json && echo ""
echo "===RAINFALL===" && cat /tmp/hko_rainfall.json && echo ""
rm -f /tmp/hko_rhrread.json /tmp/hko_warnsum.json /tmp/hko_flw.json /tmp/hko_fnd.json /tmp/hko_warninfo.json /tmp/hko_rainfall.json
bash
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=rhrread&lang={lang}" > /tmp/hko_rhrread.json &
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=warnsum&lang={lang}" > /tmp/hko_warnsum.json &
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=flw&lang={lang}" > /tmp/hko_flw.json &
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=fnd&lang={lang}" > /tmp/hko_fnd.json &
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=warningInfo&lang={lang}" > /tmp/hko_warninfo.json &
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/hourlyRainfall.php?lang={lang}" > /tmp/hko_rainfall.json &
wait
echo "===RHRREAD===" && cat /tmp/hko_rhrread.json && echo ""
echo "===WARNSUM===" && cat /tmp/hko_warnsum.json && echo ""
echo "===FLW===" && cat /tmp/hko_flw.json && echo ""
echo "===FND===" && cat /tmp/hko_fnd.json && echo ""
echo "===WARNINGINFO===" && cat /tmp/hko_warninfo.json && echo ""
echo "===RAINFALL===" && cat /tmp/hko_rainfall.json && echo ""
rm -f /tmp/hko_rhrread.json /tmp/hko_warnsum.json /tmp/hko_flw.json /tmp/hko_fnd.json /tmp/hko_warninfo.json /tmp/hko_rainfall.json

Rain Query Mode — fetch three in parallel:

降雨查询模式——并行获取三个接口:

bash
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=rhrread&lang={lang}" > /tmp/hko_rhrread.json &
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=flw&lang={lang}" > /tmp/hko_flw.json &
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=fnd&lang={lang}" > /tmp/hko_fnd.json &
wait
echo "===RHRREAD===" && cat /tmp/hko_rhrread.json && echo ""
echo "===FLW===" && cat /tmp/hko_flw.json && echo ""
echo "===FND===" && cat /tmp/hko_fnd.json && echo ""
rm -f /tmp/hko_rhrread.json /tmp/hko_flw.json /tmp/hko_fnd.json
bash
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=rhrread&lang={lang}" > /tmp/hko_rhrread.json &
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=flw&lang={lang}" > /tmp/hko_flw.json &
curl -s "https://data.weather.gov.hk/weatherAPI/opendata/weather.php?dataType=fnd&lang={lang}" > /tmp/hko_fnd.json &
wait
echo "===RHRREAD===" && cat /tmp/hko_rhrread.json && echo ""
echo "===FLW===" && cat /tmp/hko_flw.json && echo ""
echo "===FND===" && cat /tmp/hko_fnd.json && echo ""
rm -f /tmp/hko_rhrread.json /tmp/hko_flw.json /tmp/hko_fnd.json

Error Handling

错误处理

After each curl response, check:
  • If curl itself fails → report "Failed to reach HKO API" and continue to next endpoint
  • If response is empty, null, or not valid JSON → report "No data available for {dataType}" and continue
  • Always continue processing remaining endpoints if one fails
每次curl请求后,检查以下内容:
  • 如果curl请求本身失败 → 报告“无法连接HKO API”,并继续处理下一个接口
  • 如果响应为空、null或不是有效的JSON → 报告“{dataType}暂无可用数据”,并继续处理
  • 即使某个接口失败,也必须继续处理剩余的接口

Step 3: Present Results

步骤3:展示结果

Default Mode Output (quick summary)

默认模式输出(快速摘要)

undefined
undefined

香港天氣概況

香港天氣概況

更新時間: {updateTime}
概況: {generalSituation}
預報 ({forecastPeriod}): {forecastDesc}
展望: {outlook}

- Omit `generalSituation` line if empty
- Keep it compact — no tables, no section headers beyond the title
更新時間: {updateTime}
概況: {generalSituation}
預報 ({forecastPeriod}): {forecastDesc}
展望: {outlook}

- 如果`generalSituation`为空,则省略该行
- 保持内容简洁——除标题外,不使用表格和额外的章节标题

Rain Query Mode Output

降雨查询模式输出

If
rhrread.warningMessage
is non-empty, display it prominently at the very top.
For Traditional Chinese (tc/sc):
undefined
如果
rhrread.warningMessage
不为空,将其突出显示在最顶部。
繁体中文/简体中文(tc/sc):
undefined

降雨情況

降雨情況

{if warningMessage: show as highlighted alert}
更新時間: {updateTime from rhrread}
目前降雨: {if any rainfall.data[].max > 0:}
地點雨量 (mm)
{place}{max}
......
{else:} 各區目前無錄得雨量
今日降雨概率: {fnd.weatherForecast[0].PSR}
預報: {flw.forecastDesc}
展望: {flw.outlook}
資料來源:香港天文台

**For English (en):**
{如果有warningMessage:以高亮提示显示}
更新時間: {来自rhrread的updateTime}
目前降雨: {如果存在rainfall.data[].max > 0的记录:}
地點雨量 (mm)
{place}{max}
......
{否则:} 各區目前無錄得雨量
今日降雨概率: {fnd.weatherForecast[0].PSR}
預報: {flw.forecastDesc}
展望: {flw.outlook}
資料來源:香港天文台

**英文(en):**

Rain Status

Rain Status

{if warningMessage: show as highlighted alert}
Updated: {updateTime from rhrread}
Current Rainfall: {if any rainfall.data[].max > 0:}
StationRainfall (mm)
{place}{max}
......
{else:} No rainfall currently recorded across stations
Today's Rain Probability: {fnd.weatherForecast[0].PSR}
Forecast: {flw.forecastDesc}
Outlook: {flw.outlook}
Source: Hong Kong Observatory

**Error handling for rain query mode:**
- If `rhrread` fails → omit Current Rainfall section, continue
- If `flw` fails → omit Forecast and Outlook sections, continue
- If `fnd` fails → omit Today's Rain Probability line silently, continue
- If any section is omitted due to failure, still show other data and attribution line
{如果有warningMessage:以高亮提示显示}
Updated: {来自rhrread的updateTime}
Current Rainfall: {如果存在rainfall.data[].max > 0的记录:}
StationRainfall (mm)
{place}{max}
......
{否则:} No rainfall currently recorded across stations
Today's Rain Probability: {fnd.weatherForecast[0].PSR}
Forecast: {flw.forecastDesc}
Outlook: {flw.outlook}
Source: Hong Kong Observatory

**降雨查询模式错误处理:**
- 如果`rhrread`请求失败 → 省略“目前降雨”部分,继续处理
- 如果`flw`请求失败 → 省略“预报”和“展望”部分,继续处理
- 如果`fnd`请求失败 → 静默省略“今日降雨概率”行,继续处理
- 如果某部分因请求失败被省略,仍需显示其他可用数据和来源说明行

Stations Mode Output

站点模式输出

undefined
undefined

目前天氣

目前天氣

更新時間: {updateTime}

- Show temperature for all stations in a table
- Show humidity as a compact list
- For rainfall, only mention stations with max > 0. If all zero, say "各區無顯著雨量"
- If UV index data exists, show it
- If `warningMessage` is non-empty, show it prominently at the top
更新時間: {updateTime}

- 以表格形式展示所有站点的气温数据
- 以紧凑列表形式展示湿度数据
- 降雨量仅展示max>0的站点,如果所有站点均为0,则显示“各區無顯著雨量”
- 如果存在UV指数数据,展示该数据
- 如果`warningMessage`不为空,将其突出显示在最顶部

Detail Mode Output

详细模式输出

Show warning messages (from
rhrread.warningMessage
) if non-empty, then current conditions with all stations, then forecast.
undefined
如果
rhrread.warningMessage
不为空,先显示该预警信息,然后展示所有站点的当前天气状况,最后显示预报内容。
undefined

香港天氣概況

香港天氣概況

更新時間: {updateTime from rhrread}
undefined
更新時間: {来自rhrread的updateTime}
undefined

Current Conditions

当前天气状况

undefined
undefined

目前天氣

目前天氣

地點氣溫 (°C)
{place}{value}
......
相對濕度: {humidity place}: {value}%
降雨: {list any places with non-zero rainfall}

- Show temperature for all stations in a table
- Show humidity as a compact list (typically fewer stations)
- For rainfall, only mention stations with max > 0. If all zero, say "各區無顯著雨量"
- If UV index data exists, show it
- If `warningMessage` has content, display it prominently at the top
地點氣溫 (°C)
{place}{value}
......
相對濕度: {humidity地点}: {value}%
降雨: {列出所有降雨量非零的地点}

- 以表格形式展示所有站点的气温数据
- 以紧凑列表形式展示湿度数据(通常站点数量较少)
- 降雨量仅展示max>0的站点,如果所有站点均为0,则显示“各區無顯著雨量”
- 如果存在UV指数数据展示该数据
- 如果`warningMessage`不为空,将其突出显示在最顶部

Forecast Section

预报章节

undefined
undefined

天氣預報

天氣預報

預報時段: {forecastPeriod}
{forecastDesc}
展望: {outlook}

If `generalSituation` is non-empty, show it before the forecast description.
預報時段: {forecastPeriod}
{forecastDesc}
展望: {outlook}

如果`generalSituation`不为空,在预报描述前展示该内容。

Forecast Mode Output (9-day)

预报模式输出(9天)

undefined
undefined

9天天氣預報

9天天氣預報

更新時間: {updateTime}
日期星期天氣氣溫 (°C)濕度 (%)風向降雨概率
{MM/DD}{week}{forecastWeather}{min}-{max}{minrh}-{maxrh}{forecastWind}{PSR}
...
undefined
更新時間: {updateTime}
日期星期天氣氣溫 (°C)濕度 (%)風向降雨概率
{MM/DD}{week}{forecastWeather}{min}-{max}{minrh}-{maxrh}{forecastWind}{PSR}
...
undefined

Warnings Mode Output

预警模式输出

undefined
undefined

天氣警告詳情

天氣警告詳情

更新時間: {updateTime}

If no warnings active:
目前沒有任何天氣警告。

If warnings exist, for each warning in `warningInfo.details[]`:
更新時間: {updateTime}

如果没有生效的预警:
目前沒有任何天氣警告。

如果存在预警,针对`warningInfo.details[]`中的每个预警:

{warningStatementCode} {subtype if present}

{warningStatementCode} {如果有subtype则显示}

{contents joined by newlines}
更新: {updateTime}

Also show summary table from `warnsum`:
警告狀態發出時間
{name}{actionCode}{issueTime}
undefined
{将contents用换行符连接}
更新: {updateTime}

同时展示来自`warnsum`的摘要表格:
警告狀態發出時間
{name}{actionCode}{issueTime}
undefined

Rainfall Mode Output

降雨量模式输出

undefined
undefined

過去一小時雨量

過去一小時雨量

觀測時間: {obsTime}
站點雨量 (mm)
{automaticWeatherStation}{value}
...

- Filter out stations where `value` is `0` — unless ALL stations are 0, then show all with a note "各區過去一小時無錄得雨量"
- If `value` is `"M"` (maintenance), show as "維修中"
- Sort by rainfall amount descending (highest first)
觀測時間: {obsTime}
站點雨量 (mm)
{automaticWeatherStation}{value}
...

- 过滤掉`value`为`0`的站点——除非所有站点均为0,此时显示所有站点并附加说明“各區過去一小時無錄得雨量”
- 如果`value`为`"M"`(维护中),显示为“維修中”
- 按降雨量从高到低排序

All Mode Output

全量模式输出

Combine all sections in this order:
  1. Warnings (if any)
  2. Current conditions
  3. Local forecast
  4. 9-day forecast
  5. Hourly rainfall
按以下顺序组合所有章节:
  1. 预警信息(如果有)
  2. 当前天气状况
  3. 本地预报
  4. 9天预报
  5. 每小时降雨量

Formatting Rules

格式规则

  • Attribution: Always append a source line at the end of ALL output, after all sections:
    • tc/sc:
      _資料來源:香港天文台_
    • en:
      _Source: Hong Kong Observatory_
  • Temperatures: display as returned (integer or 1 decimal), with °C
  • Humidity: integer, with %
  • Rainfall: integer, mm
  • Times: convert ISO 8601 timestamps to human-readable HKT format
    YYYY-MM-DD HH:MM HKT
    (e.g.
    2026-03-22T02:45:00+08:00
    2026-03-22 02:45 HKT
    )
  • 9-day forecast dates: convert
    YYYYMMDD
    to
    MM/DD
    format
  • Omit null/empty fields silently — do not show placeholder text for missing data
  • Use the language matching
    lang
    for section headers (tc/sc → Chinese headers as shown above; en → English headers like "Current Weather", "9-Day Forecast", etc.)
  • 来源标注:在所有输出的末尾,必须添加来源行:
    • tc/sc:
      _資料來源:香港天文台_
    • en:
      _Source: Hong Kong Observatory_
  • 气温:按返回值展示(整数或1位小数),附带°C
  • 湿度:整数,附带%
  • 降雨量:整数,单位mm
  • 时间:将ISO 8601时间戳转换为易读的HKT格式
    YYYY-MM-DD HH:MM HKT
    (例如
    2026-03-22T02:45:00+08:00
    2026-03-22 02:45 HKT
  • 9天预报日期:将
    YYYYMMDD
    转换为
    MM/DD
    格式
  • 静默省略null/空字段——不为缺失的数据显示占位文本
  • 章节标题使用与
    lang
    匹配的语言(tc/sc → 使用上述中文标题;en → 使用英文标题如"Current Weather", "9-Day Forecast"等)

Rules

规则

  • Read-only — only GET requests, never POST/PUT/DELETE
  • Always use
    curl -s
    for silent mode
  • Default language is
    tc
    (Traditional Chinese)
  • If one endpoint fails, still process all remaining endpoints
  • All HKO timestamps are in HKT (+08:00) — convert to
    YYYY-MM-DD HH:MM HKT
    format
  • When presenting in English mode, use English section headers accordingly
  • 只读 —— 仅使用GET请求,禁止使用POST/PUT/DELETE
  • 始终使用
    curl -s
    以静默模式执行
  • 默认语言为
    tc
    (繁体中文)
  • 即使某个接口失败,仍需处理所有剩余接口
  • 所有HKO时间戳均为HKT时区(+08:00)——转换为
    YYYY-MM-DD HH:MM HKT
    格式
  • 当使用英文模式时,对应使用英文章节标题