pro construct_sst ; Purpose ; ------- ; Constructs a text file containing climatological SSTs in the format read by ; the CSIRO AGCM ; ; History ; ------- ; 2004 Nov 25 Steve Phipps Original version ; Get climatological SSTs filename = "" var = "" print, "" read, filename, prompt="Name of file containing SSTs : " read, var, prompt="Name of variable containing SST data : " print, "" ncid = ncdf_open(filename) datid = ncdf_varid(ncid, var) ncdf_varget, ncid, datid, sst_in ncdf_close, ncid ; Declare array to hold SSTs for output sst_out = fltarr(64, 28, 2, 12) ; Read SSTs into output array, converting to minus Kelvin in the process for j = 0, 27 do begin sst_out(*, j, 0, *) = -273.15 - sst_in(*, 55-j, *) sst_out(*, j, 1, *) = -273.15 - sst_in(*, j, *) endfor ; Write data to output file header = "" read, header, prompt="Header for output file : " print, "" openw, 1, "clim3f.sst" for i = 0, 11 do begin printf, 1, header, ", month ", i+1 printf, 1, i+1 printf, 1, sst_out(*, *, *, i) endfor close, 1 end