Energy and direction spectrum data - derived from a fast fourier transform of
approximately 30 minutes of wave data -
wave data) is plotted with frequency on the x axis and time on the y axis.
The length of a vector corresponds to the energy density (with scale to
the right of the plot) and the wavefront direction is in the direction
of the arrow. True North is at the top of the page.
Every fourth data run is plotted.
Matlab code for generating the plot (no longer used)
%-------------------------------------------------------------------------------
% Name:
% .dbase/web_programs/plotpro/matlab_scripts/feather.m
% Description:
% Creates the monthly vector plot (feathers).
% A few lines are pre-pended to this script.
% Called by:
% .f90/plot_utils.make_plot
%-------------------------------------------------------------------------------
path(path,'/project/dbase/web_programs/plotpro/matlab_scripts');
wkg = wkg_path;
% give short names for loaded variables.
% NOTE: x = frequency data, y = energy density data, z = direction
eval(['freq=load(''',wkg,'freq.',pid,'01'');']);
eval(['ener=load(''',wkg,'ener.',pid,'01'');']);
eval(['dire=load(''',wkg,'dire.',pid,'01'');']);
x = freq(1,:);
y = ener;
z = dire;
% check to see if we have data
if ~ (any(x>0) & any(y>0) & any(z>0))
unix(['\rm ',wkg,'plot_',pid,'*']); % for pp when run mountain with archive.
clear all;
quit;
end
dt = read_date_file([pid,'01'],wkg);
tim = dt.day + (dt.hour + dt.min/60)/24; % in days
yearchar = num2str(dt.year(1));
monthnum = dt.month(1);
clear freq ener date
% set energy to zero where direction is -1
I = find(z<0);
y(I) = 0;
clear I;
% set figure location on paper
ppleft = .05;
ppbottom = .05;
ppwidth = .9;
ppheight = .93;
% set figure window
figure('units','normal','paperunits','normal', 'position',[.1,.1,.5,.8], ...
'paperposition',[ppleft,ppbottom,ppwidth,ppheight],'visible','off');
% to get arrow directions right get paper dimensions
xpage = 8.5;
ypage = 11;
% setup axes for text outside the plot region
tah = axes('position',[0 0 1 1],'visible','off');
% setup axes for data plot.
axleft = 0.1;
axbottom = 0.1;
axwidth = 0.7;
axheight = 0.76;
dah = axes('position',[axleft, axbottom, axwidth, axheight],'visible','off');
% setup plot scale parameters.
uxlim = 0.25;
lxlim = 0.04;
uylim = 33;
lylim = 1;
sy= size(y);
sz= size(z);
% get date information and index I for first of every
% day and every six hours.
pday = 0;
ptime = 0;
j=1;
k=1;
for i=1:sz(1)
if ( (dt.day(i) ~= pday) | (tim(i) - ptime > 5/24))
pday = dt.day(i);
ptime = tim(i);
I(k) = i;
k = k + 1;
end
end
% relate paper dimensions to axes scales
J = find( x<=uxlim & x >= lxlim);
Imin = min(J);
Imax = max(J);
xscale = ( Imax - Imin )/(xpage*ppwidth*axwidth);
%xscale = ( uxlim - lxlim )/(xpage*ppwidth*axwidth);
yscale = ( uylim - lylim )/(ypage*ppheight*axheight);
% remove records not used
y = y(I,J);
ymax = max(max(y));
z = z(I,J);
tim = tim(I);
clear I;
%-------------------------------------------------------------------------------
%-- PLOT VECTORS ---------------------------------------------------------------
%-------------------------------------------------------------------------------
stretch = 7;
%ymax=30.; % Use for fixed scale
%stretch = 0;
[u,v]=pol2cart(-1*(z+90)*(2*pi/360),y./ymax);
quiver(J,tim,xscale.*u,yscale.*v,stretch);
% LABEL X AXIS
numticks = 5;
diff = floor((Imax - Imin)/(numticks-1));
xt = Imin + (0:(numticks-1))*diff;
fxtl = num2str(x(xt)',2);
pxtl = num2str(1./x(xt)',2);
set(gca,'xlim',[Imin,Imax],'xtick',xt,'xticklabel',fxtl);
text(xt,-.5*ones(1,numticks),pxtl,'horizontalalignment','center');
text(Imax+.5,0.5,'Frequency (Hz)','horizontalalignment','left',...
'fontsize',10);
text(Imax+.5,-.37,'Period (s)','horizontalalignment','left',...
'fontsize',10);
% LABEL Y AXIS
ylabel('Day of Month (UTC)','fontsize',12);
set(gca,'ylim',[lylim,uylim],'ytick',[lylim:uylim-2],...
'yticklabel',num2str([lylim:uylim-2]'));
% GET STATION INFO
info = read_info_file([pid,'01'],wkg);
% WRITE STATION INFO ON PLOT
set(gcf,'currentaxes',tah);
text(.45,.955,[info.stnid,' ',info.stname],'horizontalalignment',...
'center','fontsize',14);
stream_name = ['(',char(info.stream_name),')'];
if ( length(stream_name) > 5 )
text(.45, .932, stream_name, 'horizontalalignment',...
'center','fontsize',12);
end
text(.45,.903,'ENERGY/DIRECTION SPECTRUM','horizontalalignment',...
'center','fontsize',14);
mname = get_monthname(monthnum,'long');
text(.45,.883,[char(mname),' ',yearchar],'horizontalalignment',...
'center','fontsize',14);
% PUT SCALE ON FIGURE
plotmax = 0.197; % magic number: length of ymax (inches) on plot per unit of stretch
ymaxlength = plotmax*stretch; % length in inches of ymax on plot
%ymaxlength = plotmax; % use for fixed scale
scalelength = 2; % desired approximate length of scale in inches
ytop = ymax*scalelength/ymaxlength;
if ytop < .1
rndval = .01;
elseif ytop < 1
rndval = .1;
elseif ytop < 10
rndval = 1;
else
rndval = 10;
end
scaleytop = rndval*round(ytop/rndval); % top value on scale
% y scale height in normalized units
yscaleheight = (scalelength/ypage)*(scaleytop/ytop);
axes('position',[.870,.60,.05,yscaleheight]);
hold on;
%draw the scale line (4 units long)
ytick = [0,scaleytop/4,scaleytop/2,3*scaleytop/4,scaleytop];
yticklabs = num2str(ytick',4);
feather(0,scaleytop);
hold on;
set(gca,'ylim',[0,scaleytop],'ytick',ytick,'yticklabel',yticklabs,'xticklabel',[]);
xlim=get(gca,'xlim');
ylim=get(gca,'ylim');
xtext = (xlim(2)-xlim(1))/7 + xlim(2);
text(xtext,ytop/2,'Energy Density (m^2/Hz)','rotation',90, ...
'horizontalalignment','center','fontsize',12);
text((xlim(2)-xlim(1))/2 + xlim(1), ylim(2) + ylim(2)/5,...
'TRUE','horizontalalignment','center','fontsize',12);
text((xlim(2)-xlim(1))/2 + xlim(1), ylim(2) + ylim(2)/10,...
'NORTH','horizontalalignment','center','fontsize',12);
blue_box(0.01)
% Print the plot
%saveas(gcf,'/home/corey/feather.fig')
set(gcf, 'visible','off');
png_name = [wkg,'plot_',pid,'.png'];
print('-dpng','-r75',png_name);
quit