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

root/DPWP/trunk/DPWavesProc/nortek/nortek_specread.m

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

Adding diwasp customizations.

Line 
1 %This script is designed to separate the nortek processed wave directional
2 %spectra into seperate date files
3
4 %first load the spectral file as spec and the wave detail file as details
5 %also load the directional energy file as dirspec and the frequency
6 %spectrum file as freqspec
7
8 month=details(:,1);
9 day=details(:,2);
10 year=details(:,3);
11 hour=details(:,4);
12 minute=details(:,5);
13 second=details(:,6);
14
15
16 %next set up the data and time in the right format
17 time=datenum(year,month,day,hour,minute,second);
18
19 datelist=datestr(time, 'yymmddHHMM');
20
21
22 %now go through each spectrum, cut out each one from the file and create a
23 %new text file with the datestamp.
24 for i=2:length(datelist)
25     startpos=(i*40)-39; %(where 40 is the number of frequencies used per spectra)
26     stoppos=(i*40);
27     specfile=spec(startpos:stoppos,:);
28     freqs=freqspec(i,:);  %need to change from normalized values so have to multiply through by the freq power spectrum
29     mult=freqs'*ones(1,90);
30     specfilemult=(mult.*specfile)/4; %this is the 3d spectrum in m^2s/deg
31     dateinfo=datelist(i-1,:);
32     name=strcat('nortekspec_',dateinfo,'.txt');
33     dlmwrite(name, specfilemult, ' ');
34 end
35
36 %now do the same thing for the dirspec file and the freqspec file
37
38 for i=2:length(datelist)
39     dirspecfile=dirspec(i,:);
40     freqspecfile=freqspec(i,:);
41     dateinfo=datelist(i,:);
42     namedir=strcat('nortekdirspec_',dateinfo,'.txt');
43     namefreq=strcat('nortekfreqspec_',dateinfo,'.txt');
44     dlmwrite(namedir, dirspecfile, ' ');
45     dlmwrite(namefreq, freqspecfile, ' ');
46 end
47
48    
49    
50    
Note: See TracBrowser for help on using the browser.