In Grafana Cloud - trying to call a weather API for historical temperatures to correlate with electrical usage data.
Using the grafanacloud-infinity data source to call the following API:
https://api.open-meteo.com/v1/forecast?latitude=52.52&longitude=13.41&hourly=temperature_2m&timezone=America%2FNew_York&past_days=31&forecast_days=3&timeformat=unixtime&wind_speed_unit=mph&temperature_unit=fahrenheit&precipitation_unit=inch
Output of the API
{
"latitude": 52.52,
"longitude": 13.419998,
"generationtime_ms": 0.0957250595092773,
"utc_offset_seconds": -14400,
"timezone": "America/New_York",
"timezone_abbreviation": "GMT-4",
"elevation": 38,
"hourly_units": {
"time": "unixtime",
"temperature_2m": "°F"
},
"hourly": {
"time": [1749787200, 1749790800, ETC, ETC],
"temperature_2m": [54, 54.3, 57, ETC, ETC]
}
}
Trying to marry time and temperature into a time series using UQL.
Current Query calls the above api and uses the following UQL query which results in the error “error applying the UQL query”…
parse-json
| extend “data” = array_from_entries(‘Time’, $.hourly.time, ‘Temperature’, $.hourly.temperature_2m)
| mv-expand “data”
| project “Time” = unixtime_seconds_todatetime(“data.Time”), “Temperature”
Thoughts?
