[gradsusr] problem related to while loop in grads....

Kishore Babu kishoreragi at gmail.com
Thu Nov 8 05:45:15 EST 2012


Dear all,

I want to calculate the area average of a variable over the globe. I have
written the grads scripts as follows. It is giving output file, but for
single grid at single level.

'reinit'
'sdfopen sample.nc'
'set t 1 12'
lev=1
while(lev<15)
'set lev 'lev
lt1=-90
while(lt1<90)
lt2=lt1+10
ln1=0
while(ln1<360)
ln2=ln1+30
'define temp=aave(t,lon='ln1',lon='ln2',lat='lt1',lat='lt2')'
'set sdfwrite sample1.nc'
'sdfwrite temp'
ln1=ln1+30
endwhile
lt1=lt1+10
endwhile
lev=lev+1
endwhile

It is giving output file, but for single grid at single level.

Output file description is as follows...

Type = Gridded
  Xsize = 1  Ysize = 1  Zsize = 1  Tsize = 12  Esize = 1
  Number of Variables = 1
     temp  0  t,y,x  temp

It looks like there is problem in looping... Could you please help me fix
this problem...

Your help will save a lot of time...

Thank you in advance..

Sincerely,

Kishore
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20121108/57c1e9ea/attachment-0003.html 


More information about the gradsusr mailing list