weewx.units.MetricUnits['group_length']         = 'mm'
weewx.units.MetricUnits['group_rain']           = 'mm'
weewx.units.MetricUnits['group_rainrate']       = 'mm_per_hour'
weewx.units.MetricUnits['group_pressure']       = 'hPa'
weewx.units.MetricUnits['group_pressurerate']   = 'hPa_per_hour'

in extensions.py produces the error:

un 29 15:59:04 kakapo weewxd[175095]: INFO __main__: Initializing weewxd 
version 5.1.0
Jun 29 15:59:04 kakapo weewxd[175095]: INFO __main__: Command line: 
/usr/share/weewx/weewxd.py /etc/weewx/weewx.conf
Jun 29 15:59:04 kakapo weewxd[175095]:  File "/usr/share/weewx/weewxd.py", 
line 226, in <module>
Jun 29 15:59:04 kakapo weewxd[175095]:  File "/usr/share/weewx/weewxd.py", 
line 76, in main
Jun 29 15:59:04 kakapo weewxd[175095]:  File 
"/usr/share/weewx/weeutil/startup.py", line 111, in start_app
Jun 29 15:59:04 kakapo weewxd[175095]:    weewx_root, user_module = 
initialize(config_dict)
Jun 29 15:59:04 kakapo weewxd[175095]:  File 
"/usr/share/weewx/weeutil/startup.py", line 76, in initialize
Jun 29 15:59:04 kakapo weewxd[175095]:  File 
"/etc/weewx/bin/user/extensions.py", line 23, in <module>
Jun 29 15:59:04 kakapo weewxd[175095]:   
 weewx.units.MetricUnits['group_length']         = 'mm'
Jun 29 15:59:04 kakapo weewxd[175095]: NameError: name 'weewx' is not 
defined
Jun 29 15:59:04 kakapo systemd[1]: weewx.service: Main process exited, 
code=exited, status=1/FAILURE
Jun 29 15:59:04 kakapo systemd[1]: weewx.service: Failed with result 
'exit-code'.

Do I need to include some headers?

Thanks
Alan

On Sunday, June 29, 2025 at 2:04:50 PM UTC+12 Graham Eddy wrote:

> as tom indicates, the actual data in the database is in some units we do 
> not need to care about, all we care about is how the data is presented.
> rather than update weewx source code (units.py), just override it in your 
> ~weewx/$station/bin/user/extensions.py:
>
> weewx.units.MetricUnits['group_rain']           = 'mm'
>
> weewx.units.MetricUnits['group_rainrate']       = 'mm_per_hour'
>
> *⊣GE⊢*
>
> On 29 Jun 2025, at 11:33 am, Tom Keffer <[email protected]> wrote:
>
> See option target_unit 
> <https://www.weewx.com/docs/5.1/reference/weewx-options/stdconvert/#target_unit>
> .
>
> On Sat, Jun 28, 2025 at 6:28 PM Alan <[email protected]> wrote:
>
>> I there anyway you can modify the units the data is written with to the 
>> weewx *archive database *by modifying weewx.conf?
>>
>>  I am not talking about the units in the reports.
>>
>> For example, in New Zealand we use metric but want the rain in mm (not 
>> cm) and the wind in km_per_hour.
>>
>> The only way I have found of doing this is to edit the METRIC dictionary 
>> in units.py.
>>
>> This works fine but a version update in the linux repo could overwrite it.
>>
>> (reason: I have other applications using this data).
>>
>> Thanks
>> Alan
>>
>> -- 
>> 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/5ea87391-6ea4-45c7-be7c-53ef2049c5f4n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/weewx-user/5ea87391-6ea4-45c7-be7c-53ef2049c5f4n%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/CAPq0zECxQERh25vU7CtN%2B4Pfvj_Z2-dmYBZY9RQfLj8yVRngCw%40mail.gmail.com
>  
> <https://groups.google.com/d/msgid/weewx-user/CAPq0zECxQERh25vU7CtN%2B4Pfvj_Z2-dmYBZY9RQfLj8yVRngCw%40mail.gmail.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/ac0512ba-ac24-42d0-8db5-df7db289661an%40googlegroups.com.

Reply via email to