Page 1 of 1

Wind rose with trend

Posted: Mon 18 Jan 2010 10:23 am
by drjoshua
I have made a wind rose for average wind bearing http://www.retrodata.com/weather/vadretjustnu-it.asp and it works fine. I used a table background. (Really fun making your own site with the webtags!) It´s going to be implemented on a RC modelplane site.

But I want to present a wind trend, by showing the average wind bearing 1 hour ago and an arrow towards the present wind bearing. http://www.retrodata.com/weather/vindtrend.jpg . I managed to get my hands on the wind bearing data by putting the data into a array and calculated average for the first 10 min.

Issues:
Knowing from which direction the wind bearing comes from (less bearing or more bearing).
Making layers visible depending which wind bearings are involved (working with 360/22.5 numbers of layers and images).
Thinking right when the wind turns from bearing 10 to 270.

Have anyone done this?

Re: Wind rose with trend

Posted: Mon 18 Jan 2010 10:41 am
by TNETWeather
Don't recall seeing too many stations using ASP. Not sure if anyone else is using it but it might be of interest to those running IIS to see how you did what you did code wise.

Nice looking graphic.

Re: Wind rose with trend

Posted: Mon 18 Jan 2010 12:59 pm
by drjoshua
My humble code so far is (the most important):

<%
Dim pil
pil="<#wdir>" & ".jpg"
%>


<td width="33%" align="center" valign="middle" STYLE="font-size:13px; background:url(<%=pil%>); background-position: center;background-color:#FFFFFF; background-repeat:no-repeat;background-attachment:scroll">
<font face="Verdana,Arial"><#wspeed></font>
</td>
<td width="34%" align="center" valign="middle" STYLE="font-family:Verdana, Arial; font-size:11px; background:url(tom.jpg); background-position: center;background-color:#FFFFFF; background-repeat:no-repeat;background-attachment:scroll">
<br><img src="solen.jpg"><br>
<#sunrise> <#sunset>
<br>&nbsp;
</td>

Re: Wind rose with trend

Posted: Mon 18 Jan 2010 2:19 pm
by beteljuice
If you want the 'trend' to begin at 'old_avg' and end at 'now_avg' you will need MANY more graphics than you have said !

An easier route would be to make your graphics transparent, and 'layer' the 'old' and 'new' on top of each other (16 pics indicator eg. red, 16 pics indicator eg. blue)

Then you need a 'trend' arrow 90 degrees or a bit less, that will cover or fit between the indicators (8 clockwise, 8 anti-clockwise)

You already have your routine for compass 'placement' and know the direction of 'old' and 'new', so now you want to place the 'trend' arrow and know its direction.

(Re-write in the language of your choice - illustrative ONLY !)

if 'old' not equal 'new' AND 'old' speed not equal 0 AND 'new' speed not equal 0 // some change in direction has taken place
trend = old - new - 180 // best guess, take shortest route around compass
if trend > 0
trend_dir = right // clockwise from 'old to 'new'
else
trend_dir = left // anti-clockwise from 'old to new
end

new layer overlay = image = trend_dir [(your position routine) trend / 2]

end

Hope that's understandable to you :?

Re: Wind rose with trend

Posted: Mon 18 Jan 2010 2:43 pm
by drjoshua
Yes, I understand that. I just posted the existing code to show my doings so far.

Lets se what you have written...

Re: Wind rose with trend

Posted: Mon 18 Jan 2010 6:15 pm
by beteljuice
I gave you guidance to your 'issues' - I can work with cgi / perl, php, Javascript, anything else you are on your own.

Even then the beteljuice would be unlikely to give you a custom solution to the kind of query you have raised, just hints ;)

This is the Cumulus software support site. Anything else is goodwill and a bonus.

Re: Wind rose with trend

Posted: Wed 20 Jan 2010 9:53 am
by drjoshua
Now I got it to work! :clap:

http://www.retrodata.com/weather/test.asp

I calculate average for 10 minutes an hour ago and compare it with average last 10 minutes.
I call images representing the rounded values/22.5 degrees.

If bearing(1h) was 45 deg and average(10min) is 180 the code steps from 45/22.5 to 180/22.5 writing images accordingly.

If anyone wants to see the code, just tell me. So long and thanks for a wonderful software.