Weather by You!

Templates and Projects support => Libraries => Topic started by: avoorpool on July 29, 2012, 10:08:45 AM

Title: Correct Forecast Icon Display
Post by: avoorpool on July 29, 2012, 10:08:45 AM
Hi,

Since we talked about the different choices in Forecast Icons, I like to bring up a different question in regards to those displayed.

Everyday I sit behind my computer after 9:00pm (current time of sunset, but it chances rapidly) I'm surprised to see a bright sunny forecast image while it is pitch dark outside.......Kind of annoying........It does not reflect reality (and that's what weather is all about isn't it?? :lol: ).
Looking at the "tools" we have in the form of webtags and forecast numbers, is there a way we combine those so the forecast image matches the actual weather (and 24 hour) status.....?
What we have is:
<#sunrise> / <#sunset> / <#isdaylight> (Returns 1 if currently within daylight hours (i.e. between dawn and dusk), 0 if not) / <#daylightlength>
In other words, IS there a combination to be found, so that the following forecast string shows correctly (according weather and time of day). I'm not a programmer, just thinking "logically"  :D  :lol:
At 2:00PM: "Fine, becoming less settled" IF <#isdaylight> = 1 (daylight) -> show forecast # 4 (sun and clouds)
At 11:00PM: "Fine, becoming less settled" IF <#isdaylight> = 0 (dark) -> show forecast # 18 (moon and clouds)

Just an idea.........

Cheers,

Arthur
Title: Re: Correct Forecast Icon Display
Post by: krmidas on July 29, 2012, 10:21:40 AM
Is the forecast projecting ahead 12 hours, as indicated on the template? If so, you'd have your moon templates all day and your sunshine templates all night.

Not sure what the answer is...
Title: Re: Correct Forecast Icon Display
Post by: Mr.Meteo on July 29, 2012, 10:51:17 AM
Hi Guys,

Yes, we have to status on that! If forecast are "now + 12h", we have to
display a moon (near) all day long... and so on, like you said Tom.

I've posted question on Cumulus forum... waiting for answer  :roll:

Jacques
Title: Re: Correct Forecast Icon Display
Post by: avoorpool on July 29, 2012, 11:21:07 AM
To me, it all comes down to "trustable" information on the website.....
Showing a bright sunny image for the next 12 hours while it's 9:00PM doesn't make sense....(same as when I see amateur weather sites in Toronto, showing a record wind of 398km/h or an hourly rainfall record of 325mm  :D  :D ).......

There'll be a way to "link" forecast image to actual time of day...??? (display moon image after sunset..???) qlthough with the 12 hours ahead it seems a bit tricky.... :roll:

Cheers,

Arthur
Title: Re: Correct Forecast Icon Display
Post by: Mr.Meteo on July 29, 2012, 12:20:44 PM
Hi Arthur,

I've see your "jump" to "other side"... and is temptated to wait their answer!! :lol:

For html version, it goes by javascript as we need a "switch" depends on a condition (night/day)
or replace "0" by "night" word (as example). the solution is pretty simple!

insert that code just before </head>

Code: [Select]
<script type="text/javascript">
function ChangeIt(expr,a,b) {
var i=0
while (i!=-1) {
i=expr.indexOf(a,i);
if (i>=0) {
expr=expr.substring(0,i)+b+expr.substring(i+a.length);
i+=b.length;
}
}
return expr
}
</script>
Cut your image line in 2 parts and insert js, like this

Code: [Select]
<img src="images/meteo/
<script type="text/javascript">
document.write(ChangeIt('<#isdaylight>','0','night'));
</script>.
<#forecastnumber>.png"....
That way on night hours, you'll have night0.png to night26.png
Days hours, you'll have regular 0.png to 26.png

That solution is not best, we could do much better, but I propose that one
as it coulb be a "swiss knife" as it replace in phrase(expr)  "Something(a)", "by other thing(b)"

Now, you just have to build (find) an entire weather icon set for nights!

Jacques
Title: Re: Correct Forecast Icon Display
Post by: avoorpool on July 29, 2012, 12:48:57 PM
HI Jacques,

Great!!!!!!Awesome!!!
I'll do this after modifying the current [tabs] issue (addition)!! (And that all before 9:00pm tonight when my 8 yr old son comes here to stay with daddy for the next 2 weeks (time for website will be limited then, when pools and beaches might have priority... :D  :D )

Check it out by the end of today.......

Cheers,

Arthur
Title: Re: Correct Forecast Icon Display
Post by: Mr.Meteo on July 29, 2012, 02:04:52 PM
Hi,

Answer from Steve :
Quote
I think it's supposed to be a forecast for the next 12 hours, but I don't know for certain

Then, if I see Wikipedia link, it said that Zambretti is a Short Term forecast
(next 4 hours) http://www.meteormetrics.com/zambretti.htm (http://www.meteormetrics.com/zambretti.htm)

But, that link said 12h device: http://www.shipwreck2000.freeserve.co.uk/ (http://www.shipwreck2000.freeserve.co.uk/)

Then do we have to correct phrase: Forecast... for next 12 hours??

Jacques
Title: Re: Correct Forecast Icon Display
Post by: avoorpool on July 29, 2012, 02:22:03 PM
That's fine to me!!!!
Easy job  :D  :D  :D

Cheers,

Arthur
Title: Re: Correct Forecast Icon Display
Post by: avoorpool on July 30, 2012, 01:10:46 AM
Hi Jacques,

After a productive day (my tabs and new pages area ll in place!!), I tried the modification for the day/night forecast image, but it's 2:00AM and I still see a sunny forecast  :D  :D
I followed your instructions, but I guess there is something missing since I only see text in the forecast box.
When I look at it, how can the image text be cut in 2, with a direct <script> after "images/meteo/........?
<img src="images/meteo/
<script type="text/javascript">
   document.write(ChangeIt('<#isdaylight>','0','night'));
</script>.
<#forecastnumber>.png"....

Tomorrow I'll find some time to modify the recordT files as well.

Cheers,

Arthur
Title: Re: Correct Forecast Icon Display
Post by: virusdunil on July 30, 2012, 09:11:15 AM
I'm so damned lost in here :shock:   :lol:  :lol:  :lol:  (when it comes to scripts i mean )
Title: Re: Correct Forecast Icon Display
Post by: Mr.Meteo on July 30, 2012, 03:57:22 PM
Ahhhhhh Too complicated!!!  :twisted:  Forget it!!!

I've searched easier way to do it and found it! Really simple!  :lol:
 
See it there: http://weatherbyyou.com/forum/index.php ... 197#msg197 (http://weatherbyyou.com/forum/index.php?topic=134.msg197#msg197)

Regards,
Jacques
Title: Re: Correct Forecast Icon Display
Post by: krmidas on July 30, 2012, 07:06:58 PM
I'm going to put an enhancement request in for a new web tag: <#isfreezing>. Should be simple enough.

This way, not only can we customize the icons for day or night, but we can further customize to show if the precipitation is frozen or not.

I'm curious if setting an alarm state will serve the same purpose. If I set a low temp alarm for 32 degrees F, will the use of the web tag <#lowtempalarm> do the same thing as <#isfreezing>? I haven't used the alarms yet and am not clear if it works like the error or new record light, which stops lighting once you've acknowledged it by clicking it. I would want the low temp alarm state to stay engaged as long as the temp is below 32F.

-Tom
Title: Re: Correct Forecast Icon Display
Post by: Mr.Meteo on July 30, 2012, 07:46:41 PM
Hi Tom,

Effectively, your "edit" is a pretty good idea!  :D

As you wrote, it have to react ok. If low alarm is viewed on Cumulus screen
it need to stay on... and as opposed, if low temp ended, tag need to turn to 0.

could stack them in same line as that:

forecast_0_0_25.png

But, 28 icons x 2 (night/day) x 2 (freeze or not) = 112 icons!  Ohhhhhh boy! :shock:

Jacques
Title: Re: Correct Forecast Icon Display
Post by: krmidas on July 30, 2012, 08:21:31 PM
Isn't it 104 icons?

26 x 4?

html would be something like ...<#isdaylight>_<#isfreezing>_<#forecastnumber>.png

I'll ask the question on the Cumulus board about adding the new webtag.
Title: Re: Correct Forecast Icon Display
Post by: Mr.Meteo on July 30, 2012, 08:34:59 PM
Hi Tom,

You know that sometime, Cumulus send negative values?

-1 = Exceptionally fine
-26 = Exceptionally Bad

Then, 28 x 4 = 112 ;)

You keep us informed about Steve Answer?

Thanks,
Jacques
Title: Re: Correct Forecast Icon Display
Post by: krmidas on July 30, 2012, 10:19:37 PM
Hmmmm, in reading samplestrings.ini it only lists the 26 forecasts, although it says "exceptional=exceptional weather" right before the forecast list starts. I only have png's numbered from 1-26. Do I need 2 more for the negatives?

I've listed my new webtag question on the enhancement request forum, as well as the website development:

http://http://sandaysoft.com/forum/viewtopic.php?f=14&t=8031

I'll let you know what I hear.
Title: Re: Correct Forecast Icon Display
Post by: avoorpool on July 31, 2012, 12:28:10 AM
Hi Jacques,

Thanks for the improvement in forecast display.
These icons look great, and at least I don't see the sun at 1:20am in the forecast image but a nice moon (unfortunately with some rain drops......)
(see attachment: CORRECT timestamp versus icon  :D  :D )

Cheers,

Arthur
Title: Re: Correct Forecast Icon Display
Post by: krmidas on July 31, 2012, 09:01:37 AM
[attachment=0:314n07p4]Snapz Pro XScreenSnapz001.jpg[/attachment:314n07p4]Looks like, according to Steve, the <#lowtempalarm> would work just like the proposed new tag <#isfreezing>.

So it sounds like I'll be doubling my icon count from 52 to 104.
Title: Re: Correct Forecast Icon Display
Post by: Mr.Meteo on July 31, 2012, 09:46:02 AM
Hi Tom,

As I've already done the "Winter Kit" for winther days...
http://meteoduquebec.com/winter_kit.html (http://meteoduquebec.com/winter_kit.html)

Only 26 icons to do!!  :D
... and only 13 if we duplicate incons where no sun/moon appear! :D

Regards,
Jacques
Title: Re: Correct Forecast Icon Display
Post by: krmidas on July 31, 2012, 10:09:13 AM
Excellent!

What are you using in your htm file to trigger the use of winter icons? Do you just swap them out during the winter months, or are you using <#lowtempalarm> to indicate whether they should be used?

I'm probably going to do the latter so I don't have to remember to swap out icons in winter.

-Rom
Title: Re: Correct Forecast Icon Display
Post by: Mr.Meteo on July 31, 2012, 10:40:09 AM
Hi Tom,

Effectively, I switch by hand, Mainly because since some years,
we have a couple of days with (icy) rain in winter... and Temp below 0c (32f)  :shock:

But, I agree that we're better to show some days with snow instead of rain,
then forgot to switch it during 1 month!!  :lol:

Jacques
Title: Re: Correct Forecast Icon Display
Post by: mgelinas on September 22, 2013, 03:45:21 AM
Life is a journey, not the destination, but the scenery along the should be and the mood at the view.