Thanks a lot Rahiz. That would do .. It is still wandering in me if at all I can use templates to create a .ctl(descriptor file) to access all the files.(<a href="http://www.iges.org/grads/gadoc/templates.html">http://www.iges.org/grads/gadoc/templates.html</a>).<div>
<br></div><div><br></div><div>Thanks,</div><div>Subash</div><div><br><div class="gmail_quote">On Mon, Feb 7, 2011 at 2:42 AM, Muhammad Rahiz <span dir="ltr"><<a href="mailto:muhammad.rahiz@ouce.ox.ac.uk">muhammad.rahiz@ouce.ox.ac.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">The following code would allow you to open multiple files but you need to make a list of files you want to open as *.txt (e.g. inputfiles.txt)<br>
<br>
n = 10 # where n is the total number of files in inputfiles.txt<br>
m = 1<br>
while(m< n+1)<br>
ifile = 'inputfiles.txt'<br>
rec = read(ifile)<br>
<br>
IO = sublin(rec,1)<br>
if(IO = 1)<br>
say ifile' > File open error'<br>
endif<br>
if (IO = 0)<br>
a = subwrd(rec,2)<br>
endif<br>
<br>
'sdfopen 'a''<br>
say ''a''<br>
'quit'<br>
m = m +1<br>
endwhile<br>
<br>
<br>
If you're using GrADS in Linux/Unix environment, the following would work as well;<br>
<br>
#!/bin/bash<br>
<br>
for i in $(ls *.nc); do<br>
<br>
cat > <a href="http://grads.gs" target="_blank">grads.gs</a> << EOF<br>
'sdfopen $i'<br>
say '$i'<br>
'quit'<br>
EOF<br>
grads -blc 'run <a href="http://grads.gs" target="_blank">grads.gs</a>'<br>
<br>
done<br>
<br>
<br>
HTH,<br>
---<div><div></div><div class="h5"><br>
Muhammad Rahiz<br>
Researcher & DPhil Candidate (Climate Systems & Policy)<br>
School of Geography & the Environment<br>
University of Oxford<br>
<br>
On Sun, 6 Feb 2011, Subash Yeggina wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi! Muhammad, <br>
sdfopen <a href="http://inputfile.nc" target="_blank">inputfile.nc</a> is to read one file. I would like to know how to read<br>
all the files using 'templates'.<br>
<br>
<br>
Thanks,<br>
Subash<br>
<br>
On Sun, Feb 6, 2011 at 9:50 PM, Muhammad Rahiz<br>
<<a href="mailto:muhammad.rahiz@ouce.ox.ac.uk" target="_blank">muhammad.rahiz@ouce.ox.ac.uk</a>> wrote:<br>
<br>
sdfopen <a href="http://inputfile.nc" target="_blank">inputfile.nc</a><br>
<br>
<br>
<br>
Muhammad Rahiz<br>
Researcher & DPhil Candidate (Climate Systems & Policy)<br>
School of Geography & the Environment<br>
University of Oxford<br>
<br>
On Sun, 6 Feb 2011, Subash Yeggina wrote:<br>
<br>
> Hi! All,<br>
> I have 1 year 3B42 3hr TRMM data in NetCDF format. My question is<br>
how to<br>
> write the template file to read all the data is GrADS.<br>
><br>
><br>
> Thanks & Regards,<br>
> Subash<br>
><br>
><br>
_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br>
<br>
<br>
</blockquote>
</div></div><br>_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br></blockquote></div><br></div>