pro construct_dsss ; Purpose ; ------- ; Reads SSS corrections from a netCDF file, and generates the auxiliary file ; read by the CSIRO coupled model. ; ; History ; ------- ; 2004 Nov 23 Steve Phipps Original version ; 2004 Nov 24 Steve Phipps Corrected to convert corrections from psu to ; kg/kg ; Define constants lon = 64 lat = 28 ; Initialise variables smo = dblarr(lon, lat, 2, 12) ; Get SST corrections filename = '' dsvar = '' read, filename, prompt="Enter name of input file : " read, dsvar, prompt="Enter name of variable containing SSS corrections : " ncid = ncdf_open(filename) datid = ncdf_varid(ncid, dsvar) ncdf_varget, ncid, datid, ds ncdf_close, ncid ; Transfer data to output array, converting from psu to kg/kg 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 smo(mg-1, lg-1, ns-1, *) = double(ds(mg-1, lx-1, *) / 1000.0) endfor endfor endfor ; Generate s1coravth header = " " header2 = "" read, header2, prompt="Enter header for s1coravth: " strput, header, header2 openw, 1, "s1coravth", /f77_unformatted for month = 0, 11 do begin writeu, 1, header writeu, 1, long(month+1) writeu, 1, smo(*, *, *, month) endfor close, 1 end