By selecting a cut-off period (usually 10 seconds), the
total energy in all bands less than the cut-off (the sea), is
plotted in blue, and the total energy in all bands greater
than the cut-off (the swell) is plotted in red for each
run (30 minute file).
Source Code:
%-----------------------------------------------------------------------
% Name:
% .dbase/web_programs/plotpro/matlab_scripts/seaswell.m
% Description:
% Creates a sea swell plot for the supplied time span by
% splitting 9-band data at the specified period cut-off.
% A few lines are pre-pended to this script.
% Called by:
% .f90/plot_utils.make_plot
%-----------------------------------------------------------------------
% ADD PATH TO ACCESS MATLAB SCRIPTS
path(path,'/project/dbase/web_programs/plotpro/matlab_scripts');
path(path,'/project/wvutil/mat_util');
wkg = wkg_path;
% SET-UP FIGURE
h=figure('Position',[100 100 900 700],'Name',...
'Compendium Plot','NumberTitle','off','paperposition',[0 0 7.75 7.75], ...
'defaultaxesposition',[0.08 0.12 .87 .725], 'visible', 'off');
eval(['list=load(''',wkg,'list.',pid,'01'');']);
% GET STATION INFO
info = read_info_file([pid,'01'],wkg);
% INITIALIZE DATENUMS
number_date = integer_to_datenum(list(:,1));
last_date = length(number_date);
% FIND THE CUT-OFF IDX
idx = 11 - tp_cut/2;
if ( idx == 0 ) idx = 1, end; % 22 second cut-off case
% determine the cut-off columns
low_cols = [ (idx + 4) : 12 ]; % low period energy band columns
high_cols = [ 4 : (idx + 3) ]; % high period energy band columns
% calculate Hs for each case (low/high period) and each sample
num_points = size(list,1);
for row=1:num_points
hs_low(row) = 4 * sqrt( sum(list(row,low_cols)) );
hs_high(row) = 4 * sqrt( sum(list(row,high_cols)) );
end
plot(number_date, hs_high, 'r.');
hold on;
plot(number_date, hs_low, 'b.');
% ADD LEGEND
tp_s = num2str(tp_cut);
legend(['Peak period >= ',tp_s,'s'],['Peak period < ',tp_s,'s']);
% CREATE DATE LABELS
timespan=number_date(last_date)-number_date(1);
timediv=(timespan/10);
xar=[number_date(1):timediv:number_date(last_date)];
xlab1=datestr(xar,'mm/dd/yy');
xlab2=datestr(xar,'HH:MM');
set(gca,'XLim',[number_date(1) number_date(last_date)]);
set(gca,'XTick',xar);
set(gca,'XTickLabel',xlab1);
maxhs = max([hs_high hs_low]);
% MAKE AND WRITE TITLE INFORMATION
del_x = xar(3)-xar(2);
% STATION ID, NAME
y = 1.27*maxhs;
x = xar(6) - .0*del_x;
text(x,y,[char(info.stnid),' ',char(info.stname)], ...
'fontsize',14,'fontweight','normal', 'horizontalalignment','center');
% MAKE START AND END DATES
x = xar(6) + .0*del_x;
y = 1.225*maxhs;
ds1 = [datestr(number_date(1),'mm/dd/yy'),' ',datestr(number_date(1),'HH:MM')];
ds2 = [datestr(number_date(last_date),'mm/dd/yy'),' ' , ...
datestr(number_date(last_date),'HH:MM')];
text(x,y,[ds1,' - ',ds2],'fontsize',12,'fontweight','bold', ...
'horizontalalignment','center');
% NUMBER OF OCCURRENCES
y = 1.185*maxhs;
x = xar(6) + .0*del_x;
text(x,y,['Total Number of Occurrences = ',num2str(num_points)], ...
'fontsize',12, 'fontweight','bold', 'horizontalalignment','center');
% SEA/SWELL
y = 1.13*maxhs;
x = xar(6) - .1*del_x;
text(x,y,'SEA','fontsize',14,'fontweight','bold','color','b', ...
'horizontalalignment','right');
x = xar(6) + 0*del_x;
text(x,y,'/','fontsize',14,'fontweight','bold','horizontalalignment','center');
x = xar(6) + 0.1*del_x;
text(x,y,'SWELL','fontsize',14,'fontweight','bold','color','r', ...
'horizontalalignment','left');
% WRITE HOURS TO X AXIS
sl=size(xlab1);
for i=1:sl(1)
text(xar(i),-.045*maxhs,xlab2(i,1:5),'HorizontalAlignment','center');
end
ylim([0 maxhs*1.1]);
ylabel('Significant Wave Height, Hs (cm)','FontSize',12,'FontWeight','bold');
text(xar(6),-.085*maxhs,'Date (UTC)','HorizontalAlignment','center','FontSize',12,'FontWeight','bold');
%text(xar(9),-.12*maxhs,'http://cdip.ucsd.edu','HorizontalAlignment','left','FontSize',9);
grid on;
% PUT BOX AROUND PLOT WITH WEB ADDRESS
blue_box(0.01);
set(gcf, 'visible','off');
set(gcf, 'PaperPosition',[0 0 7.75 7.75]);
png_name = [wkg,'plot_',pid,'.png'];
print('-dpng','-r75',png_name);
quit;