% plots parameter vs. date at > 975m (the stability figures)

% loads:
  % float0005.mat (generated by applyCalProfile.m)  

% no mat files are saved

% written by E. Boss, UMaine, 2006
% email: emmanuel.boss@maine.edu

clear all
close('all')

% get float data
load float0005 % float0005 contains:
profileNum=float0005(:,1); %profile number
date=float0005(:,2); %date
lat=float0005(:,3); %latitude (degrees)
lon=float0005(:,4); %longitude (degrees)
P=float0005(:,5); %depth (m)
theta=float0005(:,6); %potential temperature (degrees C)
S=float0005(:,7); %salinity (psu)
sigma=float0005(:,8); %density-1000 (kg/m3)
B_LSS_b_corr=float0005(:,9); %bb (m-1, calibrated using MODIS data downloaded 01/11/08)
Chl_b_corr=float0005(:,10); %chlorophyll (mg/m3, calibrated using MODIS data downloaded 01/11/08) 
O2sat=float0005(:,11); %oxygen (% saturation) !oxygen sensor not working
O2=float0005(:,12); %oxygen (um/kg) !oxygen sensor not working
POC_b=float0005(:,13);
C_phy=float0005(:,14);
profile=float0005(:,15); % (in days from start)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PLOTS 

I=find(P>975); % get data at depth > 900m
 
figure('Units','inches','Resize','off','position',[0 0 7.25 5.25],'paperposition',[0.5 3 7.25 5.25]); % potential temperature
subplot('Position',[0.1 0.55 0.325 0.355]);
plot(tt(I),theta(I),'ko');
hold on;
plot([732910 732910],[0 6],'k','LineWidth',2);
plot([732985 732985],[0 6],'k','LineWidth',2);
hold off
% set(gca,'XTick',[732099 732464 732829 733194 733560]);
tick = [732099 732464 732829 733194 733560];
set(gca,'XTick',tick);
set(gca, 'XTickLabels', datestr(tick,'dd mmm yy'));
set(gca,'FontName','Times New Roman','FontSize',10,'LineWidth',0.75);
% datetick('x', 'dd-mmm-yy','keeplimits','keepticks');
% set(gca,'XTick',[]);
xlim([732090 733250]);
ylim([2.95 5.5]);
% ylabel('Potential Temperature (^{o}C)');
annotation('textbox',[0.01 0.47 0.1 0.1],'String','Potential temperature (^{o}C)','Rotation',[90],'EdgeColor','none','FontName','Times New Roman','FontSize',10);
% xlabel('Date');
% title('Temperature at Depths Greater Than 975m');

subplot('Position',[0.55 0.55 0.29 0.365]); % salinity
plot(tt(I),S(I),'ko');
hold on;
plot([732910 732910],[34.6 35.1],'k','LineWidth',2);
plot([732985 732985],[34.6 35.1],'k','LineWidth',2);
hold off
% set(gca,'XTick',[732099 732464 732829 733194 733560]);
tick = [732099 732464 732829 733194 733560];
set(gca,'XTick',tick);
set(gca, 'XTickLabels', datestr(tick,'dd mmm yy'));
set(gca,'FontName','Times New Roman','FontSize',10,'LineWidth',0.75);
% datetick('x', 'dd-mmm-yy','keeplimits','keepticks');
xlim([732090 733250]);
ylim([34.79 35.1]);
ylabel('Salinity');
% xlabel('Date');
% title('Salinity at Depths Greater Than 975m');

subplot('Position',[0.1 0.103 0.325 0.350]); % side scattering
loglog(tt(I),B_LSS_b_corr(I),'ko');
hold on;
plot([732910 732910],[0.00009 0.01],'k','LineWidth',2);
plot([732985 732985],[0.00009 0.01],'k','LineWidth',2);
hold off
xlim([732090 733250]);
ylim([0.00009 0.01]); % moved up from 0.0001 to give room on graph
% set(gca,'XTick',[732099 732464 732829 733194 733560]);
tick = [732099 732464 732829 733194 733560];
set(gca,'XTick',tick);
set(gca, 'XTickLabels', datestr(tick,'dd mmm yy'));
set(gca,'FontName','Times New Roman','FontSize',10,'LineWidth',0.75);
% datetick('x', 'dd-mmm-yy','keeplimits','keepticks');
ylabel('b_{bp}(440) (m^{-1})');
xlabel('Date');
% title('Side Scatter at Depths Greater Than 975m');

subplot('Position',[0.55 0.10 0.29 0.35]); % chlorophyll
plot(tt(I),Chl_b_corr(I),'ko');
hold on;
plot([732910 732910],[-0.001 .05],'k','LineWidth',2);
plot([732985 732985],[-0.001 .05],'k','LineWidth',2);
hold off
xlim([732090 733250]);
ylim([-0.001 0.05 ]);
% set(gca,'XTick',[732099 732464 732829 733194 733560]);
tick = [732099 732464 732829 733194 733560];
set(gca,'XTick',tick);
set(gca, 'XTickLabels', datestr(tick,'dd mmm yy'));
set(gca,'FontName','Times New Roman','FontSize',10,'LineWidth',0.75);
% datetick('x', 'dd-mmm-yy','keeplimits','keepticks');
ylabel('Chlorophyll (mg m^{-3})');
xlabel('Date');
% title('Chlorophyll at Depths Greater Than 975m');

% subplot(2,2,1); % density
% plot(tt(I),sigma(I),'o');
% set(gca,'xlim',[datenum('01 jun 2004') datenum('01 jun 2008')]);
% set(gca,'XTick',[datenum('01 jun 2004') datenum('01 jun 2005') datenum('01 jun 2006') datenum('01 jun 2007') datenum('01 jun 2008')]);
% set(gca,'FontName','Times New Roman');
% set(gca,'FontSize',12);
% datetick('x', 'mmmyy','keeplimits','keepticks');
% ylabel('density-1000 [kg]');
% title('Density at Depths Greater Than 975m');

