[gradsusr] Loop help

Emily Wilson wilson.emily.parker at gmail.com
Mon Jul 1 16:40:54 EDT 2013


Hello, I am trying to write a script in which a loop is used to compile raw
data values for each month in years 1906-2010 for a specific pair of
lat-long coordinates.  Below is the code I am using.....

 'reinit'

*

'sdfopen
http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/dai_pdsi/pdsi.mon.mean.selfcalibrated.nc
'

*

 'enable print grads.outfile'

  say '** OUTPUT FILE: grads.outfile'

 'clear'

 'set grads off'

 'set mpdset lores'

 'set lon 110W 112.5W'

 'set lat 32N 34.5N'



arg=(pdsi.1,t=673,t=1932,t=1)

var=subwrd(arg,1)

start=subwrd(arg,2)

end=subwrd(arg,3)

by=subwrd(arg,4)

if (by=’’)

by=1

endif

say var ‘=’ start‘ to ‘ end ‘ step ‘ by

*get grads commands

ncmd=0

flag=1

while (flag=1)

  say ‘enter command:’

  pull command.ncmd

  if (command.ncmd = ‘ ‘)

    flag=0

  else

    ncmd=ncmd+1

  endif

endwhile

*

i=start

while (i<= end)

    ‘set ‘ var ‘ ‘ i

    ‘clear’

    ‘set grads off’

    j=0

    while (j< ncmd)

      command.j

      j=j+1

    endwhile

    ‘draw title ‘ var ‘=’ i

    say var ‘=’ i ‘ enter <cr> for next’

    pull x

    i=i+by

endwhile

exit

 I keep getting an error message for line 13.  Could someone please tell me
what is wrong.
Thanks,
*Emily P. Wilson, Intern*
Research and Conservation Department
Denver Botanic Gardens
1007 York St.
Denver, CO 80206
720-865-3593
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20130701/d3448d82/attachment-0003.html 


More information about the gradsusr mailing list