[gradsusr] Write data to text file

Menaka Revel menakarevel at yahoo.com
Mon Sep 22 11:40:26 EDT 2014


Hi I used following Script to to write the data to number of text files but the text could not be found and there is no error.

Help me to correct the script. I am using grads 2.1.a1 in linux platform
 
'open DM02_M.ctl'
'set dbuff on'


t=1
m=1

while (i<193)

'set t 't
'

outfile='arain_'m'.txt'

'!/bin/rm -f 'outfile
'set gxout print'

fmt='%10.3f'

numcols=1

'set prnopts 'fmt' 'numcols' 1'

'd lon'
lon_data = result

'd lat'
lat_data = result

'd rainc(t+24)+rainnc(t+24)-rainc-rainnc'
v1_data = result

i=1

while (i<100)

  lons  = sublin(lon_data,i)
  lats  = sublin(lat_data,i)
  line1 = sublin(v1_data,i)


if (lons='' | lats='' | line1=''); break; endif


if (i>1)

 
      str = subwrd(lons,j) 
lon = math_format(fmt,str)
      str = subwrd(lats,j)
lat = math_format(fmt,str)
      str = subwrd(line1,j)
v1 = math_format(fmt,str)
      
      record = lon' 'lat' 'v1

      rc = write(outfile,record,append)
      
endif

i=i+1

endwhile

'swap'

t=t+24
m=m+1

endwhile


Regards,

Menaka Revel,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20140922/5f95b37b/attachment.html 


More information about the gradsusr mailing list