サインインしてAPIトークンを発行し(無料枠があります)、最初のリクエストを送ります。下の例(cURLまたはPython)をコピーし、トークンと時刻を差し替えればすぐに動かせます。[API_TOKEN]と書かれている場所は、角括弧なしで自分のトークンに置き換えてください。
NOAA Global Forecast System (GFS)を使い、2025年5月1日のTimes Squareにおける1時間ごとの気温データをクエリします。
リクエストはこのエンドポイントに送ります:
POST https://gribstream.com/api/v2/[MODEL]/timeseries
名称変更 以前は/historyでした。旧URLも引き続き動作します。
[MODEL]をGFSのコードであるgfsに置き換えると、エンドポイントは次のようになります:
POST https://gribstream.com/api/v2/gfs/timeseries
利用可能なモデルはモデル一覧で確認できます。
時刻はISO 8601 UTC形式です。この例では、fromTimeからuntilTimeまでの時間範囲を指定します。
座標は(latitude, longitude)の数値ペアです。
気象パラメータは(name, level, info)の組み合わせで選択します。これはカタログにある正確なセレクタです。nameは上流のパラメータコード、levelは鉛直レベルまたは地表面レベル、infoは必要に応じて同じパラメータコードの違いを区別します。GFSを見ると、気温は多くのlevelでTMPというnameとして公開されています。この例では2m above groundを使います。
curl -X POST 'https://gribstream.com/api/v2/gfs/timeseries' \
-H "Authorization: Bearer [API_TOKEN]" \
-d '{
"fromTime": "2025-05-01T00:00:00Z",
"untilTime": "2025-05-02T00:00:00Z",
"coordinates": [{ "lat": 40.758, "lon": -73.985 }],
"variables": [{ "name": "TMP", "level": "2 m above ground", "info": "" }]
}'
import requests
API_TOKEN = "[API_TOKEN]" # Replace with your token
payload = {
"fromTime": "2025-05-01T00:00:00Z",
"untilTime": "2025-05-02T00:00:00Z",
"coordinates": [
{ "lat": 40.758, "lon": -73.985 }
],
"variables": [
{ "name": "TMP", "level": "2 m above ground", "info": "" }
]
}
headers = {
"Authorization": f"Bearer {API_TOKEN}",
}
response = requests.post("https://gribstream.com/api/v2/gfs/timeseries", json=payload, headers=headers)
response.raise_for_status()
print(response.text)
forecasted_at,forecasted_time,lat,lon,name,TMP|2 m above ground|
2025-05-01T06:00:00Z,2025-05-01T09:00:00Z,40.7580,-73.9850,,286.7000
2025-05-01T06:00:00Z,2025-05-01T11:00:00Z,40.7580,-73.9850,,286.5539
2025-05-01T00:00:00Z,2025-05-01T01:00:00Z,40.7580,-73.9850,,292.2532
2025-05-01T12:00:00Z,2025-05-01T15:00:00Z,40.7580,-73.9850,,292.2911
2025-05-01T18:00:00Z,2025-05-01T19:00:00Z,40.7580,-73.9850,,292.7923
2025-05-01T12:00:00Z,2025-05-01T14:00:00Z,40.7580,-73.9850,,290.9911
2025-05-01T12:00:00Z,2025-05-01T17:00:00Z,40.7580,-73.9850,,293.8677
2025-05-01T12:00:00Z,2025-05-01T16:00:00Z,40.7580,-73.9850,,293.2000
2025-05-01T18:00:00Z,2025-05-01T20:00:00Z,40.7580,-73.9850,,292.3354
2025-05-01T18:00:00Z,2025-05-01T18:00:00Z,40.7580,-73.9850,,293.5384
2025-05-01T06:00:00Z,2025-05-01T08:00:00Z,40.7580,-73.9850,,287.1673
2025-05-01T12:00:00Z,2025-05-01T13:00:00Z,40.7580,-73.9850,,289.4673
2025-05-01T00:00:00Z,2025-05-01T04:00:00Z,40.7580,-73.9850,,289.4754
2025-05-01T00:00:00Z,2025-05-01T03:00:00Z,40.7580,-73.9850,,290.4711
2025-05-01T00:00:00Z,2025-05-01T05:00:00Z,40.7580,-73.9850,,288.8000
2025-05-01T00:00:00Z,2025-05-01T00:00:00Z,40.7580,-73.9850,,292.9684
2025-05-01T12:00:00Z,2025-05-01T12:00:00Z,40.7580,-73.9850,,287.7405
2025-05-01T00:00:00Z,2025-05-01T02:00:00Z,40.7580,-73.9850,,291.3480
2025-05-01T06:00:00Z,2025-05-01T06:00:00Z,40.7580,-73.9850,,288.2327
2025-05-01T06:00:00Z,2025-05-01T10:00:00Z,40.7580,-73.9850,,286.2595
2025-05-01T18:00:00Z,2025-05-01T22:00:00Z,40.7580,-73.9850,,290.9539
2025-05-01T06:00:00Z,2025-05-01T07:00:00Z,40.7580,-73.9850,,287.7000
2025-05-01T18:00:00Z,2025-05-01T23:00:00Z,40.7580,-73.9850,,290.0113
2025-05-01T18:00:00Z,2025-05-01T21:00:00Z,40.7580,-73.9850,,291.8027
行がforecasted_at順でもforecasted_time順でもない点に注意してください。これはAPIの効率のためです。
aliasレスポンスを処理するときは、座標ペアだけでなく名前を使えると便利です。地点に人間が読める名前を付けたり、IDを保持したりできます。前処理なしで可視化やダッシュボードを作るときに役立ちます。
各座標に追加のnameプロパティを入れることで実現します。この例ではTimesSquareを使います。
気象変数の3要素の命名規則は、人間には読みにくいことがあります(TMP|2 m above ground|)。そこで、追加のaliasプロパティで変数名を変更できます。
たとえば別の高度の気温へコード上で切り替えながら、列名はtempのままにできます。SQLのASキーワードに近いものです。
curl -X POST 'https://gribstream.com/api/v2/gfs/timeseries' \
-H "Authorization: Bearer [API_TOKEN]" \
-d '{
"fromTime": "2025-05-01T00:00:00Z",
"untilTime": "2025-05-02T00:00:00Z",
"coordinates": [{ "lat": 40.758, "lon": -73.985 , "name": "TimesSquare"}],
"variables": [{ "name": "TMP", "level": "2 m above ground", "info": "", "alias": "temp" }]
}'
import requests
API_TOKEN = "[API_TOKEN]" # Replace with your token
payload = {
"fromTime": "2025-05-01T00:00:00Z",
"untilTime": "2025-05-02T00:00:00Z",
"coordinates": [
{ "lat": 40.758, "lon": -73.985, "name": "TimesSquare" }
],
"variables": [
{ "name": "TMP", "level": "2 m above ground", "info": "", "alias": "temp" }
]
}
headers = {
"Authorization": f"Bearer {API_TOKEN}",
}
response = requests.post("https://gribstream.com/api/v2/gfs/timeseries", json=payload, headers=headers)
response.raise_for_status()
print(response.text)
forecasted_at,forecasted_time,lat,lon,name,temp
2025-05-01T05:00:00Z,2025-05-01T06:00:00Z,40.7580,-73.9850,TimesSquare,287.7400
2025-05-01T10:00:00Z,2025-05-01T11:00:00Z,40.7580,-73.9850,TimesSquare,285.7200
2025-05-01T03:00:00Z,2025-05-01T04:00:00Z,40.7580,-73.9850,TimesSquare,289.1600
2025-05-01T08:00:00Z,2025-05-01T09:00:00Z,40.7580,-73.9850,TimesSquare,285.7200
2025-05-01T20:00:00Z,2025-05-01T21:00:00Z,40.7580,-73.9850,TimesSquare,291.7000
2025-05-01T04:00:00Z,2025-05-01T05:00:00Z,40.7580,-73.9850,TimesSquare,288.4300
2025-05-01T02:00:00Z,2025-05-01T03:00:00Z,40.7580,-73.9850,TimesSquare,290.1200
2025-05-01T09:00:00Z,2025-05-01T10:00:00Z,40.7580,-73.9850,TimesSquare,285.4300
2025-05-01T06:00:00Z,2025-05-01T07:00:00Z,40.7580,-73.9850,TimesSquare,286.8900
2025-05-01T19:00:00Z,2025-05-01T20:00:00Z,40.7580,-73.9850,TimesSquare,292.5500
2025-05-01T07:00:00Z,2025-05-01T08:00:00Z,40.7580,-73.9850,TimesSquare,286.3500
2025-05-01T15:00:00Z,2025-05-01T16:00:00Z,40.7580,-73.9850,TimesSquare,292.9300
2025-05-01T11:00:00Z,2025-05-01T12:00:00Z,40.7580,-73.9850,TimesSquare,286.8000
2025-05-01T18:00:00Z,2025-05-01T19:00:00Z,40.7580,-73.9850,TimesSquare,293.4100
2025-05-01T17:00:00Z,2025-05-01T18:00:00Z,40.7580,-73.9850,TimesSquare,293.8500
2025-05-01T12:00:00Z,2025-05-01T13:00:00Z,40.7580,-73.9850,TimesSquare,288.1300
2025-05-01T21:00:00Z,2025-05-01T22:00:00Z,40.7580,-73.9850,TimesSquare,291.0500
2025-05-01T13:00:00Z,2025-05-01T14:00:00Z,40.7580,-73.9850,TimesSquare,290.2100
2025-05-01T14:00:00Z,2025-05-01T15:00:00Z,40.7580,-73.9850,TimesSquare,291.3900
2025-05-01T01:00:00Z,2025-05-01T02:00:00Z,40.7580,-73.9850,TimesSquare,291.2300
2025-05-01T00:00:00Z,2025-05-01T01:00:00Z,40.7580,-73.9850,TimesSquare,291.6000
2025-05-01T16:00:00Z,2025-05-01T17:00:00Z,40.7580,-73.9850,TimesSquare,293.6300
2025-04-30T23:00:00Z,2025-05-01T00:00:00Z,40.7580,-73.9850,TimesSquare,292.6500
2025-05-01T22:00:00Z,2025-05-01T23:00:00Z,40.7580,-73.9850,TimesSquare,289.6300
かなり読みやすくなりました。
レスポンス形式はAcceptヘッダーで決まります。APIは3つの形式に対応しています:
Accept: text/csv - レスポンスは予報データを含むCSVファイルです。Accept: application/json - レスポンスは単一のJSON配列で、各要素はオブジェクトです。Accept: application/ndjson - レスポンスは改行区切りJSON(NDJSON)で、1行に1つのJSONオブジェクトが入ります。レスポンス形式を指定しない場合、デフォルトはtext/csvです。
curl -X POST 'https://gribstream.com/api/v2/gfs/timeseries' \
-H "Authorization: Bearer [API_TOKEN]" \
-H "Accept: text/csv" \
-d '{
"fromTime": "2025-05-01T00:00:00Z",
"untilTime": "2025-05-02T00:00:00Z",
"coordinates": [{ "lat": 40.758, "lon": -73.985 , "name": "TimesSquare"}],
"variables": [{ "name": "TMP", "level": "2 m above ground", "info": "", "alias": "temp" }]
}'
forecasted_at,forecasted_time,lat,lon,name,temp
2025-05-01T05:00:00Z,2025-05-01T06:00:00Z,40.7580,-73.9850,TimesSquare,287.7400
2025-05-01T10:00:00Z,2025-05-01T11:00:00Z,40.7580,-73.9850,TimesSquare,285.7200
2025-05-01T03:00:00Z,2025-05-01T04:00:00Z,40.7580,-73.9850,TimesSquare,289.1600
2025-05-01T08:00:00Z,2025-05-01T09:00:00Z,40.7580,-73.9850,TimesSquare,285.7200
2025-05-01T20:00:00Z,2025-05-01T21:00:00Z,40.7580,-73.9850,TimesSquare,291.7000
2025-05-01T04:00:00Z,2025-05-01T05:00:00Z,40.7580,-73.9850,TimesSquare,288.4300
2025-05-01T02:00:00Z,2025-05-01T03:00:00Z,40.7580,-73.9850,TimesSquare,290.1200
2025-05-01T09:00:00Z,2025-05-01T10:00:00Z,40.7580,-73.9850,TimesSquare,285.4300
2025-05-01T06:00:00Z,2025-05-01T07:00:00Z,40.7580,-73.9850,TimesSquare,286.8900
2025-05-01T19:00:00Z,2025-05-01T20:00:00Z,40.7580,-73.9850,TimesSquare,292.5500
2025-05-01T07:00:00Z,2025-05-01T08:00:00Z,40.7580,-73.9850,TimesSquare,286.3500
2025-05-01T15:00:00Z,2025-05-01T16:00:00Z,40.7580,-73.9850,TimesSquare,292.9300
2025-05-01T11:00:00Z,2025-05-01T12:00:00Z,40.7580,-73.9850,TimesSquare,286.8000
2025-05-01T18:00:00Z,2025-05-01T19:00:00Z,40.7580,-73.9850,TimesSquare,293.4100
2025-05-01T17:00:00Z,2025-05-01T18:00:00Z,40.7580,-73.9850,TimesSquare,293.8500
2025-05-01T12:00:00Z,2025-05-01T13:00:00Z,40.7580,-73.9850,TimesSquare,288.1300
2025-05-01T21:00:00Z,2025-05-01T22:00:00Z,40.7580,-73.9850,TimesSquare,291.0500
2025-05-01T13:00:00Z,2025-05-01T14:00:00Z,40.7580,-73.9850,TimesSquare,290.2100
2025-05-01T14:00:00Z,2025-05-01T15:00:00Z,40.7580,-73.9850,TimesSquare,291.3900
2025-05-01T01:00:00Z,2025-05-01T02:00:00Z,40.7580,-73.9850,TimesSquare,291.2300
2025-05-01T00:00:00Z,2025-05-01T01:00:00Z,40.7580,-73.9850,TimesSquare,291.6000
2025-05-01T16:00:00Z,2025-05-01T17:00:00Z,40.7580,-73.9850,TimesSquare,293.6300
2025-04-30T23:00:00Z,2025-05-01T00:00:00Z,40.7580,-73.9850,TimesSquare,292.6500
2025-05-01T22:00:00Z,2025-05-01T23:00:00Z,40.7580,-73.9850,TimesSquare,289.6300
curl -X POST 'https://gribstream.com/api/v2/gfs/timeseries' \
-H "Authorization: Bearer [API_TOKEN]" \
-H "Accept: application/json" \
-d '{
"fromTime": "2025-05-01T00:00:00Z",
"untilTime": "2025-05-02T00:00:00Z",
"coordinates": [{ "lat": 40.758, "lon": -73.985 , "name": "TimesSquare"}],
"variables": [{ "name": "TMP", "level": "2 m above ground", "info": "", "alias": "temp" }]
}'
[{"forecasted_at":"2025-05-01T00:00:00Z","forecasted_time":"2025-05-01T00:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":292.96841796875}
,{"forecasted_at":"2025-05-01T06:00:00Z","forecasted_time":"2025-05-01T11:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":286.553857421875}
,{"forecasted_at":"2025-05-01T00:00:00Z","forecasted_time":"2025-05-01T05:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":288.80002441406253}
,{"forecasted_at":"2025-05-01T00:00:00Z","forecasted_time":"2025-05-01T04:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":289.4754296875}
,{"forecasted_at":"2025-05-01T12:00:00Z","forecasted_time":"2025-05-01T17:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":293.86765136718753}
,{"forecasted_at":"2025-05-01T12:00:00Z","forecasted_time":"2025-05-01T13:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":289.46726074218753}
,{"forecasted_at":"2025-05-01T12:00:00Z","forecasted_time":"2025-05-01T14:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":290.99106445312503}
,{"forecasted_at":"2025-05-01T18:00:00Z","forecasted_time":"2025-05-01T19:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":292.7922607421875}
,{"forecasted_at":"2025-05-01T18:00:00Z","forecasted_time":"2025-05-01T18:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":293.53837890625005}
,{"forecasted_at":"2025-05-01T18:00:00Z","forecasted_time":"2025-05-01T20:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":292.33542480468753}
,{"forecasted_at":"2025-05-01T12:00:00Z","forecasted_time":"2025-05-01T15:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":292.29106445312505}
,{"forecasted_at":"2025-05-01T18:00:00Z","forecasted_time":"2025-05-01T21:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":291.802685546875}
,{"forecasted_at":"2025-05-01T06:00:00Z","forecasted_time":"2025-05-01T09:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":286.70000000000005}
,{"forecasted_at":"2025-05-01T06:00:00Z","forecasted_time":"2025-05-01T06:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":288.23271484375}
,{"forecasted_at":"2025-05-01T06:00:00Z","forecasted_time":"2025-05-01T07:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":287.70000000000005}
,{"forecasted_at":"2025-05-01T18:00:00Z","forecasted_time":"2025-05-01T22:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":290.953857421875}
,{"forecasted_at":"2025-05-01T06:00:00Z","forecasted_time":"2025-05-01T08:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":287.1672607421875}
,{"forecasted_at":"2025-05-01T06:00:00Z","forecasted_time":"2025-05-01T10:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":286.2595458984375}
,{"forecasted_at":"2025-05-01T12:00:00Z","forecasted_time":"2025-05-01T12:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":287.74045410156253}
,{"forecasted_at":"2025-05-01T12:00:00Z","forecasted_time":"2025-05-01T16:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":293.20000000000005}
,{"forecasted_at":"2025-05-01T00:00:00Z","forecasted_time":"2025-05-01T02:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":291.348046875}
,{"forecasted_at":"2025-05-01T00:00:00Z","forecasted_time":"2025-05-01T03:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":290.47107421875}
,{"forecasted_at":"2025-05-01T00:00:00Z","forecasted_time":"2025-05-01T01:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":292.25318359375}
,{"forecasted_at":"2025-05-01T18:00:00Z","forecasted_time":"2025-05-01T23:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":290.0113037109375}
]
curl -X POST 'https://gribstream.com/api/v2/gfs/timeseries' \
-H "Authorization: Bearer [API_TOKEN]" \
-H "Accept: application/ndjson" \
-d '{
"fromTime": "2025-05-01T00:00:00Z",
"untilTime": "2025-05-02T00:00:00Z",
"coordinates": [{ "lat": 40.758, "lon": -73.985 , "name": "TimesSquare"}],
"variables": [{ "name": "TMP", "level": "2 m above ground", "info": "", "alias": "temp" }]
}'
{"forecasted_at":"2025-05-01T12:00:00Z","forecasted_time":"2025-05-01T12:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":287.74045410156253}
{"forecasted_at":"2025-05-01T00:00:00Z","forecasted_time":"2025-05-01T05:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":288.80002441406253}
{"forecasted_at":"2025-05-01T12:00:00Z","forecasted_time":"2025-05-01T15:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":292.29106445312505}
{"forecasted_at":"2025-05-01T06:00:00Z","forecasted_time":"2025-05-01T06:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":288.23271484375}
{"forecasted_at":"2025-05-01T12:00:00Z","forecasted_time":"2025-05-01T16:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":293.20000000000005}
{"forecasted_at":"2025-05-01T18:00:00Z","forecasted_time":"2025-05-01T22:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":290.953857421875}
{"forecasted_at":"2025-05-01T00:00:00Z","forecasted_time":"2025-05-01T01:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":292.25318359375}
{"forecasted_at":"2025-05-01T00:00:00Z","forecasted_time":"2025-05-01T02:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":291.348046875}
{"forecasted_at":"2025-05-01T00:00:00Z","forecasted_time":"2025-05-01T03:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":290.47107421875}
{"forecasted_at":"2025-05-01T12:00:00Z","forecasted_time":"2025-05-01T13:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":289.46726074218753}
{"forecasted_at":"2025-05-01T00:00:00Z","forecasted_time":"2025-05-01T04:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":289.4754296875}
{"forecasted_at":"2025-05-01T12:00:00Z","forecasted_time":"2025-05-01T14:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":290.99106445312503}
{"forecasted_at":"2025-05-01T00:00:00Z","forecasted_time":"2025-05-01T00:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":292.96841796875}
{"forecasted_at":"2025-05-01T06:00:00Z","forecasted_time":"2025-05-01T07:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":287.70000000000005}
{"forecasted_at":"2025-05-01T12:00:00Z","forecasted_time":"2025-05-01T17:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":293.86765136718753}
{"forecasted_at":"2025-05-01T06:00:00Z","forecasted_time":"2025-05-01T08:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":287.1672607421875}
{"forecasted_at":"2025-05-01T18:00:00Z","forecasted_time":"2025-05-01T18:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":293.53837890625005}
{"forecasted_at":"2025-05-01T06:00:00Z","forecasted_time":"2025-05-01T09:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":286.70000000000005}
{"forecasted_at":"2025-05-01T18:00:00Z","forecasted_time":"2025-05-01T19:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":292.7922607421875}
{"forecasted_at":"2025-05-01T06:00:00Z","forecasted_time":"2025-05-01T10:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":286.2595458984375}
{"forecasted_at":"2025-05-01T18:00:00Z","forecasted_time":"2025-05-01T20:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":292.33542480468753}
{"forecasted_at":"2025-05-01T18:00:00Z","forecasted_time":"2025-05-01T21:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":291.802685546875}
{"forecasted_at":"2025-05-01T06:00:00Z","forecasted_time":"2025-05-01T11:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":286.553857421875}
{"forecasted_at":"2025-05-01T18:00:00Z","forecasted_time":"2025-05-01T23:00:00Z","lat":40.758,"lon":-73.985,"name":"TimesSquare","temp":290.0113037109375}
時間範囲ではなく、特定の時刻リストを選びたい場合があります。その場合はリクエストのtimesListを使います。/timeseriesでは、各値は返してほしい有効時刻で、forecasted_timeに対応します。
たとえば、2022年、2023年、2024年、2025年の新年の気象データをクエリできます。
curl -X POST 'https://gribstream.com/api/v2/gfs/timeseries' \
-H "Authorization: Bearer [API_TOKEN]" \
-d '{
"timesList": [
"2022-01-01T00:00:00Z",
"2023-01-01T00:00:00Z",
"2024-01-01T00:00:00Z",
"2025-01-01T00:00:00Z"
],
"coordinates": [{ "lat": 40.758, "lon": -73.985 , "name": "TimesSquare"}],
"variables": [{ "name": "TMP", "level": "2 m above ground", "info": "", "alias": "temp" }]
}'
forecasted_at,forecasted_time,lat,lon,name,temp
2022-01-01T00:00:00Z,2022-01-01T00:00:00Z,40.7580,-73.9850,TimesSquare,283.1841
2024-01-01T00:00:00Z,2024-01-01T00:00:00Z,40.7580,-73.9850,TimesSquare,279.0649
2023-01-01T00:00:00Z,2023-01-01T00:00:00Z,40.7580,-73.9850,TimesSquare,281.7180
2025-01-01T00:00:00Z,2025-01-01T00:00:00Z,40.7580,-73.9850,TimesSquare,281.8039
個別の座標を指定する代わりに、minLatitude、maxLatitude、minLongitude、maxLongitude、stepで格子を定義できます。stepは度単位の解像度です。
視覚的な例は、風のフィールドデモで確認できます。
curl -X POST 'https://gribstream.com/api/v2/gfs/timeseries' \
-H "Authorization: Bearer [API_TOKEN]" \
-d '{
"timesList": [ "2025-01-01T00:00:00Z" ],
"grid": {
"minLatitude": 25.00,
"maxLatitude": 27.00,
"minLongitude": -122.00,
"maxLongitude": -120.00,
"step": 0.5
},
"variables": [{ "name": "TMP", "level": "2 m above ground", "info": "", "alias": "temp" }]
}'
forecasted_at,forecasted_time,lat,lon,name,temp
2025-01-01T00:00:00Z,2025-01-01T00:00:00Z,27.0000,-122.0000,,290.0439
2025-01-01T00:00:00Z,2025-01-01T00:00:00Z,27.0000,-121.5000,,289.8739
2025-01-01T00:00:00Z,2025-01-01T00:00:00Z,27.0000,-121.0000,,289.7339
2025-01-01T00:00:00Z,2025-01-01T00:00:00Z,27.0000,-120.5000,,289.6239
2025-01-01T00:00:00Z,2025-01-01T00:00:00Z,27.0000,-120.0000,,289.5039
2025-01-01T00:00:00Z,2025-01-01T00:00:00Z,26.5000,-122.0000,,290.2839
2025-01-01T00:00:00Z,2025-01-01T00:00:00Z,26.5000,-121.5000,,290.1139
2025-01-01T00:00:00Z,2025-01-01T00:00:00Z,26.5000,-121.0000,,289.9739
2025-01-01T00:00:00Z,2025-01-01T00:00:00Z,26.5000,-120.5000,,289.8339
2025-01-01T00:00:00Z,2025-01-01T00:00:00Z,26.5000,-120.0000,,289.7239
2025-01-01T00:00:00Z,2025-01-01T00:00:00Z,26.0000,-122.0000,,290.5739
2025-01-01T00:00:00Z,2025-01-01T00:00:00Z,26.0000,-121.5000,,290.4239
2025-01-01T00:00:00Z,2025-01-01T00:00:00Z,26.0000,-121.0000,,290.2439
2025-01-01T00:00:00Z,2025-01-01T00:00:00Z,26.0000,-120.5000,,290.0339
2025-01-01T00:00:00Z,2025-01-01T00:00:00Z,26.0000,-120.0000,,289.8339
2025-01-01T00:00:00Z,2025-01-01T00:00:00Z,25.5000,-122.0000,,290.9539
2025-01-01T00:00:00Z,2025-01-01T00:00:00Z,25.5000,-121.5000,,290.7239
2025-01-01T00:00:00Z,2025-01-01T00:00:00Z,25.5000,-121.0000,,290.4739
2025-01-01T00:00:00Z,2025-01-01T00:00:00Z,25.5000,-120.5000,,290.2339
2025-01-01T00:00:00Z,2025-01-01T00:00:00Z,25.5000,-120.0000,,290.0439
2025-01-01T00:00:00Z,2025-01-01T00:00:00Z,25.0000,-122.0000,,291.1239
2025-01-01T00:00:00Z,2025-01-01T00:00:00Z,25.0000,-121.5000,,290.9539
2025-01-01T00:00:00Z,2025-01-01T00:00:00Z,25.0000,-121.0000,,290.7139
2025-01-01T00:00:00Z,2025-01-01T00:00:00Z,25.0000,-120.5000,,290.4539
2025-01-01T00:00:00Z,2025-01-01T00:00:00Z,25.0000,-120.0000,,290.2239
リードタイムは、予報が発行された時刻(forecasted_at)と、その予報が対象とする有効時刻(forecasted_time)の差です。
"12h"、"45m")。"3h")。つまり、この2つのパラメータは、取得する各予報値の最小・最大リードタイム(モデル実行時刻から有効時刻までの予報時間)を制御します。minHorizon/maxHorizonは整数時間を受け取る非推奨の旧エイリアスです。
例: 少なくとも12時間前に発行された予報値だけを表示します:
curl -X POST 'https://gribstream.com/api/v2/nbm/timeseries' \
-H "Authorization: Bearer [API_TOKEN]" \
-d '{
"fromTime": "2025-05-01T12:00:00Z",
"untilTime": "2025-05-01T18:00:00Z",
"minLeadTime": "12h",
"coordinates": [{ "lat": 40.758, "lon": -73.985, "name": "TimesSquare" }],
"variables": [{ "name": "TMP", "level": "2 m above ground", "alias": "temp" }]
}'
forecasted_at,forecasted_time,lat,lon,name,temp,horizon_hours
2025-05-01T00:00:00Z,2025-05-01T12:00:00Z,40.7580,-73.9850,TimesSquare,286.6700
2025-05-01T01:00:00Z,2025-05-01T13:00:00Z,40.7580,-73.9850,TimesSquare,288.0300
2025-05-01T02:00:00Z,2025-05-01T14:00:00Z,40.7580,-73.9850,TimesSquare,289.5900
2025-05-01T03:00:00Z,2025-05-01T15:00:00Z,40.7580,-73.9850,TimesSquare,290.9600
2025-05-01T04:00:00Z,2025-05-01T16:00:00Z,40.7580,-73.9850,TimesSquare,292.3300
2025-05-01T05:00:00Z,2025-05-01T17:00:00Z,40.7580,-73.9850,TimesSquare,293.1900
注: 結果を読みやすくするため、ここでは行をforecasted_at順に並べています。
別の例: 3時間以内の短期予報だけを含めます:
curl -X POST 'https://gribstream.com/api/v2/nbm/timeseries' \
-H "Authorization: Bearer [API_TOKEN]" \
-d '{
"fromTime": "2025-05-01T12:00:00Z",
"untilTime": "2025-05-01T15:00:00Z",
"maxLeadTime": "3h",
"coordinates": [{ "lat": 40.758, "lon": -73.985 }],
"variables": [{ "name": "TMP", "level": "2 m above ground" }]
}'
minLeadTimeとmaxLeadTimeを組み合わせると、取得する予報値を目的のリードタイム範囲に絞り込めます。
ヒント: 次の例のasOfパラメータは、特定時刻より前に利用可能だったデータだけに結果を制限します。一方、minLeadTimeとmaxLeadTimeは、返される各値の有効時刻に対して予報がどれだけ前に発行されたかで絞り込みます。
asOfで過去時点の見え方を再現する(過去検証向け)予報モデルをバックテストするときは、後から確定した情報ではなく、その時点で知られていた状態のデータをクエリすることが重要です。
たとえば、「4月30日12:00 UTCまでに利用可能だった情報に基づく、5月1日の予報は何だったか?」という問いです。
これは、過去のある時点から見えていた予報だけを再現するクエリです。asOfは基準時刻なので、その時刻以前に生成されたモデル実行だけが対象になります。後からの修正や更新は入りません。
curl -X POST 'https://gribstream.com/api/v2/nbm/timeseries' \
-H "Authorization: Bearer [API_TOKEN]" \
-d '{
"fromTime": "2025-05-01T00:00:00Z",
"untilTime": "2025-05-02T00:00:00Z",
"asOf": "2025-05-01T12:00:00Z",
"coordinates": [{ "lat": 40.758, "lon": -73.985 , "name": "TimesSquare"}],
"variables": [{ "name": "TMP", "level": "2 m above ground", "info": "", "alias": "temp" }]
}'
forecasted_at,forecasted_time,lat,lon,name,temp
2025-04-30T23:00:00Z,2025-05-01T00:00:00Z,40.7580,-73.9850,TimesSquare,292.6500
2025-05-01T00:00:00Z,2025-05-01T01:00:00Z,40.7580,-73.9850,TimesSquare,291.6000
2025-05-01T01:00:00Z,2025-05-01T02:00:00Z,40.7580,-73.9850,TimesSquare,291.2300
2025-05-01T02:00:00Z,2025-05-01T03:00:00Z,40.7580,-73.9850,TimesSquare,290.1200
2025-05-01T03:00:00Z,2025-05-01T04:00:00Z,40.7580,-73.9850,TimesSquare,289.1600
2025-05-01T04:00:00Z,2025-05-01T05:00:00Z,40.7580,-73.9850,TimesSquare,288.4300
2025-05-01T05:00:00Z,2025-05-01T06:00:00Z,40.7580,-73.9850,TimesSquare,287.7400
2025-05-01T06:00:00Z,2025-05-01T07:00:00Z,40.7580,-73.9850,TimesSquare,286.8900
2025-05-01T07:00:00Z,2025-05-01T08:00:00Z,40.7580,-73.9850,TimesSquare,286.3500
2025-05-01T08:00:00Z,2025-05-01T09:00:00Z,40.7580,-73.9850,TimesSquare,285.7200
2025-05-01T09:00:00Z,2025-05-01T10:00:00Z,40.7580,-73.9850,TimesSquare,285.4300
2025-05-01T10:00:00Z,2025-05-01T11:00:00Z,40.7580,-73.9850,TimesSquare,285.7200
2025-05-01T11:00:00Z,2025-05-01T12:00:00Z,40.7580,-73.9850,TimesSquare,286.8000
2025-05-01T12:00:00Z,2025-05-01T13:00:00Z,40.7580,-73.9850,TimesSquare,288.1300
2025-05-01T12:00:00Z,2025-05-01T14:00:00Z,40.7580,-73.9850,TimesSquare,290.1600
2025-05-01T12:00:00Z,2025-05-01T15:00:00Z,40.7580,-73.9850,TimesSquare,291.3400
2025-05-01T12:00:00Z,2025-05-01T16:00:00Z,40.7580,-73.9850,TimesSquare,292.6500
2025-05-01T12:00:00Z,2025-05-01T17:00:00Z,40.7580,-73.9850,TimesSquare,293.0100
2025-05-01T12:00:00Z,2025-05-01T18:00:00Z,40.7580,-73.9850,TimesSquare,293.1500
2025-05-01T12:00:00Z,2025-05-01T19:00:00Z,40.7580,-73.9850,TimesSquare,292.7500
2025-05-01T12:00:00Z,2025-05-01T20:00:00Z,40.7580,-73.9850,TimesSquare,292.1500
2025-05-01T12:00:00Z,2025-05-01T21:00:00Z,40.7580,-73.9850,TimesSquare,291.3500
2025-05-01T12:00:00Z,2025-05-01T22:00:00Z,40.7580,-73.9850,TimesSquare,290.7100
2025-05-01T12:00:00Z,2025-05-01T23:00:00Z,40.7580,-73.9850,TimesSquare,289.5800
注: 結果を読みやすくするため、ここでは行をforecasted_at順に並べています。
この例では、1時間ごとに実行されるNOAA National Blend of Models (NBM)を使っています。forecasted_atは多くの場合forecasted_timeの1時間前で、その時刻に対する最良の予報を意味します。
基準時刻後の有効時刻についても、asOfを2025-05-01T12:00:00Zに設定しているため、それ以降のモデル実行は除外されます。
GribStreamでは、APIリクエストの中で派生列、変換、true/false条件による絞り込みを計算するためのexpressionsを定義できます。
expressionsはexpr言語を使い、数値演算、論理演算、文字列操作と数学関数をサポートします。
1回のAPIリクエストで計算式を使う例として、トウモロコシ成長シミュレーションのデモを確認できます。
func.Hypot(uwind, vwind)
int(270 - func.Atan2(vwind, uwind) * 180 / 3.14159) % 360
func.Hypot(uwind, vwind) > 10
curl -X POST 'https://gribstream.com/api/v2/hrrr/timeseries' \
-H "Content-Type: application/json" \
-H "Authorization: Bearer [API_TOKEN]" \
-d '{
"fromTime": "2024-09-10T00:00:00Z",
"untilTime": "2024-09-10T10:00:00Z",
"coordinates": [{ "lat": 40.7306, "lon": -73.9352, "name": "New York City" }],
"variables": [
{ "name": "UGRD", "level": "1000 mb", "alias": "uwind" },
{ "name": "VGRD", "level": "1000 mb", "alias": "vwind" }
],
"expressions": [
{ "expression": "func.Hypot(uwind, vwind)", "alias": "wind_magnitude" },
{ "expression": "int(270 - func.Atan2(vwind, uwind) * 180 / 3.14159) % 360", "alias": "wind_direction" }
]
}'
forecasted_at,forecasted_time,lat,lon,name,uwind,vwind,wind_direction,wind_magnitude
2024-09-10T02:00:00Z,2024-09-10T03:00:00Z,40.7306,-73.9352,New York City,7.1213,1.7680,256,7.3375
2024-09-10T01:00:00Z,2024-09-10T02:00:00Z,40.7306,-73.9352,New York City,8.1815,1.6363,258,8.3435
2024-09-10T00:00:00Z,2024-09-10T01:00:00Z,40.7306,-73.9352,New York City,8.0572,2.9389,249,8.5765
2024-09-10T05:00:00Z,2024-09-10T06:00:00Z,40.7306,-73.9352,New York City,6.8368,0.1001,269,6.8375
2024-09-10T04:00:00Z,2024-09-10T05:00:00Z,40.7306,-73.9352,New York City,6.4087,3.0921,244,7.1157
2024-09-10T03:00:00Z,2024-09-10T04:00:00Z,40.7306,-73.9352,New York City,6.4841,2.5385,248,6.9633
2024-09-09T23:00:00Z,2024-09-10T00:00:00Z,40.7306,-73.9352,New York City,6.1795,3.9539,237,7.3362
2024-09-10T08:00:00Z,2024-09-10T09:00:00Z,40.7306,-73.9352,New York City,5.9424,-0.6889,276,5.9822
2024-09-10T06:00:00Z,2024-09-10T07:00:00Z,40.7306,-73.9352,New York City,7.3567,1.5594,258,7.5201
2024-09-10T07:00:00Z,2024-09-10T08:00:00Z,40.7306,-73.9352,New York City,6.5438,0.7486,263,6.5864
GribStreamでは、空間と時間の条件で絞り込む計算式を定義し、条件に一致するデータだけを返せます。
絞り込み条件は計算式と同じ構文に従いますが、trueまたはfalseに評価される必要があります。
1回のAPIリクエストで絞り込みを使う例として、雷雨追跡のデモを確認できます。
curl -X POST 'https://gribstream.com/api/v2/gfs/timeseries' \
-H "Content-Type: application/json" \
-H "Authorization: Bearer [API_TOKEN]" \
-d '{
"fromTime": "2024-09-10T00:00:00Z",
"untilTime": "2024-09-10T10:00:00Z",
"grid": {
"minLatitude": 24.52,
"maxLatitude": 49.38,
"minLongitude": -124.77,
"maxLongitude": -66.93,
"step": 0.5
},
"variables": [
{"name": "CAPE", "level": "180-0 mb above ground", "info": "", "alias": "cape"},
{"name": "CIN", "level": "180-0 mb above ground", "info": "", "alias": "cin"}
],
"expressions":[
{ "expression": "cape + cin", "alias": "storm_severity"}
],
"filter":{"expression": "storm_severity >= 1200"}
}'
forecasted_at,forecasted_time,lat,lon,name,cape,cin,offset_hours,storm_severity
2024-09-10T00:00:00Z,2024-09-10T01:00:00Z,29.0200,-70.7700,,1337.0000,-1.6324,-5713.0000,1335.3676
2024-09-10T00:00:00Z,2024-09-10T01:00:00Z,29.0200,-70.2700,,1204.0000,-1.6324,-5713.0000,1202.3676
2024-09-10T00:00:00Z,2024-09-10T01:00:00Z,28.5200,-71.7700,,1432.0000,-0.6324,-5713.0000,1431.3676
2024-09-10T00:00:00Z,2024-09-10T01:00:00Z,28.5200,-71.2700,,1384.0000,-1.6324,-5713.0000,1382.3676
2024-09-10T00:00:00Z,2024-09-10T01:00:00Z,28.5200,-70.7700,,1355.0000,-0.6324,-5713.0000,1354.3676
2024-09-10T00:00:00Z,2024-09-10T01:00:00Z,28.5200,-70.2700,,1388.0000,-1.6324,-5713.0000,1386.3676
2024-09-10T00:00:00Z,2024-09-10T01:00:00Z,28.0200,-112.2700,,1599.0000,-148.6324,-5713.0000,1450.3676
2024-09-10T00:00:00Z,2024-09-10T01:00:00Z,28.0200,-111.2700,,1424.0000,-104.6324,-5713.0000,1319.3676
2024-09-10T00:00:00Z,2024-09-10T01:00:00Z,28.0200,-75.2700,,1328.0000,-0.6324,-5713.0000,1327.3676
2024-09-10T00:00:00Z,2024-09-10T01:00:00Z,28.0200,-74.7700,,1242.0000,-1.6324,-5713.0000,1240.3676
2024-09-10T00:00:00Z,2024-09-10T01:00:00Z,28.0200,-73.2700,,1327.0000,0.3676,-5713.0000,1327.3676
2024-09-10T00:00:00Z,2024-09-10T01:00:00Z,28.0200,-72.7700,,1471.0000,0.3676,-5713.0000,1471.3676
...
ここまでの例はすべてtimeseriesエンドポイント(以前のhistory)を使っています。このエンドポイントの目的は、各時刻について可能な限り最良の予報を返すことです。
最良の予報は常に最も新しい予報、言い換えると最も低いリードタイムを持つ予報です。ここでのリードタイムは、モデル実行時刻(forecasted_at)と有効時刻(forecasted_time)の差です。minLeadTime、maxLeadTime、asOfパラメータは、
どのモデル実行を候補にするかを制限しますが、各予報値について選ばれるモデル実行は1つだけです。
各値についてすべてのモデル実行を取得したい場合は、runsエンドポイント(以前のforecasts)を使います。
POST https://gribstream.com/api/v2/[MODEL]/runs
このエンドポイントでは、forecastedFromとforecastedUntilというパラメータで時間範囲を選びます。これにより、データがモデル実行時刻で選択されることが明確になります。これはレスポンスでforecasted_atとして返る時刻と同じです。/runsでは、timesListもモデル実行時刻リストを列挙します。特定のサイクルを探すときに便利です。
asOf以外のパラメータは同じように利用できます。つまり、minLeadTimeとmaxLeadTimeで絞り込み、計算値を持つexpressionsを定義し、それらでさらに絞り込む、といった使い方ができます。minHorizon/maxHorizonは整数時間を受け取る非推奨の旧エイリアスです。
curl -X POST 'https://gribstream.com/api/v2/nbm/runs' \
-H "Authorization: Bearer [API_TOKEN]" \
-d '{
"forecastedFrom": "2024-09-10T00:00:00Z",
"forecastedUntil": "2024-09-10T03:00:00Z",
"minLeadTime": "1h",
"maxLeadTime": "3h",
"coordinates": [
{ "lat": 47.6, "lon": -122.33 }
],
"variables": [
{ "name": "TMP", "level": "2 m above ground", "info": "", "alias": "temp" },
{ "name": "WIND", "level": "10 m above ground", "info": "", "alias": "wind_speed" },
{ "name": "DPT", "level": "2 m above ground", "info": "", "alias": "dew_point" }
]
}'
forecasted_at,forecasted_time,lat,lon,name,dew_point,temp,wind_speed
2024-09-10T00:00:00Z,2024-09-10T01:00:00Z,47.6000,-122.3300,,288.2500,294.2700,1.6000
2024-09-10T00:00:00Z,2024-09-10T02:00:00Z,47.6000,-122.3300,,288.4000,293.4800,1.6000
2024-09-10T00:00:00Z,2024-09-10T03:00:00Z,47.6000,-122.3300,,288.2600,293.0000,1.6000
2024-09-10T01:00:00Z,2024-09-10T02:00:00Z,47.6000,-122.3300,,288.3500,293.4900,1.6000
2024-09-10T01:00:00Z,2024-09-10T03:00:00Z,47.6000,-122.3300,,288.1800,292.9800,1.6000
2024-09-10T01:00:00Z,2024-09-10T04:00:00Z,47.6000,-122.3300,,288.1900,292.2100,1.2000
2024-09-10T02:00:00Z,2024-09-10T03:00:00Z,47.6000,-122.3300,,288.1600,292.9500,1.6000
2024-09-10T02:00:00Z,2024-09-10T04:00:00Z,47.6000,-122.3300,,288.3800,292.1800,1.2000
2024-09-10T02:00:00Z,2024-09-10T05:00:00Z,47.6000,-122.3300,,287.9300,291.2800,1.2000
2024-09-10T03:00:00Z,2024-09-10T04:00:00Z,47.6000,-122.3300,,288.3300,292.0300,1.2000
2024-09-10T03:00:00Z,2024-09-10T05:00:00Z,47.6000,-122.3300,,287.9400,291.4900,1.2000
2024-09-10T03:00:00Z,2024-09-10T06:00:00Z,47.6000,-122.3300,,287.8000,290.8100,1.2000
注: 結果を読みやすくするため、ここでは行をforecasted_at順に並べています。各モデル実行がリードタイム 1-3時間の値を返している点に注目してください。
GribStreamの一部のモデル、たとえばNOAA Global Ensemble Forecast System (GEFS Atmos)やECMWF Integrated Forecasting System - Ensemble Forecast (IFS Enfo)は アンサンブルです。 各モデル実行は、わずかに異なる初期条件から開始する30から50個のアンサンブルメンバーで構成されます。 すべてのアンサンブルメンバーを見ることで、不確実性やばらつきの定量化、確率の計算(例: 「雨量が25 mmを超える確率80%」)、単一の決定論的な予報では見逃しうる稀な極端事例の検出ができます。
membersフィールドで、1つまたは複数のアンサンブルメンバーを選べます。省略した場合、デフォルトでは通常の制御予報であるアンサンブルメンバー0だけが返ります。
curl -X POST 'https://gribstream.com/api/v2/gefsatmos/timeseries' \
-H "Content-Type: application/json" \
-H "Authorization: Bearer [API_TOKEN]" \
-d '{
"fromTime": "2021-02-24T00:00:00Z",
"untilTime": "2021-02-24T12:00:00Z",
"minLeadTime": "0h",
"maxLeadTime": "3h",
"coordinates": [
{ "lat": 40.75, "lon": -73.98, "name": "home"}
],
"variables": [
{ "name": "TMP", "level": "2 m above ground", "info": "", "alias": "temp" }
],
"members": [1,2,3]
}'
forecasted_at,forecasted_time,lat,lon,name,member,temp
2021-02-24T00:00:00Z,2021-02-24T00:00:00Z,40.7500,-73.9800,home,1,277.0675
2021-02-24T00:00:00Z,2021-02-24T00:00:00Z,40.7500,-73.9800,home,2,276.9957
2021-02-24T00:00:00Z,2021-02-24T00:00:00Z,40.7500,-73.9800,home,3,277.1360
2021-02-24T00:00:00Z,2021-02-24T03:00:00Z,40.7500,-73.9800,home,1,275.1206
2021-02-24T00:00:00Z,2021-02-24T03:00:00Z,40.7500,-73.9800,home,2,275.0662
2021-02-24T00:00:00Z,2021-02-24T03:00:00Z,40.7500,-73.9800,home,3,275.7054
2021-02-24T06:00:00Z,2021-02-24T06:00:00Z,40.7500,-73.9800,home,1,275.9707
2021-02-24T06:00:00Z,2021-02-24T06:00:00Z,40.7500,-73.9800,home,2,275.3141
2021-02-24T06:00:00Z,2021-02-24T06:00:00Z,40.7500,-73.9800,home,3,275.7535
2021-02-24T06:00:00Z,2021-02-24T09:00:00Z,40.7500,-73.9800,home,1,273.9249
2021-02-24T06:00:00Z,2021-02-24T09:00:00Z,40.7500,-73.9800,home,2,273.8208
2021-02-24T06:00:00Z,2021-02-24T09:00:00Z,40.7500,-73.9800,home,3,274.3771
注: 結果を読みやすくするため、ここでは行をforecasted_at順に並べています。各モデル実行がリードタイム 1-3時間の値を返している点に注目してください。
使いたいデータセットとセレクタがすでに分かっている場合は、この章を飛ばして/timeseriesまたは/runsへ進んでください。それが今でもGribStreamの通常の使い方です。
カタログはより高度な用途向けです。データセットピッカー、複数モデルを扱うダッシュボード、社内ツール、またはセレクタを固定で書き込まずに発見する必要があるアプリケーションで使います。
curl 'https://gribstream.com/api/v2/catalog/datasets'
各データセットの公開メタデータが返ります。コード、正式名称、提供機関、タグ、実行頻度、アーカイブ情報、ソースへのリンク、対応するモデルページ、APIエンドポイントへのリンクが含まれます。
[
{
"code": "gfs",
"name": "GFS",
"full_name": "Global Forecast System",
"provider": "NOAA",
"models_page_url": "/models/gfs",
"api_timeseries_url": "/api/v2/gfs/timeseries",
"api_runs_url": "/api/v2/gfs/runs"
}
]
curl 'https://gribstream.com/api/v2/catalog/datasets/ifsoper/parameters'
各パラメータ要約には、上流の正確な短縮コード、正式名称、単位、説明文、そのパラメータに複数のセレクタバリエーションがあるかどうかが含まれます。パラメータコードは大文字小文字を区別します。データセットが100uを公開している場合は、返された通りに100uを再利用してください。
[
{
"short_name": "100u",
"full_name": "100 metre U wind component",
"units": "m s-1",
"variation_count": 1
}
]
すべてのバリエーションとコピー可能なセレクタを含めて、1つのパラメータを詳しく見るには:
curl 'https://gribstream.com/api/v2/catalog/datasets/ifsoper/parameters/100u'
{
"short_name": "100u",
"full_name": "100 metre U wind component",
"variations": [
{
"selector": { "name": "100u", "level": "sfc", "info": "" },
"selector_literal": "{\"name\":\"100u\",\"level\":\"sfc\",\"info\":\"\"}"
}
]
}
これはカタログを使う流れの中でも最も高度な使い方です。アプリケーションが10 m風速(10 m wind speed)のような共通概念を使いたい一方で、データセットごとに異なるセレクタや計算式で公開されている場合に便利です。
curl 'https://gribstream.com/api/v2/catalog/shared-parameters/wind_speed_10m?dataset=ifsoper&alias=wind'
レスポンスには、対象データセットの予報リクエスト本文へコピーできる機械可読なresolved_request断片が含まれます。
{
"code": "wind_speed_10m",
"resolved_dataset": "ifsoper",
"resolved_supported": true,
"resolved_request": {
"variables": [
{ "name": "10u", "level": "sfc", "alias": "u_component", "hidden": true },
{ "name": "10v", "level": "sfc", "alias": "v_component", "hidden": true }
],
"expressions": [
{ "expression": "func.Hypot(u_component, v_component)", "alias": "wind" }
]
}
}
セレクタまたはresolved_requestが得られたら、このガイドの前半で示した同じ/timeseriesと/runsエンドポイントで使えます。
完全なカタログスキーマと追加例は、エンドポイント、OpenAPI、生のOpenAPI仕様である/docs/openapi.yamlで確認できます。
このガイドで扱っていない利用ケースについては、info@gribstream.comまでご連絡ください。