; pro open_read_ctd_2 ; defsysv, '!a_bar', -0.15d ; kg m^-3 oC^-1 defsysv, '!b_bar', 0.78d ; kg m^-3 ppt^-1 defsysv, '!k_bar', 4.50d-3 ; kg m^-3 db^-1 defsysv, '!rho_o', 1027.d ; kg m^-3 defsysv, '!T_o', 10d ; oC defsysv, '!S_o', 35d ; ppt defsysv, '!rho_1000', 1000d ; convert from density to density analomaly ; lu1 = 1 infilename = 'h11a0202.ctd' ; ;..find out how big the file is ; openr, lu1, infilename input_string = '' ndata = 0 while not eof(lu1) do begin readf, lu1, input_string ndata = ndata + 1 endwhile close, lu1 print, ndata ; ;..there are six header lines ; openr, lu1, infilename ; readf, lu1, input_string print, input_string readf, lu1, input_string print, input_string readf, lu1, input_string print, input_string readf, lu1, input_string print, input_string readf, lu1, input_string print, input_string readf, lu1, input_string print, input_string ; input_data = fltarr(8,ndata-6) readf, lu1, input_data close, lu1 ; ;..check that the first line of data is consistent with 'h11a0202.ctd' ;..open 'h11a0202.ctd' in Notepad to verify ; print, input_data(*,0) ;stop ; ;..assignments of input_data array into vectors ; p_db = input_data(0,*) print, p_db, format = '(10f10.2)' ;stop ; t_c = input_data(1,*) print, t_c, format = '(10f10.2)' ;stop ; s_ppt = input_data(2,*) print, s_ppt, format = '(10f10.2)' ;stop ; ;..plot the vertical profiles of temperature and salinity to a postscript file ; xsize_inch = 8.5 ysize_inch = 11. ; set_plot, 'ps' !p.font = 0 device, /times, font_size = 12, filename = 'open_read_ctd_2.ps', /inches, yoffset = 0., $ xoffset = 0., xsize = xsize_inch, ysize = ysize_inch, bits_per_pixel = 8, /color ; width_inch = 2.00 width_normal = width_inch / xsize_inch height_inch = 2.00 height_normal = height_inch / ysize_inch height_spacer_inch = 1.00 height_spacer_normal = height_spacer_inch / ysize_inch width_spacer_inch = 0.50 width_spacer_normal = width_spacer_inch / xsize_inch yoffset_inch = 1.0 yoffset_normal = yoffset_inch / ysize_inch xoffset_inch = 1.0 xoffset_normal = xoffset_inch / xsize_inch ; x_coord_min_normal = xoffset_normal x_coord_max_normal = x_coord_min_normal + width_normal y_coord_min_normal = (ysize_inch - 1.*height_inch - 0.*height_spacer_inch) / ysize_inch - yoffset_normal y_coord_max_normal = y_coord_min_normal + height_normal !p.position = [x_coord_min_normal,y_coord_min_normal,x_coord_max_normal,y_coord_max_normal] ; xrange = [0, 30] xticks = 3 xminor = 1 yrange = [3000, 0] ; note the perspective, largest value of depth is the minimum on the y axis scale yticks = 3 yminor = 1 plot, /nodata, [1], xstyle = 1, xrange = xrange, xticks = xticks, xminor = xminor, $ ystyle = 1, yrange = yrange, yticks = yticks, yminor = yminor, xtitle = 'Temperature, !Uo!NC', $ ytitle = 'Pressure, db', xticklen = -0.02, yticklen = -0.02 oplot, t_c, p_db ; x_coord_min_normal = xoffset_normal + width_normal + width_spacer_normal x_coord_max_normal = x_coord_min_normal + width_normal y_coord_min_normal = (ysize_inch - 1.*height_inch - 0.*height_spacer_inch) / ysize_inch - yoffset_normal y_coord_max_normal = y_coord_min_normal + height_normal !p.position = [x_coord_min_normal,y_coord_min_normal,x_coord_max_normal,y_coord_max_normal] ; xrange = [34, 36] xticks = 2 xminor = 5 yrange = [3000, 0] ; note the perspective, largest value of depth is the minimum on the y axis scale yticks = 3 yminor = 1 plot, /nodata, /noerase, [1], xstyle = 1, xrange = xrange, xticks = xticks, xminor = xminor, $ ystyle = 1, yrange = yrange, yticks = yticks, yminor = yminor, xtitle = 'Salinity, Part per Thousand', $ xticklen = -0.02, yticklen = -0.02, ytickname = replicate(' ', yticks + 1) oplot, s_ppt, p_db ; ;..now the top 300 m ; x_coord_min_normal = xoffset_normal x_coord_max_normal = x_coord_min_normal + width_normal y_coord_min_normal = (ysize_inch - 2.*height_inch - 1.*height_spacer_inch) / ysize_inch - yoffset_normal y_coord_max_normal = y_coord_min_normal + height_normal !p.position = [x_coord_min_normal,y_coord_min_normal,x_coord_max_normal,y_coord_max_normal] ; xrange = [0, 30] xticks = 3 xminor = 1 yrange = [300, 0] ; note the perspective, largest value of depth is the minimum on the y axis scale yticks = 3 yminor = 1 plot, /nodata, /noerase, [1], xstyle = 1, xrange = xrange, xticks = xticks, xminor = xminor, $ ystyle = 1, yrange = yrange, yticks = yticks, yminor = yminor, xtitle = 'Temperature, !Uo!NC', $ ytitle = 'Pressure, db', xticklen = -0.02, yticklen = -0.02 oplot, t_c, p_db, psym = 4, symsize = 0.05 ; x_coord_min_normal = xoffset_normal + width_normal + width_spacer_normal x_coord_max_normal = x_coord_min_normal + width_normal y_coord_min_normal = (ysize_inch - 2.*height_inch - 1.*height_spacer_inch) / ysize_inch - yoffset_normal y_coord_max_normal = y_coord_min_normal + height_normal !p.position = [x_coord_min_normal,y_coord_min_normal,x_coord_max_normal,y_coord_max_normal] ; xrange = [34, 36] xticks = 2 xminor = 5 yrange = [300, 0] ; note the perspective, largest value of depth is the minimum on the y axis scale yticks = 3 yminor = 1 plot, /nodata, /noerase, [1], xstyle = 1, xrange = xrange, xticks = xticks, xminor = xminor, $ ystyle = 1, yrange = yrange, yticks = yticks, yminor = yminor, xtitle = 'Salinity, Part per Thousand', $ xticklen = -0.02, yticklen = -0.02, ytickname = replicate(' ', yticks + 1) oplot, s_ppt, p_db, psym = 4, symsize = 0.05 ; resetps2x ; end