% +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
% Liverpool Bay WaveNet Site (WMO ID 62287) © Crown Copyright 2009					
% Deployment Id LIVBAYWN/004: from 01-Jun-2008 to 30-Mar-2009					
% Located at 53°32'.06N and 003°21'.16W in 22m of water					
% Data recorded using a Directional Waverider					
% Time (GMT)	Hm0 (m) 	TEMP(°C)	Tpeak (s)	W_PDIR (deg)	W_SPR(deg)
% +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
clear;pack
cd 'E:\Jon_work\PROJECTS\CURRENT PROJECTS\MICORE FP7 START June 2008\Data and data management\Liverpool wave buoy 1_6_2008 to 30_3_2009';
load Liv_Bay_wave_tide
%time_str = textread('test_1.txt','%19c' );time = datenum(time_str,'yyyy-mm-dd HH:MM:SS');
%time_tide = datenum(textdata,'dd-mm-yyyy HH:MM:SS');
Hm0 = wave_data(:,1);  Temp = wave_data(:,2); Tp = wave_data(:,3); dir = wave_data(:,4); spread = wave_data(:,5);
count = 1; for index = 1:length(Hm0); if Hm0(index) > 3.0; storm_time(count) = time(index);  count = count +1; end; end;

storms = datevec(storm_time);  
%events with Hm0 > 3.0 m:           
%         1)  22/06/2008 21:00 - 23:30                                          
%         2)  01/10/2008 04:30 - 11:30          
%         3)  03/10/2008 00:00 - 05:00          
%         4)  10/11/2008 04:30 - 05:00         
%         5)  11/11/2008 09:30 - 20:30          
%         6)  21/11/2008 05:00 - 18:00        
%         7)  23/11/2008 11:30 - 24/11/2008 00:30         
%         8)  19/12/2008 17:00         
%         9)  09/03/2009 01:30 07:00           
%         10) 23/03/2009 20:00 - 23:30          
%         11) 27/03/2009  04:00 - 08:30          

figure
    subplot(4,1,1)
        plot(time_tide,Tide,'-k'); hold on; plot(storm_time,12,'or');datetick('x',3);
        set(gca,'fontsize',12);title('Tide');ylabel('m');axis([min(time_tide) max(time_tide) 0 15]);set(gca,'fontsize',12); 
    subplot(4,1,2)
        plot(time,Hm0,'.k'); hold on; plot(storm_time,5,'or');datetick('x',3);
        set(gca,'fontsize',12);title('Hm0');ylabel('m');axis([min(time) max(time) 0 6]);set(gca,'fontsize',12); 
    subplot(4,1,3)
        plot(time,Tp,'.b');datetick('x',3);
        set(gca,'fontsize',12);title('Tp');ylabel('s');axis([min(time) max(time) 0 16]);set(gca,'fontsize',12); 
    subplot(4,1,4)
        plot(time,dir,'.k');hold on;plot(time,spread,'.r');datetick('x',3);
        set(gca,'fontsize',12);title('black = mean direction    red = spread');xlabel('Date'); ylabel('deg');axis([min(time) max(time) -50 400]);set(gca,'fontsize',12);
         
