function [] = plotSWIFT(SWIFT);

if ~isempty(SWIFT) & length(SWIFT)>1,
    
wd = pwd;
wdi = find(wd == '/',1,'last');
wd = wd((wdi+1):length(wd));

% wind and wave plot
figure(1), clf, n = 4; 

ax(1) = subplot(n,1,1);
plot( [SWIFT.time],[SWIFT.windspd],'bx','linewidth',2) 
datetick
ylabel([ 'windppd [m/s]'])
set(gca,'Ylim',[0 20])

ax(2) = subplot(n,1,2);
plot( [SWIFT.time],[SWIFT.sigwaveheight],'g+','linewidth',2) 
datetick
ylabel([ 'waveheight [m]'])
set(gca,'Ylim',[0 7])


ax(3) = subplot(n,1,3);
plot( [SWIFT.time],[SWIFT.peakwaveperiod],'g+','linewidth',2) 
datetick
ylabel([ 'waveperiod [s]'])
set(gca,'Ylim',[0 12])

ax(4) = subplot(n,1,4);
plot([SWIFT.time],[SWIFT.winddirT],'bx','linewidth',2), hold on, 
plot([SWIFT.time],[SWIFT.peakwavedirT],'g+','linewidth',2), hold on
datetick
ylabel('directions [^\circ T]')
set(gca,'Ylim',[0 360])
set(gca,'YTick',[0 180 360])


linkaxes(ax,'x')
set(gca,'XLim',[min([SWIFT.time]) max([SWIFT.time])] )
print('-dpng',[wd  '_windandwaves.png'])

% temperature plot
figure(2), clf, n = 3; 
 
tax(1) = subplot(n,1,1); 
plot( [SWIFT.time],[SWIFT.airtemp],'g+','linewidth',2) 
datetick
ylabel(['airtemp [C]'])
set(gca,'Ylim',[-15 25])


tax(2) = subplot(n,1,2); 
if length([SWIFT.time])==length([SWIFT.watertemp]), % only one CT
    plot( [SWIFT.time],[SWIFT.watertemp],'g+','linewidth',2) 
elseif length([SWIFT.time])==length([SWIFT.watertemp])./3, % three CTs
    Tarray = reshape([SWIFT.watertemp],3,length([SWIFT.time]));   
    plot( [SWIFT.time],Tarray(1,:),'rx','linewidth',2), hold on
    plot( [SWIFT.time],Tarray(2,:),'g+','linewidth',2), hold on 
    plot( [SWIFT.time],Tarray(3,:),'k.','linewidth',2), hold on 
    legend('0.1 m','0.5 m','1.2 m')
else
end

datetick
ylabel(['watertemp [C]'])
set(gca,'Ylim',[-2 30])


tax(3) = subplot(n,1,3); 
if length([SWIFT.time])==length([SWIFT.salinity]), % only one CT
    plot( [SWIFT.time],[SWIFT.salinity],'g+','linewidth',2) 
elseif length([SWIFT.time])==length([SWIFT.salinity])./3, % three CTs
    Sarray = reshape([SWIFT.salinity],3,length([SWIFT.time]));  
    plot( [SWIFT.time],Sarray(1,:),'rx','linewidth',2), hold on 
    plot( [SWIFT.time],Sarray(2,:),'g+','linewidth',2), hold on 
    plot( [SWIFT.time],Sarray(3,:),'k.','linewidth',2), hold on 
    legend('0.1 m','0.5 m','1.2 m')
else
end
datetick
ylabel(['salinity [PSU]'])
set(gca,'Ylim',[0 30])

linkaxes(tax,'x')
set(gca,'XLim',[min([SWIFT.time]) max([SWIFT.time])])
print('-dpng',[wd '_tempandsalinity.png'])
 
% turbulence plot
figure(3), clf
for ai = 1:length(SWIFT), 

        plot(SWIFT(ai).uplooking.tkedissipationrate,SWIFT(ai).uplooking.z,'linewidth',2), hold on
        set(gca,'YDir','reverse')
        ylabel('z [m]')
        xlabel('\epsilon [W/kg]')
        set(gca,'Ylim',[0 0.7])
        set(gca,'Xlim',[0 1e-2])
        
end
print('-dpng',[ wd '_turbulence.png'])
        
% wave spectra plot
figure(4), clf
for ai = 1:length(SWIFT), 

        loglog(SWIFT(ai).wavespectra.freq,SWIFT(ai).wavespectra.energy,'linewidth',2), hold on
        xlabel('freq [Hz]')
        ylabel('Energy [m^2/Hz')
end
print('-dpng',[ wd '_wavespectra.png'])
 
% downlooking velocity profile plot
figure(5), clf
for ai = 1:length(SWIFT), 
        
        plot(SWIFT(ai).downlooking.velocityprofile,SWIFT(ai).downlooking.z,'linewidth',2), hold on
        set(gca,'YDir','reverse')
        ylabel('z [m]')
        xlabel('velocity [m/s]')
end
print('-dpng', [wd '_velocityprofiles.png'])

% drift plot
figure(6), %clf
%quiver(lon,lat,dlondt,dlatdt,1), hold on
quiver([SWIFT.lon],[SWIFT.lat],[SWIFT.driftspd].*sind([SWIFT.driftdirT]),[SWIFT.driftspd].*cosd([SWIFT.driftdirT]),1,'r','linewidth',2), hold on
xlabel('longitude'), ylabel('latitude')
axlims = axis;
%quiver(axlims(1) +(axlims(2)-axlims(1))./10, axlims(3)+(axlims(4)-axlims(3))./10, .1, 0,0 );
%text(axlims(1) +(axlims(2)-axlims(1))./9, axlims(3)+(axlims(4)-axlims(3))./8,'0.1 m/s')
plot([SWIFT.lon],[SWIFT.lat],'bo','markersize',2), hold on
%plot(lon(length(lon)),lat(length(lon)),'r.','markersize',20), hold on
print('-dpng',[wd '_drift.png'])

else 
end
