Accessing Database From Service Extension

75 views
Skip to first unread message

carter.hu...@gmail.com

unread,
Apr 21, 2024, 12:17:50 PM4/21/24
to weewx-user
I have PM 2.5 data being feed into WeeWx via a custom service extension. What I want to do is calculate the air quality index (AQI) based on the PM2.5 data. The EPA references the correct way of doing this as using the 24-hour average PM2.5.

So my question is, is there a way for an extension to access the weewx database a pull the average value of a variable over the last 24 hours?

p q

unread,
Apr 21, 2024, 2:09:21 PM4/21/24
to weewx...@googlegroups.com
You might be able to use the python library https://pypi.org/project/python-aqi/


On Sun, Apr 21, 2024 at 9:17 AM carter.hu...@gmail.com <carter.hu...@gmail.com> wrote:
I have PM 2.5 data being feed into WeeWx via a custom service extension. What I want to do is calculate the air quality index (AQI) based on the PM2.5 data. The EPA references the correct way of doing this as using the 24-hour average PM2.5.

So my question is, is there a way for an extension to access the weewx database a pull the average value of a variable over the last 24 hours?

--
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 weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/03f80a01-a1ab-4ee7-9ae1-244312a74115n%40googlegroups.com.


--
Peter Quinn
(415)794-2264

Carter Humphreys

unread,
Apr 21, 2024, 2:39:56 PM4/21/24
to weewx...@googlegroups.com

Thanks. So the calculation of AQI I have in my extension already, however I need the average value from the weewx database of the PM2.5 for a more realistic AQI. I essentially want to create a new variable that is the AQI based on the rolling 24-hour average and add that to the database.

On Apr 21, 2024, at 11:09, p q <peterq...@gmail.com> wrote:


You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/-mBPA6zENp4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/CAA1SM22%3DtUXpkHLdxBHePbtn_JcmCEidHdHSigfB4ztVd3cVtw%40mail.gmail.com.

Tom Keffer

unread,
Apr 21, 2024, 2:40:48 PM4/21/24
to weewx...@googlegroups.com
Take a look at the section Programming interface in the documentation and see if that answers your question.

On Sun, Apr 21, 2024 at 9:17 AM carter.hu...@gmail.com <carter.hu...@gmail.com> wrote:
I have PM 2.5 data being feed into WeeWx via a custom service extension. What I want to do is calculate the air quality index (AQI) based on the PM2.5 data. The EPA references the correct way of doing this as using the 24-hour average PM2.5.

So my question is, is there a way for an extension to access the weewx database a pull the average value of a variable over the last 24 hours?

--

Carter Humphreys

unread,
Apr 22, 2024, 12:47:42 AM4/22/24
to weewx...@googlegroups.com
Ah that looks like it should do the trick! I’ll give it a try and reach back out if I have any issues. Thanks Tom!

Carter

On Apr 21, 2024, at 11:40, Tom Keffer <tke...@gmail.com> wrote:


You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/-mBPA6zENp4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/CAPq0zEBEiF2KHNFBvzSmVWd_V%3DjmYbN7g4X4aNo%2Bm1kbJwtkqQ%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages