|
clear all
|
|
|
|
|
|
load ADCP_Feb_2013_Site3_data
|
|
|
|
% load ADCP matlab structure file
|
|
|
|
time_adcp=data.time.val; %ADCP time in UTC
|
|
depth_adcp=data.Depth_adcp.val; % ADCP depth (above transducer or corrected from the bed/transducer distance?)
|
|
|
|
|
|
% load YSI files
|
|
|
|
files=dir('*.txt');
|
|
|
|
pmax=3; % arbitrary maximum water depth for profile interpolation
|
|
pint=(0:0.05:pmax); % interpolation every 5cm
|
|
|
|
for i=1:length(files)
|
|
input_file=[files(i).name];
|
|
|
|
|
|
fid=fopen(input_file);
|
|
|
|
ysidata=textscan(fid,'%f/%f/%f %f:%f:%f %f %f %f %f %f %f');
|
|
fclose(fid);
|
|
|
|
|
|
time_ysi=datenum(ysidata{3},ysidata{2},ysidata{1},ysidata{4},ysidata{5},ysidata{6})-1/24;
|
|
temp_ysi=ysidata{7};
|
|
sal_ysi=ysidata{8};
|
|
depth_ysi=ysidata{10};
|
|
turb_ysi=ysidata{11};
|
|
ssc_ysi=ysidata{12};
|
|
|
|
% save raw data in matlab structure
|
|
ysi(i).raw.time=time_ysi;
|
|
ysi(i).raw.temperature=temp_ysi;
|
|
ysi(i).raw.salinity=sal_ysi;
|
|
ysi(i).raw.depth=depth_ysi;
|
|
ysi(i).raw.turbidity=turb_ysi;
|
|
ysi(i).raw.ssc=ssc_ysi;
|
|
|
|
tmean_ysi=mean(time_ysi);
|
|
|
|
% find corresponding ADCP profile
|
|
iadcp=find(time_adcp>tmean_ysi,1,'first');
|
|
depth_profile=depth_adcp(iadcp);
|
|
|
|
|
|
tabletemp(:,1)=depth_ysi;
|
|
tabletemp(:,2)=temp_ysi;
|
|
tabletemp(:,3)=sal_ysi;
|
|
tabletemp(:,4)=turb_ysi;
|
|
tabletemp(:,5)=ssc_ysi;
|
|
|
|
|
|
tabletemp=sortrows(tabletemp,1); % sort if the YSI is not monotocally going down
|
|
% next average values if they do have the same pressure value
|
|
% requested prior to interpolation step
|
|
|
|
|
|
profile_array=zeros(length(pint),5);
|
|
profile_array(:,:)=-999;
|
|
profile_array(:,1)=pint;
|
|
|
|
for j=1:5
|
|
pp=1;
|
|
tt=1;
|
|
tmp=tabletemp(1,j);
|
|
for l=2:length(tabletemp(:,1))
|
|
|
|
if tabletemp(l,1)==tabletemp(l-1,1)
|
|
tmp=tmp+tabletemp(l,j);
|
|
tt=tt+1;
|
|
else
|
|
if tt>1
|
|
tabletemp2(pp,j)=tmp/tt;
|
|
tt=1;
|
|
tmp=tabletemp(l,j);
|
|
else
|
|
tabletemp2(pp,j)=tmp;
|
|
tmp=tabletemp(l,j);
|
|
l=l-1;
|
|
end
|
|
pp=pp+1;
|
|
|
|
end
|
|
end
|
|
|
|
if j>1
|
|
profile_array(:,j)=interp1(depth_profile-tabletemp2(:,1),tabletemp2(:,j),pint,'linear');
|
|
end
|
|
|
|
|
|
end
|
|
profile_array(:,5)=profile_array(:,5)/1000; % in g/l
|
|
profile_array(isnan(profile_array))=-999;
|
|
|
|
ysi(i).profile.time=tmean_ysi;
|
|
ysi(i).profile.depth=profile_array(:,1);
|
|
ysi(i).profile.temperature=profile_array(:,2);
|
|
ysi(i).profile.salinity=profile_array(:,3);
|
|
ysi(i).profile.turbidity=profile_array(:,4);
|
|
ysi(i).profile.ssc=profile_array(:,5);
|
|
|
|
%
|
|
% figure
|
|
% hold on
|
|
% plot(profile_array(:,5),profile_array(:,1))
|
|
%
|
|
% plot(tabletemp2(:,5),depth_profile-tabletemp2(:,1),'+r')
|
|
%
|
|
% pause
|
|
|
|
clear tabletemp tabletemp2
|
|
|
|
end
|
|
|
|
%
|
|
% save('Aulne_experiment_20130214_site3_YSI_profiles.mat','ysi')
|
|
|
|
%% display
|
|
|
|
disp_p=ysi(1).profile.depth;
|
|
for i=1:length(ysi)
|
|
disp_t(i)=ysi(i).profile.time;
|
|
disp_sal(:,i)=ysi(i).profile.salinity;
|
|
disp_temp(:,i)=ysi(i).profile.temperature;
|
|
disp_turb(:,i)=ysi(i).profile.turbidity;
|
|
disp_ssc(:,i)=ysi(i).profile.ssc;
|
|
end
|
|
|
|
salmax=10;
|
|
tempmax=12;
|
|
turbmax=500;
|
|
sscmax=2;
|
|
pmax=3;
|
|
|
|
fz=16;
|
|
tmin=min(disp_t);
|
|
tmax=max(disp_t);
|
|
|
|
cmap=jet(31);
|
|
cmap(1,:)=[1 1 1];
|
|
|
|
%salinity
|
|
figure
|
|
colormap(cmap)
|
|
imagesc(disp_t,disp_p,disp_sal)
|
|
caxis([0-salmax/30 salmax])
|
|
ylim([0 pmax])
|
|
set(gca,'YDir','normal','Xtick',(tmin:(tmax-tmin)/10:tmax),'XTickLabel',datestr((tmin:(tmax-tmin)/10:tmax),15),'Fontsize',12)
|
|
xlabel('Time UTC (HH:MM)','Fontsize',fz);ylabel('Depth (m)','Fontsize',fz);title('Aulne experiment - Site3 - Salinity - YSI profiles','Fontsize',fz)
|
|
colorbar
|
|
|
|
figure
|
|
for i=1:length(ysi)
|
|
|
|
tmpx=disp_sal(:,i);
|
|
tmpy=disp_p;
|
|
tmpy(tmpx==-999)=[];
|
|
tmpx(tmpx==-999)=[];
|
|
|
|
subplot(3,3,i)
|
|
plot(tmpx,tmpy)
|
|
xlabel('Salinity','Fontsize',fz);ylabel('Depth (m)','Fontsize',fz);title(datestr(disp_t(i),31),'Fontsize',fz)
|
|
axis([0 salmax,0 pmax])
|
|
end
|
|
|
|
%temperature
|
|
figure
|
|
colormap(cmap)
|
|
imagesc(disp_t,disp_p,disp_temp)
|
|
caxis([0-tempmax/30 tempmax])
|
|
ylim([0 pmax])
|
|
set(gca,'YDir','normal','Xtick',(tmin:(tmax-tmin)/10:tmax),'XTickLabel',datestr((tmin:(tmax-tmin)/10:tmax),15),'Fontsize',12)
|
|
xlabel('Time UTC (HH:MM)','Fontsize',fz);ylabel('Depth (m)','Fontsize',fz);title('Aulne experiment - Site3 - Temperature - YSI profiles','Fontsize',fz)
|
|
colorbar
|
|
|
|
|
|
figure
|
|
for i=1:length(ysi)
|
|
|
|
tmpx=disp_temp(:,i);
|
|
tmpy=disp_p;
|
|
tmpy(tmpx==-999)=[];
|
|
tmpx(tmpx==-999)=[];
|
|
|
|
subplot(3,3,i)
|
|
plot(tmpx,tmpy)
|
|
xlabel('Temperature','Fontsize',fz);ylabel('Depth (m)','Fontsize',fz);title(datestr(disp_t(i),31),'Fontsize',fz)
|
|
axis([0 tempmax,0,pmax])
|
|
end
|
|
|
|
%ssc
|
|
figure
|
|
colormap(cmap)
|
|
imagesc(disp_t,disp_p,disp_ssc)
|
|
caxis([0-sscmax/30 sscmax])
|
|
ylim([0 pmax])
|
|
set(gca,'YDir','normal','Xtick',(tmin:(tmax-tmin)/10:tmax),'XTickLabel',datestr((tmin:(tmax-tmin)/10:tmax),15),'Fontsize',12)
|
|
xlabel('Time UTC (HH:MM)','Fontsize',fz);ylabel('Depth (m)','Fontsize',fz);title('Aulne experiment - Site3 - SSC - YSI profiles','Fontsize',fz)
|
|
colorbar
|
|
|
|
|
|
figure
|
|
for i=1:length(ysi)
|
|
|
|
tmpx=disp_ssc(:,i);
|
|
tmpy=disp_p;
|
|
tmpy(tmpx==-999)=[];
|
|
tmpx(tmpx==-999)=[];
|
|
|
|
subplot(3,3,i)
|
|
plot(tmpx,tmpy)
|
|
xlabel('SSC','Fontsize',fz);ylabel('Depth (m)','Fontsize',fz);title(datestr(disp_t(i),31),'Fontsize',fz)
|
|
axis([0 sscmax,0,pmax])
|
|
end
|