I have looked for days trying to change the output of W/m² to lux.

108 views
Skip to first unread message

Scott Grayban

unread,
Feb 7, 2019, 2:27:30 PM2/7/19
to weewx-user
Is there anyway to get this changed ?

W/m² to Lux

gjr80

unread,
Feb 8, 2019, 12:16:37 AM2/8/19
to weewx-user
Might need some more information as to exactly what you are trying to do. WeeWX has no concept of what lux is so it cannot convert to/from lux like it can convert between C and F. Or are you wanting to do something3 else?

Gary

Scott Grayban

unread,
Feb 8, 2019, 12:19:02 AM2/8/19
to weewx-user
I have a JSON template that I parse but the one thing I want to change is Watts to Lux and I can't figure out if that is even possible.

Colin Larsen

unread,
Feb 8, 2019, 12:29:51 AM2/8/19
to weewx-user
I believe it's a pretty complicated beast to do properly but a factor of Lux * 0.0079 gets you W/m2 (approx?) from what I've read ..... so just the reverse?
I'm looking at sensors at the moment that output Lux and converting it to Wm/2 which where I found that conversion.

Hope it helps
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.
For more options, visit https://groups.google.com/d/optout.

gjr80

unread,
Feb 8, 2019, 12:31:25 AM2/8/19
to weewx-user
If you want a formula for converting W/sq m to lux then I can't help, my understanding is there is no direct formula as lux is dependent on the wavelength of the light. Assuming you have a formula then I guess you can directly code it with some in-line python code in your template or you can make WeeWX lux aware by extending the WeeWX units module. The latter is fairly easily done by adding a handful of lines to bin/user/extensions.py, some example code is in the Creating a new unit group section in the Customization Guide.

Gary

Scott Grayban

unread,
Feb 8, 2019, 12:46:49 AM2/8/19
to weewx-user
Thanks

vince

unread,
Feb 8, 2019, 12:49:42 AM2/8/19
to weewx-user
On Thursday, February 7, 2019 at 9:31:25 PM UTC-8, gjr80 wrote:
If you want a formula for converting W/sq m to lux then I can't help, my understanding is there is no direct formula as lux is dependent on the wavelength of the light. 

There was a long very technical discussion along these lines in the WeatherFlow community forums within the last few weeks that said exactly the same thing.

Long explanation is at https://www.translatorscafe.com/unit-converter/en/illumination/1-11/ if you want to read that for details.

 

Greg Troxel

unread,
Feb 8, 2019, 10:04:41 AM2/8/19
to Colin Larsen, weewx-user
Colin Larsen <colin....@gmail.com> writes:

> I believe it's a pretty complicated beast to do properly but a factor of
> Lux * 0.0079 gets you W/m2 (approx?) from what I've read ..... so just the
> reverse?
> I'm looking at sensors at the moment that output Lux and converting it to
> Wm/2 which where I found that conversion.

It simply does not make technical sense to convert a sensor value in
W/m^2 to lux (which is lm/m^2, lm being lumen). They are incompatible
units measuring different things.

Sensors like the Davis solar radiation sensor measure "irradiance" in
W/m^2, which is the amount of power arriving in an area. By definition,
power at all wavelengths is treated equally.

lux is a unit of illuminance, which measures the amount of light in an
area in terms of the response of the human eye, according to a
standardized response curve obtained from experiments.

For a single wavelength, one can ask what the value of one measurement
is given the other, multiplying or dividing by the standarized response
curve. Using a spectroradiometer, one can measure the power at a
variety of wavelenghts, say at 10 nm intervals, and then sum the
converted powers.

Another way to obtain lux is to use a device with a filter that matches
the standard curve. There are instruments for lighting, and for
photography that do this. There are also sky brightness meters (which
I have read about but do have not experience with):
http://unihedron.com/projects/darksky/

Typically people care about illuminance for management of artificial
lighting or light pollution, and the values are very low compared to
values that can be read on a solar radiation sensor.

This stackexchange answer claims 6.8 mW/m^2 at full moon, and a full
moon is known to produce about 0.3 lux. Note that this ratio cannot be
applied to sunlight; moonlight has a very high color temperature,
meaning that it has more blue than red compared to sunlight.
https://physics.stackexchange.com/questions/89181/how-is-the-earth-heated-by-a-full-moon#89197

So basically, you just cannot convert sensor output and weewx should not
try. If you want to measure lux you need a lux sensor, and to measure
W/m^w you need a radiation sensor.

One could go out on a limb and start making assumptions about the
spectral distribution of different kinds of daylight that are likely for
various irradiance levels. For example, full sun with no clouds is well
characterized. But as soon as you get into dawn/dusk and clouds, there
is much more variability. Trying to guess spectral distribution based
on illuminance or irradiance and converting, and comparing that to a
sensor that measures the other, would be an interesting science
experiment.

https://en.wikipedia.org/wiki/Photometry_(optics)

Thomas Keffer

unread,
Feb 8, 2019, 12:46:26 PM2/8/19
to weewx-user, Colin Larsen
 Very nice write up, Greg.

May I cut and paste it into a Wiki article? This is not the first time this has come up.

-tk

Greg Troxel

unread,
Feb 8, 2019, 2:34:33 PM2/8/19
to Thomas Keffer, weewx-user, Colin Larsen
Thomas Keffer <tke...@gmail.com> writes:

> Very nice write up, Greg.
>
> May I cut and paste it into a Wiki article? This is not the first time this
> has come up.

Sure, that's fine.
Reply all
Reply to author
Forward
0 new messages