Is it possible to do this?

I have some weather data coming into InfluxDB from two different sources and am successfully visualising them in Grafana. What I now want to do is mathematically combine two of the values, one from each source, in this equation for wind chill Tch.
Tch = 13.12 + 0.6215Ta - 11.37v^0.16 + 0.3965Ta v^0.16
Ta is a temperature and v is a speed.
I really don’t where to start, is there a way of doing exponents?
Can someone please point me in the right direction.

Try the POW() function:

Antony.

Thanks Antony, a useful link.
I can see how POW() does the exponents but how do I build up the equation above?

I would expect something like:

select (13.12+0.6215Ta-11.37POW(v,0.16)+0.3965TaPOW(v,0.16)) as Tch

…assuming I read your original equation correctly :slight_smile:

Antony.

Thanks again, I will experiment!

Not getting much success, everything I have tried gives no result !
These are two working sql statements for the variables I want to combine in my equation. They work fine for graphing individually. avSpeed is v and Outside Temp degC is Ta.

SELECT last("avSpeed") FROM "anenom" WHERE $timeFilter GROUP BY time($__interval) fill(null)
and
SELECT last("Outside Temp degC") FROM "Temperature" WHERE ("location" = 'Home') AND $timeFilter GROUP BY time($__interval) fill(null)

For example:
SELECT POW("avSpeed",0.16) FROM "anenom" WHERE $timeFilter GROUP BY time($__interval) fill(null)

Gives no output at all.

@peterb If using Flux, this kind of operation is definitely possible.

from(bucket: "db/rp")
  |> range(start: v.timeRangeStart)
  |> filter(fn: (r) => r._measurement == "anenom" or r._measurement == "Temperature")
  |> filter(fn: (r) => r._field == "avSpeed" or r._field == "Outside Temp degC")
  |> aggregateWindow(every: v.windowPeriod, fn: last)
  |> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")
  |> map(fn: (r) => ({ r with Tch: 13.12 + (0.6215 * r.Temperature) - 11.37 * r.anenom^0.16 + 0.3965 * r.Temperature * r.anenom^0.16}))

Thanks Scott. I am a novice to all this so even the relationship of Flux to InfluxDB and Grafana, my visualising tool, is something I have to understand.
Presumably the code above can be entered at the command line but will it:

  1. Continue to run in the background.
  2. Be available for me to visualise in Grafana.

@peterb

  1. Grafana runs queries on a specified interval. Each time Grafana refreshes the data, it will rerun this query. In that way, I guess you could say it does run in the background.
  2. If you install the Grafana Flux plugin, yes, you’ll be able to use that query to visualize the data in Grafana. You may need to update some of the variables (v.timeRangeStart, v.windowPeriod) to use Grafana variables, but I’m not sure.