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

root/DPWavesProc/trunk/DPWavesProc/diwasp_1_1GD/infospec.m

Revision 215 (checked in by gdusek, 16 years ago)

--

Line 
1 function [H,HsConf,Tp,DTp,Dp]=infospec(SM)
2
3 %Edited on 9/17/08 to include confidence limits for the sig wave height
4
5
6 %DIWASP V1.1 function
7 %infospec: calculates and displays information about a directional spectrum
8 %
9 %[Hsig,Tp,DTp,Dp]=infospec(SM)
10 %
11 %Outputs:
12 %Hsig           Signficant wave height (Hmo)
13 %HsConf     95% conf limits for Hsig
14 %Tp                     Peak period
15 %DTp            Direction of spectral peak
16 %Dp                     Dominant direction
17 %
18 %Inputs:
19 %SM             A spectral matrix structure containing the file data
20 %
21 %
22 %Hsig is the significant wave height. Tp is the peak frequency, the highest point in the one dimensional spectrum.
23 %DTp is the main direction of the peak period (i.e the highest point in the two-dimensional directional spectrum).
24 %Dp is the dominant direction defined as the direction with the highest energy integrated over all frequencies.
25 %
26 %"help data_structures" for information on the DIWASP data structures
27
28 %Copyright (C) 2002 Coastal Oceanography Group, CWR, UWA, Perth
29
30 SM=check_data(SM,2);if isempty(SM) return;end;
31
32 H=Hsig(SM);
33 HsConf=HsigConf(SM);
34
35 S=sum(real(SM.S),2); % S is freq spectrum
36
37 [P,I]=max(S);
38 Tp=1/(SM.freqs(I));
39 [P,I]=max(real(SM.S(I,:)));
40 DTp=SM.dirs(I);
41 [P,I]=max(real(sum(SM.S,1)));
42 Dp=SM.dirs(I);
43
44 disp(['Infospec::']);
45 disp(['Significant wave height (Hmo): ' num2str(H)]);
46 disp(['Sig wave height 95% confidence limits: ' num2str(HsConf)]);
47 disp(['Peak period: ' num2str(Tp)]);
48 disp(['Direction of peak period: ' num2str(DTp) ' axis angle / ' num2str(compangle(DTp,SM.xaxisdir)) ' compass bearing']);
49 disp(['Dominant direction: ' num2str(Dp) ' axis angle / ' num2str(compangle(Dp,SM.xaxisdir)) ' compass bearing']);
50
51
52 function dirs=compangle(dirs,xaxisdir)
53 dirs=xaxisdir*ones(size(dirs))-dirs;
54 dirs=dirs+360*(dirs<0);
55 dirs=dirs-360*(dirs>360);
Note: See TracBrowser for help on using the browser.