corner = REPLICATE({ u10:0.0, cd:0.0 }, 4 ) data = REPLICATE({ u10:0.0, cd:0.0 }, 300 ) ; open input file openr, in, 'cd.dig', /GET_LUN ; read upper left corner readf, in, FORMAT = '(2F6.0)', dum1, dum2 corner(0).u10 = dum1 corner(0).cd = dum2 ; read lower left corner readf, in, FORMAT = '(2F6.0)', dum1, dum2 corner(1).u10 = dum1 corner(1).cd = dum2 ; read lower right corner readf, in, FORMAT = '(2F6.0)', dum1, dum2 corner(2).u10 = dum1 corner(2).cd = dum2 ; read upper right corner readf, in, FORMAT = '(2F6.0)', dum1, dum2 corner(3).u10 = dum1 corner(3).cd = dum2 ; read in the points i = 0L while NOT EOF(in) do begin readf, in, FORMAT = '(I5,1X,I5, 2X)', dum1, dum2 data(i).u10 = FLOAT( dum1 ) data(i).cd = FLOAT( dum2 ) i = i + 1L endwhile FREE_LUN, in num_obs = i ; convert to real scale cd_scale = 2.5 / ( corner(0).cd - corner(1).cd ) u10_scale = 10.0 / (corner(2).u10 - corner(1).u10 ) data(*).cd = ( data(*).cd - corner(1).cd ) * cd_scale data(*).u10 = 2.0 + ( data(*).u10 - corner(1).cd ) * u10_scale ; open output file openw, out, 'cd.dat', /GET_LUN ; write output data to file FOR i = 0, num_obs-1 DO BEGIN printf, out, FORMAT = '(F6.3, 2X, F6.4)', data(i).u10, data(i).cd ENDFOR FREE_LUN, out END