Add new conversion unit

Skip to first unread message

František Slimařík

Apr 9, 2023, 4:04:57 AMApr 9
to weewx-development

can somebody gimme guidance where to add following code to allow me extension of units for solar radiation? I´d like to measure amount of radiation per interval and in some cases it´s better to have in kilowatts rather than in watts. Unfortunately adding this into user/ doesn´t work :)

import weewx.units

weewx.units.default_unit_format_dict['kilo_watt_per_meter_squared'] = '%.3f'
weewx.units.default_unit_label_dict['kilo_watt_per_meter_squared'] = ' kW/m²'
weewx.units.conversionDict['watt_per_meter_squared'] = {'kilo_watt_per_meter_squared': lambda x : x * 0.001}
weewx.units.conversionDict['kilo_watt_per_meter_squared'] = {'watt_per_meter_squared': lambda x : x * 1000}
Apr  9 09:55:35 new-weather-machine journal: weewx[7799] ERROR weewx.cheetahgenerator: **** Reason: cannot find 'kilo_watt_per_meter_squared' while searching for 'day.radiation.sum.kilo_watt_per_meter_squared'

Tom Keffer

Apr 9, 2023, 3:39:48 PMApr 9
to František Slimařík, weewx-development
Hmmm, that should work. 

Please show more of the log. Set debug=1, restart weewxd, let it run through the first archive interval, post the log.

Also, what are you using for the tag? It should be $day.radiation.sum.kilo_watt_per_meter_squared

Just a note: if you're summing radiation over a day, you're really getting units of energy, not power. You should multiply by the length of the day in hours to get kWh/m².

You received this message because you are subscribed to the Google Groups "weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
Reply all
Reply to author
0 new messages