help needed with ascii output

M P Borkow mpborkow at NCSU.EDU
Thu Sep 1 14:44:01 EDT 2005


This listserv has been a life saver as I've been struggling with how to get
grads output into a ascii text file for over a week, and now I feel like I'm
making progress.

After searching the archives I have tried (with success) using the following
script posted by Jennifer Adams several years ago:

function txtout()
'open sst.master.ctl'
'set gxout print'
'set prnopts %12.8f'
'd sst'
ascii = result
asciifile = 'test.txt'

numbers = sublin(result,2)
if (numbers != '')
  rc = write(asciifile,numbers)
else
  say 'no ascii data to write'
return
endif

i=3
while(1)
  numbers = sublin(result,i)
  if (numbers!='')
    rc = write(asciifile,numbers,append)
  else
    break
  endif
  i = i+1
endwhile
close(asciifile)
return 0

However, I need to modify the script a bit and, no having much grads
experience, don't know how to do so.  What I'd essentially like to end up
with is a text file with 3 columns per line...containing the variables
latitude, longitude, and sst.  Can explain to me how I need to go about
modifying the script to do this?  Right now the script just spits out the
sst values with a couple spaces in between each value.  Also, what exactly
am I defining by doing 'prnopts %12.8f'?

Thanks,
Matt



More information about the gradsusr mailing list