Re: num

From: Mary Haley (haley AT ucar.edu)
Date: Thu Oct 27 2005 - 18:19:41 MDT

  • Next message: Sam Drinkard: "Possible bug in script wrf_em_real.ncl (Beta version)"

    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



    This archive was generated by hypermail 2b29 : Thu Oct 27 2005 - 18:24:21 MDT