<div dir="ltr">Hi:<div><br></div><div>If there is no standard NCL program, then...<br><div><br></div><div>One approach is to use WRAPIT and apply it to my_sort.f.</div><div><br></div><div>WRAPIT my_sort.f</div><div><br></div><div>This will create my_sort.so.</div><div><br></div><div>Place this before &quot;begin.&quot;</div><div><br></div><div><div>external MY_SORT &quot;./my_sort.so&quot;</div><div><br></div><div><br></div><div>  begin</div></div><div><br></div><div>Then:</div><div><br></div><div>create three arrays</div><div><br></div><div><div>  r_list =new((/icnt/),float)</div><div>  i_list=new((/icnt/),integer)</div><div>  j_list=new((/icnt/),integer)</div></div><div><br></div><div>If you don&#39;t want a real value and two integers, then change my_sort.f to the correct variable definitions, and modify your definitions above.</div><div><br></div><div>Within the program, call my_sort</div><div><br></div><div>MY_SORT::my_sort(i_cnt,r_list,i_list,j_list)<br></div></div><div><br></div><div>where i_cnt is the number of elements in each one dimensional array.</div><div><br></div><div>The first (r_list) will be sorted and the i_list, and j_list will tag along.</div><div><br></div><div>Barry Lynn</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 6, 2016 at 7:59 AM, Abhik Santra <span dir="ltr">&lt;<a href="mailto:abhiksantra@tropmet.res.in" target="_blank">abhiksantra@tropmet.res.in</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Hi NCL users<br>
<br>
How can I sort an array based on its first column elements?<br>
For example, if<br>
<br>
Ain = (/ (/2,1,3/), (/6,2,4/), (/3,1,5/), (/1,7,4/) /)<br>
<br>
then how can I get<br>
<br>
Aout = (/ (/1,7,4/), (/2,1,3/), (/3,1,5/), (/6,2,4/) /) ?<br>
<br>
Any help would be greatly appreciated.<br>
<br>
Thanks,<br>
Abhik<br>
<br>
******************************<wbr>**********<br>
Abhik Santra<br>
Postdoctoral Research Fellow<br>
Australian Bureau of Meteorology,<br>
Melbourne, Australia<br>
******************************<wbr>**********<br>
<br>
______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">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/<wbr>mailman/listinfo/ncl-talk</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Barry H. Lynn, Ph.D<div><div>Senior Lecturer,</div><div><div><span style="color:rgb(136,136,136)">The Institute of the Earth Science, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">The Hebrew University of Jerusalem, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Givat Ram, Jerusalem 91904, Israel </span><br style="color:rgb(136,136,136)"></div><span style="color:rgb(136,136,136)">Tel: 972 547 231 170</span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Fax: (972)-25662581</span></div></div><div><span style="color:rgb(136,136,136)"><br></span></div><div>C.E.O, Weather It Is, LTD<br>Weather and Climate Focus<br><a href="http://weather-it-is.com" target="_blank">http://weather-it-is.com</a><br>Jerusalem, Israel<br>Local: 02 930 9525<br>Cell: 054 7 231 170<br>Int-IS: x972 2 930 9525<br>US 914 432 3108<br></div></div></div>
</div>