Re: How to print the value of a variable from lowest to highest or highest to lowest

From: Hobbs, Will R (3244-CalTech) <William.R.Hobbs_at_nyahnyahspammersnyahnyah>
Date: Fri Dec 10 2010 - 11:50:22 MST

Ket

There are a number of 'sort' functions in NCL. Without knowing exactly what you data is, the simplest for you is probably 'qsort'; if your data is a multi-dimensional array then you will first need to convert it to 1d, using the 'ndtooned' function:

    x1D = ndtooned(x) ;for a multidimensional array (not necessary for a 1d array)

    print(qsort(x1D)) ;prints values of x1D from lowest to highest

If you need to do something a little more, then consider the dim_pqsort function

http://www.ncl.ucar.edu/Document/Functions/Built-in/qsort.shtml

http://www.ncl.ucar.edu/Document/Functions/Built-in/dim_pqsort.shtml

Will

On 12/10/10 10:21 AM, "Ketsiri Leelasakultum" <ketsiri.leela@gmail.com> wrote:

Hello !!

I want to print my variable from the lowest to highest or highest to lowest.
Does anyone has experience with this?

Please suggest.

Thanks,
Ket

**********************************************************
Will Hobbs, Ph.D. William.R.Hobbs@jpl.nasa.gov
Jet Propulsion Laboratory
4800 Oak Grove Dr. office: 300-324a
M/S 300-323 phone: (818) 354-0466
Pasadena, CA 91109 fax: (818) 354-0966
**********************************************************

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Dec 10 11:51:19 2010

This archive was generated by hypermail 2.1.8 : Fri Dec 10 2010 - 14:58:12 MST