Page 2 of 2

Re: is there a webtag for record yearly rainfall?

Posted: Fri 18 May 2012 10:37 pm
by steve
Yes, but the point is that you have to edit it on Jan 1st anyway if it's changed.

Re: is there a webtag for record yearly rainfall?

Posted: Sat 19 May 2012 10:42 am
by bigmac
steve wrote:Yes, but the point is that you have to edit it on Jan 1st anyway if it's changed.
Oh, I get it now. I'm not storing the value anywhere am I, of course I have to re-enter it on 1st Jan.

Thanks for pointing out the flaw in my thinking. I'll engage brain next time. :oops:

Re: is there a webtag for record yearly rainfall?

Posted: Sat 19 May 2012 11:19 am
by steve
I might have added wettest/driest year to the all-time records before next Jan 1st anyway :lol:

Re: is there a webtag for record yearly rainfall?

Posted: Sat 19 May 2012 12:22 pm
by bigmac
OK, just in case anyone else is following this or wants to do this on their site, this is what I have done.

I put the following code at that start of the "records" page (note I use php pages)

Code: Select all

$wettestyearamnt = 'whatever value your highest yearly rainfall is';
	$wettestyear = 'whatever that wettest year is';
		if($wettestyearamnt > $ryear)
			$wettestyearamnt=$wettestyearamnt; 
		else
			($wettestyearamnt=$ryear) && ($wettestyear=$year);
	$driestyearamnt = 'whatever value your lowest yearly rainfall is';
	$driestyear = 'whatever that driest year is';
		if($driestyearamnt < $ryear)
			$driestyearamnt=$driestyearamnt; 
		else
			($driestyearamnt=$ryear) && ($driestyear=$year);
I took the viewpoint that the driest year is the current year until it's rainfall exceeds the existing driest year value.

This is what I used to print the values out:

Code: Select all

<tr class="td_data">
				<td>Wettest Year</td>
				<td><?php print $wettestyearamnt;?> <?php print $rainunit;?> </td>
				<td><?php print $wettestyear;?></td>
			</tr>
			<tr class="td_data">
				<td>Driest Year</td>
				<td><?php print $driestyearamnt;?> <?php print $rainunit;?> </td>
				<td><?php print $driestyear;?></td>
			</tr>
I know I still have to manually enter the values at the start of each year, but as Steve said:
I might have added wettest/driest year to the all-time records before next Jan 1st anyway
Hope that helps someone else.