'reinit'
'sdfopen /net/stg/netcdf/isabel_ras.nc'
*
*  define scaling environment by displaying any variable (otherwise an error
*  results...)
*
'set gxout shaded'
'd ps'
*
*  open output file and print header...
*
rc = write('test_xy2w.txt','i j  lonval latval')
i=1
while ( i <= 2 )
  j=1
  while ( j <= 2 )
    'q xy2w 'i' 'j
    rec = sublin(result,1)
    lonv = subwrd(rec,3)
    latv = subwrd(rec,6)
    say ''i' 'j' 'lonv' 'latv
    lonval = math_format('%6.3f',lonv)
    latval = math_format('%6.3f',latv)
    rc = write('test_xy2w.txt',''i' 'j' 'lonval' 'latval'')
    j=j+1
  endwhile
  i=i+1
endwhile
rc = close('test_xy2w.txt')
