use of if or where

From: James Correia <jimmyc42_at_nyahnyahspammersnyahnyah>
Date: Fri, 14 Mar 2008 10:58:42 -0700

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
Received on Fri Mar 14 2008 - 11:58:42 MDT

This archive was generated by hypermail 2.2.0 : Mon Mar 17 2008 - 13:59:23 MDT