Add new observation - micro_sievert_hour (4.9.1, skin Bootstrap)

136 views
Skip to first unread message

anb...@gmail.com

unread,
Jan 3, 2023, 11:01:15 AM1/3/23
to weewx-user
Hello,

I will be highly appreciated if someone point me what is wrong when I adding new observation.

Contents of extensions.py as following:

weewx.units.obs_group_dict['ion_rad'] = 'group_radex'
weewx.units.obs_group_dict['cpm'] = 'group_counter'
weewx.units.USUnits['group_radex'] = 'micro_sievert_hour'
weewx.units.USUnits['group_counter'] = 'cpm'
weewx.units.MetricUnits['group_radex'] = 'micro_sievert_hour'
weewx.units.MetricUnits['group_counter'] = 'cpm'
weewx.units.default_unit_format_dict['micro_sievert_hour'] = '%.2f'
weewx.units.default_unit_format_dict['cpm']  = '%.0f'
weewx.units.default_unit_label_dict['micro_sievert_hour'] = ' µSv/h'
weewx.units.default_unit_label_dict['cpm']  = ' CPM'


Error:

Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine: Caught unrecoverable exception in generator 'user.gaugeengine.GaugeGenerator'
Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:         ****  'micro_sievert_hour'
Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:         ****  Traceback (most recent call last):
Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:         ****    File "/usr/share/weewx/weewx/reportengine.py", line 197, in run
Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:         ****      obj.start()
Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:         ****    File "/usr/share/weewx/weewx/reportengine.py", line 385, in start
Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:         ****      self.run()
Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:         ****    File "/usr/share/weewx/user/gaugeengine.py", line 121, in run
Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:         ****      self.gen_gauges()
Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:         ****    File "/usr/share/weewx/user/gaugeengine.py", line 224, in gen_gauges
Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:         ****      ret = self.gen_gauge(gauge, plot_options, img_file)
Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:         ****    File "/usr/share/weewx/user/gaugeengine.py", line 410, in gen_gauge
Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:         ****      label_format = self.units_dict['StringFormats'][target_unit]
Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:         ****    File "/usr/lib/python3/dist-packages/configobj.py", line 554, in __getitem__
Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:         ****      val = dict.__getitem__(self, key)
Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:         ****  KeyError: 'micro_sievert_hour'
Jan  3 17:00:30 raspberrypi weewx[4310] ERROR weewx.reportengine:         ****  Generator terminated


Many Thanks!

Tom Keffer

unread,
Jan 3, 2023, 2:40:49 PM1/3/23
to weewx...@googlegroups.com
My best guess: instead of using weewx to look up a string format for your new unit, the extension gaugeengine is doing its own lookup. So it is unaware of the new unit. It also is not providing a fallback, hence the error.

--
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/069dc394-5a77-49b9-ab0e-78219e1456a2n%40googlegroups.com.

anb...@gmail.com

unread,
Jan 5, 2023, 3:06:19 PM1/5/23
to weewx-user
Thanks Tom!

Possible to write example, how to use weewx to lookup a string format for new units?

Thanks

michael.k...@gmx.at

unread,
Feb 10, 2023, 1:21:29 PM2/10/23
to weewx-user
Which version of the Bootstrap skin are you using? The current version doesn't even have 410 lines in gaugeengine.py. Anyway, Tom is right, the skin has a section [[StringFormats]] in Bootstrap/skin.conf where you need to specify 

    [[StringFormats]]
        #
        # This section sets the string formatting for each type of unit.
        #
        micro_sievert_hour   = %.2f

Since I am the leading maintainer of the bootstrap skin now,  I probably should find a way to do this in another, probably more weewx-like way or at least just log the error without terminating. The python part is still kind of hard for me :)

Consider upgrading to the latest version of the skin, I added some nice looking interactive charts and gauges, as well as the possibility feeding chart and gauges with live weather data. Here is how it looks like in action: https://www.kainzbauer.net/weather/Rif/

anb...@gmail.com

unread,
Feb 27, 2023, 1:57:20 PM2/27/23
to weewx-user

Hello,

Yes, I use slightly older version of skin. Will be very thankful if someone provide example (for example from stock Seasons skin), how to point skin to use weewx to lookup a string format for new units.  

Thanks
Reply all
Reply to author
Forward
0 new messages