OrdinatesLong Option for Wind Direction?

47 views
Skip to first unread message

Chris Alemany

unread,
Nov 10, 2020, 5:02:07 PM11/10/20
to weewx-user
Hello all,

Is it possible to be able to add a full word version of the ordinal_compass formatting for wind directions? This would be useful for cerating auto-generated scripts and readouts, especially if they are read by machine, like an Alexa skill. Currently the Ordinates section controls this in skin.conf and I could replace the abbreviations with words, but that would change it for all directions in that skin which would not be desirable. I’m currently implementing this in a custom RSS/XML file in the RSS directory of the Standard skin.

It would be wonderful if we could have two separate formats for ordinals:

eg.

[[Ordinates]]
# The ordinal directions. The last one should be for no wind direction
directions = N, NNE, NE, ENE, E, ESE, SE, SSE, S, SSW, SW, WSW, W, WNW, NW, NNW, N/A

[[OrdinatesLong]]
# The ordinal directions. The last one should be for no wind direction
directions = North, North Northeast, Northeast, East Northeast, East, East Southeast, Southeast, South Southeast, South, South Southwest, Southwest, West Southwest, West, West Northwest, Northwest, North Northwest, N/A

I’m working on the Alexa Skill/Flash Briefing for my website (you can search for it at Port Alberni Weather in the Alexa Skill store) and so having this functionality available would be an asset.

If I have missed this ability elsewhere please forgive me.
I indebted to your advice!

Thanks
Chris

Tom Keffer

unread,
Nov 10, 2020, 5:39:14 PM11/10/20
to weewx-user
Off the top of my head, I can think of three ways to do this. Needless to say, none of them is tested.

1. It's not very elegant, but you could monkey patch ValueHelper. See this email exchange.

2 Alternatively, you can write a search list extension dedicated to doing what you want. It would look like:

<p>The current wind direction is $long_ordinal($current.windDir.raw> </p>

3. Use a map in your template to map from the abbreviated ordinals, to the long version:

#set ord_map = {'N': 'North', 'NNE': 'North Northeast', ... }

<p>The current wind direction is $ord_map[$current.windDir.ordinal_compass]</p>




-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/23049B5D-C896-40CE-AC60-47D92AD9EB5C%40gmail.com.

Chris Alemany

unread,
Nov 14, 2020, 3:46:44 PM11/14/20
to weewx-user
thanks! I'll give the template map a try.
Reply all
Reply to author
Forward
0 new messages