PLOT_AV
Torsten Linders, torsten@oceansurface.se, December 13, 2011
Plots average values.
Should work with both matlab and octave.
Contents
Cleaning up
clear
close all
Settings
par='Ekad'; % eps, N2, dens, U, shear, mUt, Udst, intU, pdev, zdev, Epot, time whichplot='av'; % legs, all, diffio, av plot_dens=0; % 0, 1 par_vector=0; % 0, 1 platform='mss'; % mss, ship, timos avday=4; % 0, 1, 2, 3
Loading prepared data
load mat/timeposlegs load mat/fjordsection load mat/sigma sigma_v load mat/mycolormap if strcmp(par,'eps') if avday==0 load mat/epsav load mat/densav elseif avday==1 load mat/epsav1 load mat/densav1 elseif avday==2 load mat/epsav2 load mat/densav2 elseif avday==3 load mat/epsav3 load mat/densav3 end elseif strcmp(par,'dens') if avday==0 load mat/densav elseif avday==1 load mat/densav1 elseif avday==2 load mat/densav2 elseif avday==3 load mat/densav3 end elseif strcmp(par,'pdev') load mat/pdevav elseif strcmp(par,'N2') if avday==0 load mat/N2av elseif avday==1 load mat/N2av1 elseif avday==2 load mat/N2av2 elseif avday==3 load mat/N2av3 end elseif strcmp(par,'U') || strcmp(par,'mUt') || strcmp(par,'Udst') if strcmp(platform,'ship') if avday==0 load mat/Usav load mat/densav elseif avday==1 load mat/Usav1 load mat/densav1 elseif avday==2 load mat/Usav2 load mat/densav2 elseif avday==3 load mat/Usav3 load mat/densav3 end elseif strcmp(platform,'timos') if avday==0 load mat/Utav load mat/densav elseif avday==1 load mat/Utav1 load mat/densav1 elseif avday==2 load mat/Utav2 load mat/densav2 elseif avday==3 load mat/Utav3 load mat/densav3 end end elseif strcmp(par,'Ek') load mat/Ekav elseif strcmp(par,'Ekad') load mat/Ekadav elseif strcmp(par,'Epad') load mat/Epadav elseif strcmp(par,'shear') if strcmp(platform,'ship') if avday==0 load mat/shsav elseif avday==1 load mat/shsav1 elseif avday==2 load mat/shsav2 elseif avday==3 load mat/shsav3 end elseif strcmp(platform,'timos') if avday==0 load mat/shtav elseif avday==1 load mat/shtav1 elseif avday==2 load mat/shtav2 elseif avday==3 load mat/shtav3 end end elseif strcmp(par,'intU') if strcmp(platform,'ship') if avday==0 load mat/intUsav elseif avday==1 load mat/intUsav1 elseif avday==2 load mat/intUsav2 elseif avday==3 load mat/intUsav3 end elseif strcmp(platform,'timos') if avday==0 load mat/intUtav elseif avday==1 load mat/intUtav1 elseif avday==2 load mat/intUtav2 elseif avday==3 load mat/intUtav3 end end elseif strcmp(par,'Epot') if avday==0 load mat/Epotav elseif avday==1 load mat/Epotav1 elseif avday==2 load mat/Epotav2 load mat/epsav2 %!!!!!!!!!!!!!! elseif avday==3 load mat/Epotav3 end end
Plotting averages
fig=figure(200+avday); set(fig,'Position',[1 1 800 900]); set(fig,'Colormap',mycolormap); if avday==0 day_title='All legs, '; if strcmp(platform,'timos') avlegs=2:23; else avlegs=1:23; end elseif avday==1 day_title='Day 1, '; if strcmp(platform,'timos') avlegs=2:3; else avlegs=1:3; end elseif avday==2 day_title='Day 2, '; avlegs=4:13; elseif avday==3 day_title='Day 3, '; avlegs=14:23; elseif avday==4 day_title='All legs, '; if strcmp(platform,'timos') avlegs=2:23; else avlegs=1:23; end end if strcmp(par,'eps') imagesc(epsav) if plot_dens hold on contour(fliplr(rot90(densav',-1)),sigma_v,'w') hold off title([day_title 'average dissipation (log_{10}[m^2 s^{-3}]) and density']) else title([day_title 'average dissipation (log_{10}[m^2 s^{-3}])']) end elseif strcmp(par,'dens') imagesc(densav) title([day_title 'average density']) elseif strcmp(par,'Epot') imagesc(log10(abs(Epotav))-epsav-log10(86400)) title([day_title 'average potential energy (J/kg) of z deviation']) Ebud=log10(abs(Epotav))-epsav-log10(86400); iEbud=not(isnan(Ebud)); mean(Ebud(iEbud)) elseif strcmp(par,'N2') imagesc(N2av) title([day_title 'average buoyancy frequency squared (s^{-2})']) elseif strcmp(par,'U') if strcmp(platform,'ship') imagesc(Usav) title([day_title 'average horizontal velocity (m/s), ship ADCP']) elseif strcmp(platform,'timos') imagesc(Utav) if plot_dens hold on contour(fliplr(rot90(densav',-1)),sigma_v,'k') hold off title([day_title 'average horizontal velocity (m/s), TIMOS, and density']) else title([day_title 'average horizontal velocity (m/s), TIMOS']) end end elseif strcmp(par,'Ek') imagesc(Ekav(:,:,avday)) title([day_title ', average kinetic energy (m^2 s^{-2})']) elseif strcmp(par,'Ekad') span=50; window=ones(span,1)/span; for k=1:kmax Ekadav_pl(k,:)=conv(Ekadav(k,:,avday),window,'same'); end imagesc(Ekadav_pl) title([day_title ', average horizontal advection of kinetic energy (m^2 s^{-3})']) text(50,460,['Horizontal filtering over ' num2str(span*dx) ' m.']) elseif strcmp(par,'Epad') imagesc(Epadav(:,:,avday)) title([day_title ', average horizontal advection of potential energy (m^2 s^{-3})']) elseif strcmp(par,'Udst') imagesc(Usav-Utav) title(['Average Difference in horizontal velocity (m/s), ship ADCP - TIMOS']) elseif strcmp(par,'mUt') && leg>mlegs imagesc(mean(Utal(:,:,leg-mlegs+1:leg),3)) if plot_dens hold on contour(fliplr(rot90(mean(densal(:,:,leg-mlegs+1:leg),3)',-1)),sigma_v,'k') hold off title(['Leg ' num2str(leg-mlegs+1) ' - ' num2str(leg) ', Mean horizontal velocity (m/s), TIMOS, and density']) else title(['Leg ' num2str(leg-mlegs+1) ' - ' num2str(leg) ', Mean horizontal velocity (m/s), TIMOS']) end elseif strcmp(par,'shear') if strcmp(platform,'ship') imagesc(shsav) title([day_title 'average magnitude of vertical shear (s^{-1}), ship ADCP']) elseif strcmp(platform,'timos') imagesc(shtav) title([day_title 'average magnitude of vertical shear (s^{-1}), TIMOS']) end elseif strcmp(par,'time') subplot(2,1,1) if strcmp(platform,'mss') li=filmss(avlegs(1)):lilmss(avlegs(end)); for ibad=imssbad li=li(find(li~=ibad)); end if avday==0 for inl=imssnl li=li(find(li~=inl)); end end plot(distmss(li),tmss(li),'ob') title([day_title 'MSS']) elseif strcmp(platform,'ship') elseif strcmp(platform,'timos') end elseif strcmp(par,'intU') subplot(2,1,2) if strcmp(platform,'ship') plot(x,intUsav,'.r-') title([day_title 'average, the ship ADCP']) elseif strcmp(platform,'timos') plot(x,intUtav,'.g-') title([day_title 'average, TIMOS']) end end
One of the following help scripts is used: plot_extras_vector.m or plotextras.m
if par_vector plot_extras_vector else plot_extras end
The help script printplot_av.m is used for producing an png-file of each figure.
printplot_av
close all