function stat=newplt_abs_stats(name_base) % script to plot abs data, data format has changed since Myrtle Beach % report, so one file per frequency must be loaded, but the plotting is based % on Charlene's plot_ABS_stats.m from Myrtle Beach % emontgomery@usgs.gov; March 2011 % make sure the argument is the right form if isnumeric(name_base) name_base=num2str(name_base); end stat=1; % load in the data for the 3 heads % first 5KhZ in the 3s file fname=[name_base 'abss3s.cdf']; nc=netcdf(fname); tt5=nc{'time'}(:)+(nc{'time2'}(:)./86400000); mean5=nc{'abs_trans_mean'}(:,:)'; vr5=nc{'vrange'}(:)'; pctl5=nc{'abs_trans_pctl'}(:,:); ttl5=nc{'abs_trans_mean'}.long_name(:); close(nc) %now for 2.5KhZ in the 2s file fname=[name_base 'abss2s.cdf']; nc=netcdf(fname); tt2_5=nc{'time'}(:)+(nc{'time2'}(:)./86400000); mean2_5=nc{'abs_trans_mean'}(:,:)'; vr2_5=nc{'vrange'}(:)'; pctl2_5=nc{'abs_trans_pctl'}(:,:); ttl2_5=nc{'abs_trans_mean'}.long_name(:); close(nc) %now for 1KhZ in the 1s file fname=[name_base 'abss1s.cdf']; nc=netcdf(fname); tt1=nc{'time'}(:)+(nc{'time2'}(:)./86400000); mean1=nc{'abs_trans_mean'}(:,:)'; vr1=nc{'vrange'}(:)'; pctl1=nc{'abs_trans_pctl'}(:,:); ttl1=nc{'abs_trans_mean'}.long_name(:); clrttl=nc{'abs_trans_mean'}.units(:); close(nc) % assume the times cover the same span since logged together freq_strs=['1 '; '2_5'; '5 ']; pctiles = {'1st','16th','50th','84th','99th'}; %now do the plot of means for ik=1:3 switch ik case 1 figure('pos',[100 100 1000 800]) orient landscape subplot(311) case 2 subplot(312) case 3 subplot(313) end eval(['xdata=datenum(gregorian(tt' deblank(freq_strs(ik,:)) '));']) eval(['depth=vr' deblank(freq_strs(ik,:)) ';']) eval(['data=mean' deblank(freq_strs(ik,:)) ';']) eval(['ttl=ttl' deblank(freq_strs(ik,:)) ';']) pcolor(xdata, flipud(depth), log(data)) shading flat datetick('x',2,'keepticks','keeplimits') ylabel('Distance from ABS (m)') set(gca,'YDir','reverse') set(gca,'Ytick',[0:.25:depth(end)]) set(gca,'YtickLabel',num2str([0:.25:depth(end)]',2)) set(gca,'Layer','top') axpos = get(gca,'position'); if ik ==1; ca=caxis; else caxis(ca); end L = axpos(1)-.055; B = axpos(2); W = axpos(3)+.075; H = .2; set(gca,'position',[L B W H]) clrbr = colorbar; cpos = get(clrbr,'position'); set(clrbr,'position',[L+W+.01 B 0.02 H]) set(get(clrbr,'Ylabel'),'String',clrttl) title(ttl) if isequal(ik,3) xlabel('Time') end end %removing the large matrices doesn't help memory much, but removing the %plot when your done with it helps a lot! clear xdata depth data ttl mean* nc eval(['print -djpeg ' name_base 'abs_means.jpg;']) close % now do the pctl plots for each transducer for ik=1:3 eval(['data=pctl' deblank(freq_strs(ik,:)) ';']) eval(['xdata=datenum(gregorian(tt' deblank(freq_strs(ik,:)) '));']) eval(['depth=vr' deblank(freq_strs(ik,:)) ';']) eval(['ttl=ttl' deblank(freq_strs(ik,:)) ';']) [a,b,lvl]=size(data); figure('pos',[100 100 1000 800]) orient landscape for k = 1:lvl subplot(lvl,1,k) pcolor(xdata, flipud(depth), log(data(:,:,k)')) shading flat datetick('x',2,'keepticks','keeplimits') ylabel({'Distance from','ABS (m)'}) set(gca,'YDir','reverse') set(gca,'Layer','top') title([pctiles{k},' Percentile']) axpos = get(gca,'position'); if k ==1; ca=caxis; else caxis(ca); end L = axpos(1)-.05; B = axpos(2); W = axpos(3)+.07; H = .1; set(gca,'position',[L B W H]) clrbr = colorbar; cpos = get(clrbr,'position'); set(clrbr,'position',[L+W+.01 B 0.02 H]) set(get(clrbr,'Ylabel'),'String',clrttl) if isequal(k,1) text(((xdata(1)+xdata(end))/2),-0.45,ttl,'horizontalalignment',... 'center','fontsize',14) elseif isequal(k,5) xlabel('Time') end end %removing the large matrices doesn't help memory much, but removing the %plot when your done with it helps a lot! eval (['clear data pctl' deblank(freq_strs(ik,:)) ';']) eval(['print -djpeg ' name_base 'abs' deblank(freq_strs(ik,:)) '_pctl.jpg;']) close end