n = 10 evlr = random_uniform(-1,1,n) ; place-holder numbers evlr@eigright = random_uniform(10,20,(/n,n/)) ; place-holder numbers evlr@eigleft = random_uniform(15,25,(/n,n/)) ; ncl-talk numbers evlr@eigr = (/ 0.8869482, 0.8869482, 0.9359075, 0.6810071, 0.6810071 \ ,-0.06872535, 0.0454572, 0.0454572, 0.192471 , 0.6176199 /) evlr@eigi = (/ 0.1857084,-0.1857084, 0, 0.2888337, -0.2888337\ , 0, 0.1147234,-0.1147234, 0, 0 /) evlr@eigv_length = (/ 0.9061815, 0.9061815, 0.9359075, 0.7397267, 0.7397267 \ , 0.06872535, 0.123401 , 0.123401 , 0.192471 , 0.6176199/) printVarSummary(evlr) print("===") ;=== ; ncl-talk: ; is that possible to sort the array by one of the attribute? ; For example, I want the variable evlr show in descending order of the attribute eigv_length. ;=== ; http://www.ncl.ucar.edu/Document/Functions/Built-in/dim_pqsort.shtml ; http://www.ncl.ucar.edu/Document/Functions/Built-in/dim_pqsort_n.shtml ;=== kflag = -1 ; return the permutation vector resulting from sorting x in decreasing order and do not sort x. id = dim_pqsort(evlr@eigv_length, kflag) print(id) print("===") eigv_len_sort = evlr@eigv_length(id) eigr_sort = evlr@eigr(id) eigi_sort = evlr@eigi(id) ;http://www.ncl.ucar.edu/Document/Functions/Built-in/sprintf.shtml print(id+" "+sprintf("%9.6f",eigv_len_sort)+" "+sprintf("%9.6f",eigr_sort)+" "+sprintf("%9.6f",eigi_sort)) print("===")