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