Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Fwd: aggregating time steps

Begin forwarded message:


On Aug 23, 2007, at 4:25 PM, Mr. Shawn H. Corey wrote:

> # How about?
>  my ( $year, $month, $doy, $tmax, $tmin, $par, $precip, $NH4, $NO3,
> $O3, $CO2, $V1, $V2, $V3, $V4 ) = split;
> # You can now store your totals by month as:
>  $totals{$year}{$month}{tmax} += $tmax;
>  ...
> # and the count
>  $totals{$year}{$month}{count} ++;
>
> # After you read all the input, you can calculate the averages.
>

Interesting idea. I like it in that it is flexable (for example I
could easily print the monthly sum of precip by not dividing by a
"count", which brings me to my question. I see how you are summing
each of the variables like tmax with:

+= $tmax;

I'm not sure though how you are keeping track of the "count". In
order to print out averages, I'd have to do something like:

print $year, $doy / count, $tmax / count, $tmin / count

I don't see how  $totals{$year}{$month}{count} ++; is holding the count.



Report this thread to moderator Post Follow-up to this message
Old Post
Kirk Wythers
08-24-07 09:00 AM


Re: Fwd: aggregating time steps
Kirk Wythers wrote:
> I don't see how  $totals{$year}{$month}{count} ++; is holding the count.

Read about the auto-increment operator in "perldoc perlop".

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

Report this thread to moderator Post Follow-up to this message
Old Post
Gunnar Hjalmarsson
08-24-07 09:01 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PERL Beginners archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:06 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.