Display local wind names

67 views
Skip to first unread message

Pila

unread,
Sep 23, 2019, 8:10:56 AM9/23/19
to weewx-user
I would like to use and display our local wind names. I understand this may be impossible, but it is not my fault WeeWX impresses me so much that I expect it to do anything I wish :) Not my fault!

We have 8 distinct winds governing not only weather but also the mood of most people. Just ask the police during Jugo :) Unless I am sailing and watching the compass or the map, I really do not use degrees. Plus, not the same watching the map or a graph. We normally use local wind names. Only if unsure, we may use Cardinal directions for wind. But degrees - never. We do it this way for thousands of years :) We comment winds many times each day.

So, when the wind is NNE-NE-ENE - I would like to label it Bura. For ENE-E-ESE wind I would like to label it Levanat. For ESE-SE-SSE I would like to see Jugo and so on. If I could somehow define wind lables with custom resolution, it would be perfect. This wish applies to both graphs and the main page.

1. At main SmartPhone page, now I get (currently) Wind: 5 km/h E (98). I guess it shold be possible to put somewhere something like:

if $current.windDir >= 22.5 and $current.windDir <= 67.5 then label is Bura
else if $current.windDir > 67.5 and $current.windDir <= 112.5 then label is Levanat
else if $current.windDir > 112.5 and $current.windDir <= 157.5 then label is Jugo
....


And based on that, print cardinal leter and the wind name on the main page. If this is possible, I would appreciate a hint and a little help.

2. In addition to dispalying 8 or 16 cardinal points of the compass as Letters in the Wind graphs, I would also like to add above labels over the graphs indicating Wind names. Bura would go over NE - 45 deg, Levanat over E -90 deg, and Jugo over SE - 135 deg and so on.

I do not care if it is complicated.

Thomas Keffer

unread,
Sep 23, 2019, 8:29:48 AM9/23/19
to weewx-user
1. You can do something like this in the templates (NOT TESTED):

#if $current.windDir.raw >= 22.5 and $current.windDir.raw <= 67.5
   #set label = "Bura"
#elif $current.windDir.raw > 67.5 and $current.windDir.raw <= 112.5
   #set label = "Levanat"
#elif $current.windDir.raw > 112.5 and $current.windDir.raw <= 175.5
   #set label = "Jugo"
...
#else
   #set label = "something"
#end if
<p>The wind direction is $label</p>

Note the use of the .raw suffix. This is necessary to get a numeric value (otherwise, you get an instance of the ValueHelper class, which cannot do arithmetic). Also, the labels, Bura, etc., must be in quotes.

2. Not sure I understand what you're asking. Are you referring to the y-axis in plots?

-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/91695557-c6d8-45d8-b2ec-4f4fbc7b140f%40googlegroups.com.

Pila

unread,
Sep 23, 2019, 9:14:25 AM9/23/19
to weewx-user
Works! Just need tweaking to look good! Thanks. My code was decently close :)

As for the second issue, yes, I would like to overlay names over corresponding points of the graphs if possible.

Pila

unread,
Sep 23, 2019, 11:25:24 AM9/23/19
to weewx-user
I had to make quite complex meal in the meantime, so, now I can post the solution.

If someone wants to have name of the wind shown instead or in addition to Cardinal and numeric, here it is. This example will serve people at Croatian coast of Adriatic see without modification. It is easy to modify it for any other winds.

I modified Smartphone skin. Here are the steps.

edit file (I installed by using setup.py):
/home/weewx/skins/Smartphone/index.html.tmpl

Locate the line starting with:
<li><a href="wind.html">...

Just in front of it, goes the new code:

#if $current.windDir.raw >= 22.5 and $current.windDir.raw <= 67.5
   
#set label = "Bura"
#elif $current.windDir.raw > 67.5 and $current.windDir.raw <= 112.5
   
#set label = "Levanat"
#elif $current.windDir.raw > 112.5 and $current.windDir.raw <= 157.5
   
#set label = "Jugo"
#elif $current.windDir.raw > 157.5 and $current.windDir.raw <= 202.5
   
#set label = "O&scaron;tro"
#elif $current.windDir.raw > 202.5 and $current.windDir.raw <= 247.5
   
#set label = "Lebi&cacute;"
#elif $current.windDir.raw > 247.5 and $current.windDir.raw <= 292.5
   
#set label = "Pulenat"
#elif $current.windDir.raw > 292.5 and $current.windDir.raw <= 315
   
#set label = "Maestral"
#elif $current.windDir.raw > 315 and $current.windDir.raw <= 360
   
#set label = "Tramontana"
#else
   
#set label = "Vjetar"
#end if

This last else is for anything not covered with the wind names. Since now I have proper wind names for all winds, I modified my basic printout into:

<li><a href="wind.html">$label: $current.windSpeed ($current.windDir.ordinal_compass $current.windDir)</a></li>

so now my Wind ... line will look like:

Bura: 3 km/h (ENE 63)

Bura (from $label) is the name of the correspondiing wind. The word "Wind" seems superfluos to me in this configuration. Now it tells me that the wind is Bura! But, should the wind name be empty, it will be filled with "Vjetar" (Croatian word for Wind).

Unrelated to the above code, note that I have changed display unit of the wind speed to km/h and that I added cardinal to the numeric directions.

I hope this may be of use to others.

Reply all
Reply to author
Forward
0 new messages