Skip to content

Commit

Permalink
Merge pull request #529 from aodn/2.5.42
Browse files Browse the repository at this point in the history
2.5.42
  • Loading branch information
ggalibert authored Jan 21, 2019
2 parents 959c4a0 + ac369f5 commit 5bf1762
Show file tree
Hide file tree
Showing 6 changed files with 220 additions and 216 deletions.
21 changes: 10 additions & 11 deletions Parser/readAWACWaveAscii.m
Original file line number Diff line number Diff line change
Expand Up @@ -340,20 +340,19 @@

waveData.fullSpectrum = nan(nTime, nDirFreq, nDir);

% we should have nTime samples so :
nFreqFullSpectrum = round(length(pwrFreqDir(2:end,:)) / nTime);
% we should have nTime samples such that :
nTimeFullSpectrum = size(pwrFreqDir(2:end,:), 1) / nDirFreq;

if nTimeFullSpectrum ~= nTime
fprintf('%s\n', ['Info : Full directional spectrum data found in ' fileRadName '.wds' ...
' is missing data for ' num2str(nTime-nTimeFullSpectrum) ' time samples. We assumed these were the last time samples.']);
end

% rearrange full power spectrum matrix so dimensions
% are ordered: time, frequency, direction
start = 2;
for i=1:nTime
if start+nFreqFullSpectrum-1 <= size(pwrFreqDir,1)
waveData.fullSpectrum(i, :, :) = pwrFreqDir(start:start+nFreqFullSpectrum-1,:);
start = start+nFreqFullSpectrum;
else
break;
end
end
pwrFreqDir = pwrFreqDir(2:end,:);
[nRow,nColumn] = size(pwrFreqDir);
waveData.fullSpectrum(1:nTimeFullSpectrum, :, :) = permute(reshape(pwrFreqDir', [nColumn, nRow/nTimeFullSpectrum, nTimeFullSpectrum]), [3, 2, 1]);
clear pwrFreqDir
catch e
fprintf('%s\n', ['Warning : Wave data related to ' fileRadName ...
Expand Down
Loading

0 comments on commit 5bf1762

Please sign in to comment.