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

root/DPWavesProc/trunk/DPWavesProc/adcp_matlab/waveplot.m

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

--

Line 
1 function [E_radial_WI,fig1,fig2]=waveplot(radialE,sysinfo)
2
3 %make sure to load the EMEP, IMLM and wavesmon samples
4 %EMEP=load('emep'), IMLM=load('imlm'), spec=load('wavesmon')
5 %rangeE=load('EMEP_range'), rangeI=load('IMLM_range')
6
7
8 %what is the frequency and dir resolution for those generated in DIWASP
9 freqres=0.01;
10 freqs=[0.01:0.01:.4];
11 dirres=2;
12 dirs=[0:2:360];
13
14
15 % plot the spectrum generated through DIWASP
16
17 scrsz = get(0,'ScreenSize');
18 fig1=figure('Position',[scrsz]);
19 subplot(1,1,1);
20 subplotspec(radialE,4);
21 title('radial velocity data');
22
23
24 %calculate just the dir energy spectrum on a single graph
25
26
27 EMEPradialdir=sum(radialE.S)*freqres;
28
29 %calculate just the frequency energy spectrum
30 EMEPradialfreq=sum(radialE.S')*dirres;
31
32 %Find the maximum for the directional spectrum so we can set up the proper
33 %x-axis
34 [maxvalue,maxindex] = max(EMEPradialdir);
35 maxdir=dirs(maxindex);
36 % set up the x-axis for all of the spectra depending on the max
37 if ((100 < maxdir) | (maxdir < -100));
38     %for diwasp spectra
39     index1=find(dirs < 0);
40     index2=find(dirs > -1);
41     dirs(index1)=dirs(index1) +360;
42     %plot the directional energy spectrum
43     fig2=figure('Position',[scrsz]);
44     subplot(1,2,1);
45     h1 = plot(dirs(index2),EMEPradialdir(index2),'b');
46     hold on
47     h1a= plot(dirs(index1),EMEPradialdir(index1),'b');
48 else
49     %for diwasp spectra do nothing
50    
51     %plot the directional energy spectrum
52     fig2=figure('Position',[scrsz]);
53     subplot(1,2,1);
54     h1 = plot(dirs,EMEPradialdir,'b');
55 end
56
57 legend([h1],'EMEP radial','location','best');
58 title('directional wave spectrum integrated over frequency');
59 xlabel('axis angle (degrees true)');
60 ylabel('m^2 / deg');
61
62 %plot the frequency energy spectrum
63 subplot(1,2,2);
64 plot(freqs,EMEPradialfreq,'b');
65 legend('EMEP radial','location','best');
66 title('directional wave spectrum integrated over direction');
67 xlabel('frequency in Hz');
68 ylabel('m^2 / hz');
69
70 % ______Calculate and display the wave parameters SigH, Tp, Dp,DTp_______
71
72
73 % for Radial of EMEP
74
75 % Calculate the Sig wave height
76 EMEP_radial_Hsig=Hsig(radialE);
77 %Use the function HsigConf.m to calculate the sigH confidence limits
78 EMEP_radial_HsConf=HsigConf(radialE);
79
80 % Calculate the peak period Tp
81 [P,I]=max(EMEPradialfreq);
82 EMEP_radial_Tp=1/(freqs(I));
83
84 %Calculate the Direction of the peak period DTp
85 [P,I]=max(real(radialE.S(I,:)));
86 EMEP_radial_DTp=dirs(I);
87
88 %Calculate the Dominant Direction Dp
89 [P,I]=max(EMEPradialdir);
90 EMEP_radial_Dp=dirs(I);
91
92 %Display on the screen the SigH,Tp,Dp,DTp
93 disp(['EMEP radial']);
94 disp(['SigH (meters): ' num2str(EMEP_radial_Hsig)]);
95 disp(['SigH 95% confidence limits: ' num2str(EMEP_radial_HsConf)]);
96 disp(['peak period (seconds): ' num2str(EMEP_radial_Tp)]);
97 disp(['Dir of peak period: ' num2str(compangle(EMEP_radial_DTp, radialE.xaxisdir))]);
98 disp(['Dominant Direction: ' num2str(compangle(EMEP_radial_Dp, radialE.xaxisdir))]);
99 disp(['  ']);
100
101 E_radial_WI.hsig=EMEP_radial_Hsig;
102 E_radial_WI.hconf=EMEP_radial_HsConf;
103 E_radial_WI.tp=EMEP_radial_Tp;
104 E_radial_WI.dtp=compangle(EMEP_radial_DTp, radialE.xaxisdir);
105 E_radial_WI.dp=compangle(EMEP_radial_Dp, radialE.xaxisdir);
106
107
108
109 %function to change from axis angles to compass bearings
110
111 function angle=compangle(angle,xaxisdir)
112 angle=xaxisdir*ones(size(angle))-angle;
113 angle=angle+360*(angle<0);
114 angle=angle-360*(angle>360);
115
116
117
118
119
Note: See TracBrowser for help on using the browser.