Wind speed without units

36 views
Skip to first unread message

Rob Cranfill

unread,
Dec 20, 2020, 2:28:01 PM12/20/20
to weewx-user
I'm making a skin to display on a small screen (a 7" RPi LCD) and would like to format the wind speed myself, but $windSpeed and all other wind values seem to include the "mph" string. Is there a tag that is just the numeric value?

I guess one option is to use skin.conf to set the units to "", right? Is there another way?

Thanks for any suggestions!

p q

unread,
Dec 20, 2020, 2:34:51 PM12/20/20
to weewx...@googlegroups.com
try $windspeed.raw ?

--
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/e0b62150-cf9e-448e-a0e6-cc88cdfa282bn%40googlegroups.com.


--
Peter Quinn
(415)794-2264

gjr80

unread,
Dec 20, 2020, 2:55:15 PM12/20/20
to weewx-user

Have a look at the Formatting options section in the Customization Guide.
 
$xxxxx.windSpeed.raw will certainly give you a number (not a string) with no units and you can do whatever you want with the data but you will need to do all formatting manually. Also have a look at $xxxxx.windSpeed.format, it will give you a string and there are numerous arguments that can be passed to .format that do things such as omitting the units, specifying a format string, what to display if None etc. There are examples further down.

Gary 

Rob Cranfill

unread,
Dec 20, 2020, 7:01:07 PM12/20/20
to weewx-user
Thanks, all! Looks like there is more than one way to accomplish this, thanks for the suggestions. :-)

I think I like the looks of this, which does what I want:

$current.windSpeed.format(add_label=False) – $span($time_delta=1800).windSpeed.max.format(add_label=False) MPH

which gives me a result like "3 - 14 MPH", where the first number is the current speed and the 2nd is the peak in the last 30 minutes.

John Kline

unread,
Dec 20, 2020, 7:49:21 PM12/20/20
to weewx...@googlegroups.com
$current.windSpeed.format(add_label=False) is equivalent to
$current.windSpeed.formatted
The latter being a little shorter to type.

Instead of MPH, you could use $unit.label.windSpeed

On Dec 20, 2020, at 4:01 PM, Rob Cranfill <robcr...@gmail.com> wrote:

Thanks, all! Looks like there is more than one way to accomplish this, thanks for the suggestions. :-)
--
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.
Reply all
Reply to author
Forward
0 new messages