
mydir='/Users/cosadmin/Desktop/Jeff/SH/';

%load SH data
%  load([mydir 'mat/SHUCDT.mat']);
%  load([mydir 'mat/SHUCCO.mat']);
 load([mydir 'mat/SHUCDT_atten.mat']);

%load M1 met data
 load('/Users/cosadmin/Desktop/Jeff/M1/M1_met.mat');
 clear time wind_u wind_v;

%find indices
 tiInd=1;
 deInd=2;
 teInd=3;
 saInd=4;
 siInd=5;
 flInd=6;
 o2Ind=7;
 trInd=8;
 atInd=9;

%axes properties
 ax.FontSize=16;
 ax.FontName='Arial';
 ax.XLim=[min(dataUC(:,tiInd))-1/24 max(dataUC(:,tiInd))+1/24];
 ax.YLim=[-70 0];
 ax.XTick=[ceil(ax.XLim(1)):3:ax.XLim(2)];
 ax.YTick=[-60:20:0];
 ax.XTickLabel=[];
 ax.YTickLabel=abs(ax.YTick);
 ax.Box='on';
 co.FontName='Arial'; %value
 co.FontSize=ax.FontSize-4;
 co2.FontName='Arial'; %label
 co2.FontSize=ax.FontSize;
 si=size(dataUC,1); %color axes limits
 caInd=[round(si*0.025) round(si*0.975)];

%axes spacing
 spAbBot=0.10; %space above bottom
 spFroLe=0.17; %space from left
 spAxWid=0.65; %space of axes widths
 spAxHei=0.10; %space of axes heights
 spBtwAx=0.024; %space between axes

 ind=8; %plot every (ind) dataUC pt

figure('Units','normalized','Position',[0 0 1 1]);

%temp
 ax1=axes;
 scatter(dataUC(1:ind:end,tiInd),dataUC(1:ind:end,deInd),3,...
   dataUC(1:ind:end,teInd),'filled');
 set(ax1,ax);
 set(ax1,'Position',[spFroLe spAbBot+(spAxHei+spBtwAx)*5 ...
   spAxWid spAxHei]);
 s=sort(dataUC(:,teInd));
 ca=round2(s(caInd),0.1);
 caxis(ca);
 c=colorbar; set(c,co); set(get(c,'YLabel'),co2,'String',...
   ['T (' char(186) 'C)']);
 set(c,'YTick',linspace(ca(1),ca(2),3));
 g1=get(ax1,'Position');

%wind
 ax7=axes;
 da=[1 8.5 1];
 [X,Y]=myStick(timeAvg,zeros(size(timeAvg)),wind_uAvg,...
   wind_vAvg,da,1);
 plot(X,Y,'k');
 set(ax7,ax,'YLim',[-10 10],'YTick',[-10:10:10],...
   'YTickLabel',[-10:10:10],'DataAspectRatio',da);
 set(ax7,'Position',[spFroLe spAbBot+(spAxHei+spBtwAx)*6 ...
   spAxWid spAxHei]);
 g7=get(ax7,'Position');
 set(ax7,'Position',[g7(1:2) g1(3) g7(4)]);
 ylabel({'M1 wind'; '(m s^-^1)'});
 title({'Fall 2012  SeaHorse time series'},...
   'FontSize',ax.FontSize+4);

%salinity
 ax2=axes;
 scatter(dataUC(1:ind:end,tiInd),dataUC(1:ind:end,deInd),3,...
   dataUC(1:ind:end,saInd),'filled');
 set(ax2,ax);
 set(ax2,'Position',[spFroLe spAbBot+(spAxHei+spBtwAx)*4 ...
   spAxWid spAxHei]);
 s=sort(dataUC(:,saInd));
 ca=round2(s(caInd),0.01);
 caxis(ca);
 c=colorbar; set(c,co); set(get(c,'YLabel'),co2,'String','Sal');
 set(c,'YTick',linspace(ca(1),ca(2),3));

%sigma_t
 ax3=axes;
 scatter(dataUC(1:ind:end,tiInd),dataUC(1:ind:end,deInd),3,...
   dataUC(1:ind:end,siInd),'filled');
 set(ax3,ax);
 set(ax3,'Position',[spFroLe spAbBot+(spAxHei+spBtwAx)*3 ...
   spAxWid spAxHei]);
 s=sort(dataUC(:,siInd));
 ca=round2(s(caInd),0.1);
 caxis(ca);
 c=colorbar; set(c,co); set(get(c,'YLabel'),co2,'String',...
   {'sigma-t'; '(kg m^-^3)'}); 
 set(c,'YTick',linspace(ca(1),ca(2),3));

%chl fluor
 ax4=axes; hold on;
 scatter(dataUC(1:ind:end,tiInd),dataUC(1:ind:end,deInd),3,...
   dataUC(1:ind:end,flInd),'filled');
 set(ax4,ax);
 set(ax4,'Position',[spFroLe spAbBot+(spAxHei+spBtwAx)*2 ...
   spAxWid spAxHei]);
 s=sort(dataUC(:,flInd));
 ca=round2(s(caInd),1);
 caxis(ca);
 c=colorbar; set(c,co); set(get(c,'YLabel'),co2,'String',...
   {'fluor'; '(mg m^-^3)'}); 
 set(c,'YTick',linspace(ca(1),ca(2),3));

%O2
 ax5=axes; hold on;
 scatter(dataUC(1:ind:end,tiInd),dataUC(1:ind:end,deInd),3,...
   dataUC(1:ind:end,o2Ind),'filled');
 set(ax5,ax);
 set(ax5,'Position',[spFroLe spAbBot+(spAxHei+spBtwAx)*1 ...
   spAxWid spAxHei]);
 s=sort(dataUC(:,o2Ind));
 ca=round2(s(caInd),0.1);
 caxis(ca);
 c=colorbar; set(c,co); set(get(c,'YLabel'),co2,'String',...
   {'O_2';'(ml l^-^1)'}); 
 set(c,'YTick',linspace(ca(1),ca(2),3));

%trans/atten
 ax6=axes;
 scatter(dataUC(1:ind:end,tiInd),dataUC(1:ind:end,deInd),3,...
   attenDT(1:ind:end),'filled');
 set(ax6,ax);
 set(ax6,'Position',[spFroLe spAbBot+(spAxHei+spBtwAx)*0 ...
   spAxWid spAxHei]);
 s=sort(attenDT);
 ca=round2(s(caInd),0.01);
%  ca=[0.05 0.9];
 caxis(ca);
 c=colorbar; set(c,co); set(get(c,'YLabel'),co2,'String',...
   {'atten'; '(m^-^1)'}); 
 set(c,'YTick',linspace(ca(1),ca(2),3));
 %ticks
  set(ax6,'XTickLabel',datestr(ax.XTick,'dd-mmm'));
  ylabel('depth (m)');

%save
 set(gcf,'PaperPositionMode','auto','Renderer','painters',...
   'PaperSize',[16,12]);
%  saveas(gcf,[mydir 'SHcont'] ,'png');
%  saveas(gcf,[mydir 'SHcontCO'] ,'png');
 saveas(gcf,[mydir 'SHcontDT_AT'] ,'png');
 close;
