Author Topic: New Weather Alert Program  (Read 39770 times)

0 Members and 1 Guest are viewing this topic.

Offline jonnyj771

  • Senior Contributor
  • ****
  • Posts: 220
    • Lightning Weather
Re: New Weather Alert Program
« Reply #175 on: April 06, 2014, 05:42:10 PM »
Jonny J,

I don't know what is causing the internal server error but it could be from the script attempting to write files.
You will need to locate and change three file paths in the file nws-alerts-config.php to the paths below.

Code: [Select]
$cacheFileDir  = './alerts-cache/';         // default cache file directory
$icons_folder  = './alert-images';          // folder that contains the icons. No slash on end

$log_folder    = './alertlog';              // folder that contains the log files. No slash on end

After the changes, upload the file and manually update the file nws-alerts.php.

Curly,

I have those files/folders located in the weather2/nws-alerts folder(s).
should I move those out to the root and note in the code?
Facebook:
Lightning Weather
   www.facebook.com/lightningweather
                             /groups/lightningweather
Lightning Weather Quad Cities
                             /lightningwxqc
                             /groups/lightningWXQC
Weather Station Hardware: Davis Vantage Pro2 6152
Weather Station Software: WD - 10.37S Build XXX (Beta)
Page Template: MeteoTemplate v1x. (Current Active)

Offline Curly

  • Forecaster
  • *****
  • Posts: 724
    • Michiana Weather
Re: New Weather Alert Program
« Reply #176 on: April 06, 2014, 06:17:59 PM »
Quote
I have those files/folders located in the weather2/nws-alerts folder(s).
should I move those out to the root and note in the code?

The paths are relative to where nws-alerts.php is located.
You have that file here: /weather2/nws-alerts/nws-alerts.php
The cache folder is here: /weather2/nws-alerts/alerts-cache/
So the path would be  $cacheFileDir  = './alerts-cache/';

Since you have the main file in a separate folder, the paths to the icons and details probably won't work correctly if the web pages are in another folder.
The files in the folder nws-alerts should be in your weather root folder where all of your web pages resides.

« Last Edit: April 06, 2014, 06:36:26 PM by Curly »

Offline jonnyj771

  • Senior Contributor
  • ****
  • Posts: 220
    • Lightning Weather
Re: New Weather Alert Program
« Reply #177 on: April 17, 2014, 09:07:28 PM »
Curly,

I got the pages going properly (sort of)... When you go to the site  advisories page The page shows blank, aside of the template.  If you make it the summary page, you get the summary, then clicking on each county will get you a separate page and but doesn't include the template.
I'm using the Leuven Template. Although there is an advisory script, it's only designed for 1 Zone or County Code. Not a Zone|County Code. It's also not designed for multiple zones.
When you go to do the ?mu=1 it does update the summary. I also have a cron job running.

I have posted this just about a week ago.  I was originally having 500 internal server errors, but that has since been corrected.

Can you get me some idea of what I am missing?

Regards,
Jonny J
Facebook:
Lightning Weather
   www.facebook.com/lightningweather
                             /groups/lightningweather
Lightning Weather Quad Cities
                             /lightningwxqc
                             /groups/lightningWXQC
Weather Station Hardware: Davis Vantage Pro2 6152
Weather Station Software: WD - 10.37S Build XXX (Beta)
Page Template: MeteoTemplate v1x. (Current Active)

Offline Curly

  • Forecaster
  • *****
  • Posts: 724
    • Michiana Weather
Re: New Weather Alert Program
« Reply #178 on: April 18, 2014, 05:20:12 AM »

I see that the file nws-alerts.php is included in the page and according to the settings, you have nws-alerts.php set to use a cron job.
Each time you visit the advisories page, all it does is update the cache files.
The code to get the summary on the page is this:
Code: [Select]
<?php include("nws-alerts-summary-inc.php"); ?>
The page with the details should have this code:
Code: [Select]
<?php include("nws-alerts-details-inc.php"); ?>
To view the alert box, this code gets placed in the web page:
Code: [Select]
<?php
// Add nws-alerts alert box cache file
include_once("nws-alerts-config.php");
include(
$cacheFileDir.$aboxFileName);
// Insert nws-alerts alert box
echo $alertBox;
?>

<script type="text/javascript" src="nws-alertmap.js"></script>

The summary page and details are showing up here:  http://lightningweather.com/weather2/nws-summary.php
Both of theses files are working as set in the file nws-alerts-config.php


Offline jonnyj771

  • Senior Contributor
  • ****
  • Posts: 220
    • Lightning Weather
Re: New Weather Alert Program
« Reply #179 on: April 18, 2014, 08:19:55 AM »

I see that the file nws-alerts.php is included in the page and according to the settings, you have nws-alerts.php set to use a cron job.
Each time you visit the advisories page, all it does is update the cache files.
The code to get the summary on the page is this:
Code: [Select]
<?php include("nws-alerts-summary-inc.php"); ?>
The page with the details should have this code:
Code: [Select]
<?php include("nws-alerts-details-inc.php"); ?>
To view the alert box, this code gets placed in the web page:
Code: [Select]
<?php
// Add nws-alerts alert box cache file
include_once("nws-alerts-config.php");
include(
$cacheFileDir.$aboxFileName);
// Insert nws-alerts alert box
echo $alertBox;
?>

<script type="text/javascript" src="nws-alertmap.js"></script>

The summary page and details are showing up here:  http://lightningweather.com/weather2/nws-summary.php
Both of theses files are working as set in the file nws-alerts-config.php

Curly,

I switched my settings around to show the summary page as my advisory page. When you click on the advisory/no alert for each county, it takes you to the details, however, it's not showing the template. that would make some want to just go elsewhere (alot don't like the back button).
any remedy for this?
Facebook:
Lightning Weather
   www.facebook.com/lightningweather
                             /groups/lightningweather
Lightning Weather Quad Cities
                             /lightningwxqc
                             /groups/lightningWXQC
Weather Station Hardware: Davis Vantage Pro2 6152
Weather Station Software: WD - 10.37S Build XXX (Beta)
Page Template: MeteoTemplate v1x. (Current Active)

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1986
    • My PWS at Leuven Belgium Europe
Re: New Weather Alert Program
« Reply #180 on: April 19, 2014, 08:34:52 AM »
Good morning, I am the developer of the Leuven-Template and just started to implement the very nice loking Curly's alerts scripts into the Leuven-Template.

My first 'adaption' works at http://www.weerstation-leuven.be/northam/.

I added a combined summary/details page to the menu http://www.weerstation-leuven.be/northam/index.php?p=57-3
Clicking on a link on the summary page or on the alert-box on top of the page brings you to the detailed information.

I will as always keep the adaption in someone elses scripts to the absolute minimum.
As for now I only have to change a few ? in the url-links to a &
The template itself is uses the ? to refer to the pagenumber.
 
I also changed the css for the alert box to have the same look as the rest of the page , but all will be documented.

Remaining questions:
nws-alertsIconData.php does anyone has a link to a page where they are used?
I understood that they are sometimes added to the menu-area but also if there are multiple warnings?
Thunder and severe rain/snow warning As with the current euro/noaa script I want to include a small version of the thunder-page or rain-radar when such a warning is in effect. I have to find out where to raise the condition for those warnings.

It will take a few days before everything is runnig smoothly enough to distribute the scripts.

Wim

Offline Curly

  • Forecaster
  • *****
  • Posts: 724
    • Michiana Weather
Re: New Weather Alert Program
« Reply #181 on: April 19, 2014, 09:15:27 AM »
Quote
I switched my settings around to show the summary page as my advisory page. When you click on the advisory/no alert for each county, it takes you to the details, however, it's not showing the template. that would make some want to just go elsewhere (alot don't like the back button).
any remedy for this?

What is the file name (page number) for the template page for the details?

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1986
    • My PWS at Leuven Belgium Europe
Re: New Weather Alert Program
« Reply #182 on: April 19, 2014, 09:29:18 AM »
Quote
I switched my settings around to show the summary page as my advisory page. When you click on the advisory/no alert for each county, it takes you to the details, however, it's not showing the template. that would make some want to just go elsewhere (alot don't like the back button).
any remedy for this?

What is the file name for the template page for the details?
The "file-name" in the Leuven-Template does not refer to an exact script-name. For the details page jonnyj771 is using (and so do I) for the name in the browser window index.php?p=57-3 and that is what has to be set in the $alertURL variable.
In the menu xml file the number 57-3 is linked to a script to handle that menu choice.

As the handling is identical between summary and detail I choose to have only one php-script for summary and details. And based on the &a=xxxxxx get setting I include either the summary or details inc scripts.
Code: [Select]
if (isset ($_REQUEST['a']) && '' <> trim($_REQUEST['a']) ){
include ('nws-alerts-details-inc.php');
} else {
include ('nws-alerts-summary-inc.php');
}
So I already posted this script to jonnyj771 in another thread.

Again very fine scripts, very easy to integrate into ones website or into a template. I wish I had known your scripts before I wrote my own NOAA alert script.

Wim

Offline Curly

  • Forecaster
  • *****
  • Posts: 724
    • Michiana Weather
Re: New Weather Alert Program
« Reply #183 on: April 19, 2014, 10:02:27 AM »
Quote
Remaining questions:
nws-alertsIconData.php does anyone has a link to a page where they are used?
I understood that they are sometimes added to the menu-area but also if there are multiple warnings?
Thunder and severe rain/snow warning As with the current euro/noaa script I want to include a small version of the thunder-page or rain-radar when such a warning is in effect. I have to find out where to raise the condition for those warnings.

The cache file nws-alertsIconData.php is generally included in the menubar which is set by the tag $iconFileName.
Icons have the tag $bigIcons. You can see this used in the left menu bar under County Alerts. http://www.weather.ricksturf.com/WX/wxNWSforecast.php
There are 6 settings on how to display the large icons including the most severe alert icon for a location or all icons for all alerts. Sometimes there can be multiple alerts with the same alert name and those can be regulated in the config file.

All of the alert data is in the cache file nws-alertsMainData.php.
In that file, the first tag will be $atomAlerts. It will be empty if there are no alerts.
When there are alerts, the tag will have an array for each location with the alert(s) starting with the most severe alert listed first. If you want to check for specific alerts for the thunder-page or rain-radar, a few lines of php code could get you the results.

Offline jonnyj771

  • Senior Contributor
  • ****
  • Posts: 220
    • Lightning Weather
Re: New Weather Alert Program
« Reply #184 on: April 19, 2014, 10:41:29 PM »
Curly,

I have the page up and running now. I have noticed with an alert I have going, It's a River Flood Warning on the Mississippi at Dubuque. The icon is showing Flash Flood Warning. I have it set in the Config file as 'true' to show "river and aerial" warnings.

Advisories Page
I'm wondering where I look to check what icon the alert is supposed to be displaying and how to change it so it shows "R" for the River Flood Warning (as the legend depicts.)

Regards

Jonny J.
Facebook:
Lightning Weather
   www.facebook.com/lightningweather
                             /groups/lightningweather
Lightning Weather Quad Cities
                             /lightningwxqc
                             /groups/lightningWXQC
Weather Station Hardware: Davis Vantage Pro2 6152
Weather Station Software: WD - 10.37S Build XXX (Beta)
Page Template: MeteoTemplate v1x. (Current Active)

Offline Curly

  • Forecaster
  • *****
  • Posts: 724
    • Michiana Weather
Re: New Weather Alert Program
« Reply #185 on: April 20, 2014, 12:53:23 AM »
Open nws-alerts.php and find this line:
Code: [Select]
    array('N'=>'River Flood Warning',             'C'=>'#D00', 'S'=>'23', 'I'=>'FFW.gif'),

Replace it with this:
Code: [Select]
    array('N'=>'River Flood Warning',             'C'=>'#D00', 'S'=>'23', 'I'=>'FLW.gif'),

Offline jonnyj771

  • Senior Contributor
  • ****
  • Posts: 220
    • Lightning Weather
Re: New Weather Alert Program
« Reply #186 on: April 20, 2014, 01:07:16 AM »
Open nws-alerts.php and find this line:
Code: [Select]
    array('N'=>'River Flood Warning',             'C'=>'#D00', 'S'=>'23', 'I'=>'FFW.gif'),

Replace it with this:
Code: [Select]
    array('N'=>'River Flood Warning',             'C'=>'#D00', 'S'=>'23', 'I'=>'FLW.gif'),

Fixed it.
Thanks Curly!!
Facebook:
Lightning Weather
   www.facebook.com/lightningweather
                             /groups/lightningweather
Lightning Weather Quad Cities
                             /lightningwxqc
                             /groups/lightningWXQC
Weather Station Hardware: Davis Vantage Pro2 6152
Weather Station Software: WD - 10.37S Build XXX (Beta)
Page Template: MeteoTemplate v1x. (Current Active)

Offline mkutche

  • Forecaster
  • *****
  • Posts: 1043
    • GosportWx.com
Re: New Weather Alert Program
« Reply #187 on: December 03, 2016, 06:30:40 PM »
my alert log doesn't seem to be working.. http://gosportwx.com/wxnws-alerts-log.php shouldn't it display the current day or no, and I know I've had more alerts since November 29th and well before?
« Last Edit: December 03, 2016, 06:35:12 PM by mkutche »
Mike K.
Davis Vantage Vue 6250 - CumulusMX (3.21.1-b3205)
Gosport, Indiana
Gosportwx.com twitter.com/GosportINWX
-----------------------------------------------------------

Offline Curly

  • Forecaster
  • *****
  • Posts: 724
    • Michiana Weather
Re: New Weather Alert Program
« Reply #188 on: December 04, 2016, 09:52:39 AM »
The log file only stores the brief information for active alerts.
If there are no alerts for a day, that day doesn't get logged.

Looking at the the SPC Storm Reports and the Local Storm Reports for your area, nothing is displayed for your area in the last 4 days.
You if have alerts and it's not logging them, check the  alertlog  folder for proper file writing permission.

Offline Bunty

  • Forecaster
  • *****
  • Posts: 2432
  • Stillwater, home of Oklahoma State University
    • Welcome to Stillwater Weather
Re: New Weather Alert Program
« Reply #189 on: January 13, 2017, 11:53:06 PM »
How do I set things to make the link go straight to the nws-details.php page, rather than nws-summary page?  Also does the Google  map feature no longer work?

Also the 2nd home page using modified AltDashboard 6.95 at http://stillwaterweather.com/2ndhome.php

Offline Maumelle Weather

  • Forecaster
  • *****
  • Posts: 1825
    • Maumelle Weather
Re: New Weather Alert Program
« Reply #190 on: January 14, 2017, 07:32:20 AM »
Hi Bunty,

Look in your nws-alerts-config.php file for the following:

// file names
$cacheFileName = 'nws-alertsMainData.php';  // main data cache file name
$aboxFileName  = 'nws-alertsBoxData.php';   // alert box cache file name
$iconFileName  = 'nws-alertsIconData.php';  // big icons cache file
$alertURL      = 'wxnws-details.php';       // web page file name for complete details - Used with Saratoga Base USA template
//$summaryURL    = 'wxadvisory.php';       // web page for the alert summary - Used with Saratoga Base USA template
//$alertURL      = 'nws-details.php';       // web page file name for complete details - Used for standard web pages
$summaryURL    = 'nws-summary.php';       // web page for the alert summary - Used for standard web pages

Yours may look very similar. Put 2 forward slashes in front of the one in orange and remove the ones in red. This should make both links the same.

Hope this helps,

John
GR2AE, GR3, Cumulus