Re: cumulative sum

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Thu, 15 Feb 2007 07:08:47 -0700 (MST)

> Is there any function to calculate cumulative sum of variable. I would like
> to avoid the following loop.
>
> ; loop to compute cumulative sum of number of days
> tm=new(dimsizes(month),"integer")
> a=0
> do i=0,nmonth-1
> tm(i)=month(i)+a
> a=tm(i)
> end do
>------------------------------

sum, dim_sum

http://www.ncl.ucar.edu/Document/Functions/Built-in/sum.shtml
http://www.ncl.ucar.edu/Document/Functions/Built-in/dim_sum.shtml

----
If you are looking for a function that does "something" [eg, sum]
type sum in the Search box in the upper left of all NCL web pages.
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Feb 15 2007 - 07:08:47 MST

This archive was generated by hypermail 2.2.0 : Thu Feb 22 2007 - 14:54:01 MST