Thanks for the tips on color, Glenn. (Thanks also for providing a live 
example of how this looks.)

I hope someone can come up with a more attractive color combination that 
provides enough contrast between wind and gusts, without clashing. Colors 
are not my forte. Just ask my wife.

The other thing I'm less than happy with is the fatness of that gust 
pointer. It needs to be significantly larger than the wind pointer, so it's 
visible when they're pointing in the same direction. But it's really ugly.

At present, I'm trying this as a substitute for the gust pointer definition:

<polygon points="90 $wg, 95 50, 96 65, 84 65, 85 50" fill="orangered" 
transform="rotate($current.windGustDir.formatted 90 85)" />

I think it's a slight improvement.


On Friday, April 6, 2018 at 4:42:40 AM UTC-4, Glenn McKechnie wrote:
>
> For any one else who wants to tweak the colours to match their weewx 
> skin.conf of choice.
> It's worth noting the hint that's in the [ImageGenerator] section of the 
> Standard skin.conf file
>   
>  # Colors can be specified any of three ways:
>     #   1. Notation 0xBBGGRR;
>     #   2. Notation #RRGGBB; or
>     #   3. Using an English name, such as 'yellow', or 'blue'.
>     # So, 0xff0000, #0000ff, or 'blue' would all specify a pure blue color.
>
> The existing skin colors are probably in the first format. 
> To use those values in the svg windrose they needs to be changed to the 
> 2nd format. 
>
> Note the BGR -- RGB reversal and you'll be less likely to be surprised by 
> the weird results ;-)
>
>
>
> Cheers
>  Glenn
>
> rorpi - read only raspberry pi & various weewx addons
> https://github.com/glennmckechnie
>
> On 6 April 2018 at 05:36, RobbH <holm...@gmail.com <javascript:>> wrote:
>
>> I finally came to the realization that everything I wanted to do could be 
>> done with the Cheetah engine, and even learned a tiny bit of Python in the 
>> process. The following code, added to index,html.tmpl (or some other 
>> template) generates a crude compass rose with up to two directional vanes, 
>> one (in red) for gust direction and one (in blue) for wind direction. The 
>> length of the vanes is proportional to the corresponding speed value, on a 
>> logarithmic scale.
>>
>> #import math
>>        <svg version="1.1" baseProfile="full" width="200" height="200" 
>> xmlns="http://www.w3.org/2000/svg";>
>>        <!-- draw outer ring, then 10-degree tickmarks, 2 gray inner 
>> circles and 3 scale labels (1, 10, 100)  -->
>>         <circle cx="90" cy="85" r="75" stroke="black" stroke-width="5" 
>> stroke-dasharray="1,12.08" fill="transparent" />
>>         <circle cx="90" cy="85" r="80" stroke="lightgray" 
>> stroke-width="10" fill="transparent" />
>>         <circle cx="90" cy="85" r="38" stroke="lightgray" 
>> fill="transparent" />
>>         <circle cx="90" cy="85" r="56" stroke="lightgray" 
>> fill="transparent" />
>>         <text x="120" y="26" font-size="8" text-anchor="middle" 
>> fill="gray">100</text>
>>         <text x="112" y="42" font-size="8" text-anchor="middle" 
>> fill="gray">10</text>
>>         <text x="103" y="58" font-size="8" text-anchor="middle" 
>> fill="gray">1</text>
>>        <!-- draw compass rose background (2 polygons) then 4 directional 
>> letters and innermost circle  -->
>>         <polygon points="90 35, 100 75, 140 85, 100 95, 90 135, 80 95, 40 
>> 85, 80 75" fill="lightgray" transform="rotate(45 90 85)" />
>>         <polygon points="90 25, 100 75, 150 85, 100 95, 90 145, 80 95, 30 
>> 85, 80 75" fill="lightgray" />
>>         <text x="90" y="22" font-size="16" text-anchor="middle" 
>> fill="gray">N</text>
>>         <text x="90" y="159" font-size="16" text-anchor="middle" 
>> fill="gray">S</text>
>>         <text x="22" y="91" font-size="16" text-anchor="middle" 
>> fill="gray">W</text>
>>         <text x="158" y="91" font-size="16" text-anchor="middle" 
>> fill="gray">E</text>
>>         <circle cx="90" cy="85" r="20" stroke="black" fill="white" />
>>        <!-- put current values for gust and wind speed in inner circle, 
>> then calculate and draw vanes if direction given and speed > 0   -->
>>         <text x="90" y="83" font-size="12" text-anchor="middle" 
>> fill="orangered">$current.windGust.formatted</text>
>>         <text x="90" y="97" font-size="12" text-anchor="middle" 
>> fill="dodgerblue">$current.windSpeed.formatted</text>
>>        #if $current.windGustDir.formatted != "   N/A" and 
>> float($current.windGust.formatted) > 0
>>        #set $wg = 65 - 18 * (1 + 
>> math.log(float($current.windGust.formatted), 10))
>>         <polygon points="90 $wg, 100 65, 80 65" fill="orangered" 
>> transform="rotate($current.windGustDir.formatted 90 85)" />
>>        #end if
>>         #if $current.windDir.formatted != "   N/A" and 
>> float($current.windSpeed.formatted) > 0
>>        #set $ws = 65 - 18 * (1 + 
>> math.log(float($current.windSpeed.formatted), 10))
>>         <polygon points="90 $ws, 95 65, 85 65" fill="dodgerblue" 
>> transform="rotate($current.windDir.formatted 90 85)" />
>>        #end if
>>        </svg>
>>
>>
>> This is set up to work with speeds measured in miles per hour. Some 
>> modification would be needed to make it work with other units. I hope 
>> someone will find it useful. Improvements welcome.
>>
>>
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to