[gradsusr] Simple loop question

Matt Masarik mmasarik at atmos.ucla.edu
Fri Jul 12 17:35:13 EDT 2013


Hi Emily,

The short answer is


t = 1
while ( t <= 62 )

       sdfopen  filename(t)
       set dfile t
       * do whatever with file t data *

t = t + 1
endwhile


Download this document:
         http://www.iges.org/grads/gadoc/reference_card_scl.pdf
it has lots of good info, including the code above.  You should
also become familiar with the grads webpage.

As a note, I think there is a limit to how many files you can
have open at once, and 62 is quite possibly to many.
If you don't need multiple files open at once, close them
once you finish with them---add   close t     to the
loop above.   That should give you a good head start.

Matt



On 07/12/2013 08:18 AM, Emily Wilson wrote:
> Hello,
> I am trying to write a simple loop but I cannot figure out the GrADS 
> code.  I have 62 netCDF files that I want to be read. Therefore I want 
> to code a loop so that for i in 1948-2010 sdfopen air.sig995.*.nc.  
> The * is where the year goes in the file name.  How should I script 
> this loop?
> Thanks in advance,
> *Emily P. Wilson, Intern*
> Research and Conservation Department
> Denver Botanic Gardens
> 1007 York St.
> Denver, CO 80206
> 720-865-3593
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20130712/7b88d6bb/attachment-0003.html 


More information about the gradsusr mailing list