Author Topic: Scripts to Display CPC's Near-Term and Long-Term Outlook Maps  (Read 6947 times)

0 Members and 1 Guest are viewing this topic.

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2249
    • SouthEast Lincoln, NE Weather
Re: Scripts to Display CPC's Near-Term and Long-Term Outlook Maps
« Reply #25 on: July 14, 2013, 07:26:27 PM »
The gray box is my answer to variable height images.  When you mouse over/click on a shorter graphic, the space is filled in by a gray background box.  Is that what you're referring to?

Looking at your site, I think not.  It looks like the gray box is a part of your template.
« Last Edit: July 14, 2013, 07:29:32 PM by gwwilk »
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline mikeym2m

  • Contributor
  • ***
  • Posts: 122
    • MikeyM's Thornhurst PA Weather
Re: Scripts to Display CPC's Near-Term and Long-Term Outlook Maps
« Reply #26 on: July 14, 2013, 10:12:16 PM »
Hi Jerry

The gray box shows up when I mouse over the "Near Term" 1 month or 3 months. I didn't make any changes to the templates, just uploaded them to my server as I received them from the .zip file. Hope that's what you were asking. I'll take a look at the templates tomorrow as it's getting a little late here and I have to be up and out early in the morning.

Tomorrow I'll reload the Ver 4 scripts and see what happens, also the Ver 3 scripts.

EDIT: I just looked at : http://www.cnyweather.com/wxcpcoutlook.php , not sure what version he's running, but no gray boxed on "Near Term" 1 or 3 months.

EDIT 2: OK I realized it because I'm not using a "gray" background. I'll fix that tomorrow.  Thanks
 
Have a good evening.

 :-)

MikeyM
« Last Edit: July 14, 2013, 10:20:28 PM by mikeym2m »

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2249
    • SouthEast Lincoln, NE Weather
Re: Scripts to Display CPC's Near-Term and Long-Term Outlook Maps
« Reply #27 on: July 15, 2013, 12:05:25 AM »
I think I see what's happening.  When you change themes, the browser's cached 'white_box.png' is displaying rather than the newly written appropriately colored one.  Clearing the browser's cache (<shift><F5> in Chrome for instance) will display the newly created and appropriately colored background 'white_box.png'.  I'll look around for a solution to the problem, but I can't promise anything other than what's below, which may be preferable to some anyway.

If you prefer a white 'white_box.png' background with all themes, just edit the script
Code: [Select]
<?php function make_white_box () {
// Create a 4:3 image
global $horImgWidth$horImgHeight;
$im imagecreatetruecolor($horImgWidth,$horImgHeight);
$CSSstyle '';
# was there a style selected from the form input
if (isset($_COOKIE['CSSstyle'])) {
       
$_SESSION['CSSstyle'] = $_COOKIE['CSSstyle'];
       
$CSSstyle $_COOKIE['CSSstyle'];
} else if (isset(
$_SESSION['CSSstyle']) and $_SESSION['CSSstyle'] <> '' ) {
       
$CSSstyle $_SESSION['CSSstyle'];
}
if (
preg_match('|black|i',$CSSstyle) ) {
$white imagecolorallocate($im192192192);
}else if (
preg_match('|silver|i',$CSSstyle) ) {
$white imagecolorallocate($im202202202);
} else {
$white imagecolorallocate($im255255255);
}
// Use identical RGB values for shades of gray to black at 0, 0, 0--e.g. 192, 192, 192 for light gray.
// Draw a white or gray rectangle depending upon color style in use.
imagefilledrectangle($im00$horImgWidth$horImgHeight$white);
// Save the image
imagepng($im'./white_box.png');
imagedestroy($im);
}
?>

to read
Code: [Select]
<?php function make_white_box () {
// Create a 4:3 image
global $horImgWidth$horImgHeight;
$im imagecreatetruecolor($horImgWidth,$horImgHeight);
$white imagecolorallocate($im255255255);
// Draw a white rectangle.
imagefilledrectangle($im00$horImgWidth$horImgHeight$white);
// Save the image
imagepng($im'./white_box.png');
imagedestroy($im);
}
?>

« Last Edit: July 15, 2013, 12:20:11 AM by gwwilk »
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2249
    • SouthEast Lincoln, NE Weather
Re: Scripts to Display CPC's Near-Term and Long-Term Outlook Maps
« Reply #28 on: July 15, 2013, 07:43:02 AM »
In response to MikeyM's observation regarding the 'white_box.png' behavior during theme switching Version 5a adds an option, $allWhiteBox, to the near-term scripts to use all white 'white_box.png' backgrounds rather than switching to shades of gray for the black and silver themes.  Switching to shades of gray may be overkill and is beset by browser cache issues if viewers switch themes back and forth.  Just set $allWhiteBox = true to use all white box backgrounds.  The white box was originally created to maintain the same aspect ratio of the US when switching maps.  Without it the vertical compression/expansion of the US during switching is very distracting.

The modified files are in wxcpcltoutlook5a.zip which is available in the first post of this thread.
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline mikeym2m

  • Contributor
  • ***
  • Posts: 122
    • MikeyM's Thornhurst PA Weather
Re: Scripts to Display CPC's Near-Term and Long-Term Outlook Maps
« Reply #29 on: July 15, 2013, 02:19:47 PM »
Thanks Jerry.
That works. Sorry to make extra work for you. I forgot that I'm using a modified "black" css file to add shading on my webpage in the "Black" mode.

Thanks again.

Cheers

 :-)

MikeyM

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2249
    • SouthEast Lincoln, NE Weather
Re: Scripts to Display CPC's Near-Term and Long-Term Outlook Maps
« Reply #30 on: July 18, 2013, 07:58:11 AM »
I awoke early this morning to the realization that the map-date-switching algorithm was broken.  Version 5b further revises the logic that determines when to switch maps by relying on a day-of-month of the third-Thursday-of-the-month calculation rather than day-of-week calculations.  While the prior algorithm worked this month, it would fall over some months.  The new algorithm should solve this problem.  Version 5b is available in the first post of this thread.
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2249
    • SouthEast Lincoln, NE Weather
Re: Scripts to Display CPC's Near-Term and Long-Term Outlook Maps
« Reply #31 on: July 18, 2013, 09:37:33 AM »
I inadvertently deleted a needed variable, $day_mon, from Version 5b, and Version 5c remedies that problem.  It has been verified to change map months at 7:30am US/Eastern time on the 3rd Thursday of the month (this month, anyway).  I've verified the 3rd Thursday's accuracy through Jan, 2014 which is as far as the algorithm will go since it relies on the current year's calendar to calculate the 3rd Thursday of each month.
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2249
    • SouthEast Lincoln, NE Weather
Re: Scripts to Display CPC's Near-Term and Long-Term Outlook Maps
« Reply #32 on: August 15, 2013, 11:48:02 AM »
The latest script, Version 5c,  successfully switched to the current maps today, Aug 15 which is the third Thursday of this month, at the correct time, so I think it's stable for now.
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline mikeym2m

  • Contributor
  • ***
  • Posts: 122
    • MikeyM's Thornhurst PA Weather
Re: Scripts to Display CPC's Near-Term and Long-Term Outlook Maps
« Reply #33 on: August 15, 2013, 06:02:59 PM »
Working fine here with 5C. Thanks Jerry

Cheers

 :grin:

MikeyM

Offline K3JAE

  • Contributor
  • ***
  • Posts: 132
  • Davis VP2 Wireless
    • K3JAE's Weather Station
Re: Scripts to Display CPC's Near-Term and Long-Term Outlook Maps
« Reply #34 on: August 16, 2013, 03:56:50 PM »
Just wondering if you would be willing to share your wxdrought3.php page?  Like the way it operates and seems to fit in with this current series, some of the information is duplicate but like the interface.



73's de K3JAE

John
K3JAE Weather Station

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2249
    • SouthEast Lincoln, NE Weather
Re: Scripts to Display CPC's Near-Term and Long-Term Outlook Maps
« Reply #35 on: August 16, 2013, 06:17:49 PM »
Just wondering if you would be willing to share your wxdrought3.php page?  Like the way it operates and seems to fit in with this current series, some of the information is duplicate but like the interface.
This script is included in the package I posted here.

Regards,
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline K3JAE

  • Contributor
  • ***
  • Posts: 132
  • Davis VP2 Wireless
    • K3JAE's Weather Station
Re: Scripts to Display CPC's Near-Term and Long-Term Outlook Maps
« Reply #36 on: August 16, 2013, 06:33:03 PM »
Thanks... Funny, I actually searched for this script here and it came up empty. Appreciate the redirect!

I have it uploaded now but the mouseovers are not working at all. On your page you mouseover, say, temperature and the image changes without the need to click. Mine does not change unless I click the link. Any help here?

http://www.k3jae.com/wxDrought3.php for your review.
« Last Edit: August 17, 2013, 01:47:24 AM by K3JAE »


73's de K3JAE

John
K3JAE Weather Station

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2249
    • SouthEast Lincoln, NE Weather
Re: Scripts to Display CPC's Near-Term and Long-Term Outlook Maps
« Reply #37 on: February 21, 2014, 04:17:09 PM »
The script displayed erroneous dates in some of the links this month.  There were also problems in Nov and Dec that I uncovered while debugging the script.  All of the charts displayed correctly, but the links didn't match the chart dates at times.  Version 6 in the first post hopefully fixes those problems.  I've also updated the fixed mouseover and fixed onclick scripts for Google Analytics compatibility.  Version 5c is no longer available.
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline mikeym2m

  • Contributor
  • ***
  • Posts: 122
    • MikeyM's Thornhurst PA Weather
Re: Scripts to Display CPC's Near-Term and Long-Term Outlook Maps
« Reply #38 on: November 21, 2014, 04:17:50 PM »
Jerry

For some reason the 1 month and 3 months are not updating in the "Near Term" version. 6 - 10 days and 8-14 days are correct, but 1 month and 3 month are showing an update of 16 Oct.
"Long Term" version is correct with data from yesterday 20 Nov.  http://mikeymsweather.com/wxcpcoutlook.php
Any ideas?   :?



Cheers

MikeyM 

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2249
    • SouthEast Lincoln, NE Weather
Re: Scripts to Display CPC's Near-Term and Long-Term Outlook Maps
« Reply #39 on: November 21, 2014, 05:36:27 PM »
Jerry

For some reason the 1 month and 3 months are not updating in the "Near Term" version. 6 - 10 days and 8-14 days are correct, but 1 month and 3 month are showing an update of 16 Oct.
"Long Term" version is correct with data from yesterday 20 Nov.  http://mikeymsweather.com/wxcpcoutlook.php
Any ideas?   :?



Cheers

MikeyM
Hit alt-F5 to refresh the page & flush the browser's cache...I see the correct charts here.
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline mikeym2m

  • Contributor
  • ***
  • Posts: 122
    • MikeyM's Thornhurst PA Weather
Re: Scripts to Display CPC's Near-Term and Long-Term Outlook Maps
« Reply #40 on: November 22, 2014, 09:28:24 AM »
Thanks Jerry

It was strange as it was OK in IE, Chrome and Pale Moon and the problem only showed up in FireFox. It was fine after a "reload".

Thanks again.

Cheers

 :grin:

MikeyM

Offline W3DRM

  • Forecaster
  • *****
  • Posts: 3320
    • Carson Valley Weather
Re: Scripts to Display CPC's Near-Term and Long-Term Outlook Maps
« Reply #41 on: November 22, 2014, 07:21:35 PM »
Jerry,

I've had your scripts on my "to-do" list for a long time. Today, as a cold wind howled outside and listening to some Emma Veary Hawaiian music on Pandora, I decided now was the time! Did the installation and all appears to be working just fine. Great script. I put mine under my "Forecast and Advisories" menu item.

Thanks for you efforts...  =D&gt;
Don - W3DRM - Minden, Nevada --- Blitzortung ID: 808 --- FlightRadar24 ID: F-KRNO2
Davis Wireless VP2, WD 10.37s101,
StartWatch, VirtualVP, VPLive, Win10 Pro
--- Logitech HD Pro C920 webcam
--- RIPE Atlas Probe - 32849

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2249
    • SouthEast Lincoln, NE Weather
Re: Scripts to Display CPC's Near-Term and Long-Term Outlook Maps
« Reply #42 on: June 23, 2015, 02:50:08 PM »
The NWS CPC has moved the Long-Term Outlook from experimental to production.  The old Version 6 no longer displays updated maps and has been removed.  Version 7 in the first post displays the 'Official' production CPC long-term outlook charts.
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline mikeym2m

  • Contributor
  • ***
  • Posts: 122
    • MikeyM's Thornhurst PA Weather
Re: Scripts to Display CPC's Near-Term and Long-Term Outlook Maps
« Reply #43 on: June 23, 2015, 07:46:53 PM »
Thanks for the update Jerry

Cheers

 :grin:

MikeyM

Offline jgillett

  • Forecaster
  • *****
  • Posts: 1186
  • Boltek, Win7 Pro, ToA
    • TiggrWeather Phoenix
Re: Scripts to Display CPC's Near-Term and Long-Term Outlook Maps
« Reply #44 on: June 23, 2015, 08:34:41 PM »
Jerry, is the V7 you now have posted really the latest? All still say 'version 6' at the top of the code, and the page title within the code still says 'experimental'.

Thanks.
John
W7JKG

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2249
    • SouthEast Lincoln, NE Weather
Re: Scripts to Display CPC's Near-Term and Long-Term Outlook Maps
« Reply #45 on: June 24, 2015, 12:43:11 AM »
Once again John Gillett has unearthed the errors of my ways :-)  Thanks for doing so, John!  I had completely forgotten what the alternate versions were all about in my haste to publish the click-mouseover configurable version that I use.  They indeed needed modification before they could function properly again.

I've now updated all of the Long Term Outlook scripts in Version 7a in the first post above.
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline jgillett

  • Forecaster
  • *****
  • Posts: 1186
  • Boltek, Win7 Pro, ToA
    • TiggrWeather Phoenix
Re: Scripts to Display CPC's Near-Term and Long-Term Outlook Maps
« Reply #46 on: June 24, 2015, 01:28:36 PM »
OK, Jerry - lessee here. That makes 194 burps found over the years, usual pricing is $75/burp - but my special friend pricing applies here ($62.99) - plus tax for the idiots in DC... My, my - that's a bunch!

Let's just leave it at 'my pleasure', and thank you for the kind note.   :roll:   :grin:
John
W7JKG

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2249
    • SouthEast Lincoln, NE Weather
Re: Scripts to Display CPC's Near-Term and Long-Term Outlook Maps
« Reply #47 on: January 19, 2020, 12:23:20 AM »
There was an error in the logic for computation of the first Thursday of the month that resulted in the display of stale 'One Month Outlook' maps from the last day of the prior month rather than the maps which were freshened on the third Thursday of each month.  This has been corrected in the latest version that's available as 'wxcpcoutlook.zip' on my scripts page.

It was a subtle bug that escaped my notice for all this time! :oops:
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline gwwilk

  • Southeast Lincoln Weather
  • Forecaster
  • *****
  • Posts: 2249
    • SouthEast Lincoln, NE Weather
Re: Scripts to Display CPC's Near-Term and Long-Term Outlook Maps
« Reply #48 on: January 19, 2020, 07:12:54 AM »
And there was yet another error in my 'first Thursday' logic in that it was using the first Thursday for last month, not the current month. :oops:

Corrected zip available as above.
Regards, Jerry Wilkins
gwwilk@gmail.com

Offline mikeym2m

  • Contributor
  • ***
  • Posts: 122
    • MikeyM's Thornhurst PA Weather
Re: Scripts to Display CPC's Near-Term and Long-Term Outlook Maps
« Reply #49 on: January 19, 2020, 10:56:56 AM »
Hi Jerry and Happy New Year

I just updated and when I go to the Long Term Maps the data appears to be 1 map off, ie if I hover over FMA (Feb,Mar Apr) the map show MAM (May,Jun,Jul). Not sure if I'm doing something wrong or the CPC hasn't updated the maps.

Thanks for all your updates.

Cheers

MikeyM

 

anything