% plot chla with respect to depth for cast 9
cast9=find(cast==9);
plot (chla(cast9),depth(cast9),'+')
xlabel ('Chla')
ylabel ('Depth')

% test for diana

cruise=415;

load oce415_1hydro.dat

data=oce415_1hydro;
depth=data(:,3);
oxy=data(:,4);
cast=data(:,1);
chla=data(:,5);
phaeo=data(:,6);

% plot different plots on same page
subplot(221),plot(oxy,depth,'+')
subplot(222),plot(chla,depth,'+')
subplot(223),plot(phaeo,depth,'o')


% plot different things on same plot
figure(1)
clf			% clean figure
plot(chla,depth,'+',phaeo,depth,'o')

% to do the same thing

figure(2)
plot(chla,depth,'b+')
hold on
plot(phaeo,depth,'go')
hold off


% example
% plot different casts on same figure

cast4=find(cast==4);

% the first eddy was from cast 4 to cast 9

for ii=4:1:9    % loop from 4 to 9 by increment of 1
   castindex=find(cast==ii);
   plot(chla(castindex),depth(castindex))
   hold on 
   pause   % this decompose the loop each time you hit enter
end
hold off



% removing nan


isnan([1 2 nan 3 nan])   % return 1 if it's nan and 0 if it's not nan
isfinite([1 2 nan 3 nan])   % opposite function 


% we are going to construct a new data set with just the chla (and phaeo) data

newchla=[];       % new variables as empty vector at first
newdepth=[];



for ii=1:length(chla)
   if isfinite(chla(ii))==1
      newchla=[newchla;chla(ii)]   % builts a colum of data
      newdepth=[newdepth depth(ii)]   %builts a raw of data
   else
      newchla=newchla
   end
 %  pause
   
end

      







