pro construct_dsst ; Purpose ; ------- ; Reads SST corrections and values for DTM from a netCDF file, and generates ; the auxiliary files read by the CSIRO coupled model. ; ; History ; ------- ; 2004 Nov 20 Steve Phipps Original version ; Define constants lon = 64 lat = 28 ; Initialise variables tdtm = dblarr(lon, lat, 2, 12) tmo = dblarr(lon, lat, 2, 12) ; Get SST corrections and values for DTM filename = '' dtvar = '' dtmvar = '' read, filename, prompt="Enter name of input file : " read, dtvar, prompt="Enter name of variable containing SST corrections : " read, dtmvar, prompt="Enter name of variable containing DTM : " ncid = ncdf_open(filename) datid = ncdf_varid(ncid, dtvar) ncdf_varget, ncid, datid, dt datid = ncdf_varid(ncid, dtmvar) ncdf_varget, ncid, datid, dtm ncdf_close, ncid ; Transfer data to output arrays for ns = 1, 2 do begin for lg = 1, lat do begin lx = (ns - 1) * lg + (2 * lat + 1 - lg) * (2 - ns) for mg = 1, lon do begin ma = mg + (ns - 1) * lon tdtm(mg-1, lg-1, ns-1, *) = double(dtm(mg-1, lx-1, *)) tmo(mg-1, lg-1, ns-1, *) = double(dt(mg-1, lx-1, *)) endfor endfor endfor ; Generate dtm1av header = " " header2 = "" read, header2, prompt="Enter header for dtm1av: " strput, header, header2 openw, 1, "dtm1av", /f77_unformatted for month = 0, 11 do begin writeu, 1, header writeu, 1, long(month+1) writeu, 1, tdtm(*, *, 0, month), tdtm(*, *, 1, month) endfor close, 1 ; Generate t1coravth header = " " header2 = "" read, header2, prompt="Enter header for t1coravth: " strput, header, header2 openw, 1, "t1coravth", /f77_unformatted for month = 0, 11 do begin writeu, 1, header writeu, 1, long(month+1) writeu, 1, tmo(*, *, *, month) endfor close, 1 end