[ncl-talk] sort multiple 1D vectors with a common timestamp according to one, without a loop

Matthew Fearon Matthew.Fearon at dri.edu
Wed Aug 26 14:47:14 MDT 2015


Thanks, Rick. I just tried a small example as you suggested. I think dim_pqsort is sorting as we thought. However, though carries along an assigned coordinate variable, it doesn't appear to sort it with the data as qsort would. I think I can piece something together. Thanks for the help.

________________________________
From: Rick Brownrigg [brownrig at ucar.edu]
Sent: Wednesday, August 26, 2015 1:42 PM
To: Matthew Fearon
Cc: ncl-talk at ucar.edu
Subject: Re: [ncl-talk] sort multiple 1D vectors with a common timestamp according to one, without a loop

Hi Matt,

I don't know definitively, but my reading of the docs on dim_pqsort suggest, along with its attendant example #2, suggest that it does indeed do what you want.  You could cobble together a small test case to verify.

HTH...
Rick




On Wed, Aug 26, 2015 at 2:32 PM, Matthew Fearon <Matthew.Fearon at dri.edu<mailto:Matthew.Fearon at dri.edu>> wrote:
Does dim_pqsort do this?

In my example, if I did  x = dim_pqsort(precip, -2) , is x the indices of the sorted array (descending) that I could apply to the other variables to order them consistent with precip?

thanks for the help.

________________________________
From: ncl-talk-bounces at ucar.edu<mailto:ncl-talk-bounces at ucar.edu> [ncl-talk-bounces at ucar.edu<mailto:ncl-talk-bounces at ucar.edu>] on behalf of Matthew Fearon [Matthew.Fearon at dri.edu<mailto:Matthew.Fearon at dri.edu>]
Sent: Wednesday, August 26, 2015 1:20 PM
To: ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>
Subject: [ncl-talk] sort multiple 1D vectors with a common timestamp according to one, without a loop

Dear NCL users,

Trying to sort multiple 1D vectors according to one primary vector. For example, I have temp, rh, wind, and precip as 1D vectors of the same length, and they corresponding in time. How can I sort precip descending and attached the corresponding temp, rh, and wind to it, without a loop?

thanks,
Matt


_______________________________________________
ncl-talk mailing list
ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150826/882c0045/attachment.html 


More information about the ncl-talk mailing list