Hi Mike,
I think the easiest thing to do would be to put all 10 of your lat/lon
arrays into one 3D array dimensioned lat x lon x time, and then use the
dim_avg (or dim_avg_Wrap) function:
http://www.ncl.ucar.edu/Document/Functions/Built-in/dim_avg.shtml
http://www.ncl.ucar.edu/Document/Functions/Contributed/dim_avg_Wrap.shtml
The nice thing about dim_avg is that it ignores missing data. To see
what I mean, try doing this:
a = (/1,2,-999,4/)
a@_FillValue = -999
print(dim_avg(a))
a will equal 2.333.
Adam
Michael Tosca wrote:
> I have a set of arrays (all same month) that contain lat and lon points.
> I wish to compute an average value for each lat/lon point from all the
> arrays, however, some points (different in each array dataset) contain
> missing values, so that when i just add the arrays and divide by 'n' any
> lat/lon point that has at least ONE missing value in one of the arrays
> is essentially "thrown out".
>
> My question is: how can i average over the arrays and simply disregard a
> point when it has a missing value and use the remaining points to
> compute the average. For example, if I have 10 arrays, and one lat/lon
> point only has a vlue in 4 of the 10 arrays, I want the average value of
> that point in the resulting dataset to be an average of the 4 available
> data. The "avg" function doesn't work because it averages over a single
> array, whereas I want to average between several arrays. Here's a sample
> of the code I'm using to average:
>
> MISR_ASO_ElNino = MISR_ASO_2002
> MISR_ASO_ElNino = (MISR_ASO_2002 + MISR_ASO_2004 + MISR_ASO_2006 ) / 3
>
> Thanks!
> -Mike
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-- -------------------------------------------------------------- Adam Phillips asphilli_at_ucar.edu National Center for Atmospheric Research tel: (303) 497-1726 ESSL/CGD/CAS fax: (303) 497-1333 P.O. Box 3000 Boulder, CO 80307-3000 http://www.cgd.ucar.edu/cas/asphilli _______________________________________________ ncl-talk mailing list ncl-talk_at_ucar.edu http://mailman.ucar.edu/mailman/listinfo/ncl-talkReceived on Wed Jun 04 2008 - 12:19:04 MDT
This archive was generated by hypermail 2.2.0 : Wed Jun 04 2008 - 15:43:54 MDT