Use "num"
If x(time,lev,lat,lon)
klvl = 5 ; (say)
k5 = num(x(:,klvl,:,:).gt.xcrit))
klvl = 9
k9 =num(x(:,klvl,:,:).gt.xcrit))
etc
James Correia wrote:
> All-
> I am trying to count how many times a particular value is exceeded at
> each gird point at 3 different levels.
> The variables I am comparing do not have the same number of dimensions
> so the where function errors. I tried doing this in a loop with an if
> statement but there is an error having something to do with ismissing.
>
> my variables are:
> th10(level,i,j) i,j are the x and y indices
> th(level,i,j,t) ; t is time
>
> th10 represents the 90th percentile of the th variable.
> I tried doing this:
> cnta = where(th10 .lt. th, 0, 1)
> cnt = dim_sum(cnta(:,:,:,:))
>
> and tried this:
> cnt(:,:,:,:) = 0. ; make it non-missing after declaration using new
> do level=0,nlevels-1
> do i=0,153
> do j=0,128
> do it=0,248
> if(th10(level,i,j) .lt. th(level,i,j,it))then ; th exceeds th10
> cnt(level,i,j) = cnt(level,i,j) + 1.
> else
> cnt(level,i,j) = cnt(level,i,j)
> end if
> end do
> end do
> end do
> end do
>
> is there a cleaner, better way to do this type of calculation?
>
>
> --
> James Correia Jr.
> Post Doc
> Climate Physics Group, PNNL
> ------------------------------------------------------------------------
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-- ====================================================== Dennis J. Shea tel: 303-497-1361 | P.O. Box 3000 fax: 303-497-1333 | Climate Analysis Section | Climate & Global Dynamics Div. | National Center for Atmospheric Research | Boulder, CO 80307 | USA email: shea 'at' ucar.edu | ====================================================== _______________________________________________ ncl-talk mailing list ncl-talk_at_ucar.edu http://mailman.ucar.edu/mailman/listinfo/ncl-talkReceived on Fri Mar 14 2008 - 13:44:21 MDT
This archive was generated by hypermail 2.2.0 : Mon Mar 17 2008 - 13:59:23 MDT