Issue with WindRose & Flux

  • What Grafana version and what operating system are you using?
    Grafana 9.2.3 Debian Bullseye

  • What are you trying to achieve?
    Getting the WindRose to work with Flux

  • How are you trying to achieve it?
    from(bucket: “netatmo”)
    |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
    |> filter(fn: (r) => r[“_measurement”] == “WindAngle” or r[“_measurement”] == “WindStrength”)
    |> filter(fn: (r) => r[“module”] == “wind”)
    |> filter(fn: (r) => r[“station”] == “Maison (station)”)
    |> filter(fn: (r) => r[“_field”] == “value”)
    |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
    |> yield(name: “mean”)

  • What happened?
    No data or compass rose lines, but using Inspect I see the data

  • What did you expect to happen?
    Wind Speed and Wind Direction (which worked on the postgres data source)

  • Can you copy/paste the configuration(s) that you are having problems with?
    see above Flux

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    None.

  • Did you follow any online instructions? If so, what is the URL?
    None Available

fixed it
from(bucket: “netatmo”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r[“_measurement”] == “WindStrength” or r[“_measurement”] == “WindAngle”)
|> filter(fn: (r) => r[“_field”] == “value”)
|> pivot(rowKey:[“_time”], columnKey: [“_measurement”], valueColumn: “_value”) // put dir and speed values into the same row based on timestamps
|> filter(fn: (r) => exists r[“WindAngle”] and exists r[“WindStrength”]) // drop rows that donot have both values
|> rename(columns: {“WindAngle”: “direction”, “WindStrength”: “speed”})
//|> map(fn: (r) => ({ r with direction: r.directionRad / 3.14 * 180.0 })) // convert to degrees from radians
//|> map(fn: (r) => ({ r with speed: r.speedMps / 0.514 })) // convert to knots from m/s
|> aggregateWindow(every: v.windowPeriod, fn: first, column: “direction”, createEmpty: false) // sample the first row for each window (real aggregation would show fake values in gusty winds)

1 Like