Add new conversion unit

29 views
Skip to first unread message

František Slimařík

unread,
Apr 9, 2023, 4:04:57 AM4/9/23
to weewx-development
Hello,

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/extensions.py 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

unread,
Apr 9, 2023, 3:39:48 PM4/9/23
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 weewx-developm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-development/4ab39331-7aef-414a-a3e4-2d35d3fd23ban%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages