function main (args) 'reinit' fin=args fout=fin%".bin" finfo=fin%".info" say fout ** Give the basename as input, for example sst 'open 'fin 'query ctlinfo' ** Find the x-dimension so that we can avoid ** setting a cyclic point in longitude k=1 while (k<6) pline = sublin(result,k) pword = subwrd(pline,1) if (pword="xdef"); break ; endif k=k+1 endwhile x1=1 say pword x2=subwrd(pline,2) say x2 'set x 'x1' 'x2 'set t 1 last' 'query dims' *** GET LONGITUDE INFORMATION *** pline=sublin(result,2) lon1=subwrd(pline,6) lon2=subwrd(pline,8) nlon=subwrd(pline,13) *** GET LATITUDE INFORMATION *** pline=sublin(result,3) lat1=subwrd(pline,6) lat2=subwrd(pline,8) nlat=subwrd(pline,13) *** GET TIME INFORMATION *** pline=sublin(result,5) tim1=subwrd(pline,6) tim2=subwrd(pline,8) ntim=subwrd(pline,13) write(finfo,"LON"%" "%lon1%" "%lon2%" "%nlon) write(finfo,"LAT"%" "%lat1%" "%lat2%" "%nlat,append) write(finfo,"TIM"%" "%tim1%" "%tim2%" "%ntim,append) 'set gxout fwrite' 'set fwrite 'fout 'd 'fin return