[ncl-talk] data_arrange

Dennis Shea shea at ucar.edu
Thu Feb 9 15:05:27 MST 2017


I'm not sure of the objective. Please read all documentation carefully.
===
   ncol =6
   data = readAsciiTable("kunal.txt", ncol, "float", 1)   ; file attached
   dimd = dimsizes(data)
   nrow = dimd(0)

   write_matrix (data, ncol+"f7.2", False)
   print("===")

   ip = dim_pqsort_n(data(:,ncol-1), 1, 0)  ; sort on 'value'
   print(ip)
   print("===")

   print(data(ip,3)+"  "+data(ip,4)+"  "+data(ip,5))  ; sort order
   print("===")

--------------

(0)    22.5  80.5  0.137148
(1)    21.5  80.5  0.142752
(2)    22.5  81.5  0.146989
(3)    21.5  81.5  0.152621
(4)    22.5  82.5  0.163371
(5)    22.5  83.5  0.173756
(6)    21.5  82.5  0.183771
(7)    21.5  83.5  0.20762
(8)    22.5  84.5  0.212553
(9)    21.5  84.5  0.222279
(10)    21.5  85.5  0.247331
(11)    22.5  85.5  0.258845
(12)    22.5  86.5  0.287599
(13)    21.5  86.5  0.303266
(14)    22.5  87.5  0.349944
(15)    21.5  87.5  0.402958
(16)    21.5  88.5  0.48809
(17)    21.5  89.5  0.541822



On Thu, Feb 9, 2017 at 2:19 PM, Tao Lu <hakufu.asano at gmail.com> wrote:

> Hello
>
> https://github.com/yyr/ncl/blob/master/ni/src/lib/nfpfort/dpsort.f
> I sort data use the above subroutine.
> Please read its comments.
>
> Hope this helps.
> Tao
>
> On Thu, Feb 9, 2017 at 2:37 PM, Kunal Bali <kunal.bali9 at gmail.com> wrote:
>
>> Dear NCL users
>>
>> I have sorted DATA1 in ascending order. Doing this, the lat lon also
>> sorted in ascending order. now I want to arrange the DATA2 values in the
>> same order with respect to lat lon.
>>
>> is there any function to do it?
>>
>>
>> lat      lon        DATA1                   lat    lon       DATA2
>> 21.5    80.5    0.1927848193        21.5    80.5    0.1427516818
>> 22.5    80.5    0.2107088708 <(210)%20708-8708>        21.5    81.5
>> 0.1526213445
>> 23.5    84.5    0.2248266773 <022%204826%206773>        21.5    82.5
>> 0.1837707819 <0183%20770%207819>
>> 22.5    81.5    0.230950011          21.5    83.5    0.2076204493
>> 23.5    81.5    0.2398354544 <(239)%20835-4544>        21.5    84.5
>> 0.2222786461
>> 23.5    84.5    0.2431923192        21.5    85.5    0.2473306756
>> 23.5    83.5    0.2475542286 <02475%20542%20286>        21.5    86.5
>> 0.3032659014 <(303)%20265-9014>
>> 23.5    82.5    0.2486582397 <02486%20582%20397>        21.5    87.5
>> 0.4029584168 <040%202958%204168>
>> 22.5    80.5    0.2496962144 <(249)%20696-2144>        21.5    88.5
>> 0.4880898753
>> 21.5    80.5    0.249698807          21.5    89.5    0.5418224582
>> 21.5    81.5    0.2514767561 <0251%20476%207561>        22.5    80.5
>> 0.1371483111 <01371%20483%20111>
>> 22.5    80.5    0.2517710963 <0251%20771%200963>        22.5    81.5
>> 0.1469887603
>> 22.5    85.5    0.2518815909 <(251)%20881-5909>        22.5    82.5
>> 0.1633707824
>> 23.5    83.5    0.252597573          22.5    83.5    0.1737561754
>> 21.5    80.5    0.2531392525        22.5    84.5    0.2125528036
>> 21.5    80.5    0.2542876833 <(254)%20287-6833>        22.5    85.5
>> 0.258845448
>> 21.5    80.5    0.256160506          22.5    86.5    0.2875988691
>> 23.5    84.5    0.2594303921 <02594%20303%20921>        22.5    87.5
>> 0.3499443093
>>
>>
>> Kunal Bali
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
>
> --
> ******************************************************
> 盧 涛 (ル タオ) 修士課程2年
>
> 〒112-8551 東京都文京区春日1-13-27
>
> 中央大学理工学研究科都市環境学専攻
>
> 河川・水文研究室(山田正教授)
>
>
> TEL: 03-3817-3406;   Phone: 070-2188-7509
> Email1: hakufu.asano at gmail.com <mail%3Amet.yamos at gmail.com>
> Email2: lutao at civil.chuo-u.ac.jp <mail%3Ayamoto at civil.chuo-u.ac.jp>
> *******************************************************
> ******************************************************
> Tao Lu    (M. Eng)
> Laboratory of River Engineering and Hydrology,
> Dept. of Civil and Environmental Engineering,
> Graduate School of Science and Engineering,
> Chuo University
>
> 1-13-27,Kasuga,Bunkyo-ku,Tokyo
> 112-8551, Japan
> TEL: 03-3817-1805;   Phone: 070-2188-7509
> Email1: hakufu.asano at gmail.com <mail%3Amet.yamos at gmail.com>
> Email2: lutao at civil.chuo-u.ac.jp <mail%3Ayamoto at civil.chuo-u.ac.jp>
> *****************************************************
>
> _______________________________________________
> ncl-talk mailing list
> 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/20170209/217a22fd/attachment.html 
-------------- next part --------------
lat      lon        DATA1                   lat    lon       DATA2
21.5    80.5    0.1927848193        21.5    80.5    0.1427516818
22.5    80.5    0.2107088708        21.5    81.5    0.1526213445
23.5    84.5    0.2248266773        21.5    82.5    0.1837707819
22.5    81.5    0.230950011          21.5    83.5    0.2076204493
23.5    81.5    0.2398354544        21.5    84.5    0.2222786461
23.5    84.5    0.2431923192        21.5    85.5    0.2473306756
23.5    83.5    0.2475542286        21.5    86.5    0.3032659014
23.5    82.5    0.2486582397        21.5    87.5    0.4029584168
22.5    80.5    0.2496962144        21.5    88.5    0.4880898753
21.5    80.5    0.249698807          21.5    89.5    0.5418224582
21.5    81.5    0.2514767561        22.5    80.5    0.1371483111
22.5    80.5    0.2517710963        22.5    81.5    0.1469887603
22.5    85.5    0.2518815909        22.5    82.5    0.1633707824
23.5    83.5    0.252597573          22.5    83.5    0.1737561754
21.5    80.5    0.2531392525        22.5    84.5    0.2125528036
21.5    80.5    0.2542876833        22.5    85.5    0.258845448
21.5    80.5    0.256160506          22.5    86.5    0.2875988691
23.5    84.5    0.2594303921        22.5    87.5    0.3499443093


More information about the ncl-talk mailing list