Re: a ? b : c

From: Saji N. Hameed <saji_at_nyahnyahspammersnyahnyah>
Date: Tue, 21 Apr 2009 13:58:57 +0900

Hi Mark,

You may want to look up "where"
http://www.ncl.ucar.edu/Document/Functions/Built-in/where.shtml

array = where(array.gt.0.15, 1.0, 0.0)

saji

* Mark.Collier_at_csiro.au <Mark.Collier_at_csiro.au> [2009-04-21 14:52:01 +1000]:

> Hi,
> I'm wanting, for eg, to find values in an array > 0.15 else set them to zero.
> Operators like a ? b : c
> are ideal for this.
>
> tmp = array>0.15 will not give desired result. An operator which gives
> 1 if >0.15 else 0 would be ideal.
>
> uname -a
> Linux cherax 2.6.16.54-0.2.12-default #1 SMP Fri Oct 24 02:16:38 UTC 2008 ia64 ia64 ia64 GNU/Linux
> gcc -v
> Using built-in specs.
> Target: ia64-suse-linux
> Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --libexecdir=/usr/lib --enable-languages=c,c++,objc,fortran,obj-c++,java,ada --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.1.2 --enable-ssp --disable-libssp --disable-libgcj --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit --enable-libstdcxx-allocator=new --program-suffix= --enable-version-specific-runtime-libs --with-system-libunwind --host=ia64-suse-linux
> Thread model: posix
> gcc version 4.1.2 20070115 (prerelease) (SUSE Linux)
>
> Many thanks,
> Mark.
>
> CSIRO Marine and Atmospheric Research
> Australia.
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

-- 
Saji N. Hameed
APEC Climate Center          				
1463 U-dong, Haeundae-gu,                               +82 51 745 3951
BUSAN 612-020, KOREA                    		saji_at_apcc21.net
Fax: +82-51-745-3999
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Apr 20 2009 - 22:58:57 MDT

This archive was generated by hypermail 2.2.0 : Tue Apr 21 2009 - 11:04:41 MDT