Re: num

From: Dennis Shea (shea AT ucar.edu)
Date: Thu Oct 27 2005 - 20:30:52 MDT


I responded to Mike but inadvertently forgot to
cc to ncl-talk. It was the same as Mary's.

Try:

      MEAN = conform(annual, mean, (/0,1/) )
      knt = num(annual.gt.MEAN)
      delete(MEAN)

or, less clear:
      knt = num(annual.gt.conform(annual, mean, (/0,1/ ) )

Mike responded to me that what he really needed to use
was "dim_num", thus

      knt = dim_num(annual.gt.MEAN) ; knt(nlat,mlon)

On Thu, 27 Oct 2005, Mary Haley wrote:

> Hi Mike,
>
> You can use the "conform" function to conform "mean" to be the
> same size as "annual", and then use "num":
>
> new_mean = conform(annual,mean,(/0,1/))
> total = num(annual.gt.new_mean)
>
> The above should be the equivalent of the do loop:
>
> total = 0
> do i=0,ntim-1
> total = total + num(annual(:,:,i).gt.mean)
> end do
>
> For more information on "conform", see:
>
> http://www.ncl.ucar.edu/Document/Functions/Built-in/conform.shtml
>
>
> --Mary
>
>
> On Thu, 27 Oct 2005, Mike Notaro wrote:
>
>> I have a simple question. If I have two variables, mean(lat,lon) and
>> annual(lat,lon,time),
>> how can I count how many times annual is greater than mean at each grid
>> point (without
>> using do loops)? I tried num(annual.gt.mean) but it doesn't work since
>> their dimensions
>> are different.
>>
>> Mike
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk@ucar.edu
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk@ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
ncl-talk@ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk



This archive was generated by hypermail 2b29 : Thu Oct 27 2005 - 20:42:03 MDT