Decimal Place Changes

91 views
Skip to first unread message

Ron Walker

unread,
Aug 20, 2020, 3:33:49 PM8/20/20
to weewx-user

Hi All,

I am running Weewx 4.1.1 on a Raspberry Pi Model 3.  I am using an Arduino microcontroller to capture sensor data and a python program on the Pi to capture the data and write it to a csv file.  I am using the fileparse to read that file to pass data to Weewx.

While my Weewx version was still 3.9.1, I added two observations, WindSpeed2Avg and WindGust10Avg. The weather station is located at our RC flying field and since we upload the data to a web server, wind and gust observations are as old as 5 minutes.  The averages help to determine actual conditions over the average times.  It was displayed properly with no decimal places as was the wind direction.

Since upgrading to version 4.1.1 those observations now display with 6 decimal places!!  The wind direction degrees also display this way.  Can anyone direct me to where I can change this back to displaying no decimal places?

Thanks in advance!!

vince

unread,
Aug 20, 2020, 5:37:32 PM8/20/20
to weewx-user

Tom Keffer

unread,
Aug 20, 2020, 7:54:56 PM8/20/20
to weewx-user
The types WindSpeed2Avg and WindGust10Avg don't exist in WeeWX, so, unless you attached them to a unit group, they will use default formatting, which is "%f", the Python generic formatting for floating point numbers. That hasn't changed since v2.5.0, which came out seven years ago.

To give them a default formatting, they must be attached to a unit group. In this case, group_speed would probably be most appropriate. Put this somewhere where it will get run before use (user/extensions.py will do):

import weewx.units
weewx.units.obs_group_dict['WindSpeed2Avg'] = 'group_speed'
weewx.units.obs_group_dict['WindSpeed10Avg'] = 'group_speed'

I don't have an explanation for why formatting for wind direction would have changed. I assume you are talking about the tag $current.windDir? The unit for wind direction is "degree_compass". Its formatting is set in weewx.conf:

[StdReports]
  ...
  [[Defaults]]
    ...
    [[[Units]]]
      ...
      [[[[StringFormats]]]]
        ...
        degree_compass = "%.0f"

If you have formatting issues, you would do well to read the section Formatting options in the Customizing Guide.

-tk

--
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/be00c4a2-71ca-46b1-aeb4-5a093531cfe5n%40googlegroups.com.

Ron Walker

unread,
Aug 22, 2020, 11:00:01 AM8/22/20
to weewx-user
Thanks for the replies!  I was able to resolve the issue by adding the observations to correct units groups and using the formatting options, however, my initial concern was why did this change with the upgrade!  I was hesitant to apply the upgrade to the remote weather station until I understood what was going on.  Thanks again for your help!

Ron
Reply all
Reply to author
Forward
0 new messages