want to use lux value to calculate value for 'radiation'

472 views
Skip to first unread message

Eric K

unread,
May 18, 2021, 3:10:33 PM5/18/21
to weewx-user
The Acurite Atlas weather sensor provides a UV and a lux value, but not a radiation value.
I want to use this formula to calculate solar radiation from the lux sensor in the Acurite Atlas:  radiation = lux * 0.0079

I've been searching the weewx documentation for details and examples of how to create a data value from a calculation.  This calculated data will then go into the weewx database, and graphs in the weewx web page.

It looks like the StdWXCalculate section of the weewx.conf file is the place to do this?
Is that correct?

I've been looking for an example of the StdWXCalculate section showing how a user-created formula is included, and I have not found one.

Can someone show an example of including a user-created formula?

Help appreciated.

Rainer Lang

unread,
May 18, 2021, 3:58:31 PM5/18/21
to Eric K, weewx-user

in the [StdCalibrate] [[Corrections]] stanza in weewx.conf add the line

radiation = luminosity/126.7 if luminosity is not None else None

Then the calculated value will be stored as radiation in the database and you can use it in your reports/skins

--
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/574d19fd-304c-44d9-b73a-68d203e72a82n%40googlegroups.com.

Eric K

unread,
May 18, 2021, 5:35:04 PM5/18/21
to weewx-user
That worked well.  Thanks!
calculated radiation value.JPG

Greg Troxel

unread,
May 18, 2021, 6:04:08 PM5/18/21
to Eric K, weewx-user

Eric K <eric.k...@gmail.com> writes:

> The Acurite Atlas weather sensor provides a UV and a lux value, but not a
> radiation value.
> I want to use this formula to calculate solar radiation from the lux sensor
> in the Acurite Atlas: radiation = lux * 0.0079

See also

https://github.com/weewx/weewx/wiki/Watts-and-lux
signature.asc

Eric K

unread,
May 18, 2021, 6:18:11 PM5/18/21
to weewx-user
Yeah, I agree conversion is not the best way to obtain the solar radiation value. 
Lux is all Acurite provides us.

I found several places where the sunlight-specific conversion value of of 1/126.7 (or 0.00789) was referenced, so I went with that.
https://help.ambientweather.net/help/why-is-the-lux-to-w-m-2-conversion-factor-126-7

Greg Troxel

unread,
May 18, 2021, 6:38:27 PM5/18/21
to Eric K, weewx-user

Eric K <eric.k...@gmail.com> writes:

> Yeah, I agree conversion is not the best way to obtain the solar radiation
> value.
> Lux is all Acurite provides us.
>
> I found several places where the sunlight-specific conversion value of of
> 1/126.7 (or 0.00789) was referenced, so I went with that.
> https://help.ambientweather.net/help/why-is-the-lux-to-w-m-2-conversion-factor-126-7
> https://cumulus.hosiene.co.uk/viewtopic.php?t=3979

I added those links to the wiki page.

Agreed that for bright full sun conversions based on an assumed spectral
distribution are not ridiculous.

It would be really interesting if someone with both kinds of sensors
(both high quality!) were to post a scatter plot of one vs the other.
I expect good agreement about 500 W/m^2, and much less by the time one
gets to 100 W/m^2. But I am just guessing.
signature.asc

Kevin Crivelli

unread,
Sep 27, 2023, 6:53:10 PM9/27/23
to weewx-user
I have the same problem but this didn't work for me. any ideas?

Colin Larsen

unread,
Sep 27, 2023, 6:59:21 PM9/27/23
to weewx-user
My graph is almost perfect with that calculation

Colin



--
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.

Eric K

unread,
Sep 27, 2023, 7:11:05 PM9/27/23
to weewx-user
Share the [StdCalibrate]  [[Corrections]] section of your weewx.conf file with us.

Kevin Crivelli

unread,
Sep 27, 2023, 7:49:52 PM9/27/23
to weewx-user
[StdCalibrate]
   
    [[Corrections]]
        windDir = windDir if windSpeed > 0 else None
        lightning_distance = lightning_distance if lightning_strike_count > 0 else None
        # For each type, an arbitrary calibration expression can be given.
        # It should be in the units defined in the StdConvert section.
        # Example:
        foo = foo + 0.2
        radiation = luminosity/126.7 if luminosity is not None else None

Kevin Crivelli

unread,
Sep 27, 2023, 8:02:38 PM9/27/23
to weewx-user
after no luck I was trying to follow this thread but when I get to the end I don't think those apply to this version of weewx. The post is from 2019

https://groups.google.com/g/weewx-user/c/CMwtsQ6SrpE/m/FoiiCMrfBgAJ

Eric Koester

unread,
Sep 29, 2023, 11:17:58 AM9/29/23
to weewx...@googlegroups.com

Kevin Crivelli,

Here's what my [[Corrections]] section looks like.
Mine uses '> 0' rather than 'not None'

[StdCalibrate]
   
    [[Corrections]]

        # For each type, an arbitrary calibration expression can be given.
        # It should be in the units defined in the StdConvert section.
        # Example:  foo = foo + 0.2
        radiation = luminosity * 0.00789 if luminosity > 0 else None
        lightning_distance = lightning_distance / 1.609 if lightning_strike_count > 0 else None    #convert distance to miles

--
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/oWp-9LivDJo/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/fc6b65b0-69be-4ec7-9763-675f62302f48n%40googlegroups.com.

Kevin Crivelli

unread,
Sep 29, 2023, 3:10:05 PM9/29/23
to weewx...@googlegroups.com
Thank you! I'm gonna try this. Let ya know how it works out 

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/CADh_orjKiziRwWUTK%3DgGN2Kao%3DB3n4FGRvvmTDGn355iLpDRqQ%40mail.gmail.com.

Kevin Crivelli

unread,
Sep 29, 2023, 3:49:54 PM9/29/23
to weewx...@googlegroups.com
Should it reflect in the graphs immediately? I was able to login to ssh from work and make the change but I'm not seeing any change in the graphs

Eric K

unread,
Sep 29, 2023, 4:00:06 PM9/29/23
to weewx-user
You have to restart weewx before changes made to the weewx.conf file will take effect.
If you've restarted weewx, you should start to see additions to the graphs, every 5 minutes.

Kevin Crivelli

unread,
Oct 1, 2023, 1:28:01 PM10/1/23
to weewx-user
did it, still not working. oh well.

gjr80

unread,
Oct 1, 2023, 6:47:36 PM10/1/23
to weewx-user
So what is your reason for saying "it doesn't work", are you looking at web page output, a plot etc or did you look at the loop packet data being emitted by your driver? The former two are really at the end of the whole processing chain, so there are many opportunities for things to go awry beforehand. The latter is pretty much straight from the driver and if you observe the loop packets when running WeeWX directly you will see the effects of your [StdCalibrate]] [[Corrections]] stanza.

There is a lot of general comments and minor config snippets in this thread and it is difficult to determine exactly what is bering used and what is going on. Could I suggest we take this from the top and you:
1. Post the output from wee_debug. This will give a current and complete picture of your WeeWX config. When posting wee_debug output do check the content for sensitive information (eg user names, passwords, API keys etc), wee_debug is pretty good at obfuscating such content but it is not perfect. 
2. Run WeeWX directly. This will display loop packets (lines starting with LOOP:) and archive records (lines starting with REC:) directly on the console. Let WeeWX run so you see at least two archive records (lines starting with REC:) and post the entire output here.

Setting up a calibration correction such as this is not complex, this should be easy to troubleshoot and rectify.

Gary
Reply all
Reply to author
Forward
0 new messages