<div dir="ltr"><div><div>@Arka: Please read the <br><br><a href="https://www.ncl.ucar.edu/Document/Manuals/">https://www.ncl.ucar.edu/Document/Manuals/</a><br><br><ul><li><a href="https://www.ncl.ucar.edu/Document/Manuals/NCL_User_Guide">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">Mini-Language (pdf)</a></li></ul><p>====================================<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">https://www.ncl.ucar.edu/Document/Functions/Built-in/addfiles.shtml</a><br><a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/ListSetType.shtml">https://www.ncl.ucar.edu/Document/Functions/Built-in/ListSetType.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">https://www.ncl.ucar.edu/Applications/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"><strong>fbindirread</strong></a>("BigBinary.dat",rec,dim,type)

    Sequential Access:        data = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/fbinrecread.shtml"><strong>fbinrecread</strong></a>("BigBinary.dat",rec,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">http://www.ncl.ucar.edu/Document/Functions/Built-in/fbindirread.shtml</a><br><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/fbinrecread.shtml">http://www.ncl.ucar.edu/Document/Functions/Built-in/fbinrecread.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">http://www.ncl.ucar.edu/Document/Functions/Built-in/isbigendian.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"><strong>setfileoption</strong></a>("bin","ReadByteOrder","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.dat")) 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"><strong>fbindirread</strong></a>("BigBinary.dat",rec,dim,type)

    Sequential Access:        data = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/fbinrecread.shtml"><strong>fbinrecread</strong></a>("BigBinary.dat",rec,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="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="h5"><br>
<br>
On Wed, Dec 20, 2017 at 9:13 AM, Arka Banerjee via ncl-talk<br>
<<a href="mailto:ncl-talk@ucar.edu">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">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>
<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">laura@ucar.edu</a><br>
phone: <a href="tel:303-497-1628" value="+13034971628">303-497-1628</a><br>
<br>
!-----------------------------<wbr>------------------------------<wbr>------------------------------<wbr>--------------------<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></div>