%contourEnCTD.m % %Program to take the cast data from the Endeavor Cruise and create contour %plots of temperature and salinity vs. distance from station 10 and depth % %Soupy Alexander %3/27/02 % %Modified 4/5/02 to add fluorecsence and beam attenuation load C:\NewYork\NewYorkCD\Data_Files\CTD_Data\Mat_Files\en_ctd_mat.mat Tlimits = [5 10]; Tdelim = [5:0.5:10]; temp_conts = [6.0:0.25:8.25]; Slimits = [29 34]; Sdelim = [25.5:0.5:34]; sal_conts = [25.5:0.25:34.0]; Flimits = [0 10]; Fdelim = [0:2:10]; F_conts = [0:1:10]; attnlimits = [0 5]; attndelim = [0:0.5:5]; attn_conts = [0:0.25:5]; sigmatlimits = [22 27]; sigmatdelim = [22:1:27]; sigmat_conts = [22:0.5:27]; %Set up empty matrices of the data temp = repmat(NaN,165,10); sal = repmat(NaN,165,10); F = repmat(NaN,165,10); attn = repmat(NaN,165,10); lat = repmat(NaN,1,10); lon = repmat(NaN,1,10); depth = repmat(NaN,165,10); %Fill in the data for index = 1:10; cast = evalin('base',['ctd' num2str(index,'%02d') 'b']); [m,n] = size(cast); temp(1:m,index) = cast(:,6); sal(1:m,index) = cast(:,10); F(1:m,index) = cast(:,23); attn(1:m,index) = -4*log((cast(:,24)./100)); sigmat(1:m,index) = cast(:,22); lat(1,index) = nanmean(cast(:,4)); lon(1,index) = nanmean(cast(:,5)); depth(1:m,index) = cast(:,25); end %Set up the distance matrix dist1 = repmat(NaN,1,10); dist1(10) = 0; dist = repmat(NaN,1,10); dist(10) = 0; for index = 1:9; dist1(index) = latlon2dist(lat(index),lon(index),lat(index+1),lon(index+1)); end for index = 1:9; dist(index) = sum(dist1(index:10)); end %Convert distances to kilometers distkm = dist./1000; %Grid the temperature and salinity data (i.e., line up depth bins depth_mat = 1:0.5:83; temp_grid = repmat(NaN,length(depth_mat),10); sal_grid = repmat(NaN,length(depth_mat),10); F_grid = repmat(NaN,length(depth_mat),10); attn_grid = repmat(NaN,length(depth_mat),10); sigmat_grid = repmat(NaN,length(depth_mat),10); for index = 1:10; for index2 = 1:length(depth_mat); clear in in = value2Index(depth(:,index),depth_mat(index2),0.4); if isnan(in) == 0; temp_grid(index2,index) = temp(in,index); sal_grid(index2,index) = sal(in,index); F_grid(index2,index) = F(in,index); attn_grid(index2,index) = attn(in,index); sigmat_grid(index2,index) = sigmat(in,index); end end end depth_grid = repmat(depth_mat',1,10); distkm_grid = repmat(distkm,165,1); [c,h] = contourf(distkm_grid,depth_grid,temp_grid,temp_conts); shading flat set(gca,'fontsize',12) xlabel('Distance to Station 10 (km)') ylabel('Depth (m)') title('Temperature Contours of CTD Data from Endeavor','fontsize',16) axis ij hold on [c2,h2] = contour(distkm_grid,depth_grid,temp_grid,Tdelim,'k'); clabel(c2,h2,'rotation',0) for index = 1:10; l = line([distkm(index) distkm(index)],[0 85]); set(l,'color',[0.25 0.25 0.25],'linestyle','-.'); t = text(distkm(index)+0.5,80,[num2str(index)]); set(t,'color',[0.25 0.25 0.25]); end axis([-1 62 0 85]) fig = gca; cb = colorbar; axes(cb) ylabel('Temperature (^o C)') axes(cb) set(gca,'ytick',temp_conts) set(gca,'dataaspectratio',[17 2 2]) axes(fig) set(gca,'plotboxaspectratio',[1 0.5 1]) orient landscape figure [c,h] = contourf(distkm_grid,depth_grid,sal_grid,sal_conts); shading flat set(gca,'fontsize',12) xlabel('Distance to Station 10 (km)') ylabel('Depth (m)') title('Salinity Contours of CTD Data from Endeavor','fontsize',16) axis ij hold on [c2,h2] = contour(distkm_grid,depth_grid,sal_grid,Sdelim,'k'); clabel(c2,h2,'rotation',0) for index = 1:10; l = line([distkm(index) distkm(index)],[0 85]); set(l,'color',[0.25 0.25 0.25],'linestyle','-.'); t = text(distkm(index)+0.5,80,[num2str(index)]); set(t,'color',[0.25 0.25 0.25]); end axis([-1 62 0 85]) fig = gca; cb = colorbar; axes(cb) ylabel('Salinity (o/oo)') set(gca,'ytick',min(Sdelim):1:max(Sdelim)) set(gca,'dataaspectratio',[4.5 2 1]) axes(fig) set(gca,'plotboxaspectratio',[1 0.5 1]) orient landscape figure [c,h] = contourf(distkm_grid,depth_grid,F_grid,F_conts); shading flat set(gca,'fontsize',12) xlabel('Distance to Station 10 (km)') ylabel('Depth (m)') title('Fluorescence Contours of CTD Data from Endeavor','fontsize',16) axis ij hold on [c2,h2] = contour(distkm_grid,depth_grid,F_grid,Fdelim,'k'); clabel(c2,h2,'rotation',0) for index = 1:10; l = line([distkm(index) distkm(index)],[0 85]); set(l,'color',[0.25 0.25 0.25],'linestyle','-.'); t = text(distkm(index)+0.5,80,[num2str(index)]); set(t,'color',[0.25 0.25 0.25]); end axis([-1 62 0 85]) fig = gca; cb = colorbar; axes(cb) ylabel('Fluorescence') set(gca,'ytick',min(Fdelim):1:max(Fdelim)) set(gca,'dataaspectratio',[4 2 1]) axes(fig) set(gca,'plotboxaspectratio',[1 0.5 1]) orient landscape figure [c,h] = contourf(distkm_grid,depth_grid,attn_grid,attn_conts); shading flat set(gca,'fontsize',12) xlabel('Distance to Station 10 (km)') ylabel('Depth (m)') title('Beam Attenuation Contours of CTD Data from Endeavor','fontsize',16) axis ij hold on [c2,h2] = contour(distkm_grid,depth_grid,attn_grid,attndelim,'k'); clabel(c2,h2,'rotation',0) for index = 1:10; l = line([distkm(index) distkm(index)],[0 85]); set(l,'color',[0.25 0.25 0.25],'linestyle','-.'); t = text(distkm(index)+0.5,80,[num2str(index)]); set(t,'color',[0.25 0.25 0.25]); end axis([-1 62 0 85]) fig = gca; cb = colorbar; axes(cb) ylabel('Beam Attenuation (m-1)') set(gca,'ytick',min(attndelim):1:max(attndelim)) set(gca,'dataaspectratio',[10 2 1]) axes(fig) set(gca,'plotboxaspectratio',[1 0.5 1]) orient landscape figure [c,h] = contourf(distkm_grid,depth_grid,sigmat_grid,sigmat_conts); shading flat set(gca,'fontsize',12) xlabel('Distance to Station 10 (km)') ylabel('Depth (m)') title('Sigma T Contours of CTD Data from Endeavor','fontsize',16) axis ij hold on [c2,h2] = contour(distkm_grid,depth_grid,sigmat_grid,sigmatdelim,'k'); clabel(c2,h2,'rotation',0) for index = 1:10; l = line([distkm(index) distkm(index)],[0 85]); set(l,'color',[0.25 0.25 0.25],'linestyle','-.'); t = text(distkm(index)+0.5,80,[num2str(index)]); set(t,'color',[0.25 0.25 0.25]); end axis([-1 62 0 85]) fig = gca; cb = colorbar; axes(cb) ylabel('Sigma T (mg/cm^3)') set(gca,'ytick',min(sigmatdelim):1:max(sigmatdelim)) set(gca,'dataaspectratio',[10 2 1]) axes(fig) set(gca,'plotboxaspectratio',[1 0.5 1]) orient landscape