pro construct_sss

; Purpose
; -------
; Constructs a text file containing climatological SSSs in the format read by
; the CSIRO AGCM
;
; History
; -------
; 2004 Nov 25	Steve Phipps	Original version

; Get climatological SSSs
filename = ""
var = ""
print, ""
read, filename, prompt="Name of file containing SSSs :  "
read, var, prompt="Name of variable containing SSS data :  "
print, ""
ncid = ncdf_open(filename)
datid = ncdf_varid(ncid, var)
ncdf_varget, ncid, datid, sss
ncdf_close, ncid

; Convert SSSs from psu to absolute values
sss = 0.001 * sss

; Write data to output file
header = ""
read, header, prompt="Header for output file :  "
print, ""
openw, 1, "clim3f.sss"
for i = 0, 11 do begin
  printf, 1, header, ", month ", i+1
  printf, 1, i+1
  printf, 1, sss(*, *, i)
endfor
close, 1

end