Rain "Year to Date" and "Month to Date" Differential Script

Drobbins,

Its been a very long time since I added this…this is what I have in my ajax-dashboard for the MTD and YTD rain totals:

For the Month to Date (MTD):

<td class="data1">MTD Differential:</td>
                <td style="text-align: right;" class="data1">
				  <?php $monthrndifference=$monthrn-$avg_mtd_rain;
				  if ($monthrndifference >= 0)
				     echo "+";
				   else
				     echo ""; 
                                   ?>
          <?php $monthrndifference =  round($monthrndifference,3);
						$monthrndifference =  number_format($monthrndifference, 2, '.', '');
						?>                         
				  <?php echo "$monthrndifference" . $uomRain;?>
				</td>

and for the Year to Date (YTD):

<td class="data1" nowrap="nowrap">YTD Differential:</td>
                <td style="text-align: right;" class="data1">
				  <?php $yearrndifference=$yearrn-$avg_ytd_rain;
				  if ($yearrndifference >= 0)
				     echo "+";
				   else
				     echo ""; 
                                   ?>
          <?php $yearrndifference =  round($yearrndifference,3);
						$yearrndifference =  number_format($yearrndifference, 2, '.', '');
						?>
				  <?php echo "$yearrndifference" . $uomRain; ?>
				</td>

Currently, you’re only displaying the average month to date rainfall. You need to change your code. Basically, based on all of your data since station inception, you’ve averaged 3.08" of rain from April 1 to April 19. Then you compare this value to the current month rain to come up with a “+” or “-” value from normal. Same applies for the year to date rain but starts from Jan 1. I hope this makes sense.

Regards,
Michael