From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Mon, 04 May 2009 07:51:58 -0600

Hi Agnes,

Some functions

will do that. The above could be used for (say) total precipitation
at each grid point

prcTot = dim_sum_Wrap( prc(lat|:, lon|:, time|:) )

For (say) 4x-daily [6hr totals] to get daily totals: prc(time,lat,lon)

nDay = ntim/4
prcDay = new ((/nDay,nlat,mlon/),typeof(prc),getFillValue(prc))

ndy = -1
do nt=0,ntim-1,4
ndy = ndy+1
prc(ndy,:,:) = dim_sum( prc(lat|:, lon|:, time|nt:nt+3) )
end do

-----
The following will do it for all dimensions.
http://www.ncl.ucar.edu/Document/Functions/Built-in/sum.shtml
-----
However, if you are talking about element by element sum

D = A + B + C

where A@_FillValue, A@_FillValue, C@_FillValue
then you would have to trick NCL. EG:

A@_FillValue = 0.0 ; change to zero
B@_FillValue = 0.0
C@_FillValue = 0.0

delete(A@_FillValue)
delete(B@_FillValue)
delete(C@_FillValue)

D = A + B + C

D

Agnes Lim Huei Ni wrote:
> Hi Dennis,
I may not be too clear in my previous post.
> Though there is a missing value, I still want it to sum and return
> the remaining sum instead of a missing value if one of the three
> elements is missing.
> Is that possible?

> Agnes

> Dennis Shea wrote:
NCL automatically does that. See:

Agnes Lim Huei Ni wrote:
> Hi
I have three arrays that I wish to sum. However, the elements of
> missing values are different in each of them.
> How should i code the script in order for the array to sum only
> valid values.
> Or does NCL already automatically does that.
Agnes
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon May 04 2009 - 07:51:58 MDT

This archive was generated by hypermail 2.2.0 : Wed May 06 2009 - 16:48:59 MDT