GribStream

Weather Forecast API Documentation

This API provides access to weather forecast data for all models. You can retrieve historical and forecasted weather data by specifying parameters such as time range, coordinates, and variables of interest.

You can use our python client at GitHub or roll your own with the details below.

Weather History Endpoint

For any given coordinate, weather parameter, and time range, there are multiple forecasted values available. Each value corresponds to a different forecast horizon (lead time), representing predictions made at various times in the past.

The API returns the forecasted value with the shortest forecast horizon for each time point. This means you receive the most recent and presumably most accurate prediction available at that moment. In data science, this is often referred to as the "best" forecast or the "nowcast" series.

POST https://gribstream.com/api/v2/<model>/history

Available Models

Request Headers

Header Value Comment
Content-Type application/json Default and only valid value.
Accept Choose text/csv, application/json or application/ndjson Selects the response format. Defaults to text/csv
Accept-Encoding gzip Optional, recommended, for compressed response
Authorization Bearer <token> Replace <token> with your authentication token

Request Body Parameters

The request body should be a JSON object with the following structure:

Parameter Type Description Required
fromTime string (ISO 8601) Start time of the forecast period. Yes, either (fromTime, untilTime) or timesList
untilTime string (ISO 8601) End time of the forecast period. Yes, either (fromTime, untilTime) or timesList
timesList array of string (ISO 8601) Array of forecasted times. Yes, either (fromTime, untilTime) or timesList
asOf string (ISO 8601) Reference time for the forecast data. No
minHorizon integer Minimum forecast horizon in hours. No (default: 0)
maxHorizon integer Maximum forecast horizon in hours. No (default: 384)
coordinates array of coordinate objects List of geographical coordinates. Yes
variables array of variable objects List of weather variables to retrieve. Yes
expressions array of expression objects Server‑side calculated columns built from the variables you request. Each entry returns as its own column, using the supplied alias. No

NOTE: Selected time must be specified via range (fromTime, untilTime) or timesList

Coordinate Object

Field Type Description Required
lat float Latitude of the coordinate. Yes
lon float Longitude of the coordinate. Yes
name string Optional name for the coordinate, which will be returned in the response to help identify the location. No

Variable Object

Field Type Description Required
name string Name of the weather variable (e.g., "TMP" for temperature). Yes
level string Level of the atmosphere or surface (e.g., "2 m above ground"). Yes
info string Differentiator when the model has multiple parameters for the same name and level No
alias string Optional alias for the variable. If provided, this alias will be used as the column header in the response. No

Expression Object

FieldTypeDescriptionRequired
expression string Go‑template expression evaluated per‑row.
• All selected variables are addressable by their alias (or default column name).
• Math operators + ‑ * / % and functions in func. (Abs, Atan2, Hypot, Pow, Sqrt, etc.) are allowed.
Yes
alias string Column name used in the response for this calculated result. Yes

Example Request

POST https://gribstream.com/api/v2/hrrr/history
Content-Type: application/json
Accept-Encoding: gzip
Authorization: Bearer <token>
Payload:
{
    "fromTime": "2024-09-10T00:00:00Z",
    "untilTime": "2024-09-10T10:00:00Z",
    "asOf": "2024-09-10T05:00:00Z",
    "minHorizon": 1,
    "maxHorizon": 48,
    "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" }
    ]
}

Example Response

The format of the response is determined by the Accept header. The API supports three response formats:

If the Accept-Encoding: gzip header is included, the response will be gzip-compressed.

NOTE: The response is not strictly in-order.

CSV Response Example

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-10T05:00:00Z,2024-09-10T08:00:00Z,40.7306,-73.9352,New York City,5.2585,-1.1512,282,5.3831
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-10T05:00:00Z,2024-09-10T07:00:00Z,40.7306,-73.9352,New York City,6.9156,-1.4414,281,7.0642
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-10T03:00:00Z,2024-09-10T04:00:00Z,40.7306,-73.9352,New York City,6.4841,2.5385,248,6.9633
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-09T23:00:00Z,2024-09-10T00:00:00Z,40.7306,-73.9352,New York City,6.1795,3.9539,237,7.3362
2024-09-10T05:00:00Z,2024-09-10T09:00:00Z,40.7306,-73.9352,New York City,4.7715,-0.5644,276,4.8047

JSON Response Example (JSON Array)

[{"forecasted_at":"2024-09-10T02:00:00Z","forecasted_time":"2024-09-10T03:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":7.121286392211914,"vwind":1.7680130004882812,"wind_direction":256,"wind_magnitude":7.337478439477567}
,{"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T01:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":8.057228088378906,"vwind":2.938892364501953,"wind_direction":249,"wind_magnitude":8.576480210336284}
,{"forecasted_at":"2024-09-10T01:00:00Z","forecasted_time":"2024-09-10T02:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":8.181510925292969,"vwind":1.6362571716308594,"wind_direction":258,"wind_magnitude":8.34352794400556}
,{"forecasted_at":"2024-09-10T05:00:00Z","forecasted_time":"2024-09-10T06:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":6.836750030517578,"vwind":0.10012435913085938,"wind_direction":269,"wind_magnitude":6.837483152964509}
,{"forecasted_at":"2024-09-09T23:00:00Z","forecasted_time":"2024-09-10T00:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":6.179473876953125,"vwind":3.953920364379883,"wind_direction":237,"wind_magnitude":7.33616954846356}
,{"forecasted_at":"2024-09-10T05:00:00Z","forecasted_time":"2024-09-10T07:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":6.915561676025391,"vwind":-1.4414329528808594,"wind_direction":281,"wind_magnitude":7.064185887458082}
,{"forecasted_at":"2024-09-10T03:00:00Z","forecasted_time":"2024-09-10T04:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":6.484088897705078,"vwind":2.538473129272461,"wind_direction":248,"wind_magnitude":6.963279016482147}
,{"forecasted_at":"2024-09-10T04:00:00Z","forecasted_time":"2024-09-10T05:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":6.408748626708984,"vwind":3.0920562744140625,"wind_direction":244,"wind_magnitude":7.115677828885149}
,{"forecasted_at":"2024-09-10T05:00:00Z","forecasted_time":"2024-09-10T08:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":5.258523941040039,"vwind":-1.1512451171875,"wind_direction":282,"wind_magnitude":5.383069696589422}
,{"forecasted_at":"2024-09-10T05:00:00Z","forecasted_time":"2024-09-10T09:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":4.771465301513672,"vwind":-0.564422607421875,"wind_direction":276,"wind_magnitude":4.804732459078015}
]

NDJSON Response Example (Line-delimited)

{"forecasted_at":"2024-09-10T05:00:00Z","forecasted_time":"2024-09-10T07:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":6.915561676025391,"vwind":-1.4414329528808594,"wind_direction":281,"wind_magnitude":7.064185887458082}
{"forecasted_at":"2024-09-10T05:00:00Z","forecasted_time":"2024-09-10T08:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":5.258523941040039,"vwind":-1.1512451171875,"wind_direction":282,"wind_magnitude":5.383069696589422}
{"forecasted_at":"2024-09-10T05:00:00Z","forecasted_time":"2024-09-10T09:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":4.771465301513672,"vwind":-0.564422607421875,"wind_direction":276,"wind_magnitude":4.804732459078015}
{"forecasted_at":"2024-09-10T05:00:00Z","forecasted_time":"2024-09-10T06:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":6.836750030517578,"vwind":0.10012435913085938,"wind_direction":269,"wind_magnitude":6.837483152964509}
{"forecasted_at":"2024-09-10T03:00:00Z","forecasted_time":"2024-09-10T04:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":6.484088897705078,"vwind":2.538473129272461,"wind_direction":248,"wind_magnitude":6.963279016482147}
{"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T01:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":8.057228088378906,"vwind":2.938892364501953,"wind_direction":249,"wind_magnitude":8.576480210336284}
{"forecasted_at":"2024-09-09T23:00:00Z","forecasted_time":"2024-09-10T00:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":6.179473876953125,"vwind":3.953920364379883,"wind_direction":237,"wind_magnitude":7.33616954846356}
{"forecasted_at":"2024-09-10T01:00:00Z","forecasted_time":"2024-09-10T02:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":8.181510925292969,"vwind":1.6362571716308594,"wind_direction":258,"wind_magnitude":8.34352794400556}
{"forecasted_at":"2024-09-10T04:00:00Z","forecasted_time":"2024-09-10T05:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":6.408748626708984,"vwind":3.0920562744140625,"wind_direction":244,"wind_magnitude":7.115677828885149}
{"forecasted_at":"2024-09-10T02:00:00Z","forecasted_time":"2024-09-10T03:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":7.121286392211914,"vwind":1.7680130004882812,"wind_direction":256,"wind_magnitude":7.337478439477567}

Response Fields:

Field Description
forecasted_at The time when the forecast was generated.
forecasted_time The time for which the forecast applies.
lat Latitude of the coordinate.
lon Longitude of the coordinate.
name Name provided in the request for the coord set.
uwind, vwind, wind_direction, wind_magnitude One column per variable or derived expression. Variables default to [name]|[level]|[info].

Usage Notes

Authentication

You need to include a valid authentication token in the Authorization header. You can obtain a demo token by making a request to:

GET https://gribstream.com/auth/demo

Include the token in your request headers as follows:

Authorization: Bearer <token>

Example cURL Command

curl -X POST 'https://gribstream.com/api/v2/hrrr/history' \
        -H "Content-Type: application/json" \
        -H "Accept-Encoding: gzip" \
        -H "Authorization: Bearer $(curl https://gribstream.com/auth/demo)" \
        -d '{
            "fromTime": "2024-09-10T00:00:00Z",
            "untilTime": "2024-09-10T10:00:00Z",
            "asOf": "2024-09-10T05:00:00Z",
            "minHorizon": 1,
            "maxHorizon": 48,
            "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" }
            ]
        }' | gunzip | head -20

This command retrieves the forecast data and outputs the first 20 lines of the decompressed response.

Error Handling

If there is an error with your request, the API will return an error message with an appropriate HTTP status code.

Common Error Codes

Status Code Meaning Description
400 Bad Request Invalid request parameters. Occurs when required parameters are missing or have invalid values.
401 Unauthorized Authentication failed. Occurs when the authentication token is missing or invalid.
500 Internal Server Error Server error. Occurs when there is an error processing the request on the server.

Weather Forecasts Endpoint

Retrieve all forecast runs during a time range, for a list of coordinates, for a list of weather parameters. Optionally filtering for a range of hours ahead (min/max horizons).

POST https://gribstream.com/api/v2/<model>/forecasts

Available Models

Request Headers

Header Value Comment
Content-Type application/json Default and only valid value.
Accept Choose text/csv, application/json or application/ndjson Selects the response format. Defaults to text/csv
Accept-Encoding gzip Optional, recommended, for compressed response
Authorization Bearer <token> Replace <token> with your authentication token

Request Body Parameters

The request body should be a JSON object with the following structure:

Parameter Type Description Required
forecastedFrom string (ISO 8601) Earliest forecast run time. Yes, either (forecastedFrom, forecastedUntil) or timesList
forecastedUntil string (ISO 8601) Latest forecast run time. Yes, either (forecastedFrom, forecastedUntil) or timesList
timesList array of string (ISO 8601) Array of forecasted times. Yes, either (forecastedFrom, forecastedUntil) or timesList
minHorizon integer Minimum forecast horizon in hours. No (default: 0)
maxHorizon integer Maximum forecast horizon in hours. No (default: 384)
coordinates array of coordinate objects List of geographical coordinates. Yes
variables array of variable objects List of weather variables to retrieve. Yes
expressions array of expression objects Server‑side calculated columns built from the variables you request. Each entry returns as its own column, using the supplied alias. No

NOTE: Selected time must be specified via range (forecastedFrom, forecastedUntil) or timesList

Coordinate Object

Field Type Description Required
lat float Latitude of the coordinate. Yes
lon float Longitude of the coordinate. Yes
name string Optional name for the coordinate, which will be returned in the response to help identify the location. No

Variable Object

Field Type Description Required
name string Name of the weather variable (e.g., "TMP" for temperature). Yes
level string Level of the atmosphere or surface (e.g., "2 m above ground"). Yes
info string Differentiator when the model has multiple parameters for the same name and level No
alias string Optional alias for the variable. If provided, this alias will be used as the column header in the response. No

Expression Object

FieldTypeDescriptionRequired
expression string Go‑template expression evaluated per‑row.
• All selected variables are addressable by their alias (or default column name).
• Math operators + ‑ * / % and functions in func. (Abs, Atan2, Hypot, Pow, Sqrt, etc.) are allowed.
Yes
alias string Column name used in the response for this calculated result. Yes

Example Request

POST https://gribstream.com/api/v2/hrrr/forecasts
Content-Type: application/json
Accept-Encoding: gzip
Authorization: Bearer <token>
Payload:
{
    "forecastedFrom": "2024-09-10T00:00:00Z",
    "forecastedUntil": "2024-09-10T00:00:00Z",
    "minHorizon": 1,
    "maxHorizon": 48,
    "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" }
    ]
}

Example Response

The format of the response is determined by the Accept header. The API supports three response formats:

If the Accept-Encoding: gzip header is included, the response will be gzip-compressed.

NOTE: The response is not strictly in-order.

CSV Response Example

forecasted_at,forecasted_time,lat,lon,name,uwind,vwind,wind_direction,wind_magnitude
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-10T00:00:00Z,2024-09-11T02:00:00Z,40.7306,-73.9352,New York City,2.3471,-5.2970,336,5.7937
2024-09-10T00:00:00Z,2024-09-10T03:00:00Z,40.7306,-73.9352,New York City,7.2268,1.7030,256,7.4247
2024-09-10T00:00:00Z,2024-09-11T06:00:00Z,40.7306,-73.9352,New York City,-2.9925,-5.0025,30,5.8292
2024-09-10T00:00:00Z,2024-09-11T07:00:00Z,40.7306,-73.9352,New York City,-2.9643,-4.9196,31,5.7437
2024-09-10T00:00:00Z,2024-09-10T12:00:00Z,40.7306,-73.9352,New York City,4.7834,-4.3696,312,6.4787
2024-09-10T00:00:00Z,2024-09-10T10:00:00Z,40.7306,-73.9352,New York City,7.2718,0.5647,265,7.2937
2024-09-10T00:00:00Z,2024-09-11T10:00:00Z,40.7306,-73.9352,New York City,-2.9361,-4.5728,32,5.4343
2024-09-10T00:00:00Z,2024-09-11T05:00:00Z,40.7306,-73.9352,New York City,-3.1221,-5.8816,27,6.6589
2024-09-10T00:00:00Z,2024-09-10T06:00:00Z,40.7306,-73.9352,New York City,6.6521,1.6799,255,6.8610
2024-09-10T00:00:00Z,2024-09-11T00:00:00Z,40.7306,-73.9352,New York City,3.2101,-3.3758,316,4.6584
2024-09-10T00:00:00Z,2024-09-10T11:00:00Z,40.7306,-73.9352,New York City,6.9390,-2.4367,289,7.3544
...

JSON Response Example (JSON Array)

[{"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T09:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":7.078826904296875,"vwind":2.4223251342773438,"wind_direction":251,"wind_magnitude":7.481807896300802}
,{"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T07:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":6.181903839111328,"vwind":2.596050262451172,"wind_direction":247,"wind_magnitude":6.704879718622265}
,{"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-11T09:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":-2.627544403076172,"vwind":-5.187816619873047,"wind_direction":26,"wind_magnitude":5.815275648803582}
,{"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T08:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":7.091346740722656,"vwind":2.6632766723632812,"wind_direction":249,"wind_magnitude":7.5749746686515245}
,{"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T04:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":6.889509201049805,"vwind":2.7773094177246094,"wind_direction":248,"wind_magnitude":7.428242364996697}
,{"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T03:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":7.226800918579102,"vwind":1.7029743194580078,"wind_direction":256,"wind_magnitude":7.424740604863526}
,{"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T10:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":7.271799087524414,"vwind":0.5646705627441406,"wind_direction":265,"wind_magnitude":7.2936900683913555}
,{"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T12:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":4.783409118652344,"vwind":-4.369564056396484,"wind_direction":312,"wind_magnitude":6.4787416092446914}
,{"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T05:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":7.676166534423828,"vwind":2.414224624633789,"wind_direction":252,"wind_magnitude":8.046863563053401}
,{"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T01:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":8.057228088378906,"vwind":2.938892364501953,"wind_direction":249,"wind_magnitude":8.576480210336284}
...
]

NDJSON Response Example (Line-delimited)

{"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T03:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":7.226800918579102,"vwind":1.7029743194580078,"wind_direction":256,"wind_magnitude":7.424740604863526}
{"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T17:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":2.3053665161132812,"vwind":-3.231029510498047,"wind_direction":324,"wind_magnitude":3.969164455061737}
{"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T19:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":1.7580318450927734,"vwind":-2.8487396240234375,"wind_direction":328,"wind_magnitude":3.3475354238366912}
{"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T16:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":2.373655319213867,"vwind":-3.552021026611328,"wind_direction":326,"wind_magnitude":4.272129790622153}
{"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T20:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":1.9354515075683594,"vwind":-2.271472930908203,"wind_direction":319,"wind_magnitude":2.9842187945922025}
{"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T02:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":8.008834838867188,"vwind":1.1038799285888672,"wind_direction":262,"wind_magnitude":8.084552329782657}
{"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T12:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":4.783409118652344,"vwind":-4.369564056396484,"wind_direction":312,"wind_magnitude":6.4787416092446914}
{"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T04:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":6.889509201049805,"vwind":2.7773094177246094,"wind_direction":248,"wind_magnitude":7.428242364996697}
{"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T13:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":2.683929443359375,"vwind":-4.015068054199219,"wind_direction":326,"wind_magnitude":4.829518478770162}
{"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T18:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":1.8502693176269531,"vwind":-3.0554637908935547,"wind_direction":328,"wind_magnitude":3.5720240096076235}
{"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-11T09:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":-2.627544403076172,"vwind":-5.187816619873047,"wind_direction":26,"wind_magnitude":5.815275648803582}
{"forecasted_at":"2024-09-10T00:00:00Z","forecasted_time":"2024-09-10T14:00:00Z","lat":40.7306,"lon":-73.9352,"name":"New York City","uwind":1.9734878540039062,"vwind":-4.105434417724609,"wind_direction":334,"wind_magnitude":4.555134034047598}
...

Response Fields:

Field Description
forecasted_at The time when the forecast was generated.
forecasted_time The time for which the forecast applies.
lat Latitude of the coordinate.
lon Longitude of the coordinate.
name Name provided in the request for the coord set.
uwind, vwind, wind_direction, wind_magnitude One column per variable or derived expression. Variables default to [name]|[level]|[info].

Usage Notes

Authentication

You need to include a valid authentication token in the Authorization header. You can obtain a demo token by making a request to:

GET https://gribstream.com/auth/demo

Include the token in your request headers as follows:

Authorization: Bearer <token>

Example cURL Command

  curl -X POST 'https://gribstream.com/api/v2/hrrr/forecasts' \
-H "Content-Type: application/json" \
-H "Accept-Encoding: gzip" \
-H "Authorization: $(curl https://gribstream.com/auth/demo)" \
-d '{
    "forecastedFrom": "2024-09-10T00:00:00Z",
    "forecastedUntil": "2024-09-10T00:00:00Z",
    "minHorizon": 1,
    "maxHorizon": 48,
    "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" }
    ]
    }' | gunzip

This command retrieves the forecast data and outputs the first 20 lines of the decompressed response.

Error Handling

If there is an error with your request, the API will return an error message with an appropriate HTTP status code.

Common Error Codes

Status Code Meaning Description
400 Bad Request Invalid request parameters. Occurs when required parameters are missing or have invalid values.
401 Unauthorized Authentication failed. Occurs when the authentication token is missing or invalid.
500 Internal Server Error Server error. Occurs when there is an error processing the request on the server.

Contact Information

If you have any questions or need assistance, please contact our support team at info@gribstream.com.