The query <https://github.com/weewx/weewx/blob/26bbcc56b5939d3e7e102ba21e9e656074714f67/bin/weewx/xtypes.py#L491C19-L492C73> is
"SELECT SUM(xsum),SUM(ysum) FROM %(table_name)s_day_%(obs_key)s WHERE dateTime >= %(start)s AND dateTime < %(stop)s;" Then <https://github.com/weewx/weewx/blob/26bbcc56b5939d3e7e102ba21e9e656074714f67/bin/weewx/xtypes.py#L581> , deg = 90.0 - math.degrees(math.atan2(row[1], row[0])) value = deg if deg >= 0 else deg + 360.0 But, like Michael, I'm curious what you plan on doing with it. On Thu, Aug 10, 2023 at 10:15 PM [email protected] < [email protected]> wrote: > There is no average direction, what you are looking for is the direction > of a vector, the resulting vector (speed, direction) of all measuerements > of a given timespan. I am not too familiar with all database tables and > entries, but I thinking of the parts I know, I doubt that you can retrieve > the vector an it's direction by a query (at least with a considerable > simple one). > > What is your use case and why can't you use the provided variables you > have mentioned? > > Phil D schrieb am Freitag, 11. August 2023 um 05:58:31 UTC+2: > >> Hello everyone, >> >> I am trying to create an sql query from the archive_day_xxx tables to >> find the daily and monthly values of the average wind direction that we >> retrieve in the variables $day.wind.vecdir and $month.wind.vecdir. >> I tried several things from the archive_day_wind and archive_day_winDir >> tables but without finding the exact values. >> Anyone know how to find them? >> sorry for the google translate >> Thanks in advance >> Phil > > -- > You received this message because you are subscribed to the Google Groups > "weewx-user" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/weewx-user/0d856397-4479-439e-80ee-e7bfbd799285n%40googlegroups.com > <https://groups.google.com/d/msgid/weewx-user/0d856397-4479-439e-80ee-e7bfbd799285n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "weewx-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/CAPq0zEBZN0qVB1xT248LF%3DYEdCALZHn5g9PMgBeX6Jr%3DQTcT2g%40mail.gmail.com.
