PLOT_TSERIES
Torsten Linders, torsten@oceansurface.se, September 15, 2011
Plots time series of mean values of different parameters for different boxes.
Contents
Cleaning up
clear
close all
Settings
pars{1}='epsi'; % epsi, N2, U, shear, plot_boxes pars{2}='N2'; pars{3}='Ut'; boxes=0:4; allboxes_onefig=0;
Loading prepared data
load timeposlegs load fjordsection load sigma sigma_v load mycolormap load tmal load tsal load ttal for ipar=1:3 par=pars{ipar}; if strcmp(par,'epsi') load epsial elseif strcmp(par,'dens') load densal elseif strcmp(par,'N2') load N2al elseif strcmp(par,'Us') load Usal elseif strcmp(par,'Ut') load Utal elseif strcmp(par,'shears') load shsal elseif strcmp(par,'sheart') load shtal elseif strcmp(par,'plot_boxes') break end end
Timeseries
for box=boxes if box==0 boxrows=51:250; boxcols=201:1000; plstr='.k-'; box_title=', all boxes'; elseif box==1 boxrows=51:150; boxcols=201:400; plstr='.b-'; box_title=', box 1'; elseif box==2 boxrows=151:250; boxcols=201:400; plstr='.r-'; box_title=', box 2'; elseif box==3 boxrows=51:150; boxcols=401:1000; plstr='.g-'; box_title=', box 3'; elseif box==4 boxrows=151:250; boxcols=401:1000; plstr='.m-'; box_title=', box 4'; end for ipar=1:3 par=pars{ipar}; if strcmp(par,'plot_boxes') break end for leg=1:23 if strcmp(par,'epsi') yl=[-9 -6.5]; par_title='Mean dissipation (log_{10}[m^2 s^{-3})'; paral=epsial(:,:,leg); parval=epsival(:,:,leg); tal=tmal(1,:,leg); tval=tmval(1,:,leg); elseif strcmp(par,'N2') yl=[0.8 1.2]*1e-3; par_title='Mean buoyancy frequency squared (s^{-2})'; paral=N2al(:,:,leg); parval=N2val(:,:,leg); tal=tmal(1,:,leg); tval=tmval(1,:,leg); elseif strcmp(par,'Us') yl=[-0.15 0.15]; par_title='Mean horizontal velocity (m/s), ship ADCP'; paral=Usal(:,:,leg); parval=Usval(:,:,leg); tal=tsal(1,:,leg); tval=tsval(1,:,leg); elseif strcmp(par,'Ut') yl=[-0.15 0.15]; par_title='Mean horizontal velocity (m/s), TIMOS'; paral=Utal(:,:,leg); parval=Utval(:,:,leg); tal=ttal(1,:,leg); tval=ttval(1,:,leg); elseif strcmp(par,'shears') yl=[-7 7]*1e-3; par_title='Mean vertical shear (s^{-1}), ship ADCP'; paral=shsal(:,:,leg); parval=shsval(:,:,leg); tal=tsal(1,:,leg); tval=tsval(1,:,leg); elseif strcmp(par,'sheart') yl=[-7 7]*1e-3; par_title='Mean vertical shear (s^{-1}), TIMOS'; paral=shtal(:,:,leg); parval=shtval(:,:,leg); tal=ttal(1,:,leg); tval=ttval(1,:,leg); end boxval=parval*0; boxval(boxrows,boxcols)=1; parbox(leg)=mean(mean(paral(find(parval.*boxval)))); tbox(leg)=mean(tal(find(tval))); end if allboxes_onefig fig=figure(100); subplot(3,1,ipar) set(fig,'Position',[1 1 800 900]); hold on plot(tbox(1:3),parbox(1:3),plstr) else fig=figure(100+box); subplot(3,1,ipar) set(fig,'Position',[1 1 800 900]); plot(tbox(1:3),parbox(1:3),plstr) end hold on plot(tbox(4:13),parbox(4:13),plstr) plot(tbox(14:23),parbox(14:23),plstr) hold off xlim([163 168]) grid on title([par_title box_title]) end
Plotting the boxes' depth and distance:
if strcmp(par,'plot_boxes') && box>0 fig=figure(100); set(fig,'Position',[1 1 800 900]); plot_extras title('Boxes for time series') axis ij hold on plot([boxcols(1) boxcols(end)],[boxrows(1) boxrows(1)],'-k','LineWidth',3) plot([boxcols(1) boxcols(end)],[boxrows(end) boxrows(end)],'-k','LineWidth',3) plot([boxcols(1) boxcols(1)],[boxrows(1) boxrows(end)],'-k','LineWidth',3) plot([boxcols(end) boxcols(end)],[boxrows(1) boxrows(end)],'-k','LineWidth',3) text(mean(boxcols),mean(boxrows),num2str(box),'Color',plstr(2)); hold off end end