%%
%%% plot all surveys
% close all

nr_surveys = 12;
clr = 1-[1:nr_surveys]/nr_surveys;


figure(76)
% 1st survey


% contour
contourl = [0 1 2 3 ];

ylimits=([140 220;
    100 200;
    75 150;
    45 85]);

for i = 1: length(contourl)
    k=1;
    year = 2009;
    for month = 7:12;
        [xi, yi, altitude] = plot_interpolation(year,month);
        figure(76);subplot(length(contourl),1,i)
        contour(xi,yi,altitude,[contourl(i) contourl(i)],'color',[clr(k) clr(k) clr(k)],...
            'DisplayName', datestr(datenum(num2str([month year]),'mm yyyy'),'mmmm yy'));
        % make countour movie
        if i == 1
            figure(43)
            [C,h]=contour(xi,yi,altitude,[-8:3]);
            hold on
            contour(xi,yi,altitude,[0 0],'linewidth',3)
            xlabel('along shore [m]')
            ylabel('cross shore [m]')
            ylim([0 1050])
            set(h,'ShowText','on');
            title([num2str(year) '-' num2str(month)])
            M(k) =getframe(gcf);
            if 0
                print('-dpng',['./contour_series/contour' num2str(k) '.png'])
            end
            close(43)
        end


        hold all
        k=k+1;
    end

    year = 2010;
    for month = 1:5;
        [xi, yi, altitude] = plot_interpolation(year,month);
        figure(76);subplot(length(contourl),1,i)
        contour(xi,yi,altitude,[contourl(i) contourl(i)],'color',[clr(k) clr(k) clr(k)],...
            'DisplayName', datestr(datenum(num2str([month year]),'mm yyyy'),'mmmm yy'));
        if i ==0
            % make countour movie
            figure(43)
            [C,h]=contour(xi,yi,altitude,[-8:3]);
            hold on
            contour(xi,yi,altitude,[0 0],'linewidth',3)
            xlabel('along shore [m]')
            ylabel('cross shore [m]')
            ylim([0 1050])
            set(h,'ShowText','on');
            title([num2str(year) '-' num2str(month)])
            if 1
                print('-dpng',['./contour_series/contour' num2str(k) '.png'])
            end
            M(k) =getframe(gcf);
            close(43)
        end
        k=k+1;
    end
    ylim([ylimits(i,:)])
    title([num2str(contourl(i)) 'm contourline'])
    % ylabel('cross shore coordinate [m]')


    legend('location','NorthEastOutside')
    axis_pos = get(gca,'position');
    if i~=1 legend('off'); end
    if i==2 ylabel('cross shore [m]');end
    if i==4 xlabel('along shore [m]');end
    set(gca,'position',axis_pos);
    k=k;
end



%
%
%
%
% [xi,yi,altitude] = plot_interpolation(2009,7);
% figure
% contour(xi,yi+20,altitude,[1 1],'color',[k*0.1 k*0.1 k*0.1]);
% hold all
% shading interp