
close all

pdf = 1;  %This option prints the plots as individual .pdf files.
ps = 1;  %This option puts all plots into one .ps file.  To make this into a .pdf use "ps2pdf -sPAPERSIZE=11x17 print_filenm.ps"


%mo = [10 11 12 1 2 3];
%monthname = {'October', 'November', 'December', 'January', 'February', 'March'};

mo = 1:12;
monthname = {'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'};


bins = 0.25:.5:9.75;  %Bin Centers, hist lumps all small and big values into end bins.

figure('Position',[419 107 759 831],'PaperOrientation','portrait','PaperPosition',[0 0 8.5 11]);

hold on

for i = 1:12
    subplot(6,2,i);
    set(gca,'FontSize',14);
    [n,xout] = hist(H_s(find(~(Month-mo(i)))),bins);
    ntot = sum(n)
    bar(xout,n*(43200/60)/ntot,1);
    sum(n*(43200/60)/ntot)
    %hist(H_s(find(~(Month-mo(i)))),bins);
    title(monthname(i));
    foo = axis;
    foo(1) = 0;
    foo(2) = 10;
    foo(3) = 0;
    foo(4) = 300;
    axis(foo);
    if(mod(i,2) == 1)
        ylabel('Hours');
    end
    if(i > 10)
        xlabel('H_s (m)');
    end
end
print -dpdf 'MonthlyWaveConditions';


figure('Position',[419 107 759 831],'PaperOrientation','portrait','PaperPosition',[0 0 8.5 11]);
set(gca,'FontSize',18);
[n,xout] = hist(H_s,bins);
ntot = sum(n);
bar(xout,n*(365)/ntot,1);
ylabel('Days');
xlabel('H_s (m)');
title('Yearly wave statistics at CDIP 071 (Harvest, CA)');
print -dpdf 'YearlyWaveConditions';

if(ps)
    print('-dpsc2','CDIP071_WaveConditions');
    figure(1)
    print('-dpsc2','-append','CDIP071_WaveConditions');
end
