Re: finding the top and bottom

From: <Oliver.Fuhrer_at_nyahnyahspammersnyahnyah>
Date: Wed, 22 Apr 2009 07:58:56 +0200

Hi Cory,

A loop like this would also work fine (note that negative loop strides
don't work)...

top=new((/x,y/,integer,-1)
do k=0,z
  top = where(data(:,:,z-k).gt.0.0,z-k,kmax)
end do

Hope this helps...
Oli

> -----Original Message-----
> From: ncl-talk-bounces_at_ucar.edu
> [mailto:ncl-talk-bounces_at_ucar.edu] On Behalf Of Cory Wolff
> Sent: Mittwoch, 22. April 2009 00:11
> To: ncl-talk_at_ucar.edu
> Subject: finding the top and bottom
>
> I have data in a 3-d array (x,y,z) and would like to create a
> 2-d array
> (x,y) that holds the level at which the values go above a certain
> threshold in the z coordinate, starting from the top. I
> would also use
> this to find the same starting from the bottom in a separate
> array. I
> know that I can do this with loops:
> do i=0,x
> do j=0,y
> do k=z,0,-1
> if(data(i,j,k).gt.0.0) then
> top(i,j) = k
> ...
>
> That will be really slow, of course, so I'm wondering if I can do it
> without resorting to loops. Any help would be appreciated. Thanks.
>
> Cory
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Apr 21 2009 - 23:58:56 MDT

This archive was generated by hypermail 2.2.0 : Fri Apr 24 2009 - 14:12:40 MDT