Re: question on average

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Wed Jan 18 2012 - 15:56:46 MST

Untested:

   var_ave = dim_avg_n (var, 0)
   counts = dim_num_n (ismissing (var), 0)
   vmask = (counts .eq. 0)
   var_ave = where (vmask, var_ave, 0)

--Dave

On Wed, Jan 18, 2012 at 2:30 PM, Xiaoyan Ma <xiaoyan.ma@asrc.albany.edu> wrote:
> Dear NCL community,
>
> I am using dim_avg_n to do annual mean from monthly mean, e.g.
>
>    ntim=12
>    var=new((/ntim,nlat,nlon/), "float")
>    do nt=0,ntim-1
>    var(nt,:,:) = fbindirread(fname,0, (/nlat,nlon/), "float")
>    end do
>    var_ave = dim_avg_n(var, 0)
>
> in this function the missing values are ignored. Now I have data sets for 12
> months, but for some months there are missing values for some grid points.
> I want to set the annual average for these points as a specific value, e.g.
> zero, rather than to get the average from the available month (as done by
> dim_avg_n)..
>
> Does anybody tell me how to do that?
>
> Thanks,
> Xiaoyan
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jan 18 15:56:56 2012

This archive was generated by hypermail 2.1.8 : Mon Jan 23 2012 - 12:45:14 MST