Appendix A - Sample IDL 5.1 Chart Conversion Program ;name - sclimate.pro ;IDL program to convert 1960-79 Lake Superior ice charts to new 516x510 grid ;written by Matt Rubens ;last modified 07/06/99 ;************************************************************************** pro sclimate close,/all widget_control,/hourglass tvlct,red,grn,blu,/get restore,'e:\programs\climatology\climatologycolors.dat' tvlct,r,g,b xs=121 ;number of columns in Ice Atlas array ys=71 ;number of rows in Ice Atlas array ;irregular array of lons for superior grid suplons=fltarr(xs,ys) openr,1,'e:\iceclimatology-superior\sup6079.lon' readf,1,suplons,format='('+strtrim(xs,1)+'f12.7)' close,1 ;irregular array of lats for superior grid suplats=fltarr(xs,ys) openr,1,'e:\iceclimatology-superior\sup6079.lat' readf,1,suplats,format='('+strtrim(xs,1)+'f12.7)' close,1 ;array of latitude coordinates for 516x510 array lats=fltarr(516,510) openr,1,'d:\grids\latgrid.new' readf,1,lats,format='(f9.5,515f10.5)' close,1 ; ;array of longitude coordinates for 516x510 array lons=fltarr(516,510) openr,1,'d:\grids\longrid.new' readf,1,lons,format='(f9.5,515f10.5)' close,1 ;mask for different lakes: Lake Superior has a value of 4 openr,1,'d:\grids\lakegrid.new' lakegrid=bytarr(516,510) junk=strarr(6) readf,1,junk readf,1,lakegrid,format='(i1,515i2)' close,1 lakegrid=rotate(lakegrid,7) notsup=where(lakegrid ne 4) latv=reverse(reform(lats(0,*))) lonv=reform(lons(0:515)) ;this window is to display the arrays window,0,xsize=516,ysize=510 ;data file openr,2,'e:\iceclimatology-superior\sup6079.dat' ;output file openw,3,'e:\iceclimatology-superior\sup6079.new' ;print header printf,3,'Lake Superior' printf,3,'coordinates of lower left:(0,316) coordinates of upper right:(250,449)' printf,3,'' lat=intarr(xs*ys) lon=intarr(xs*ys) for i=0,xs*ys-1 do begin lat(i)=convertlat(suplats(i),latv) ;convertlat and convertlon are functions that, given a data point, return lon(i)=convertlon(suplons(i),lonv) ;the index on the closest corresponding CoastWatch point endfor ;read input file until end of file frame=0 while not eof(2) do begin frame=frame+1 newarr=replicate(100,516,510) ;read header into n n='' readf,2,n ;read concentrations into data data=intarr(xs,ys) readf,2,data,format='(x,'+strtrim(xs,1)+'i2)' ;remove land values from arrays z=reform(data,xs*ys) lat2=lat(where(z ne -1)) & lon2=lon(where(z ne -1)) & z=z(where(z ne -1)) ;find length of vectors len=(size(lat2))(1) ;create series of increasingly smaller boxes to cover up gaps in data without interpolating for i=5,0,-1 do begin for j=0,len-1 do begin newarr(lon2(j)-i:lon2(j)+i,lat2(j)-i:lat2(j)+i)=z(j) endfor endfor ;apply mask to array newarr(notsup)=-1 bad=where(newarr gt 99,cnt) if cnt gt 0 then newarr(bad)=99 ;display image tv,newarr ;extract subarray of Lake Superior newarr=newarr(0:250,316:449) newarr=rotate(newarr,7) ;write to output file printf,3,n printf,3,newarr,format='(x,'+strtrim((size(newarr))(1),1)+'i2)' print,frame endwhile close,/all tvlct,red,grn,blu beep end References Assel, R. A. A Computerized Ice Concentration Data Base for the Great Lakes, NOAA Data Report ERL GLERL-24 (1983).