<div dir="ltr">Hi:<div><br></div><div>Here is what you need (example)</div><div><br></div><div>







<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:17px;line-height:normal;font-family:"Courier New";color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>DATADir = "/data1/wrf/NAM/"</span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:17px;line-height:normal;font-family:"Courier New";color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space">  </span>diri = DATADir  ; you can add "+ date" if you have files listed in directories by date.</span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:17px;line-height:normal;font-family:"Courier New";color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>all_files = systemfunc("ls " + diri + "</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures;background-color:rgb(230,230,0)">nam</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">*grb")</span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:17px;line-height:normal;font-family:"Courier New";color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>print("all_files = " + all_files)</span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:17px;line-height:normal;font-family:"Courier New";color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>n_files = dimsizes(all_files)</span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:17px;line-height:normal;font-family:"Courier New";color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>print("n_files = " + n_files)</span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:17px;line-height:normal;font-family:"Courier New";color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">;do n=0,n_files -1,1</span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:17px;line-height:normal;font-family:"Courier New";color:rgb(0,0,0);background-color:rgb(255,255,255)"><br></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:17px;line-height:normal;font-family:"Courier New";color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>do n=12,14</span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:17px;line-height:normal;font-family:"Courier New";color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space">   </span>print("all_files(n) = " + all_files(n))</span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:17px;line-height:normal;font-family:"Courier New";color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space">   </span>file</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures;background-color:rgb(230,230,0)">nam</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">e = all_files(n)</span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:17px;line-height:normal;font-family:"Courier New";color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space">   </span>print ("file</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures;background-color:rgb(230,230,0)">nam</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">e" + file</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures;background-color:rgb(230,230,0)">nam</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">e)</span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:17px;line-height:normal;font-family:"Courier New";color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space">   </span>a = addfile(file</span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures;background-color:rgb(230,230,0)">nam</span><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">e,"r")</span></p></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 21, 2017 at 8:31 AM, Arka Banerjee via ncl-talk <span dir="ltr"><<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">If one write the following line what does it mean?<div dir="auto"><br></div><div dir="auto">Fn=(/"day1.dat","day2.dat","<wbr>day3.dat","day4.dat"/)</div><div dir="auto"><br></div><div dir="auto">The above line is not mean that all dat file names are concatenate in variable Fn?</div><div dir="auto">I required the same thing for 100 files but without manually putting the file name.</div><div dir="auto"><br></div><div dir="auto">That was the question.</div><div dir="auto"><br></div><div dir="auto">Thanks,</div><div dir="auto">Arka</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Dec 21, 2017 01:37, "Dennis Shea" <<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>> wrote:<br type="attribution"><blockquote class="m_2048339712400554977quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>@Arka: Please read the <br><br><a href="https://www.ncl.ucar.edu/Document/Manuals/" target="_blank">https://www.ncl.ucar.edu/Docum<wbr>ent/Manuals/</a><br><br><ul><li><a href="https://www.ncl.ucar.edu/Document/Manuals/NCL_User_Guide" target="_blank">NCL User Guide, V1.1</a> <img src="https://www.ncl.ucar.edu/Images/new.gif">
</li><li><a href="https://www.ncl.ucar.edu/Document/Manuals/language_man.pdf" target="_blank">Mini-Language (pdf)</a></li></ul><p>==============================<wbr>======<br></p></div><div>NCL does allow a user to specify a <b><i>variable</i> </b>which spans multiple netCDF, grib or HDF files to (effectively) be concatenated via <b>addfiles </b>and the appropriate<b> ListSetType </b>options. <b>NOTE: the files are not concatenated ....only the specified variable.<br></b><br><a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/addfiles.shtml" target="_blank">https://www.ncl.ucar.edu/Docum<wbr>ent/Functions/Built-in/addfile<wbr>s.shtml</a><br><a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/ListSetType.shtml" target="_blank">https://www.ncl.ucar.edu/Docum<wbr>ent/Functions/Built-in/ListSet<wbr>Type.shtml</a><br></div><div><br>=====<br>There is <b>no </b>explicit NCL function which concatenates <b>binary</b> or <b>text</b> (ascii)<i> files</i>.  <br>Please Read: <a href="https://www.ncl.ucar.edu/Applications/r-binary.shtml" target="_blank">https://www.ncl.ucar.edu/Appli<wbr>cations/r-binary.shtml</a><br></div><div><br>===<br></div><div>Some options:<br><br></div><div>[1] On the {U/Li}nix command line:<br><br></div><div>%> <b>cat</b> LocalBinaryFiles*dat <b>>!</b> BigBinary.dat<br></div><div><br></div>The <b>!</b> will overwrite 'BigBinary.dat' if the file currently exits.<br><br></div><div>Depending on the binary file type, use:<br></div><pre>    Direct Access:            data = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/fbindirread.shtml" target="_blank"><strong>fbindirread</strong></a>("BigBinary.dat",re<wbr>c,dim,type)

    Sequential Access:        data = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/fbinrecread.shtml" target="_blank"><strong>fbinrecread</strong></a>("BigBinary.dat",re<wbr>c,dim,type)<br><br></pre><pre><b>Please read</b> the documentation for these function:<br><br><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/fbindirread.shtml" target="_blank">http://www.ncl.ucar.edu/Docume<wbr>nt/Functions/Built-in/fbindirr<wbr>ead.shtml</a><br><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/fbinrecread.shtml" target="_blank">http://www.ncl.ucar.edu/Docume<wbr>nt/Functions/Built-in/fbinrecr<wbr>ead.shtml</a><br><br></pre><pre>also, binary files could be '<i>BigEndian</i>" or '<i>LittleEndian</i><b>. </b>The following allows you to specify<br><br><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/isbigendian.shtml" target="_blank">http://www.ncl.ucar.edu/Docume<wbr>nt/Functions/Built-in/isbigend<wbr>ian.shtml</a><br><br> if (<strong>isbigendian</strong>() ) then   ; is local machine big or little endian?
     <a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/setfileoption.shtml" target="_blank"><strong>setfileoption</strong></a>("bin","ReadByteO<wbr>rder","LittleEndian")
 end if
</pre><pre> x = <b>fbindirread</b>(...)<br></pre><pre>or<br></pre><pre> c = <b>fbinrecread</b>(...)<br><br></pre><pre>Sfter you are finished, you may want to delete the 'BigBinary.dat' file<br><br></pre><pre>%> rm BigBinary.dat<br><br></pre><pre>Or, perhaps the individual binary files and keep the concatenated file:<br><br></pre><pre>%> rm LittleBinary*dat<br></pre><pre><br>[2] <br><br></pre><pre>diri = ".../"    ; input dir<br></pre><pre>if (<strong>.not.fileexists</strong>("BigBinary.da<wbr>t")) then</pre><pre>    system("cat LocalBinary*dat >! "BigBinary.dat")<br></pre><pre>end if<br></pre><pre><br>    Direct Access:            data = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/fbindirread.shtml" target="_blank"><strong>fbindirread</strong></a>("BigBinary.dat",re<wbr>c,dim,type)

    Sequential Access:        data = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/fbinrecread.shtml" target="_blank"><strong>fbinrecread</strong></a>("BigBinary.dat",re<wbr>c,dim,type)<br><br><br><br><br><br></pre><pre>   <br></pre><div><div><div><div><div><div><br></div></div></div></div></div></div></div><div class="m_2048339712400554977elided-text"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 20, 2017 at 10:27 AM, Laura Fowler via ncl-talk <span dir="ltr"><<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Arka:<br>
<br>
I usually use systemfunc, followed with ListSetType, and then addfiles<br>
to read a bunch of the same kind of files together. There are lots of<br>
examples on how to use systemfun on the ncl web site.<br>
<br>
Hope this helps,<br>
Laura<br>
<div><div class="m_2048339712400554977m_12629403495640755h5"><br>
<br>
On Wed, Dec 20, 2017 at 9:13 AM, Arka Banerjee via ncl-talk<br>
<<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>> wrote:<br>
> Hi all,<br>
><br>
> How to concatenate all file names in a single variable in NCL? I have 100 of<br>
> .dat files in a directory and I want to call them all in a variable like<br>
> below;<br>
><br>
> fn=(/"gsmap_nrt.20100805.0600.<wbr>dat","gsmap_nrt.20100805.0900.<wbr>dat"/)<br>
><br>
> So that 'fn' will be re-structured for 100 of .dat files in the same way of<br>
> above line.<br>
><br>
><br>
> How to execute this thing? Function 'addfiles' helps in this case? As I have<br>
> found it is not for ascii formate.<br>
><br>
><br>
> Thanks,<br>
><br>
> Arka<br>
><br>
</div></div>> ______________________________<wbr>_________________<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/mailma<wbr>n/listinfo/ncl-talk</a><br>
><br>
<br>
<br>
<br>
--<br>
!-----------------------------<wbr>------------------------------<wbr>------------------------------<wbr>--------------------<br>
Laura D. Fowler<br>
Mesoscale and Microscale Meteorology Division (MMM)<br>
National Center for Atmospheric Research<br>
P.O. Box 3000, Boulder CO 80307-3000<br>
<br>
e-mail: <a href="mailto:laura@ucar.edu" target="_blank">laura@ucar.edu</a><br>
phone: <a href="tel:303-497-1628" value="+13034971628" target="_blank">303-497-1628</a><br>
<br>
!-----------------------------<wbr>------------------------------<wbr>------------------------------<wbr>--------------------<br>
______________________________<wbr>_________________<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/mailma<wbr>n/listinfo/ncl-talk</a><br>
</blockquote></div><br></div>
</div></blockquote></div><br></div>
</div></div><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>
<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>