Re: [weewx-user] Fixing units in a new graph

2021-02-17 Thread 'Jan-Jaap van der Geer' via weewx-user
On Wednesday, February 17, 2021 at 11:27:40 PM UTC+1 tke...@gmail.com wrote:

> Formats and labels are keyed to *unit groups*, not observation types. If 
> you really want to use luminance (instead of illuminance), you need to tell 
> the system what unit group it is in. You do that by making an assignment to 
> the data structure weewx.units.obs_group_dict:
>
> import weewx.units
> weewx.units.obs_group_dict['luminance'] = 'group_illuminance'
>
> See the section *Assigning a unit group 
> * in 
> the Customizing Guide. 
>
> However, be aware that illuminance is not the same of luminance. 
> Illuminance measures the amount of light falling on a surface area. 
> Luminance measures the amount of light passing through a solid angle. Only 
> illuminance is measured in lux.
>

This is almost what I ended up doing:

import weewx.units
weewx.units.obs_group_dict['outTempBatteryStatus'] = 'group_volt'
weewx.units.obs_group_dict['luminosity'] = 'group_illuminance'

I hadn't picked up on the difference between luminance and illuminance. But 
the field I'm using is called yet another thing, luminosity. What's that 
than? Time for a bit of googling I suppose, although I'm not sure I'll go 
as far as adding a field especially for this. Since there's a field for 
luminosity I think maybe I'll use that regardless.

Thanks for the help!

Cheers,
Jan-Jaap

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/6b31a15e-07ee-48ba-aa59-956cc63e9678n%40googlegroups.com.


Re: [weewx-user] Fixing units in a new graph

2021-02-17 Thread Tom Keffer
Formats and labels are keyed to *unit groups*, not observation types. If
you really want to use luminance (instead of illuminance), you need to tell
the system what unit group it is in. You do that by making an assignment to
the data structure weewx.units.obs_group_dict:

import weewx.units
weewx.units.obs_group_dict['luminance'] = 'group_illuminance'

See the section *Assigning a unit group
* in the
Customizing Guide.

However, be aware that illuminance is not the same of luminance.
Illuminance measures the amount of light falling on a surface area.
Luminance measures the amount of light passing through a solid angle. Only
illuminance is measured in lux.

On Wed, Feb 17, 2021 at 1:28 PM 'Jan-Jaap van der Geer' via weewx-user <
weewx-user@googlegroups.com> wrote:

> On Tuesday, February 16, 2021 at 10:53:33 PM UTC+1 tke...@gmail.com wrote:
>
>> There's already a type for luminosity, but it's called "illuminance",
>> introduced in V4.2. It's a member of group_illuminance.
>>
>
>
>> See issue #613 , in
>> particular, this post.
>> 
>>
>
> Hm, I'm not sure that helps me. I've tried replacing the 'lux = " lux"'
> with 'illuminance = " lux"' and  adding 'illuminance = %.0f' to the
> StringFormats but there's still no unit on the graph and the low/high table
> still has lot's of digits behind the comma. I'm not sure what to do, but I
> do see that lux/illuminance might be a difficult one to get right because
> of naming confusion.
>
> But I have a graph for the voltage as well. That one also doesn't show the
> unit (v) in its graph. Maybe that's a better example. I added these values
> in weewx.conf:
>
> [[Defaults]]
>   [[[Units]]]
> Groups
>   group_volt = volt
>
> Labels
>   volt = " volt"
>
> But that does not add the unit to the volt-graph. What am I missing?
>
> Thinking about it a bit more I think I might be completely in the wrong
> area as there's nothing in the section I quoted that seems to tell weewx to
> use "°C" for temperatures but still it does.
>
> How does it know this?
>
> Cheers,
> Jan-Jaap
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/0d1aad64-507e-4c76-a99d-99d0ee2c836cn%40googlegroups.com
> 
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAPq0zEDLGQF1rZxgig4B-T5Oa1xkHrf-3kfZa06aamCzQCM4Dw%40mail.gmail.com.


Re: [weewx-user] Fixing units in a new graph

2021-02-17 Thread 'Jan-Jaap van der Geer' via weewx-user
Aaaah, no matter. I just found the section 'Assigning a unit group' in the 
Customization guide. That seems to work... RTFM, I suppose... Thanks!

Cheers,
Jan-Jaap

On Wednesday, February 17, 2021 at 10:28:37 PM UTC+1 Jan-Jaap van der Geer 
wrote:

> On Tuesday, February 16, 2021 at 10:53:33 PM UTC+1 tke...@gmail.com wrote:
>
>> There's already a type for luminosity, but it's called "illuminance", 
>> introduced in V4.2. It's a member of group_illuminance. 
>>
>  
>
>> See issue #613 , in 
>> particular, this post. 
>> 
>>
>
> Hm, I'm not sure that helps me. I've tried replacing the 'lux = " lux"' 
> with 'illuminance = " lux"' and  adding 'illuminance = %.0f' to the 
> StringFormats but there's still no unit on the graph and the low/high table 
> still has lot's of digits behind the comma. I'm not sure what to do, but I 
> do see that lux/illuminance might be a difficult one to get right because 
> of naming confusion.
>
> But I have a graph for the voltage as well. That one also doesn't show the 
> unit (v) in its graph. Maybe that's a better example. I added these values 
> in weewx.conf:
>
> [[Defaults]]
>   [[[Units]]]
> Groups
>   group_volt = volt
>
> Labels
>   volt = " volt"
>   
> But that does not add the unit to the volt-graph. What am I missing?
>
> Thinking about it a bit more I think I might be completely in the wrong 
> area as there's nothing in the section I quoted that seems to tell weewx to 
> use "°C" for temperatures but still it does.
>
> How does it know this?
>
> Cheers,
> Jan-Jaap
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/253f38a2-ece8-4780-905e-bbc04517087bn%40googlegroups.com.


Re: [weewx-user] Fixing units in a new graph

2021-02-17 Thread 'Jan-Jaap van der Geer' via weewx-user
On Tuesday, February 16, 2021 at 10:53:33 PM UTC+1 tke...@gmail.com wrote:

> There's already a type for luminosity, but it's called "illuminance", 
> introduced in V4.2. It's a member of group_illuminance. 
>
 

> See issue #613 , in 
> particular, this post. 
> 
>

Hm, I'm not sure that helps me. I've tried replacing the 'lux = " lux"' 
with 'illuminance = " lux"' and  adding 'illuminance = %.0f' to the 
StringFormats but there's still no unit on the graph and the low/high table 
still has lot's of digits behind the comma. I'm not sure what to do, but I 
do see that lux/illuminance might be a difficult one to get right because 
of naming confusion.

But I have a graph for the voltage as well. That one also doesn't show the 
unit (v) in its graph. Maybe that's a better example. I added these values 
in weewx.conf:

[[Defaults]]
  [[[Units]]]
Groups
  group_volt = volt

Labels
  volt = " volt"
  
But that does not add the unit to the volt-graph. What am I missing?

Thinking about it a bit more I think I might be completely in the wrong 
area as there's nothing in the section I quoted that seems to tell weewx to 
use "°C" for temperatures but still it does.

How does it know this?

Cheers,
Jan-Jaap

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/0d1aad64-507e-4c76-a99d-99d0ee2c836cn%40googlegroups.com.


Re: [weewx-user] Fixing units in a new graph

2021-02-16 Thread Tom Keffer
There's already a type for luminosity, but it's called "illuminance",
introduced in V4.2. It's a member of group_illuminance.

See issue #613 , in particular, this
post. 

On Tue, Feb 16, 2021 at 1:01 PM 'Jan-Jaap van der Geer' via weewx-user <
weewx-user@googlegroups.com> wrote:

> I have added a luminosity graph to weewx (Seasons skin). It seems to work,
> the graph works. However, it does not mention the unit used at the top
> left, like the others do.
>
> I am trying to fix this, but I'm not sure how.
>
> In the weewx.conf I added, under [[[Units]]] in Groups :
>
> group_illuminance = lux
>
> (I think that shouldn't be needed as there is only one choice of unit for
> illuminance?)
>
> Under StringFormats I have added:
>
> lux = %.0f
>
> And under Labels I have:
>
> lux = " lux"
>
> But apparently I'm still missing something. But what?
>
> Also in the high/low part of the template I tried adding Luminosity like
> so:
>
>   #if $day.luminosity.has_data
>   
> $obs.label.luminosity
> #for $archive in $archive_data
> 
>   
> $archive[1].luminosity.max.format(add_label=False)
>   
> $archive[1].luminosity.min.format(add_label=False)
> 
> #end for
> $unit.label.luminosity
>   
>   #end if
>
> But also this is not showing the unit and the format is 6 digits after the
> floating point, which is a bit overkill.
>
> Any suggestion how to fix this?
>
> Cheers,
> Jan-Jaap
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/52f9dece-add1-44bb-8ee3-e447a5e97592n%40googlegroups.com
> 
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAPq0zECStZ5kj8J0dzh%2BXpH9n7SuOMG9DwnTss9srxZVxVQmOw%40mail.gmail.com.