Grid Weather Hourly Forecast
Weather forecast data based on numerical models, to provide hourly weather forecasts at specified coordinates around the world, with a spatial resolution of 3-5 kilometers.
Hint: The grid weather data is based on Numerical Weather Prediction (NWP) models, and it is not suitable for comparison with observation station data. For station-based city weather data, please refer to the City Weather API. Grid weather uses UTC+0 as the time zone.
| Interface code | Interface | Class |
|---|---|---|
| grid24h | Hourly Forecast by Grid (24hrs) | GridHourlyResponse |
| grid72h | Hourly Forecast by Grid (72hrs)) | GridHourlyResponse |
Parameters
GridWeatherParameter
| Name | Type | Required | Exemple |
|---|---|---|---|
| longitude | Double | true | 116.41 |
| latitude | Double | true | 39.92 |
| lang | Lang | false | ZH_HANS |
| unit | Unit | false | METRIC |
Sample code
Swift
Task{
do {
let parameter = GridWeatherParameter(longitude: 116.41, latitude: 39.92)
/*
* Hourly Forecast by Grid (24hrs)
*/
let _ = try await QWeather.instance
.grid24h(parameter)
/*
* Hourly Forecast by Grid (72hrs)
*/
let _ = try await QWeather.instance
.grid72h(parameter)
} catch QWeatherError.errorResponse(let error) {
print(error)
} catch {
print(error)
}
}
Objective-C
GridWeatherParameter *parameter = [GridWeatherParameter instanceWithLongitude:116.41 latitude:39.92 lang:@(LangZH_HANS) unit:@(UnitMETRIC)];
void (^handler)(GridHourlyResponse *, NSError *) = ^(GridHourlyResponse *response,
NSError *error) {
if (response) {
NSLog(@"%@", response.description);
}
if (error) {
NSLog(@"%@", error.localizedDescription);
}
};
/*
* Hourly Forecast by Grid (24hrs)
*/
[QWeatherObjc grid24h:parameter completionHandler:handler];
/*
* Hourly Forecast by Grid (72hrs)
*/
[QWeatherObjc grid72h:parameter completionHandler:handler];
Response
GridHourlyResponse
-
codeSee Status Code -
updateTimeAPI last update time -
fxLinkResponsive web page of this data, for embedded in website or APP -
hourly.fxTimeForecast time -
hourly.temptemperature -
hourly.iconIcon code for weather conditions. See also QWeather Icons -
hourly.textWeather conditions -
hourly.wind360Wind direction in azimuth degree -
hourly.windDirWind direction -
hourly.windScaleWind scale -
hourly.windSpeedWind speed, KM/H -
hourly.humidityRelative humidity in percent -
hourly.precipAccumulated precipitation in the current hour -
hourly.cloudCloud cover in percent, may be null -
hourly.dewDew point temperature, may be null -
refer.sourcesData source and other statements, may be null -
refer.licenseData license, may be null