<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Simple examples are always better.&nbsp;<br class="">e.g.<br class=""><br class=""><font face="Menlo" class="">alist = [/ 189., 25., 76., 34./]<br class="">write_table("list.txt", "a", alist, "%5.5f”)</font><div class=""><font face="Menlo" class=""><br class="">;;<br class="">;;more list.txt<br class="">;189.00000<br class=""></font><br class=""><br class="">This also makes it easier for you to test the problem.&nbsp;<br class=""><br class=""><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/write_table.shtml" class="">http://www.ncl.ucar.edu/Document/Functions/Built-in/write_table.shtml</a><br class=""><br class=""><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><i class=""></i><blockquote type="cite" class=""></blockquote></blockquote><blockquote type="cite" class=""><i class="">format</i><br class="">The format for of each (first) element of the list.&nbsp; &nbsp;<br class=""></blockquote><br class="">you need a format string for each column of your list (your list is only one row long but you still need a format for each column).&nbsp;<br class=""><br class="">e.g.<br class=""><br class=""><font face="Menlo" class="">write_table("list.txt", "a", alist, "%5.5f %5.5f %5.5f %5.5f&nbsp;“)</font><div class=""><font face="Menlo" class=""><br class=""></font>dynamically you could get clever about it and do the below:<br class=""><br class=""><font face="Menlo" class="">fmt = new( ListCount(alist), "string")<br class="">fmt = "%5.5f â€œ &nbsp;<span class="Apple-tab-span" style="white-space:pre">                </span>&nbsp;;; only works if every column has the same format.<br class="">write_table("list.txt", "a", alist, &nbsp; str_concat(</font><span style="font-family: Menlo;" class="">fmt</span><font face="Menlo" class="">) &nbsp; ) &nbsp;;; turn array of formats into long string.&nbsp;</font><br class=""><br class=""><br class=""><br class=""><br class=""><br class="">Good luck.&nbsp;<div class=""><br class=""></div><div class="">Alan</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><span style="orphans: 2; widows: 2;" class="">##############################</span><br style="orphans: 2; widows: 2;" class=""><span style="orphans: 2; widows: 2;" class="">Alan Brammer,</span><div style="orphans: 2; widows: 2;" class="">Post-Doc Researcher</div><div style="orphans: 2; widows: 2;" class=""><br class=""></div><div style="orphans: 2; widows: 2;" class="">Department of Atmospheric and&nbsp;Environmental Sciences,<br class="">University at Albany,&nbsp;State University of New&nbsp;York,&nbsp;Albany, NY, 12222<div class="">abrammer@albany.edu<br class="">##############################</div></div><br class=""><br class=""><blockquote type="cite" class="">On 14 Jun 2016, at 01:52, snow &lt;snowflake_822@yahoo.com&gt; wrote:<br class=""><br class=""><br class="">&nbsp;<br class="">To whom it may concern,<br class=""><br class="">I have written a simple NCL code to extract and take the average of my data and write the table of my data. but in the write part the output&nbsp;is only one data instead of 4.<br class=""><br class="">I wrote this email. to find any kind of help.<br class=""><br class="">I appreciate your time and kindness.<br class=""><br class="">Best regards,<br class=""><br class="">Snow Sho<br class=""><br class=""><br class="">this is the code:<br class=""><blockquote id="yui_3_16_0_ym19_1_1465879989122_8121" style="font-size: 13px;" abp="3357" type="cite" class="">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br class="">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br class="">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br class="">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"<br class="">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br class="">begin<br class="">;----------------------------------------------------------------------<br class="">; WRF data translate NetCDF file to &nbsp;ascii file &nbsp;<br class="">;----------------------------------------------------------------------<br class=""><br class="">&nbsp; &nbsp; infile=("wrfout_d03_2007-07-24_00_00_00")<br class="">&nbsp; &nbsp; fn=dimsizes(infile)<br class="">&nbsp; &nbsp; fin=addfile(infile,"r")<br class="">&nbsp; &nbsp; R=fin-&gt;RAINNC(0,:,:)<br class="">&nbsp; &nbsp; &nbsp;a=(/189,193,191,192,192,193,192,188,198,196,192,187,197,194,190,187,197,196,195,195,196/)<br class="">&nbsp; &nbsp; &nbsp;b=(/285,286,287,288,289,290,291,292,293,294,295,296,296,297,298,299,298,299,300,301,302/)<br class="">&nbsp; &nbsp; &nbsp;c=(/180,174,172,181,179,173,184,175,185,174,184,173,183,193,182,191,179,189,178,188,176/)<br class="">&nbsp; &nbsp; &nbsp;d=(/264,266,267,267,268,269,270,270,271,271,272,273,273,273,274,273,275,274,276,275,277/)<br class="">&nbsp; &nbsp; &nbsp;e=(/202,205,206,206,198,197,206,205,204,202,200,200,200,200,210,209,205,202,212,208,204,203/)<br class="">&nbsp; &nbsp; &nbsp;f=(/270,271,272,273,274,276,277,278,279,280,281,282,283,284,284,284,285,286,287,288,289,290/)<br class="">&nbsp; &nbsp; &nbsp;g=(/208,208,209,210,211,210,207,205,215,212,213,215,216,207,209,210,211,214,215,209,211,215,214/)<br class="">&nbsp; &nbsp; &nbsp;h=(/263,264,265,266,267,267,268,269,269,270,271,273,274,276,277,278,279,279,280,282,283,284,287/)<br class="">&nbsp; &nbsp; &nbsp; &nbsp; R1=new((/21/),"float") &nbsp; &nbsp; &nbsp; &nbsp;<br class="">&nbsp; &nbsp; &nbsp; &nbsp; R2=new((/21/),"float")<br class="">&nbsp; &nbsp; &nbsp; &nbsp; R3=new((/22/),"float")<br class="">&nbsp; &nbsp; &nbsp; &nbsp; R4=new((/23/),"float")<br class=""><br class="">&nbsp; &nbsp; &nbsp; &nbsp; do k=0,20<br class="">&nbsp; &nbsp; &nbsp; &nbsp; R1(k)=R(a(k),b(k))<br class="">&nbsp; &nbsp; &nbsp; &nbsp; end do<br class="">&nbsp; &nbsp; &nbsp;; &nbsp;print(R1)<br class="">&nbsp; &nbsp; &nbsp; &nbsp; do k=0,20<br class="">&nbsp; &nbsp; &nbsp; &nbsp; R2(k)=R(c(k),d(k))<br class="">&nbsp; &nbsp; &nbsp; &nbsp; end do<br class="">&nbsp; &nbsp; &nbsp; &nbsp; do k=0,21<br class="">&nbsp; &nbsp; &nbsp; &nbsp; R3(k)=R(e(k),f(k))<br class="">&nbsp; &nbsp; &nbsp; &nbsp; end do<br class="">&nbsp; &nbsp; &nbsp; &nbsp; do k=0,22<br class="">&nbsp; &nbsp; &nbsp; &nbsp; R4(k)=R(g(k),h(k))<br class="">&nbsp; &nbsp; &nbsp; &nbsp; end do<br class="">&nbsp; &nbsp; &nbsp; &nbsp; R5=avg(R1(:))<br class="">&nbsp; &nbsp; &nbsp; &nbsp; R6=avg(R2(:))<br class="">&nbsp; &nbsp; &nbsp; &nbsp; R7=avg(R3(:))<br class="">&nbsp; &nbsp; &nbsp; &nbsp; R8=avg(R4(:))<br class=""><br class="">&nbsp; &nbsp; &nbsp; &nbsp; ca=new((/1/),"float")<br class="">&nbsp; &nbsp; &nbsp; &nbsp; ca=(/R5/)<br class="">&nbsp; &nbsp; &nbsp; &nbsp; cb=new((/1/),"float")<br class="">&nbsp; &nbsp; &nbsp; &nbsp; cb=(/R6/)<br class="">&nbsp; &nbsp; &nbsp; &nbsp; cc=new((/1/),"float")<br class="">&nbsp; &nbsp; &nbsp; &nbsp; cc=(/R7/)<br class="">&nbsp; &nbsp; &nbsp; &nbsp; cd=new((/1/),"float")<br class="">&nbsp; &nbsp; &nbsp; &nbsp; cd=(/R8/)<br class=""><br class="">; &nbsp; alist=[/R5,R6,R7,R8/]<br class="">&nbsp; &nbsp;alist=[/ca,cb,cc,cd/]<br class="">&nbsp; write_table("list.txt", "a", alist, "%5.5f")<br class="">&nbsp; end<br class=""></blockquote><br class=""><br class=""><br class="">_______________________________________________<br class="">ncl-talk mailing list<br class="">ncl-talk@ucar.edu<br class="">List instructions, subscriber options, unsubscribe:<br class="">http://mailman.ucar.edu/mailman/listinfo/ncl-talk<br class=""></blockquote><br class=""></div><br class=""><div class=""><br class="">
</div>
<br class=""></div></div></body></html>