Re: on the behaviour of dim_pqsort

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Sun Jan 20 2013 - 23:08:17 MST

The answer is correct. The returned subscripts (indicies) are
the result of the algorithm used. The code does not check for
all values the same and then return indices (/0,1,2,3,4,5,6,7,8,9/)

---
x = new(10, "float")
x  = 15.5 ; x is a series of all constant numbers, so nothing to sort
pv = dim_pqsort(x, 1)  ; sort in ascending order, but don't sort x)
print(x(pv))
---
Variable: x (subsection)
Type: float
Total Size: 40 bytes
             10 values
Number of Dimensions: 1
Dimensions and sizes:   [10]
Coordinates:
Number Of Attributes: 1
   _FillValue :  9.96921e+36
(0)     15.5
(1)     15.5
(2)     15.5
(3)     15.5
(4)     15.5
(5)     15.5
(6)     15.5
(7)     15.5
(8)     15.5
(9)     15.5
On 1/20/13 9:22 PM, Will Hobbs wrote:
> All
>
> I stumbled over an interesting 'feature' of the dim_pqsort() function, basically that it tries to sort a constant series (see below). I'm not sure if this counts as a bug, a warning or just evidence that I should pay more attention to what I'm doing, but it might be of use to other NCL users.
>
> Will
>
>
>> begin
>
>> x=new(10, "float")
>> x = 15.5                 ; x is a series of all constant numbers, so nothing to sort
>
>> pv = dim_pqsort(x, 1)  ; try and sort in ascending order, but don't sort x)
>
>> print(pv)
>
> Variable: pv
> Type: integer
> Total Size: 40 bytes
>              10 values
> Number of Dimensions: 1
> Dimensions and sizes: [10]
> Coordinates:
> (0) 0
> (1) 6
> (2) 7
> (3) 8
> (4) 5
> (5) 4
> (6) 1
> (7) 2
> (8) 3
> (9) 9
>
>> end
>
>
>
> _______________________________________________
> 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 Sun Jan 20 23:08:28 2013

This archive was generated by hypermail 2.1.8 : Wed Jan 23 2013 - 20:38:31 MST