NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

root/DPWavesProc/trunk/DPWavesProc/test_code/nortek_specmultiplot_compare.m

Revision 225 (checked in by gdusek, 15 years ago)

Re-organized directory structure and cleaned up some code.

Line 
1 function [Winfo]=nortek_specmultiplot(dateinfo1,dateinfo2,timestep);
2
3 %NOTE:  This function is for the Nortek AWAC profiler!
4
5 %where dateinfo1 and 2 are the strings of the first and last date extension
6 %of the pressure,range,etc files and timestep is the time in hours between
7 %each burst
8
9 %This function takes the pressure, range, orbit and sysinfo files created
10 %in python and outputs a Winfo data structure with the sig wave height,
11 %peak period, direction of peak period and dominant dir.  It also generates
12 %polar plots and 2d freq and directional plots of a variety of different
13 %estimation methods, resolutions and the nortek quickwave output.
14
15
16 %first set up the time vector going from dateinfo1 to dateinfo2
17 Winfo.time=[];
18
19 date1=datevec(dateinfo1, 'yymmddHHMM');
20 date2=datevec(dateinfo2,'yymmddHHMM');
21
22 if date1 == date2
23     Winfo.time=[datenum(date1)];
24 else
25     Winfo.time=[datenum(date1)];
26     newdate=date1;
27     while datenum(newdate) ~= datenum(date2)
28         newdate=newdate+[0 0 0 timestep 0 0];
29         Winfo.time=[horzcat(Winfo.time,datenum(newdate))];
30     end
31 end
32            
33      
34 %set up time, which is Winfo.time as date str in the yymmddHHMM format
35 time=datestr(Winfo.time, 'yymmddHHMM');
36
37 %set up data structure for wave info
38 Winfo.setup={'EMEP','IMLM' 'nortek'}';
39 Winfo.hsig=[];
40 Winfo.hconf=[];
41 Winfo.peakP=[];
42 Winfo.dirP=[];
43 Winfo.Ddir=[];
44 Winfo.Spectrum.EMEP=[];
45 Winfo.Spectrum.IMLM=[];
46 Winfo.Spectrum.nortek=[];
47
48 %load the wave data from the nortek quick wave software
49 wavedata=load('BPWave01.wap');
50
51 %Load the data and run the script
52 for i=1:length(time(:,1))
53     dateinfo=time(i,:);
54
55     pressure=strcat('pressure_',dateinfo,'.txt');
56     range=strcat('range_',dateinfo,'.txt');
57     orbit=strcat('orbit_',dateinfo,'.txt');
58     sysinfo=strcat('sysinfo_',dateinfo,'.txt');
59     nortekspec=strcat('nortekspec_',dateinfo,'.txt');
60
61     pressure=load(pressure);
62     range=load(range);
63     orbit=load(orbit);
64     sysinfo=load(sysinfo);
65     nortekspec=load(nortekspec);
66
67     %set up data with standard AST freq at 0.01 and dir at 2
68     [ID,SM,EP]=nortek_radialtouvw(pressure,range,orbit,sysinfo,1);
69
70     %run diwasp to generate this spectrum
71     [E_F01_D2, EPout]=dirspec(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0});
72
73     %now for IMLM
74     EP.method='IMLM';
75     EP.iter=3;
76     [I_F01_D2, EPout]=dirspec(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0});
77
78
79     %Use waveplot to plot the polar, freq and dir plots of the spectra
80
81     [E_WI,I_WI,nortek_WI,fig1,fig2]=nortek_waveplot(E_F01_D2,I_F01_D2,sysinfo,nortekspec);
82    
83     saveas(fig1,['polar1_' dateinfo '.fig']);
84     saveas(fig2,['dirfreq1_' dateinfo '.fig']);
85    
86     close all;
87    
88     %Fill up the Winfo data structure
89
90     hsig=[vertcat(E_WI.hsig,I_WI.hsig,nortek_WI.hsig)];
91     hconf=[vertcat(E_WI.hconf,I_WI.hconf,nortek_WI.hconf)];
92     peakP=[vertcat(E_WI.tp,I_WI.tp,nortek_WI.tp)];
93     dirP=[vertcat(E_WI.dtp,I_WI.dtp,nortek_WI.dtp)];
94     Ddir=[vertcat(E_WI.dp,I_WI.dp,nortek_WI.dp)];
95    
96     Winfo.hsig=[horzcat(Winfo.hsig,hsig)];
97     Winfo.hconf=[horzcat(Winfo.hconf,hconf)];
98     Winfo.peakP=[horzcat(Winfo.peakP,peakP)];
99     Winfo.dirP=[horzcat(Winfo.dirP,dirP)];
100     Winfo.Ddir=[horzcat(Winfo.Ddir,Ddir)];
101     Winfo.Spectrum.EMEP=[cat(3,Winfo.Spectrum.EMEP,E_F01_D2.S)];
102     Winfo.Spectrum.IMLM=[cat(3,Winfo.Spectrum.IMLM,I_F01_D2.S)];
103     Winfo.Spectrum.nortek=[cat(3,Winfo.Spectrum.nortek,nortekspec)];
104    
105 end
106
107 %now create the time series plots of the wave info
108 [fig_sigh,fig_pp,fig_dp,fig_dd]=nortek_Winfo_plot(Winfo);
109
110 saveas(fig_sigh,['sigh_' dateinfo '.fig']);
111 saveas(fig_pp,['peakp_' dateinfo '.fig']);
112 saveas(fig_dp,['dirpeak_' dateinfo '.fig']);
113 saveas(fig_dd,['domdir_' dateinfo '.fig']);
114
115 close all;
116
117
118
Note: See TracBrowser for help on using the browser.