<div dir="ltr"><div><div>I have no idea the name structure of your files. I was using 'nam_xxx_20130208_yyyy_zzz.grb' as a 'strawman' name.<br></div><div>Substitute some name that is relavent for your files.<br></div><div><br></div>This is missing a "<br>files = systemfunc("ls nam_xxx_"+Date+"*grb)<br></div>should have been<br>files = systemfunc("ls nam_xxx_"+Date+"*grb")<br><div><div><div><br><br>====<br><br></div><div>You can play interactively. For convenience, go to "/data1/wrf/NAM/"<br><br></div><div>%> cd /data1/wrf/NAM<br><br></div><div>%> ncl <return><br></div><div><br></div><div>; enter the following<br></div><div><br>Date = "20130208" ; this could be integer also!<br><br>sys_cmd = "ls nam_xxx_"+Date+"*grb" ; use *your* file name structure<br></div><div>print(sys_cmd) ; "ls nam_xxx_20130208*grb"<br></div><div>files = systemfunc( sys_cmd ) ; pass to *nix system<br></div><div>print (files)<br><br>sys_cmd = "ls nam*"+Date+"*grb"<br>print(sys_cmd) ; "ls nam_xxx_20130208_yyyy_zzz*grb:<br></div><div>files = systemfunc( sys_cmd ) ; pass to *nix system<br><br></div><div>exit<br>=================<br><br></div><div>ncl <return><br><br><br><div> DATADir = "/data1/wrf/NAM/"<br><br></div><div>sys_cmd = "ls "+DATADir+"nam*"+Date+"*grb" <br></div><div>print(sys_cmd) ; "cd /data1/wrf/NAM/ ; ls nam*20130208*grb"<br></div><div>FILES = systemfunc(sys_cmd) ; file names only<br></div><div>print(FILES)<br><br><br><br>sys_cmd = "ls "+DATADir+"nam*"+Date+"*grb"<br>print(sys_cmd) ; "ls /data1/wrf/NAM/nam*20130208*grb"<br></div><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 21, 2016 at 12:32 PM, Barry Lynn <span dir="ltr"><<a href="mailto:barry.h.lynn@gmail.com" target="_blank">barry.h.lynn@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Dennis:<div><br></div><div>This was confusing because the subdirectory with the files has a date in its subdirectory name, and the files themselves have a date (but of slightly different format). </div><div><br></div><div>If I need to sub-divide the individual files according to date than I will need to follow your instructions.</div><div><br></div><div>It is unclear to me why ls has Quotes around it since it seems to be a command, while the "nam*grb*" has Quotes around it as well (but is a filename).</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Barry</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 21, 2016 at 9:25 PM, Dennis Shea <span dir="ltr"><<a href="mailto:shea@ucar.edu" target="_blank">shea@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="ltr"><div><div><div><div><div>THX.<br><br></div>So .... your directory structure had each 'Date' in a different directory (diri = DATADir+Date)? <br>This was not clear (to me) in the original message.<br><br></div>I thought it was embedded in the individual file names: eg<br><br> nam_xxx_20130208_yyyy_zzz.grb<br><br>Hence,<br> Date = "20130208/"<br><br></div> files = systemfunc("ls nam_xxx_"+Date+"*grb)<br><br></div>Cheers<span class="m_-5316656144710912460HOEnZb"><font color="#888888"><br></font></span></div><span class="m_-5316656144710912460HOEnZb"><font color="#888888">D<br></font></span></div><div class="m_-5316656144710912460HOEnZb"><div class="m_-5316656144710912460h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 21, 2016 at 12:11 PM, Barry Lynn <span dir="ltr"><<a href="mailto:barry.h.lynn@gmail.com" target="_blank">barry.h.lynn@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Dennis, thank you.<div><br></div><div>Here is the sequence of calls to produce the list, for reference of list users.</div><div><br></div><div><div>begin</div><div>; <a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/systemfunc.shtml" target="_blank">http://www.ncl.ucar.edu/Docume<wbr>nt/Functions/Built-in/systemfu<wbr>nc.shtml</a></div><div>; to retrieve a list of files from another directory</div><div> Date = "20130208/"</div><div> DATADir = "/data1/wrf/NAM/"</div><div> diri = DATADir+Date</div><div> all_files = systemfunc("ls " + diri + "nam*grb") ; notice quotes around ls as well.</div><div> n_files = dimsizes(all_files)</div><div> print("n_files = " + n_files)</div><div> do n=0,n_files -1</div><div> print("all_files(n) = " + all_files(n))</div><div> filename = all_files(n)</div><div> print ("filename" + filename)</div><div> a = addfile(filename,"r")</div><div> nc_file = a</div><div> MY_PRES = nc_file->PRMSL_218_MSL</div><div> print("MY_PRES" + MY_PRES(5,5))</div><div> end do</div><div>end</div></div><div><br></div></div><div class="m_-5316656144710912460m_-7244482390687659969HOEnZb"><div class="m_-5316656144710912460m_-7244482390687659969h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 21, 2016 at 5:51 PM, Dennis Shea <span dir="ltr"><<a href="mailto:shea@ucar.edu" target="_blank">shea@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="ltr"><div>Maybe:<br><br>Date = "20130208"<br></div><div><br></div><div>all_files = systemfunc ("ls nam*"+Date+"*grb"") ; GRIB file in current directory<br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_-5316656144710912460m_-7244482390687659969m_6884118342299020681h5">On Mon, Nov 21, 2016 at 7:28 AM, Barry Lynn <span dir="ltr"><<a href="mailto:barry.h.lynn@gmail.com" target="_blank">barry.h.lynn@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_-5316656144710912460m_-7244482390687659969m_6884118342299020681h5"><div dir="ltr"><div>Hello:</div><div><br></div><div>On: <a href="https://www.ncl.ucar.edu/Applications/addfiles.shtml" target="_blank">https://www.ncl.ucar.edu/Appli<wbr>cations/addfiles.shtml</a></div><div><br></div><div>there is the command:</div><div><br></div><div><pre style="margin-top:0px;margin-bottom:0px;padding:0px;font-size:13.3333px;line-height:12pt;font-family:courier;border-style:solid;border-width:0px 0px 15px;border-color:transparent;color:rgb(0,0,0)">all_files = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/systemfunc.shtml" style="margin:0px;padding:0px;text-decoration:none;color:rgb(133,45,133);font-family:verdana,sans-serif" target="_blank"><strong style="margin:0px;padding:0px">systemfunc</strong></a> ("ls /fs/cgd/data0/casguest/CLASS/a<wbr>nn*.nc")</pre><div>I want to include a variable in the all_files line.</div><div><br></div><div>Date = "20130208"<br></div><div><br></div><div>all_files = systemfunc ("ls 20130208/nam*grb"")<br></div><div><br></div><div>Such that it includes the variable "Date."</div><div><br></div><div>--> all_files = systemfunc ("ls Date + "nam*grb"")</div><div><br></div><div>However, the line immediately above gives an syntax error and anything</div><div>else I have tried is the same.</div><div><br></div><div>Thank you,</div><div><br></div><div>Barry</div><div><br></div><div><br></div>-- <br><div class="m_-5316656144710912460m_-7244482390687659969m_6884118342299020681m_-9027867968692981078m_-7513214583638157239m_-6715655608601859055gmail_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 <a href="tel:914%20432%203108" value="+19144323108" target="_blank">914 432 3108</a><br></div></div></div>
</div></div>
<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></blockquote></div><br></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_-5316656144710912460m_-7244482390687659969m_6884118342299020681gmail_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 <a href="tel:914%20432%203108" value="+19144323108" target="_blank">914 432 3108</a><br></div></div></div>
</div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_-5316656144710912460gmail_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 <a href="tel:914%20432%203108" value="+19144323108" target="_blank">914 432 3108</a><br></div></div></div>
</div>
</div></div></blockquote></div><br></div>