as an example, i have in a file that extensions.py imports:

""" units common to all stations, including fixes to weewx base
common_units.py Graham Eddy <[email protected]> 2025-06-20
"""
 
import weewx.units
 
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# gaps in weewx base
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
# unit -> label
weewx.units.default_unit_label_dict['kilowatt'] = u' kW'
weewx.units.default_unit_label_dict['inverted_mask'] = u' alarm'
 
# unit -> format
weewx.units.default_unit_format_dict['kilowatt'] = '%.1f'
weewx.units.default_unit_format_dict['inverted_mask'] = '%.0f'
 
# unit_system/group -> unit
weewx.units.USUnits['group_mask']               = 'inverted_mask'
weewx.units.MetricUnits['group_mask']           = 'inverted_mask'
weewx.units.MetricWXUnits['group_mask']         = ‘inverted_mask'
 
# data_type -> group
weewx.units.obs_group_dict['luminosity']        = 'group_power'
weewx.units.obs_group_dict['lightning_distance'] = 'group_distance'
weewx.units.obs_group_dict['lightning_last_det_time'] = 'group_time'
weewx.units.obs_group_dict['lightning_strike_count'] = 'group_count'
weewx.units.obs_group_dict['txBatteryStatus']   = 'group_mask'
 
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# customisations
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
# unit_system/group -> unit
 
# override insane existing defaults
weewx.units.MetricUnits['group_rain']           = 'mm'
weewx.units.MetricUnits['group_rainrate']       = 'mm_per_hour'

⊣GE⊢

> On 6 Nov 2025, at 5:11 am, vince <[email protected]> wrote:
> 
> Perhaps you might suggest a wording change to the commentary in units.py that 
> works for you as a Github issue ????
> 
> I could not find anything in the FAQ nor Customization Guide that suggests 
> using extensions.py as a best practice.  There are some examples in there, 
> but I could not find any suggestion of what 'typically' would be a 
> recommended method.
> 
> On Wednesday, November 5, 2025 at 9:21:04 AM UTC-8 Werner Krenn wrote:
>> That's why I asked the question.
>> 
>> from units.py
>> # This data structure maps observation types to a "unit group"
>> # We start with a standard object group dictionary, but users are
>> # free to extend it:
>> obs_group_dict = ListOfDicts({
>> 
>> Then perhaps it would be advisable to write in units.py that it makes more 
>> sense to enter additional "observation types" in "extensions.py".
>> 
>> Graham Eddy schrieb am Mittwoch, 5. November 2025 um 00:58:32 UTC+1:
>>> stregthening tom’s words, it should be added to extensions.py rather than 
>>> in addition to units.py.
>>> units.py is part of weewx’s code base and subject to updates. extensions.py 
>>> is the hook to allow custom changes to weewx code base and is not changed 
>>> by weewx updates.
>>> ⊣GE⊢
>>> 
>>>> On 5 Nov 2025, at 4:53 am, Tom Keffer <[email protected] <>> wrote:
>>>> 
>>>> If you added the additional fields in extensions.py you should be OK. That 
>>>> file is imported before starting processing.
>>>> 
>>>> On Tue, Nov 4, 2025 at 9:16 AM 'Werner Krenn' via weewx-user 
>>>> <[email protected] <>> wrote:
>>>>> Tom
>>>>>  thanks, it worked.
>>>>> 
>>>>> I have another question:
>>>>> 
>>>>> I'm using additional fields, e.g., "co2_Temp" with the group 
>>>>> "group_temperature". To ensure this field is also converted, I'm adding 
>>>>> these fields and their group assignments to "units.py".
>>>>> 
>>>>> Could this assignment also be entered into "extensions.py" so that the 
>>>>> conversion is performed?
>>> 
> 
> 
> -- 
> 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 [email protected] 
> <mailto:[email protected]>.
> To view this discussion visit 
> https://groups.google.com/d/msgid/weewx-user/448d56bc-5265-4daa-8679-9d27f00f24cen%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/weewx-user/448d56bc-5265-4daa-8679-9d27f00f24cen%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/weewx-user/9CFFAA84-9597-4484-A8F7-82512D22D25C%40geddy.au.

Reply via email to