[ncl-talk] Joing two uneven files.

Mary Haley haley at ucar.edu
Mon Sep 26 13:26:15 MDT 2016


Geeta,

Instead of using "print" to append the values, I suggest using
"write_table":

http://www.ncl.ucar.edu/Document/Functions/Built-in/write_table.shtml

There are several examples on this page that should help you out

--Mary


On Sat, Sep 24, 2016 at 9:06 AM, Geeta Geeta <geetag54 at yahoo.com> wrote:

> Hi all.
> I request for some help.
>
> I have two files which look like this.
>
> aditya at agniilap:~/geeta/ncl/ReadHDF-2A25$ ls -lrt 11n67* Z.txt.20080324.70
> -rw-rw-r-- 1 aditya aditya  760240 Sep 16 21:57 Z.txt.20080324.70   (17680
> Lines)
> -rw-rw-r-- 1 aditya aditya 5430095 Sep 24 01:17 11n67
> (18326 Lines)
>
> File 11n67 is like this...
> Line No  NS  NPix  ZLev11   .......................Zlev67
>  1 2915    0       0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
> 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
> 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
> 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
> 0.00
>       2 2915    1       0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
> 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
> 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
> 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
> 0.00 0.00
>       3 2915    2       0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
> 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
> 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
> 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
> 0.00 0.00
>       4 2915    3       0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
> 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
> 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
> 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
> 0.00 0.00
>
>
>
>
>
>
> 18326 3288    48      0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
> 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
> 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
> 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
> 0.00 0.00
>
>
>
> Z.txt.20080324.70 Looks like this.
> Line No      NS            NPix     Lev    Z
> 17659        3288         27         70     0.00
>   17660        3288         28         70     0.00
>   17661        3288         29         70     0.00
>   17662        3288         30         70     0.00
>   17663        3288         31         70     0.00
>   17664        3288         32         70     0.00
>   17665        3288         33         70     0.00
>   17666        3288         34         70     0.00
>   17667        3288         35         70     0.00
>   17668        3288         36         70     0.00
>   17669        3288         37
>
>
> I have to append the value of Z from the 2nd file at one point (say
> 3288/35) to the same point in the first file.
> I used if statement, but I am not able to get what I desired (Code
> attached).
>
> I want the file 11n67 to be appended with value of Z from 2nd file at the
> common points.
>
> Thanks
> Geeta.
>
> _______________________________________________
> 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/20160926/201404a8/attachment.html 


More information about the ncl-talk mailing list