<div dir="ltr"><div>HI,</div><div><br></div><div>addfiles() returns a *list* of filevars, whereas getfilevarnames expects a filevar. If you know all the files to be uniform in structure, you could simple pick one of them, say the first, to get the names:</div><div><br></div><div> names = getfilevarnames(f[0])</div><div><br></div><div>Also, see the docs for addfiles():</div><div><br></div><div><a href="http://ncl.ucar.edu/Document/Functions/Built-in/addfiles.shtml">http://ncl.ucar.edu/Document/Functions/Built-in/addfiles.shtml</a></div><div><br></div><div>It has this advice:</div><div><br></div><div><li>1. Whereas <a href="http://ncl.ucar.edu/Document/Functions/Built-in/addfile.shtml"><strong>addfile</strong></a> returns a reference to a single file in a
variable of type <b>file</b>, <strong>addfiles</strong> returns a variable
of type <b>list</b> that contains references, each of type <b>file</b>, to multiple files.
This combination of the <b>list</b> and <b>file</b> types forms a specialized <b>list</b> type. It
provides a means of obtaining the aggregated contents of variables that span the complete list of files. <p>
</p></li><li>2. It is not yet possible to use the file <b>list</b> type variable
as input to the "getfile<i>xxxx</i>" suite of functions. However, since each element of the
<b>list</b> is actually a <b>file</b> type variable, you can input a single element of
the <b>list</b> as an argument to any of these functions, e.g.:
<pre> files = <a href="http://ncl.ucar.edu/Document/Functions/Built-in/systemfunc.shtml"><strong>systemfunc</strong></a>("ls *.nc")
f = <strong>addfiles</strong>(files,"r")
dsizes = <a href="http://ncl.ucar.edu/Document/Functions/Built-in/getfiledimsizes.shtml"><strong>getfiledimsizes</strong></a>(f[0])</pre></li><li><br></li><li><pre>Rick <br></pre></li></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Apr 12, 2020 at 6:54 AM Md. Jalal Uddin via ncl-talk <<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi all,<div><br></div><div>I hope that you are all well.</div><div><br></div><div>I am trying to convert grib2 into netcdf. The problem is to use many files together. If I use only one file, it is working fine.</div><div><br></div><div>I have tried to use addfiles function here.</div><div><br></div><div> diri = "./"<br> fili = systemfunc("cd "+diri+" ; ls 20180709_0000f*.grib2")<br> f = addfiles(diri+fili,"r") <br> <br> names = getfilevarnames(f) <br><br>print(names) <br></div><div><br></div><div><br></div><div><b style="background-color:rgb(0,255,0)">fatal:</b>Argument type mismatch on argument (0) of (getfilevarnames) can not coerce</div><div><br></div><div>Any suggestions would be appreciated. The code has been added herewith.</div><div><br></div><div>Best wishes,</div><div>Jalal<br>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><font size="2" color="#000000"><b>Md. Jalal Uddin</b></font></div><div dir="ltr">M.Sc. in Applied Meteorology<br>Nanjing University of Information, Science and Technology, China.</div><div dir="ltr"><span style="letter-spacing:0.2px">B.Sc. in Disaster Management (Hons.) </span><br></div><div dir="ltr"><span style="letter-spacing:0.2px">Patuakhali Science and Technology University, Bangladesh.</span></div><div dir="ltr">Cell: +8613260859092, <span style="letter-spacing:0.2px">+8801792052662</span></div><div dir="ltr"><font size="2">Web: <a href="http://www.dmjalal90.weebly.com" target="_blank">www.dmjalal90.weebly.com</a> </font></div><div dir="ltr">Researchgate: <a href="https://www.researchgate.net/profile/Md_Uddin125" target="_blank">https://www.researchgate.net/profile/Md_Uddin125</a> </div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<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/mailman/listinfo/ncl-talk</a></blockquote></div>