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

root/DPWP/trunk/DPWP/nortek/nortek_specmultiplot.m

Revision 334 (checked in by gdusek, 14 years ago)

Total update to the DPWP code. Significant changes made to direspec, specmultiplot, radialtouvw and IMLM code. 6/14/10

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 %Make a directory for the data
34 mkdir('tempdir');
35      
36 %set up time, which is Winfo.time as date str in the yymmddHHMM format
37 time=datestr(Winfo.time, 'yymmddHHMM');
38
39 %set up data structure for wave info
40 Winfo.setup={'IMLM'}';
41 Winfo.hsig=[];
42 Winfo.hconf=[];
43 Winfo.peakP=[];
44 Winfo.dirP=[];
45 Winfo.Ddir=[];
46 Winfo.Spectrum=[];
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     %For IMLM
71     EP.method='IMLM';
72     EP.iter=50;
73     [I_F01_D2, ~]=dirspec(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0});
74
75
76     %Use waveplot to plot the polar, freq and dir plots of the spectra
77
78     %[E_WI,I_WI,nortek_WI,fig1,fig2]=nortek_waveplot(E_F01_D2,I_F01_D2,sysinfo,nortekspec);
79     [I_WI,fig1,fig2]=nortek_waveplot(I_F01_D2);
80    
81     saveas(fig1,['polar1_' dateinfo '.fig']);
82     saveas(fig2,['dirfreq1_' dateinfo '.fig']);
83    
84     movefile(['polar1_' dateinfo '.fig'],'tempdir');
85     movefile(['dirfreq1_' dateinfo '.fig'],'tempdir');
86    
87     close all;
88    
89     %Fill up the Winfo data structure
90
91     hsig=[I_WI.hsig];
92     hconf=[I_WI.hconf];
93     peakP=[I_WI.tp];
94     dirP=[I_WI.dtp];
95     Ddir=[I_WI.dp];
96    
97     Winfo.hsig=[horzcat(Winfo.hsig,hsig)];
98     Winfo.hconf=[horzcat(Winfo.hconf,hconf)];
99     Winfo.peakP=[horzcat(Winfo.peakP,peakP)];
100     Winfo.dirP=[horzcat(Winfo.dirP,dirP)];
101     Winfo.Ddir=[horzcat(Winfo.Ddir,Ddir)];
102     Winfo.Spectrum=[cat(3,Winfo.Spectrum,I_F01_D2.S)];   
103 end
104
105 save(['specdata_' dateinfo],'Winfo');
106 movefile(['specdata_' dateinfo '.mat'],'tempdir');
107
108 movefile('tempdir',strcat('procdata_',dateinfo));
109
110 %now create the time series plots of the wave info
111 %[fig_sigh,fig_pp,fig_dp,fig_dd]=nortek_Winfo_plot(Winfo);
112
113 %saveas(fig_sigh,['sigh_' dateinfo '.fig']);
114 %saveas(fig_pp,['peakp_' dateinfo '.fig']);
115 %saveas(fig_dp,['dirpeak_' dateinfo '.fig']);
116 %saveas(fig_dd,['domdir_' dateinfo '.fig']);
117
118 close all;
119
120
121
Note: See TracBrowser for help on using the browser.