Ajax/Alt Dashboard Customizations

I adjusted some code in ajax-dashboard.php and updated the uv index to match the EPA http://www.cpc.ncep.noaa.gov/products/stratosphere/uv_index/uv_info.shtml.
http://www.knology.net/~blackjack52/

<?php } else {  //  don't have UV sensor .. show UV forecast instead ?>
              <tr>
                <td class="data1" nowrap="nowrap" style="text-align: center; ">
                 <?php
                   if ($haveUV) { // Show todays high if evening or yesterdays if morning
                 ?>

                  <?php if ($time_hour > 12) { // Display Summary if in the evening ?>
                  <?php langtrans('High Today'); ?>:&nbsp;&nbsp;<span style="font-size: 9px;">
                  <?php echo $highuv; ?>&nbsp;@&nbsp;<?php echo fixup_time($highuvtime); ?></span>
                  <?php $UVptr++; // increment counter ?>
                  <?php } else { ?>
                  <?php langtrans('High Yest'); ?>:&nbsp;&nbsp;<span style="font-size: 9px;">
                  <?php echo $highuvyest; ?>&nbsp;@&nbsp;<?php echo fixup_time($highuvyesttime); ?></span>
                  <?php } ?>
		  <?php } else {?>
				<?php	if ($WXSIMuv[0] == "") {
  $uv=1;$UVptr++; // increment counter;
} else {
  $uv=0;
} ?>
 	<table>
	      <tr>
		<td style="text-align: center" >
 				    <small><?php echo $UVfcstDate[$UVptr]; ?></small> <?php echo get_UVrange($WXSIMuv[$uv]); ?>
		</td>
	      </tr>
	</table>
                                <?php $UVptr++; // increment counter ?>
				<?php $uv=($uv+2); ?>  
                  <?php } ?>
		</td>
              </tr>
              <tr>
                <td class="data1" nowrap="nowrap" style="text-align: left; ">
	<table>
	      <tr>
		<td style="text-align: center" >
				   <small><?php echo $UVfcstDate[$UVptr]; ?></small> <?php echo get_UVrange($WXSIMuv[$uv]); ?>
		</td>
	      </tr>
	</table>
                                 <?php $UVptr++; // increment counter ?>
				<?php $uv=($uv+2); ?> 
		</td>
       	      </tr>
              <tr>
                <td class="data1" nowrap="nowrap" style="text-align: left; ">
	<table>
	      <tr>
		<td style="text-align: center" >
				   <small><?php echo $UVfcstDate[$UVptr]; ?></small> <?php echo get_UVrange($WXSIMuv[$uv]); ?>
		</td>
	      </tr>
	</table>
                                 <?php $UVptr++; // increment counter ?>
				<?php $uv=($uv+2); ?> 
		</td>
			  <?php $UVptr++; // increment counter ?>
        </tr>
<?php } // end $haveUV  ---------------------------------------- ?>
//=========================================================================
//  decode UV to word+color for display

function get_UVrange ( $uv ) {
// figure out a text value and color for UV exposure text
//  0 to 2  Low
//  3 to 5 	Moderate
//  6 to 7 	High
//  8 to 10 Very High
//  11+ 	Extreme
   switch (TRUE) {
     case ($uv == 0):
       $uv = 'None';
     break;
     case (($uv > 0) and ($uv < 3)):
       $uv = '<strong>'.$uv.'</strong>&nbsp;or&nbsp;<span style="border: solid 1px; color: black; background-color: #33CC00;">&nbsp;Minimal&nbsp;</span>';
     break;
     case (($uv >= 3) and ($uv < 5)):
       $uv = '<strong>'.$uv.'</strong>&nbsp;or&nbsp;<span style="border: solid 1px; color: black; background-color: #FFCC00;">&nbsp;Low&nbsp;</span>';
     break;
     case (($uv >=5 ) and ($uv < 7)):
       $uv = '<strong>'.$uv.'</strong>&nbsp;or&nbsp;<span style="border: solid 1px; color: black; background-color: #FF9900;">&nbsp;Burn&nbsp;</span>';
     break;
     case (($uv >=7 ) and ($uv < 10)):
       $uv = '<strong>'.$uv.'</strong>&nbsp;or&nbsp;<span style="border: solid 1px; color: #FFFFFF; background-color: #FF6666;">&nbsp;Fry&nbsp;</span>';
     break;
     case (($uv >= 10) ):
       $uv = '<strong>'.$uv.'</strong>&nbsp;or&nbsp;<span style="border: solid 1px; color: #FFFFFF; background-color: #CC33CC;">&nbsp;Crispy&nbsp;</span>';
     break;
   } // end switch
   return $uv;
} // end get_UVrange

UV index of 10 = CRISPY

Nice :slight_smile:

And yesterday’s Htx was FREAKIN’ HOT.

I noticed before making refinements to the script, that after 7p CST or so, the dates go to the next day, plus the extra day, which is correct. But after 10p or so, it jumps to 2 days out for the forecast date only. ie Today is 30 Jun. At 7p the forecast correctly switches to 1Jul and 2Jul. But, after 10p, the dates will show 2Jul and 3Jul.
I’ve tried changing uvptr++ and various other items w/ no luck.

Any ideas where the culprit is?

I run my forecasts at 6pm, 6am and noon. I haven’t had the problem. If the WXSIM forecast starts with the night WXSIMuv[1] contains the first UV forecast. Somehow that late night forecast must be starting with WXSIM[3], but I can’t see why. I’ll have to try a late forecast and see what happens.
EDIT:
I ran a forecast at 10 pm but my forecast still shows Jul1 and Jul2.

Thanks for taking a look.

My last run is 5p/7p. I just ran a 1030p to see if it would jog it; nogo.

I’ll keep trying diff variants.

Mine did jump to Jul2 and Jul3 after midnight. I guess because the day advanced but the forecast didn’t. I changed

 <?php echo $UVfcstDate[$UVptr]; ?>

with

<?php echo $forecasttitles[$uv] ; ?>:

twice for my two dates.

Thanks. I 'll watch it tonight.

That did it.
Thanks.

We hit an unbelievable dew pt of 80F today. I think I’m going to factor in DP into the ajax word values next week.
ie 75F temp shouldn’t say ‘Comfortable’ w/ a DP of say 73F, it should say ‘Uncomfortable’.

Different Record HI/LOW transparent graphics for darker backgrounds.
These pop up above the current weather icon when a record was broken.

Also, glossy Fire Wx icons.


dashboard graphics.zip (25 KB)

ooops, just realized this thread should be under “Creating Weather Websites”.

I took this http://discourse.weather-watch.com/t/45605 one step further.

Add this

<?php
  $ralltimeaverage = 
$avrainjan+$avrainfeb+$avrainmar+$avrainapr+$avrainmay+$avrainjun+$avrainjul+$avrainaug+$avrainsep+$avrainoct+$avrainnov+$avraindec; 

   $ravrainalltime = $ralltimeaverage / 1; 
  $ravrainalltime = number_format((round($ravrainalltime,2)),$places); 
  $rcurrentmonthaverage = 
$avrainjannow+$avrainfebnow+$avrainmarnow+$avrainaprnow+$avrainmaynow+$avrainjunnow+$avrainjulnow+$avrainaugnow+$avrainsepnow+$avrainoctnow+$avrainnovnow+$avraindecnow; 

  $rmonthraintrend = $rcurrentmonthaverage / 1;
  $rmonthraintrend = number_format((round($rmonthraintrend,2)),$places); 

           
if($rannualtrend > 0) {
$trendimage='ajax-images/rising.png';
}
else {
$trendimage='ajax-images/falling.png';
}
?>

just before the table tag for the rain section in ajax-dashboard.php.

And add this

	      <tr>
                <td class="data1" nowrap="nowrap">YTD Diff:</td>
                <td style="text-align: right;" class="data1">
                    <?php echo gen_difference($avg_ytd_rain, $ralltimeaverage, $uomRain,
					' %s'.$uomRain.' above avg YTD Rain.',
					' %s'.$uomRain.' below avg YTD Rain.') ?>
				</td>
              </tr>

to have a new row showing the current YTD Diff from Yearly avg.

Created a Lightning Index to go in my Lightning section on my main pg. http://www.knology.net/blackjack52/
It uses clientraw tag 114, after configuring WD for lightning. Should work w/ Dallas, Nexstorm, and L2K.
It returns 7 states: QUIET, LOW, ACTIVE, MODERATE, STRONG, SEVERE, EXTREME.

Add the following code to ajaxWDws.js, in the functions section:

// function to add colored lightning
function lightColor(light) {
  if (light > 300) { return ('<span style="border: 0px; color: white; background-color: #CC33CC;">&nbsp;<b>EXTREME</b>&nbsp;</span>'); } 
  if (light > 150) { return ('<span style="border: 0px; color: white; background-color: #FF0000;">&nbsp;<b>SEVERE</b>&nbsp;</span>'); } 
  if (light > 80) { return ('<span style="border: 0px; color: black; background-color: #FF6600;">&nbsp;<b>STRONG</b>&nbsp;</span>'); }
  if (light > 30) { return ('<span style="border: 0px; color: black; background-color: #FFFF00;">&nbsp;<b>MODERATE</b>&nbsp;</span>'); }
  if (light > 5) { return ('<span style="border: 0px; color: yellow; background-color: #4A4A4A;">&nbsp;<b>ACTIVE</b>&nbsp;</span>'); }
  if (light > 0) { return ('<span style="border: 0px; color: aqua; background-color: #4A4A4A;">&nbsp;<b>LOW</b>&nbsp;</span>'); }

  return("QUIET");
}

Add this to the tags section of ajaxWDws:

		// Lightning added by Webster Weather LIVE for Alt-Dashboard Script Version 2.80 or later
		lightlastminute = clientraw[114];
                          lightlastminute = lightColor(lightlastminute);
		set_ajax_obs("ajaxlightning",lightlastminute);
		lightlasttime = clientraw[115];
		set_ajax_obs("ajaxlightningtime",lightlasttime);

And add this to ajax-dashboard.php where you want it to show:

              <tr>
                <td class="data1" nowrap="nowrap">Lightning Index:&nbsp;
			<span class="ajax" id="ajaxlightning">
			  <?php echo ($lightlastminute); ?></span>
	        </td>
              </tr>

Replacements for Fire icons. examples attached
Just upload and change references in dashboard.php of Fire0.jpg through Fire5 to .png.


FWI.zip (12.8 KB)

Fire16.png

Fire32.png