[ncl-talk] qsort

Dennis Shea shea at ucar.edu
Tue Feb 26 09:31:41 MST 2019


*dim_pqsort_n*
<https://www.ncl.ucar.edu/Document/Functions/Built-in/dim_pqsort_n.shtml>


"I have an array of HI(time), T(time), and RH(time).
 I want to qsort(HI), then reorder T and RH to match qsort(HI)."

====

   ip  = *dim_pqsort_n*(HI,2,0)
   T  = T(ip)
   RH = RH(ip)

   print(* sprintf*("%9.2f", HI)+"  "+*sprintf*("%9.2f", T)+"
"+*sprintf*("%9.2f",RH)
)




On Tue, Feb 26, 2019 at 7:12 AM Buzan, Jonathan <jbuzan at purdue.edu> wrote:

> Hi Dennis,
>
> I will work on coding up the suggested algorithm…
> However, it might be easier to rephrase the question:
>
> I have an array of HI(time), T(time), and RH(time).
> I want to qsort(HI), then reorder T and RH to match qsort(HI).
>
> Is there a way to do that?
> Because I can simply use index numbers, and get around this issue.
>
> -Jonathan
>
>
>
>
> On Feb 25, 2019, at 5:31 PM, Dennis Shea <shea at ucar.edu> wrote:
>
> Jonathan:
>
> For a sort variation, you might try *dim_pqsort_n*
> <https://www.ncl.ucar.edu/Document/Functions/Built-in/dim_pqsort_n.shtml>
> which is from the fortran *SLATEC * <https://www.netlib.org/slatec/guide>
> library.
>
> NCL's *dim_pqsort_n *should be able to handle any dimension size.
>
> Under-the-hood:   To my knowledge, fortran's default integer type is
> 32-bits [ 4 bytes ] => 2,147,483,647
> NCL's C-interface checks the size of the dimension being sorted. I it
> exceeds the 32-bit size, NCL uses a special version that allows [64-bit;
> 8-byte; INTEGER*8] indexing.
>
> Cheers
> D
>
>
> On Mon, Feb 25, 2019 at 8:17 AM Buzan, Jonathan <jbuzan at purdue.edu> wrote:
>
>> Hi Rick,
>>
>> I am running into an issue where I have some repeat values.  Is there a
>> way to add a precision level adjustment during the qsort algorithm?
>>
>> -Jonathan
>>
>>
>>
>>
>> On Feb 25, 2019, at 16:06, Rick Brownrigg <brownrig at ucar.edu> wrote:
>>
>> Hi Jonathan -- yes, qsort() takes a double, or more generally a "numeric"
>> type.
>>
>> RB
>>
>> On Mon, Feb 25, 2019 at 7:20 AM Buzan, Jonathan <jbuzan at purdue.edu>
>> wrote:
>>
>>> Hello NCL-Talk,
>>>
>>> Does qsort operate at double precision?
>>> I am trying to resolve my stat_dispersion issue by isolating the
>>> problem...
>>>
>>> -Jonathan
>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
> <dpsort.f>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190226/15d277c9/attachment.html>


More information about the ncl-talk mailing list