#import math
<!-- 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>