<div dir="ltr"><div>The attached uses <a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/dim_pqsort.shtml"><b>dim_pqsort</b></a><b> </b>to perform a passive sort. The returned indices can be used to sort in ascending or descending order.</div><div>---</div><div><b>%> </b>ncl JingSu.att_sort.ncl</div><div>---</div><div>Variable: id<br>Type: integer<br>Total Size: 40 bytes<br> 10 values<br>Number of Dimensions: 1<br>Dimensions and sizes: [10]<br>Coordinates: <br>(0) 2<br>(1) 0<br>(2) 1<br>(3) 4<br>(4) 3<br>(5) 9<br>(6) 8<br>(7) 7<br>(8) 6<br>(9) 5<br>(0) ===<br>(0) 2 0.935907 0.935907 0.000000<br>(1) 0 0.906182 0.886948 0.185708<br>(2) 1 0.906182 0.886948 -0.185708<br>(3) 4 0.739727 0.681007 -0.288834<br>(4) 3 0.739727 0.681007 0.288834<br>(5) 9 0.617620 0.617620 0.000000<br>(6) 8 0.192471 0.192471 0.000000<br>(7) 7 0.123401 0.045457 -0.114723<br>(8) 6 0.123401 0.045457 0.114723<br>(9) 5 0.068725 -0.068725 0.000000<br></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Oct 19, 2019 at 11:35 AM Jing Sun via ncl-talk <<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="line-height:1.7;color:rgb(0,0,0);font-size:14px;font-family:Arial"><div>Dear NCL users,</div><div><br></div><div>is that possible to sort the array by one of the attribute? </div><div>For example, I want the variable evlr show in descending order of the attribute eigv_length.</div><div><br></div><div><div>Variable: evlr</div><div>Type: float</div><div>Total Size: 1600 bytes</div><div> 400 values</div><div>Number of Dimensions: 1</div><div>Dimensions and sizes: [10]</div><div>Coordinates: </div><div>Number Of Attributes: 5</div><div> eigright :<span style="white-space:pre-wrap"> </span><ARRAY of 100 elements></div><div> eigleft :<span style="white-space:pre-wrap"> </span><ARRAY of 100 elements></div><div> eigi :<span style="white-space:pre-wrap"> </span>( 0.1857084, -0.1857084, 0, 0.2888337, -0.2888337, 0, 0.1147234, -0.1147234, 0, 0 )</div><div> eigr :<span style="white-space:pre-wrap"> </span>( 0.8869482, 0.8869482, 0.9359075, 0.6810071, 0.6810071, -0.06872535, 0.0454572, 0.0454572, 0.192471, 0.6176199 )</div></div><div> eigv_length :<span style="white-space:pre-wrap"> </span>( 0.9061815, 0.9061815, 0.9359075, 0.7397267, 0.7397267, 0.06872535, 0.123401, 0.123401, 0.192471, 0.6176199 )</div><div><br></div><div> Thanks for your help in advance.</div><div><br></div><div>Best regards,</div><div>Jing</div></div><br><br><span title="neteasefooter"><p> </p></span>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>