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

root/adcp/trunk/adcp/nortek/nortek_specmultiplot.m

Revision 168 (checked in by cbc, 16 years ago)

Adding diwasp customizations.

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 wavesmon 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.peakP=[];
41 Winfo.dirP=[];
42 Winfo.Ddir=[];
43 Winfo.Spectrum.EMEP=[];
44 Winfo.Spectrum.IMLM=[];
45 Winfo.Spectrum.nortek=[];
46
47 %load the wave data from the nortek quick wave software
48 wavedata=load('BPWave01.wap');
49
50 %Load the data and run the script
51 for i=1:length(time(:,1))
52     dateinfo=time(i,:);
53
54     pressure=strcat('pressure_',dateinfo,'.txt');
55     range=strcat('range_',dateinfo,'.txt');
56     orbit=strcat('orbit_',dateinfo,'.txt');
57     sysinfo=strcat('sysinfo_',dateinfo,'.txt');
58     nortekspec=strcat('nortekspec_',dateinfo,'.txt');
59
60     pressure=load(pressure);
61     range=load(range);
62     orbit=load(orbit);
63     sysinfo=load(sysinfo);
64     nortekspec=load(nortekspec);
65
66     %set up data with standard AST freq at 0.01 and dir at 2
67     [ID,SM,EP]=nortek_radialtouvw(pressure,range,orbit,sysinfo,1);
68
69     %run diwasp to generate this spectrum
70     [E_F01_D2, EPout]=dirspectest(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0});
71
72     %now for IMLM
73     EP.method='IMLM';
74     EP.iter=3;
75     [I_F01_D2, EPout]=dirspectest(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0});
76
77
78     %Use waveplot to plot the polar, freq and dir plots of the spectra
79
80     [E_WI,I_WI,nortek_WI,fig1,fig2]=nortek_waveplot(E_F01_D2,I_F01_D2,sysinfo,nortekspec);
81    
82     saveas(fig1,['polar1_' dateinfo '.fig']);
83     saveas(fig2,['dirfreq1_' dateinfo '.fig']);
84    
85  
86     %Fill up the Winfo data structure
87
88     hsig=[vertcat(E_WI.hsig,I_WI.hsig,nortek_WI.hsig)];
89     peakP=[vertcat(E_WI.tp,I_WI.tp,nortek_WI.tp)];
90     dirP=[vertcat(E_WI.dtp,I_WI.dtp,nortek_WI.dtp)];
91     Ddir=[vertcat(E_WI.dp,I_WI.dp,nortek_WI.dp)];
92    
93     Winfo.hsig=[horzcat(Winfo.hsig,hsig)];
94     Winfo.peakP=[horzcat(Winfo.peakP,peakP)];
95     Winfo.dirP=[horzcat(Winfo.dirP,dirP)];
96     Winfo.Ddir=[horzcat(Winfo.Ddir,Ddir)];
97     Winfo.Spectrum.EMEP=[cat(3,Winfo.Spectrum.EMEP,E_F01_D2.S)];
98     Winfo.Spectrum.IMLM=[cat(3,Winfo.Spectrum.IMLM,I_F01_D2.S)];
99     Winfo.Spectrum.nortek=[cat(3,Winfo.Spectrum.nortek,nortekspec)];
100    
101 end
102
103 %now create the time series plots of the wave info
104 [fig_sigh,fig_pp,fig_dp,fig_dd]=nortek_Winfo_plot(Winfo);
105
106 saveas(fig_sigh,['sigh_' dateinfo '.fig']);
107 saveas(fig_pp,['peakp_' dateinfo '.fig']);
108 saveas(fig_dp,['dirpeak_' dateinfo '.fig']);
109 saveas(fig_dd,['domdir_' dateinfo '.fig']);
110
111 close all;
112
113
114
Note: See TracBrowser for help on using the browser.