雨量
這組端點提供中央氣象署雨量站的 10 分鐘、1 小時到 3 天等累積雨量,約每 10 分鐘一筆、保留 3 天,另有單站最近 24 小時或 7 天的雨量趨勢。適合做雨量地圖、豪雨排行與雨量圖表。共通格式(欄位化快照、差量時間列表、伺服器選擇)見氣象 API 概要。
建議標示資料來源:中央氣象署、ExpTech Studio(exptech.dev)
- 中央氣象署:另須遵守中央氣象署的資料使用規範(例如政府資料開放授權條款);氣象與地震資訊以中央氣象署發布的內容為準。
標示位置、範例與商業使用申請見資料授權與來源標示。
目前不需要 API Token。
取得測站目錄
Section titled “取得測站目錄”站號對應名稱、縣市、鄉鎮、海拔與座標,格式與天氣測站目錄相同。
curl "https://api.core-tnn1.exptech.dev/api/v5/meteor/rain/station"const res = await fetch("https://api.core-tnn1.exptech.dev/api/v5/meteor/rain/station");if (!res.ok) throw new Error(`HTTP ${res.status}`);const data = await res.json();console.log(data);import requests
res = requests.get( "https://api.core-tnn1.exptech.dev/api/v5/meteor/rain/station", timeout=10,)res.raise_for_status()print(res.json())成功
{ "C0TB40": { "n": "崇德", "c": "花蓮縣", "t": "秀林鄉", "alt": 8, "lat": 24.1661, "lon": 121.6574 }, "C0SD20": { "n": "富山", "c": "臺東縣", "t": "卑南鄉", "alt": 21, "lat": 22.8224, "lon": 121.1908 }}資料未變更(If-None-Match 相符),沒有 body沒有回應本文
試試看
回應是物件,key 為站號。
| 欄位 | 類型 | 說明 |
|---|---|---|
{站號}.n | string | 測站名稱 |
{站號}.c | string | 縣市 |
{站號}.t | string | 鄉鎮市區 |
{站號}.alt | number | 海拔(m) |
{站號}.lat | number | 緯度,小數 4 位 |
{站號}.lon | number | 經度,小數 4 位 |
目錄取自最新一筆快照,只會列出那一筆裡的測站(見注意事項)。尚無資料時回 {}。
取得最新雨量
Section titled “取得最新雨量”最新一筆雨量快照,欄位化格式:每個欄位是一個陣列,與 ids 同索引對齊。
curl "https://api.core-tnn1.exptech.dev/api/v5/meteor/rain"const res = await fetch("https://api.core-tnn1.exptech.dev/api/v5/meteor/rain");if (!res.ok) throw new Error(`HTTP ${res.status}`);const data = await res.json();console.log(data);import requests
res = requests.get("https://api.core-tnn1.exptech.dev/api/v5/meteor/rain", timeout=10)res.raise_for_status()print(res.json())成功
{ "time": 1794635400, "ids": [ "C0TB40", "C0SD20" ], "now": [ 12.5, 0 ], "10m": [ 1.5, 0 ], "1h": [ 6, 0 ], "3h": [ 11, 0 ], "6h": [ 12.5, 0 ], "12h": [ 20, 0 ], "24h": [ 48.5, 0.5 ], "2d": [ 52, 0.5 ], "3d": [ 52, 3 ]}資料未變更(If-None-Match 相符),沒有 body沒有回應本文
試試看
雨量單位都是 mm,小數 1 位。
| 欄位 | 類型 | 說明 |
|---|---|---|
time | number | 觀測時間,Unix 秒 |
ids | string[] | 站號,其他陣列都依這個順序對齊 |
now | number[] | 本日累積雨量(依中央氣象署資料定義) |
10m | number[] | 過去 10 分鐘累積雨量 |
1h | number[] | 過去 1 小時累積雨量 |
3h | number[] | 過去 3 小時累積雨量 |
6h | number[] | 過去 6 小時累積雨量 |
12h | number[] | 過去 12 小時累積雨量 |
24h | number[] | 過去 24 小時累積雨量 |
2d | number[] | 過去 2 天累積雨量 |
3d | number[] | 過去 3 天累積雨量 |
數值直接沿用來源資料。雨量不會是負數,任何負值(常見 -99)都表示沒有有效觀測。尚無資料時回 {}。
取得快照時間列表
Section titled “取得快照時間列表”目前可查詢的雨量快照時間,差量編碼的 Unix 秒,由舊到新。還原方式見差量時間列表。
curl "https://api.core-tnn1.exptech.dev/api/v5/meteor/rain/list"const res = await fetch("https://api.core-tnn1.exptech.dev/api/v5/meteor/rain/list");if (!res.ok) throw new Error(`HTTP ${res.status}`);const data = await res.json();console.log(data);import requests
res = requests.get( "https://api.core-tnn1.exptech.dev/api/v5/meteor/rain/list", timeout=10,)res.raise_for_status()print(res.json())成功
[ 1794376800, 600, 600, 600]資料未變更(If-None-Match 相符),沒有 body沒有回應本文
試試看
| 欄位 | 類型 | 說明 |
|---|---|---|
[0] | number | 最舊一筆快照的時間,Unix 秒 |
[i](i ≥ 1) | number | 與前一筆的時間差(秒) |
沒有快照時回 []。
取得指定時刻的雨量
Section titled “取得指定時刻的雨量”指定時刻的雨量快照,結構與最新雨量相同。只在 static.core 提供,api.core 對這個路徑回 404。
time路徑參數。快照時間,10 位 Unix 秒,必須是 /list 裡出現過的值
curl "https://static.core-tnn1.exptech.dev/api/v5/meteor/rain/<time>"const res = await fetch("https://static.core-tnn1.exptech.dev/api/v5/meteor/rain/<time>");if (!res.ok) throw new Error(`HTTP ${res.status}`);const data = await res.json();console.log(data);import requests
res = requests.get( "https://static.core-tnn1.exptech.dev/api/v5/meteor/rain/<time>", timeout=10,)res.raise_for_status()print(res.json())成功,結構同最新雨量
{ "time": 1794634800, "ids": [ "C0TB40" ], "now": [ 11 ], "10m": [ 2 ], "1h": [ 5.5 ], "3h": [ 9.5 ], "6h": [ 11 ], "12h": [ 18.5 ], "24h": [ 47 ], "2d": [ 50.5 ], "3d": [ 50.5 ]}資料未變更(If-None-Match 相符),沒有 body沒有回應本文
time 不是整數,或該時刻沒有快照(超過保留期限也是)。沒有 body沒有回應本文
試試看
同最新雨量的回應欄位。
取得單站雨量趨勢
Section titled “取得單站雨量趨勢”單一雨量站最近 24 小時或 7 天的「過去 1 小時雨量」序列,適合畫雨量圖。
id路徑參數。站號,例如 C0TB40
range查詢參數。只有字面值 7d 會回 7 天,其他值或省略都是 24h
curl "https://api.core-tnn1.exptech.dev/api/v5/meteor/rain/trend/<id>"const res = await fetch("https://api.core-tnn1.exptech.dev/api/v5/meteor/rain/trend/<id>");if (!res.ok) throw new Error(`HTTP ${res.status}`);const data = await res.json();console.log(data);import requests
res = requests.get( "https://api.core-tnn1.exptech.dev/api/v5/meteor/rain/trend/<id>", timeout=10,)res.raise_for_status()print(res.json())成功
{ "id": "C0TB40", "range": "24h", "ts": [ 1794549600, 600, 600 ], "rain": [ 0, 0.5, 1 ]}資料未變更(If-None-Match 相符),沒有 body沒有回應本文
這個站號在範圍內沒有任何資料點。沒有 body沒有回應本文
試試看
| 欄位 | 類型 | 說明 |
|---|---|---|
id | string | 站號 |
range | string | 實際採用的範圍:24h 或 7d |
ts | number[] | 資料點時間,差量編碼的 Unix 秒 |
rain | number[] | 各時間點的過去 1 小時累積雨量(mm) |
24h:最近 24 小時內這個測站出現的每一筆快照(約每 10 分鐘一點),ts是觀測時間。7d:最近 7 天每小時一點,ts是該小時的整點,值取該小時最後一筆,接近該小時的累積雨量。
- 時間都是 Unix 秒。
- 每筆快照只包含觀測時間剛好是該時刻的測站。來源資料裡各站的觀測時間不一定一致,所以單一快照的測站數可能少於全部測站;需要每站最新值時,可以把最近幾筆快照依時間由舊到新合併。
- 快照保留 3 天;7 天趨勢從另外的每小時彙總取得。
- 資料來源:中央氣象署開放資料的雨量觀測。
- 伺服器選擇見氣象 API 概要:時間戳快照走
static.core,其他走api.core,建議直接用 TNN-1 的網址。
