Index: DPWavesProc/trunk/DPWavesProc/adcp_matlab/radialtouvw.m =================================================================== --- DPWavesProc/trunk/DPWavesProc/adcp_matlab/radialtouvw.m (revision 229) +++ DPWavesProc/trunk/DPWavesProc/adcp_matlab/radialtouvw.m (revision 232) @@ -26,4 +26,5 @@ %set up sysinfo file samplesInBurst=sysinfo(3,:); +binsOut=sysinfo(8,:); bin1height=sysinfo(9,:); bin2height=sysinfo(10,:); @@ -35,4 +36,5 @@ roll=sysinfo(20,:); + %set up pressure press=pressure/1000; @@ -53,7 +55,11 @@ orbit=orbit/1000; orbitnew=orbit; + +% calculate the total number of orbital bins output (usually 20) +orbOut=binsOut*4; + %interpolate to take out any NaNs and QC for bad data in orbital data -std_orbit=ones(1,20); -for i=1:20 +std_orbit=ones(1,orbOut); +for i=1:orbOut %first take out any points outside of 4 std deviations @@ -63,10 +69,10 @@ end %find the avg std deviation for each group 4 beams -for i=4:4:20 +for i=4:4:orbOut avgstd_orbit(i-3:i)=mean(std_orbit(i-3:i)); end %now remove the points outside 4avg std dev and interp -for i=1:20 +for i=1:orbOut ibad_std=find(abs(orbit(:,i)) > 4*avgstd_orbit(i)); orbit(ibad_std,i)=NaN; @@ -131,5 +137,5 @@ %reshape the orbital matrix to 3 dimensions -radial=reshape(orbitnew,samplesInBurst,4,5); +radial=reshape(orbitnew,samplesInBurst,4,binsOut); % Compute uvw velocities and change to earth coordinates @@ -140,11 +146,11 @@ error_vel = D1*(radial(:,1,:)+radial(:,2,:)-radial(:,3,:)-radial(:,4,:)); -u=reshape(u,samplesInBurst,5); -v=reshape(v,samplesInBurst,5); -w=reshape(w,samplesInBurst,5); -error_vel=reshape(error_vel,samplesInBurst,5); +u=reshape(u,samplesInBurst,binsOut); +v=reshape(v,samplesInBurst,binsOut); +w=reshape(w,samplesInBurst,binsOut); +error_vel=reshape(error_vel,samplesInBurst,binsOut); [m,n] = size(u); -uno = ones(m,5); +uno = ones(m,binsOut); unew = u.*(uno*a) + v.*(uno*b) + w.*(uno*c); vnew = u.*(uno*d) + v.*(uno*e) + w.*(uno*f); Index: DPWavesProc/trunk/DPWavesProc/adcp_matlab/specmultiplot.m =================================================================== --- DPWavesProc/trunk/DPWavesProc/adcp_matlab/specmultiplot.m (revision 231) +++ DPWavesProc/trunk/DPWavesProc/adcp_matlab/specmultiplot.m (revision 232) @@ -60,5 +60,5 @@ %set up data with radial velocities, freq and dir at default - [ID,SM,EP]=radialtouvw(pressure,range,orbit,sysinfo,1); + [ID,SM,EP]=radialtouvw(pressure,range,orbit,sysinfo,3); % run diwasp to generate this spectrum with EMEP