With some web search, I have a code example that can plot from the
weewx.sdb directly. Maybe this will help someone.
import sqlite3, pandas , matplotlib.pyplot as plt
from datetime import datetime
conn = sqlite3.connect("weewx.sdb")
c = conn.cursor()
def ftoc(t):
return float((t-32)/1.8)
def mtok(v):
return (v*1.60934)
def graph_data():
c.execute('SELECT dateTime, outTemp, windGust FROM archive \
WHERE dateTime BETWEEN STRFTIME("%s", "2023-01-23") AND
STRFTIME("%s", "2023-01-25") ')
data = c.fetchall()
date = []
temperature = []
gust = []
for row in data:
date.append(datetime.fromtimestamp(row[0]))
temperature.append( ftoc(row[1]) )
gust.append( mtok(row[2]) )
plt.plot_date(date,temperature,'-')
plt.plot_date(date,gust,'-')
plt.show()
graph_data()
četrtek, 19. januar 2023 ob 20:49:04 UTC+1 je oseba mihec napisala:
> Thanks, I'll have a look how to do that.
>
> četrtek, 19. januar 2023 ob 20:25:16 UTC+1 je oseba [email protected]
> napisala:
>
>> WeeWX does not use matplotlib.
>>
>> You would have to extract the data from the database, then use it. The
>> command-line tool "sqlite3 <https://sqlite.org/cli.html>" can emit CSV
>> files.
>>
>> On Thu, Jan 19, 2023 at 9:15 AM mihec <[email protected]> wrote:
>>
>>> Hi,
>>> I would like to plot e.g. temperature and solar radiation from my
>>> sqlite3 weewx's database file for the whole last year or just selected
>>> season. Is there a code example how to do that? The problem I have is
>>> actually to extract the data from the database file. The plotting part I
>>> can handle.
>>> Alternatively, is there a way to convert the selected timeframe from the
>>> database to the .csv file?
>>> Thank you.
>>>
>>> --
>>> 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/1b611686-0f84-4215-b1c3-d77e71f26664n%40googlegroups.com
>>>
>>> <https://groups.google.com/d/msgid/weewx-user/1b611686-0f84-4215-b1c3-d77e71f26664n%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/549f02f5-d162-46ac-a503-08508dcc7a1cn%40googlegroups.com.