Index: adcp/trunk/adcp/adcp_matlab/Winfo_plot.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/adcp_matlab/Winfo_plot.m (revision 168) @@ -1,0 +1,72 @@ +function [fig_sigh,fig_pp,fig_dp,fig_dd]=Winfo_plot(Winfo); + +%This function takes the wave info (sigH, peak period, direction of peak and dominant direction +%for a series of bursts and plots it as a function of time + + +%plot sig wave height +scrsz = get(0,'ScreenSize'); +fig_sigh=figure('Position',[scrsz]); +h1=plot(Winfo.time,Winfo.hsig(1,:),'b.-'); +hold on +h2=plot(Winfo.time,Winfo.hsig(2,:),'r.-'); +h3=plot(Winfo.time,Winfo.hsig(3,:),'g.-'); +h4=plot(Winfo.time,Winfo.hsig(4,:),'c.-'); +h5=plot(Winfo.time,Winfo.hsig(5,:),'m.-'); +h6=plot(Winfo.time,Winfo.hsig(7,:),'k.-'); + +datetick('x',15,'keepticks'); +legend([h1, h2, h3, h4, h5, h6],'EMEP uvw','IMLM uvw','EMEP range','IMLM range','EMEP radial','wavesmon','location','best'); +title(['Significant Wave Height starting on ',datestr(Winfo.time(:,1),0)]); +xlabel('time'); +ylabel('Wave Height (m)'); + +%plot peak period +fig_pp=figure('Position',[scrsz]); +h1=plot(Winfo.time,Winfo.peakP(1,:),'b.-'); +hold on +h2=plot(Winfo.time,Winfo.peakP(2,:),'r.-'); +h3=plot(Winfo.time,Winfo.peakP(3,:),'g.-'); +h4=plot(Winfo.time,Winfo.peakP(4,:),'c.-'); +h5=plot(Winfo.time,Winfo.peakP(5,:),'m.-'); +h6=plot(Winfo.time,Winfo.peakP(7,:),'k.-'); + +datetick('x',15,'keepticks'); +legend([h1, h2, h3, h4, h5, h6],'EMEP uvw','IMLM uvw','EMEP range','IMLM range','EMEP radial','wavesmon','location','best'); +title(['Peak Period starting on ',datestr(Winfo.time(:,1),0)]); +xlabel('time'); +ylabel('Period (seconds)'); + +%plot dir of peak period +fig_dp=figure('Position',[scrsz]); +h1=plot(Winfo.time,Winfo.dirP(1,:),'b.-'); +hold on +h2=plot(Winfo.time,Winfo.dirP(2,:),'r.-'); +h3=plot(Winfo.time,Winfo.dirP(3,:),'g.-'); +h4=plot(Winfo.time,Winfo.dirP(4,:),'c.-'); +h5=plot(Winfo.time,Winfo.dirP(5,:),'m.-'); +h6=plot(Winfo.time,Winfo.dirP(7,:),'k.-'); + +datetick('x',15,'keepticks'); +legend([h1, h2, h3, h4, h5, h6],'EMEP uvw','IMLM uvw','EMEP range','IMLM range','EMEP radial','wavesmon','location','best'); +title(['Direction of Peak Period starting on ',datestr(Winfo.time(:,1),0)]); +xlabel('time'); +ylabel('Direction (Degrees True)'); + +%plot the dominant direction + +fig_dd=figure('Position',[scrsz]); +h1=plot(Winfo.time,Winfo.Ddir(1,:),'b.-'); +hold on +h2=plot(Winfo.time,Winfo.Ddir(2,:),'r.-'); +h3=plot(Winfo.time,Winfo.Ddir(3,:),'g.-'); +h4=plot(Winfo.time,Winfo.Ddir(4,:),'c.-'); +h5=plot(Winfo.time,Winfo.Ddir(5,:),'m.-'); +h6=plot(Winfo.time,Winfo.Ddir(7,:),'k.-'); + +datetick('x',15,'keepticks'); +legend([h1, h2, h3, h4, h5, h6],'EMEP uvw','IMLM uvw','EMEP range','IMLM range','EMEP radial','wavesmon','location','best'); +title(['Dominant Direction starting on ',datestr(Winfo.time(:,1),0)] ); +xlabel('time'); +ylabel('Direction (Degrees True)'); + Index: adcp/trunk/adcp/adcp_matlab/radialtouvw.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/adcp_matlab/radialtouvw.m (revision 168) @@ -1,0 +1,304 @@ +function [ID,SM,EP]=radialtouvw(pressure,range,orbit,sysinfo,data_type) + + +%This code takes the loaded orbit, pressure and system info data from an +%ADCP waves output and computes the uvw velocities in earth coordinates. +%It also interpolates to remove bad data points and prepares the data +%structure required for running the DIWASP program. The output will be in +%the structures ID, SM and EP. + +%data_type is: +%1 to use uvw and pressure to generate the data structures, +%2 to use ranges +%3 to use radial velocity data + + + +%make sure to load: pressure=load('pressure data'), +%orbit=load('orbital data'),sysinfo=load('sysinfo data') and range + +%what is the transducer face height off the bottom? +adcpheight=0.4; + +%whats the magnetic variation +magvar=9.63; + +%set up sysinfo file +samplesInBurst=sysinfo(3,:); +bin1height=sysinfo(9,:); +bin2height=sysinfo(10,:); +bin3height=sysinfo(11,:); +bin4height=sysinfo(12,:); +bin5height=sysinfo(13,:); +heading=sysinfo(18,:); +pitch=sysinfo(19,:); +roll=sysinfo(20,:); + +%set up pressure +press=pressure/1000; + +%find the average depth +avgdepth=mean(press)+adcpheight; + +%set up range +range=range/1000; +meanrange=mean(range); +meanrange=repmat(meanrange,samplesInBurst,1); +dmrange=range-meanrange; +std_range=std(dmrange); + +% Take out any bad data points in orbital data +ibad=find(orbit < -32000); +orbit(ibad) = NaN; +orbit=orbit/1000; +orbitnew=orbit; +%interpolate to take out any NaNs and QC for bad data in orbital data +std_orbit=ones(1,20); +for i=1:20 + + %first take out any points outside of 4 std deviations + std_orbit(i)=nanstd(orbit(:,i)); + ibad_std=find(abs(orbit(:,i)) > 4*std_orbit(i)); + orbit(ibad_std,i)=NaN; +end +%find the avg std deviation for each group 4 beams +for i=4:4:20 + 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 + ibad_std=find(abs(orbit(:,i)) > 4*avgstd_orbit(i)); + orbit(ibad_std,i)=NaN; + + time=[1:1:length(orbit(:,i))]; + NaNs=isnan(orbit(:,i)); + igood=find(NaNs == 0); + ibad=find(NaNs == 1); + + intValues= interp1(time(igood),orbit(igood,i),time(ibad),'linear','extrap'); + orbitnew(ibad,i)=intValues; +end + +% Do similar QC for the range data +rangenew=dmrange; +for i=1:4 + ibad=find(abs(dmrange(:,i)) > 4*std_range(:,i)); + dmrange(ibad,i)=NaN; + time=[1:1:length(range(:,i))]; + NaNs=isnan(dmrange(:,i)); + igood=find(NaNs == 0); + ibad=find(NaNs == 1); + + intValues= interp1(time(igood),dmrange(igood,i),time(ibad),'linear','extrap'); + rangenew(ibad,i)=intValues; +end + +dmrange=rangenew; + +%change heading, pitch, roll into degrees + +heading = heading/100; +pitch=pitch/100; +roll=roll/100; +pitch_out=pitch; +roll_out=roll; + +%When converting to earth coordinates, the directions will be wrong unless we +%correct for bottom/up facing ADCPs, simply by rotating the roll by 180 +roll=roll+180; + +%Set up geometry for transformation from beam to instrument +C1 = 1; +A1 = 1/(2*sin(20*pi/180)); +B1 = 1/(4*cos(20*pi/180)); +D1 = A1/sqrt(2); + +% coordinate transformation matrix +CH = cos((heading+magvar)*pi/180); +SH = sin((heading+magvar)*pi/180); +CP = cos((pitch)*pi/180); +SP = sin((pitch)*pi/180); +CR = cos((roll)*pi/180); +SR = sin((roll)*pi/180); + +% let the matrix elements be ( a b c; d e f; g h j); +a = CH.*CR + SH.*SP.*SR; b = SH.*CP; c = CH.*SR - SH.*SP.*CR; +d = -SH.*CR + CH.*SP.*SR; e = CH.*CP; f = -SH.*SR - CH.*SP.*CR; +g = -CP.*SR; h = SP; j = CP.*CR; +uno=1; + +%reshape the orbital matrix to 3 dimensions + +radial=reshape(orbitnew,samplesInBurst,4,5); + +% Compute uvw velocities and change to earth coordinates + +u = C1*A1*(radial(:,1,:)-radial(:,2,:)); +v = C1*A1*(radial(:,4,:)-radial(:,3,:)); +w = B1*(radial(:,1,:)+radial(:,2,:)+radial(:,3,:)+radial(:,4,:)); +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); + +[m,n] = size(u); +uno = ones(m,5); +unew = u.*(uno*a) + v.*(uno*b) + w.*(uno*c); +vnew = u.*(uno*d) + v.*(uno*e) + w.*(uno*f); +wnew = u.*(uno*g) + v.*(uno*h) + w.*(uno*j); + +u_all = unew;v_all=vnew;w_all=wnew; +error_vel_all = error_vel; + +%compute the original x,y,z positions for each beam for each bin to be accurate we need to take out the adcpheight + +xyzpos=ones(3,4,5); +heights=[bin1height bin2height bin3height bin4height bin5height avgdepth]-adcpheight; +pos=heights*tan(20*pi/180); +for i=1:5 + xyzpos(:,1,i)=[pos(i),0,heights(i)]; + xyzpos(:,2,i)=[-pos(i),0,heights(i)]; + xyzpos(:,3,i)=[0,pos(i),heights(i)]; + xyzpos(:,4,i)=[0,-pos(i),heights(i)]; +end + +% set up the new coordinate transformation matrix +CH = cos((heading+magvar)*pi/180); +SH = sin((heading+magvar)*pi/180); +CP = cos((pitch_out)*pi/180); +SP = sin((pitch_out)*pi/180); +CR = cos((-roll_out)*pi/180); +SR = sin((-roll_out)*pi/180); + +% let the matrix elements be ( a b c; d e f; g h j), a slightly different +% matrix from before; +a = CH.*CR - SH.*SP.*SR; b = SH.*CP; c = -CH.*SR - SH.*SP.*CR; +d = -SH.*CR - CH.*SP.*SR; e = CH.*CP; f = SH.*SR - CH.*SP.*CR; +g = CP.*SR; h = SP; j = CP.*CR; + +%transform the original x,y,z positions to the new positions accounting for +%heading, pitch and roll... we also add adcpheight back in +newxyzpos=ones(3,4,5); +new_xyzpos(1,:,:)=xyzpos(1,:,:)*a+xyzpos(2,:,:)*b+xyzpos(3,:,:)*c; +new_xyzpos(2,:,:)=xyzpos(1,:,:)*d+xyzpos(2,:,:)*e+xyzpos(3,:,:)*f; +new_xyzpos(3,:,:)=xyzpos(1,:,:)*g+xyzpos(2,:,:)*h+xyzpos(3,:,:)*j+adcpheight; + +xyzpositions=new_xyzpos; + + +%now we need to figure out the xyz positions at the surface for the range +%sin45=0.7071 + +binheight=heights(:,6); + +%beam 3 +bearing=(heading+magvar)*(pi/180); +distfromz=binheight*tan((20-pitch_out)*(pi/180)); +xpos=sin(bearing)*distfromz; +ypos=cos(bearing)*distfromz; + +distroll=binheight*tan(roll_out*(pi/180)); +beam3xpos=xpos+0.7071*distroll; +beam3ypos=ypos+0.7071*distroll; + +%beam 4 +bearing=bearing+pi; +distfromz=binheight*tan((20+pitch_out)*(pi/180)); +xpos=sin(bearing)*distfromz; +ypos=cos(bearing)*distfromz; + +distroll=binheight*tan(roll_out*(pi/180)); +beam4xpos=xpos+0.7071*distroll; +beam4ypos=ypos+0.7071*distroll; + +%beam 1 +bearing=bearing-pi/2; +distfromz=binheight*tan((20+roll_out)*(pi/180)); +xpos=sin(bearing)*distfromz; +ypos=cos(bearing)*distfromz; + +distroll=binheight*tan(pitch_out*(pi/180)); +beam1xpos=xpos+0.7071*distroll; +beam1ypos=ypos+0.7071*distroll; + +%beam2 +bearing=bearing+pi; +distfromz=binheight*tan((20-roll_out)*(pi/180)); +xpos=sin(bearing)*distfromz; +ypos=cos(bearing)*distfromz; + +distroll=binheight*tan(pitch_out*(pi/180)); +beam2xpos=xpos+0.7071*distroll; +beam2ypos=ypos+0.7071*distroll; + +xypositions(:,:)=[beam1xpos beam2xpos beam3xpos beam4xpos; beam1ypos beam2ypos beam3ypos beam4ypos]; + +%Put into structures for DIWASP + + +%sampling frequency +ID.fs=2; +%depth +ID.depth=(adcpheight+mean(press)); +%the spectral matrix structure +SM.freqs=[0.01:0.01:0.4]; +SM.dirs=[-180:2:180]; +SM.xaxisdir= 90; +%the estimation parameter +EP.method= 'EMEP'; +EP.iter=100; + +if data_type == 1 + %For uvw and pressure for bins 2,3,4 + % the datatypes + ID.datatypes={'pres' 'velx' 'vely' 'velz' 'velx' 'vely' 'velz' 'velx' 'vely' 'velz'}; + % the layout + ID.layout = [ 0 0 0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0 0 0; + adcpheight bin2height bin2height bin2height bin3height bin3height bin3height bin4height bin4height bin4height]; + % the data + ID.data = horzcat(press, u_all(:,2), v_all(:,2), w_all(:,2), u_all(:,3), v_all(:,3), w_all(:,3), u_all(:,4), v_all(:,4), w_all(:,4)); + +elseif data_type == 2 + %For the ranges of each beam + % the datatypes + ID.datatypes={'elev' 'elev' 'elev' 'elev'}; + % the layout + ID.layout = [xypositions(1,1) xypositions(1,2) xypositions(1,3) xypositions(1,4); + xypositions(2,1) xypositions(2,2) xypositions(2,3) xypositions(2,4); + avgdepth avgdepth avgdepth avgdepth]; + % the data + ID.data = horzcat(dmrange(:,1), dmrange(:,2), dmrange(:,3), dmrange(:,4)); + +elseif data_type == 3 + % For the radial velocities bins 2,3,4 + % the datatypes + ID.datatypes={'radial' 'radial' 'radial' 'radial' 'radial' 'radial' 'radial' 'radial' 'radial' 'radial' 'radial' 'radial'}; + % the layout + %ID.layout = [xyzpositions(1,1,2) xyzpositions(1,2,2) xyzpositions(1,3,2) xyzpositions(1,4,2) xyzpositions(1,1,3) xyzpositions(1,2,3) xyzpositions(1,3,3) xyzpositions(1,4,3) xyzpositions(1,1,4) xyzpositions(1,2,4) xyzpositions(1,3,4) xyzpositions(1,4,4); + %xyzpositions(2,1,2) xyzpositions(2,2,2) xyzpositions(2,3,2) xyzpositions(2,4,2) xyzpositions(2,1,3) xyzpositions(2,2,3) xyzpositions(2,3,3) xyzpositions(2,4,3) xyzpositions(2,1,4) xyzpositions(2,2,4) xyzpositions(2,3,4) xyzpositions(2,4,4); + %xyzpositions(3,1,2) xyzpositions(3,2,2) xyzpositions(3,3,2) xyzpositions(3,4,2) xyzpositions(3,1,3) xyzpositions(3,2,3) xyzpositions(3,3,3) xyzpositions(3,4,3) xyzpositions(3,1,4) xyzpositions(3,2,4) xyzpositions(3,3,4) xyzpositions(3,4,4)]; + % the data + %ID.data = horzcat(orbitnew(:,5),orbitnew(:,6),orbitnew(:,7),orbitnew(:,8),orbitnew(:,9),orbitnew(:,10),orbitnew(:,11),orbitnew(:,12),orbitnew(:,13),orbitnew(:,14),orbitnew(:,15),orbitnew(:,16)); + + % the layout using bins 3,4,5 + ID.layout = [xyzpositions(1,1,5) xyzpositions(1,2,5) xyzpositions(1,3,5) xyzpositions(1,4,5) xyzpositions(1,1,4) xyzpositions(1,2,4) xyzpositions(1,3,4) xyzpositions(1,4,4) xyzpositions(1,1,3) xyzpositions(1,2,3) xyzpositions(1,3,3) xyzpositions(1,4,3); + xyzpositions(2,1,5) xyzpositions(2,2,5) xyzpositions(2,3,5) xyzpositions(2,4,5) xyzpositions(2,1,4) xyzpositions(2,2,4) xyzpositions(2,3,4) xyzpositions(2,4,4) xyzpositions(2,1,3) xyzpositions(2,2,3) xyzpositions(2,3,3) xyzpositions(2,4,3); + xyzpositions(3,1,5) xyzpositions(3,2,5) xyzpositions(3,3,5) xyzpositions(3,4,5) xyzpositions(3,1,4) xyzpositions(3,2,4) xyzpositions(3,3,4) xyzpositions(3,4,4) xyzpositions(3,1,3) xyzpositions(3,2,3) xyzpositions(3,3,3) xyzpositions(3,4,3)]; + % the data + ID.data = horzcat(orbitnew(:,17),orbitnew(:,18),orbitnew(:,19),orbitnew(:,20),orbitnew(:,13),orbitnew(:,14),orbitnew(:,15),orbitnew(:,16),orbitnew(:,9),orbitnew(:,10),orbitnew(:,11),orbitnew(:,12)); + +end + + + + + + + + + + + Index: adcp/trunk/adcp/adcp_matlab/radialwaveplot.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/adcp_matlab/radialwaveplot.m (revision 168) @@ -1,0 +1,237 @@ +function [E_radial_WI,I_radial_WI,fig5,fig6]=radialwaveplot(radialE,radialI,spec,sysinfo) + +%make sure to load the EMEP, IMLM and wavesmon samples +%EMEP=load('emep'), IMLM=load('imlm'), spec=load('wavesmon') +%rangeE=load('EMEP_range'), rangeI=load('IMLM_range') + +%set up the wavesmon data in a structure + +%what is the magnetic variation to nearest degree +magvar=10; + +%first change to m^2/Hz/deg +wmon.S=spec/(360*1000*1000); + +%what is the start angle +heading=sysinfo(18,:); +heading=heading/100; +sangle=heading+magvar; + +%what is the frequency and dir resolution for those generated in DIWASP +freqres=0.01; +freqs=[0.01:0.01:.4]; +dirres=2; +dirs=[-180:2:180]; + +%set up the directions +adj_angle=90-sangle+360+180; +wmon.dirs=[adj_angle:-4:-(356-adj_angle)]; +wmondirres=4; +wmon.xaxisdir=90; +wmon.freqs=[0.00781250:0.00781250:1]; +wmonfreqres=0.00781250; + +% plot the spectrum generated through DIWASP +scrsz = get(0,'ScreenSize'); +fig5=figure('Position',[scrsz]); +subplot(2,3,1); +subplotspec(radialE,4); +title('EMEP radial vel'); + +subplot(2,3,2); +subplotspec(radialI,4); +title('IMLM radial vel'); + +subplot(2,3,3); +subplotspec(wmon,4); +title('Wavesmon output'); + + +%calculate just the dir energy spectrum on a single graph + +EMEPdir=sum(radialE.S)*freqres; +IMLMdir=sum(real(radialI.S))*freqres; +wmondir=sum(wmon.S)*wmonfreqres; + +%calculate just the frequency energy spectrum +EMEPfreq=sum(radialE.S')*dirres; +IMLMfreq=sum(real(radialI.S)')*dirres; +wmonfreq=sum(wmon.S')*wmondirres; + +%Find the maximum for the directional spectrum so we can set up the proper +%x-axis +[maxvalue,maxindex] = max(EMEPdir); +maxdir=dirs(maxindex); +% set up the x-axis for all of the spectra depending on the max +if ((100 < maxdir) | (maxdir < -100)); + %for diwasp spectra + index1=find(dirs < 0); + index2=find(dirs > -1); + dirs(index1)=dirs(index1) +360; + %for wavesmon + Aindex=find(wmon.dirs < 0); + Bindex=find((-1 < wmon.dirs) & (wmon.dirs < 361)); + Bindex2=find(wmon.dirs > 360); + wmon.dirs(Bindex2)=wmon.dirs(Bindex2)-360; + wmon.dirs(Aindex)=wmon.dirs(Aindex)+360; + %plot the directional energy spectrum + fig6=figure('Position',[scrsz]); + subplot(1,2,1); + h1 = plot(dirs(index2),EMEPdir(index2),'b'); + hold on + h1a= plot(dirs(index1),EMEPdir(index1),'b'); + %plot the wavesmon data + h2 = plot(wmon.dirs(Bindex2),wmondir(Bindex2),'k'); + h2a = plot(wmon.dirs(Bindex),wmondir(Bindex),'k'); + h2b= plot(wmon.dirs(Aindex),wmondir(Aindex),'k'); + axis(axis); + %h5 = plot(dirs(index2),IMLMdir(index2),'c'); + %h5a= plot(dirs(index1),IMLMdir(index1),'c'); + +else + %for diwasp spectra do nothing + + %for wavesmon + Aindex=find(wmon.dirs > 180); + Bindex=find(wmon.dirs < 181); + wmon.dirs(Aindex)=wmon.dirs(Aindex)-360; + %plot the directional energy spectrum + fig6=figure('Position',[scrsz]); + subplot(1,2,1); + h1 = plot(dirs,EMEPdir,'b'); + hold on + %plot the wavesmon data + h2 = plot(wmon.dirs(Aindex),wmondir(Aindex),'k'); + h2a = plot(wmon.dirs(Bindex),wmondir(Bindex),'k'); + axis(axis); + %h5 = plot(dirs,IMLMdir,'c'); +end + +legend([h1, h2], 'EMEP radial vel','wavesmon','location','best'); +title('directional wave spectrum integrated over frequency'); +xlabel('axis angle (degrees true)'); +ylabel('m^2 / deg'); + +%plot the frequency energy spectrum +subplot(1,2,2); +plot(freqs,EMEPfreq,'b'); +hold on +plot(wmon.freqs,wmonfreq,'k'); +axis(axis); +plot(freqs,IMLMfreq,'c'); +legend('EMEP radial vel','wavesmon','IMLM radial vel','location','best'); +title('directional wave spectrum integrated over direction'); +xlabel('frequency in Hz'); +ylabel('m^2 / Hz'); + +% ______Calculate and display the wave parameters SigH, Tp, Dp,DTp_______ + +%For EMEP radial + +%calculate the 0,1,2 moments +m0=sum(EMEPfreq*freqres); +m1=sum(freqs.*EMEPfreq*freqres); +m2=sum((freqs.^2).*EMEPfreq*freqres); +% Calculate the Sig wave height +EMEP_radial_Hsig=4*sqrt(m0); + +% Calculate the peak period Tp +[P,I]=max(EMEPfreq); +EMEP_radial_Tp=1/(freqs(I)); + +%Calculate the Direction of the peak period DTp +[P,I]=max(real(radialE.S(I,:))); +EMEP_radial_DTp=dirs(I); + +%Calculate the Dominant Direction Dp +[P,I]=max(EMEPdir); +EMEP_radial_Dp=dirs(I); + +%Display on the screen the SigH,Tp,Dp,DTp +disp(['EMEP radial vel']); +disp(['SigH (meters): ' num2str(EMEP_radial_Hsig)]); +disp(['peak period (seconds): ' num2str(EMEP_radial_Tp)]); +disp(['Dir of peak period: ' num2str(compangle(EMEP_radial_DTp, radialE.xaxisdir))]); +disp(['Dominant Direction: ' num2str(compangle(EMEP_radial_Dp, radialE.xaxisdir))]); +disp([' ']); + +E_radial_WI.hsig=EMEP_radial_Hsig; +E_radial_WI.tp=EMEP_radial_Tp; +E_radial_WI.dtp=compangle(EMEP_radial_DTp, radialE.xaxisdir); +E_radial_WI.dp=compangle(EMEP_radial_Dp, radialE.xaxisdir); + +% For IMLM r + +%calculate the 0,1,2 moments +m0=sum(IMLMfreq*freqres); +m1=sum(freqs.*IMLMfreq*freqres); +m2=sum((freqs.^2).*IMLMfreq*freqres); +% Calculate the Sig wave height +IMLM_radial_Hsig=4*sqrt(m0); + +% Calculate the peak period Tp +[P,I]=max(IMLMfreq); +IMLM_radial_Tp=1/(freqs(I)); + +%Calculate the Direction of the peak period DTp +[P,I]=max(real(radialI.S(I,:))); +IMLM_radial_DTp=dirs(I); + +%Calculate the Dominant Direction Dp +[P,I]=max(IMLMdir); +IMLM_radial_Dp=dirs(I); + +%Display on the screen the SigH,Tp,Dp,DTp +disp(['IMLM radial vel']); +disp(['SigH (meters): ' num2str(IMLM_radial_Hsig)]); +disp(['peak period (seconds): ' num2str(IMLM_radial_Tp)]); +disp(['Dir of peak period: ' num2str(compangle(IMLM_radial_DTp, radialI.xaxisdir))]); +disp(['Dominant Direction: ' num2str(compangle(IMLM_radial_Dp, radialI.xaxisdir))]); +disp([' ']); + +I_radial_WI.hsig=IMLM_radial_Hsig; +I_radial_WI.tp=IMLM_radial_Tp; +I_radial_WI.dtp=compangle(IMLM_radial_DTp, radialI.xaxisdir); +I_radial_WI.dp=compangle(IMLM_radial_Dp, radialI.xaxisdir); + +% for wavesmon + +%calculate the 0,1,2 moments +m0=sum(wmonfreq*wmonfreqres); +m1=sum(wmon.freqs.*wmonfreq*wmonfreqres); +m2=sum((wmon.freqs.^2).*wmonfreq*wmonfreqres); +% Calculate the Sig wave height +Hsig=4*sqrt(m0); + +% Calculate the peak period Tp +[P,I]=max(wmonfreq); +Tp=1/(wmon.freqs(I)); + +%Calculate the Direction of the peak period DTp +[P,I]=max(real(wmon.S(I,:))); +DTp=wmon.dirs(I); + +%Calculate the Dominant Direction Dp +[P,I]=max(wmondir); +Dp=wmon.dirs(I); + +%Display on the screen the SigH,Tp,Dp,DTp +disp(['Wavesmon output']); +disp(['SigH (meters): ' num2str(Hsig)]); +disp(['peak period (seconds): ' num2str(Tp)]); +disp(['Dir of peak period: ' num2str(compangle(DTp, wmon.xaxisdir))]); +disp(['Dominant Direction: ' num2str(compangle(Dp, wmon.xaxisdir))]); +disp([' ']); + + +%function to change from axis angles to compass bearings + +function angle=compangle(angle,xaxisdir) +angle=xaxisdir*ones(size(angle))-angle; +angle=angle+360*(angle<0); +angle=angle-360*(angle>360); + + + + + Index: adcp/trunk/adcp/adcp_matlab/specmultiplot.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/adcp_matlab/specmultiplot.m (revision 168) @@ -1,0 +1,148 @@ +function [Winfo]=specmultiplot(dateinfo1,dateinfo2,timestep); +%where dateinfo1 and 2 are the strings of the first and last date extension +%of the pressure,range,etc files and timestep is the time in hours between +%each burst + +%This function takes the pressure, range, orbit and sysinfo files created +%in python and outputs a Winfo data structure with the sig wave height, +%peak period, direction of peak period and dominant dir. It also generates +%polar plots and 2d freq and directional plots of a variety of different +%estimation methods, resolutions and the wavesmon output. + + +%first set up the time vector going from dateinfo1 to dateinfo2 +Winfo.time=[]; + +date1=datevec(dateinfo1, 'yymmddHHMM'); +date2=datevec(dateinfo2,'yymmddHHMM'); + +if date1 == date2 + Winfo.time=[datenum(date1)]; +else + Winfo.time=[datenum(date1)]; + newdate=date1; + while datenum(newdate) ~= datenum(date2) + newdate=newdate+[0 0 0 timestep 0 0]; + Winfo.time=[horzcat(Winfo.time,datenum(newdate))]; + end +end + + +%set up time, which is Winfo.time as date str in the yymmddHHMM format +time=datestr(Winfo.time, 'yymmddHHMM'); + +%set up data structure for wave info +Winfo.setup={'EMEP UVW','IMLM UVW','EMEP range','IMLM range','EMEP radial','IMLM radial','wavesmon'}'; +Winfo.hsig=[]; +Winfo.peakP=[]; +Winfo.dirP=[]; +Winfo.Ddir=[]; +Winfo.Spectrum.EMEPuvw=[]; +Winfo.Spectrum.IMLMuvw=[]; +Winfo.Spectrum.EMEPrange=[]; +Winfo.Spectrum.IMLMrange=[]; +Winfo.Spectrum.EMEPradial=[]; +Winfo.Spectrum.IMLMradial=[]; +Winfo.Spectrum.wavesmon=[]; + +%Load the data and run the script +for i=1:length(time(:,1)) + dateinfo=time(i,:); + + pressure=strcat('pressure_',dateinfo,'.txt'); + range=strcat('range_',dateinfo,'.txt'); + orbit=strcat('orbit_',dateinfo,'.txt'); + sysinfo=strcat('sysinfo_',dateinfo,'.txt'); + spec=strcat('DSpec',dateinfo,'.txt'); + + pressure=load(pressure); + range=load(range); + orbit=load(orbit); + sysinfo=load(sysinfo); + spec=load(spec); + + %set up data with uvw and pressure, freq at 0.01 and dir at 2 + [ID,SM,EP]=radialtouvw(pressure,range,orbit,sysinfo,1); + + %run diwasp to generate this spectrum + [E_uvw_F01_D2, EPout]=dirspectest(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0}); + + %now for IMLM + EP.method='IMLM'; + EP.iter=3; + [I_uvw_F01_D2, EPout]=dirspectest(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0}); + + %set up data with ranges, freq and dir at default + [ID,SM,EP]=radialtouvw(pressure,range,orbit,sysinfo,2); + + % run diwasp to generate this spectrum with EMEP + [E_range_F01_D2, EPout]=dirspectest(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0}); + + %now with IMLM + EP.method='IMLM'; + EP.iter=3; + [I_range_F01_D2, EPout]=dirspectest(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0}); + + %set up data with radial velocities, freq and dir at default + [ID,SM,EP]=radialtouvw(pressure,range,orbit,sysinfo,3); + + % run diwasp to generate this spectrum with EMEP + [E_radial_F01_D2, EPout]=dirspectest(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0}); + + %now with IMLM + EP.method='IMLM'; + EP.iter=3; + [I_radial_F01_D2, EPout]=dirspectest(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0}); + + %Use waveplot to plot the polar, freq and dir plots of the spectra + + [E_UVW_WI,I_UVW_WI,E_range_WI,I_range_WI,wmon_WI,fig1,fig2]=waveplot(E_uvw_F01_D2,I_uvw_F01_D2,E_range_F01_D2,I_range_F01_D2,spec,sysinfo); + + saveas(fig1,['polar1_' dateinfo '.fig']); + saveas(fig2,['dirfreq1_' dateinfo '.fig']); + + [E_radial_WI,I_radial_WI,fig5,fig6]=radialwaveplot(E_radial_F01_D2,I_radial_F01_D2,spec,sysinfo); + + saveas(fig5,['polar3_' dateinfo '.fig']); + saveas(fig6,['dirfreq3_' dateinfo '.fig']); + + close all; + + %Make sure wavesmon spectrum is formatted right before outputting, change to m^2/Hz/deg + wmon.S=spec/(360*1000*1000); + + %Fill up the Winfo data structure + + hsig=[vertcat(E_UVW_WI.hsig,I_UVW_WI.hsig,E_range_WI.hsig,I_range_WI.hsig,E_radial_WI.hsig,I_radial_WI.hsig,wmon_WI.hsig)]; + peakP=[vertcat(E_UVW_WI.tp,I_UVW_WI.tp,E_range_WI.tp,I_range_WI.tp,E_radial_WI.tp,I_radial_WI.tp,wmon_WI.tp)]; + dirP=[vertcat(E_UVW_WI.dtp,I_UVW_WI.dtp,E_range_WI.dtp,I_range_WI.dtp,E_radial_WI.dtp,I_radial_WI.dtp,wmon_WI.dtp)]; + Ddir=[vertcat(E_UVW_WI.dp,I_UVW_WI.dp,E_range_WI.dp,I_range_WI.dp,E_radial_WI.dp,I_radial_WI.dp,wmon_WI.dp)]; + + + Winfo.hsig=[horzcat(Winfo.hsig,hsig)]; + Winfo.peakP=[horzcat(Winfo.peakP,peakP)]; + Winfo.dirP=[horzcat(Winfo.dirP,dirP)]; + Winfo.Ddir=[horzcat(Winfo.Ddir,Ddir)]; + Winfo.Spectrum.EMEPuvw=[cat(3,Winfo.Spectrum.EMEPuvw,E_uvw_F01_D2.S)]; + Winfo.Spectrum.IMLMuvw=[cat(3,Winfo.Spectrum.IMLMuvw,I_uvw_F01_D2.S)]; + Winfo.Spectrum.EMEPrange=[cat(3,Winfo.Spectrum.EMEPrange,E_range_F01_D2.S)]; + Winfo.Spectrum.IMLMrange=[cat(3,Winfo.Spectrum.IMLMrange,I_range_F01_D2.S)]; + Winfo.Spectrum.EMEPradial=[cat(3,Winfo.Spectrum.EMEPradial,E_radial_F01_D2.S)]; + Winfo.Spectrum.IMLMradial=[cat(3,Winfo.Spectrum.IMLMradial,I_radial_F01_D2.S)]; + Winfo.Spectrum.wavesmon=[cat(3,Winfo.Spectrum.wavesmon,wmon.S)]; + +end + +%now create the time series plots of the wave info +[fig_sigh,fig_pp,fig_dp,fig_dd]=Winfo_plot(Winfo); + +saveas(fig_sigh,['sigh_' dateinfo '.fig']); +saveas(fig_pp,['peakp_' dateinfo '.fig']); +saveas(fig_dp,['dirpeak_' dateinfo '.fig']); +saveas(fig_dd,['domdir_' dateinfo '.fig']); + +close all; + + + + Index: adcp/trunk/adcp/adcp_matlab/waveplot.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/adcp_matlab/waveplot.m (revision 168) @@ -1,0 +1,332 @@ +function [E_UVW_WI,I_UVW_WI,E_range_WI,I_range_WI,wmon_WI,fig1,fig2]=waveplot(EMEP,IMLM,rangeE,rangeI,spec,sysinfo) + +%make sure to load the EMEP, IMLM and wavesmon samples +%EMEP=load('emep'), IMLM=load('imlm'), spec=load('wavesmon') +%rangeE=load('EMEP_range'), rangeI=load('IMLM_range') + +%set up the wavesmon data in a structure + +%what is the magnetic variation to nearest degree +magvar=10; + +%first change to m^2/Hz/deg +wmon.S=spec/(360*1000*1000); + +%what is the start angle +heading=sysinfo(18,:); +heading=heading/100; +sangle=heading+magvar; + +%what is the frequency and dir resolution for those generated in DIWASP +freqres=0.01; +freqs=[0.01:0.01:.4]; +dirres=2; +dirs=[-180:2:180]; + +%set up the directions +adj_angle=90-sangle+360+180; +wmon.dirs=[adj_angle:-4:-(356-adj_angle)]; +wmondirres=4; +wmon.xaxisdir=90; +wmon.freqs=[0.00781250:0.00781250:1]; +wmonfreqres=0.00781250; + +% plot the spectrum generated through DIWASP + +scrsz = get(0,'ScreenSize'); +fig1=figure('Position',[scrsz]); +subplot(2,3,1); +subplotspec(EMEP,4); +title('EMEP uvw'); + +subplot(2,3,2); +subplotspec(IMLM,4); +title('IMLM uvw'); + +subplot(2,3,3); +subplotspec(wmon,4); +title('Wavesmon output'); + +subplot(2,3,4); +subplotspec(rangeE,4); +title('EMEP Range'); + +subplot(2,3,5); +subplotspec(rangeI,4); +title('IMLM Range'); + +%calculate just the dir energy spectrum on a single graph + +EMEPdir=sum(EMEP.S)*freqres; +IMLMdir=sum(real(IMLM.S))*freqres; +EMEPrangedir=sum(rangeE.S)*freqres; +IMLMrangedir=sum(real(rangeI.S))*freqres; +wmondir=sum(wmon.S)*wmonfreqres; + +%calculate just the frequency energy spectrum +EMEPfreq=sum(EMEP.S')*dirres; +IMLMfreq=sum(real(IMLM.S)')*dirres; +EMEPrangefreq=sum(rangeE.S')*dirres; +IMLMrangefreq=sum(real(rangeI.S)')*dirres; +wmonfreq=sum(wmon.S')*wmondirres; + +%Find the maximum for the directional spectrum so we can set up the proper +%x-axis +[maxvalue,maxindex] = max(EMEPdir); +maxdir=dirs(maxindex); +% set up the x-axis for all of the spectra depending on the max +if ((100 < maxdir) | (maxdir < -100)); + %for diwasp spectra + index1=find(dirs < 0); + index2=find(dirs > -1); + dirs(index1)=dirs(index1) +360; + %for wavesmon + Aindex=find(wmon.dirs < 0); + Bindex=find((-1 < wmon.dirs) & (wmon.dirs < 361)); + Bindex2=find(wmon.dirs > 360); + wmon.dirs(Bindex2)=wmon.dirs(Bindex2)-360; + wmon.dirs(Aindex)=wmon.dirs(Aindex)+360; + %plot the directional energy spectrum + fig2=figure('Position',[scrsz]); + subplot(1,2,1); + h1 = plot(dirs(index2),EMEPdir(index2),'b'); + hold on + h1a= plot(dirs(index1),EMEPdir(index1),'b'); + h2 = plot(dirs(index2),EMEPrangedir(index2),'r'); + h2a= plot(dirs(index1),EMEPrangedir(index1),'r'); + h3 = plot(dirs(index2),IMLMrangedir(index2),'g'); + h3a= plot(dirs(index1),IMLMrangedir(index1),'g'); + %plot the wavesmon data + h4 = plot(wmon.dirs(Bindex2),wmondir(Bindex2),'k'); + h4a = plot(wmon.dirs(Bindex),wmondir(Bindex),'k'); + h4b= plot(wmon.dirs(Aindex),wmondir(Aindex),'k'); + axis(axis); + h5 = plot(dirs(index2),IMLMdir(index2),'c'); + h5a= plot(dirs(index1),IMLMdir(index1),'c'); + +else + %for diwasp spectra do nothing + + %for wavesmon + Aindex=find(wmon.dirs > 180); + Bindex=find(wmon.dirs < 181); + wmon.dirs(Aindex)=wmon.dirs(Aindex)-360; + %plot the directional energy spectrum + fig2=figure('Position',[scrsz]); + subplot(1,2,1); + h1 = plot(dirs,EMEPdir,'b'); + hold on + h2 = plot(dirs,EMEPrangedir,'r'); + h3 = plot(dirs,IMLMrangedir,'g'); + %plot the wavesmon data + h4 = plot(wmon.dirs(Aindex),wmondir(Aindex),'k'); + h4a = plot(wmon.dirs(Bindex),wmondir(Bindex),'k'); + axis(axis); + h5 = plot(dirs,IMLMdir,'c'); +end + +legend([h1, h2, h3, h4, h5],'EMEP uvw','EMEP range','IMLM range','wavesmon','IMLM uvw','location','best'); +title('directional wave spectrum integrated over frequency'); +xlabel('axis angle (degrees true)'); +ylabel('m^2 / deg'); + +%plot the frequency energy spectrum +subplot(1,2,2); +plot(freqs,EMEPfreq,'b'); +hold on +plot(freqs,EMEPrangefreq,'r'); +plot(freqs,IMLMrangefreq,'g'); +plot(wmon.freqs,wmonfreq,'k'); +axis(axis); +plot(freqs,IMLMfreq,'c'); +legend('EMEP uvw','EMEP range','IMLM range','wavesmon','IMLM uvw','location','best'); +title('directional wave spectrum integrated over direction'); +xlabel('frequency in Hz'); +ylabel('m^2 / hz'); + +% ______Calculate and display the wave parameters SigH, Tp, Dp,DTp_______ + +%For EMEP uvw + +%calculate the 0,1,2 moments +m0=sum(EMEPfreq*freqres); +m1=sum(freqs.*EMEPfreq*freqres); +m2=sum((freqs.^2).*EMEPfreq*freqres); +% Calculate the Sig wave height +EMEP_UVW_Hsig=4*sqrt(m0); + +% Calculate the peak period Tp +[P,I]=max(EMEPfreq); +EMEP_UVW_Tp=1/(freqs(I)); + +%Calculate the Direction of the peak period DTp +[P,I]=max(real(EMEP.S(I,:))); +EMEP_UVW_DTp=dirs(I); + +%Calculate the Dominant Direction Dp +[P,I]=max(EMEPdir); +EMEP_UVW_Dp=dirs(I); + +%Display on the screen the SigH,Tp,Dp,DTp +disp(['EMEP uvw']); +disp(['SigH (meters): ' num2str(EMEP_UVW_Hsig)]); +disp(['peak period (seconds): ' num2str(EMEP_UVW_Tp)]); +disp(['Dir of peak period: ' num2str(compangle(EMEP_UVW_DTp, EMEP.xaxisdir))]); +disp(['Dominant Direction: ' num2str(compangle(EMEP_UVW_Dp, EMEP.xaxisdir))]); +disp([' ']); + +E_UVW_WI.hsig=EMEP_UVW_Hsig; +E_UVW_WI.tp=EMEP_UVW_Tp; +E_UVW_WI.dtp=compangle(EMEP_UVW_DTp, EMEP.xaxisdir); +E_UVW_WI.dp=compangle(EMEP_UVW_Dp, EMEP.xaxisdir); + + +% For IMLM uvw + +%calculate the 0,1,2 moments +m0=sum(IMLMfreq*freqres); +m1=sum(freqs.*IMLMfreq*freqres); +m2=sum((freqs.^2).*IMLMfreq*freqres); +% Calculate the Sig wave height +IMLM_UVW_Hsig=4*sqrt(m0); + +% Calculate the peak period Tp +[P,I]=max(IMLMfreq); +IMLM_UVW_Tp=1/(freqs(I)); + +%Calculate the Direction of the peak period DTp +[P,I]=max(real(IMLM.S(I,:))); +IMLM_UVW_DTp=dirs(I); + +%Calculate the Dominant Direction Dp +[P,I]=max(IMLMdir); +IMLM_UVW_Dp=dirs(I); + +%Display on the screen the SigH,Tp,Dp,DTp +disp(['IMLM uvw']); +disp(['SigH (meters): ' num2str(IMLM_UVW_Hsig)]); +disp(['peak period (seconds): ' num2str(IMLM_UVW_Tp)]); +disp(['Dir of peak period: ' num2str(compangle(IMLM_UVW_DTp, IMLM.xaxisdir))]); +disp(['Dominant Direction: ' num2str(compangle(IMLM_UVW_Dp, IMLM.xaxisdir))]); +disp([' ']); + +I_UVW_WI.hsig=IMLM_UVW_Hsig; +I_UVW_WI.tp=IMLM_UVW_Tp; +I_UVW_WI.dtp=compangle(IMLM_UVW_DTp, IMLM.xaxisdir); +I_UVW_WI.dp=compangle(IMLM_UVW_Dp, IMLM.xaxisdir); + +% for Range of EMEP + +%calculate the 0,1,2 moments +m0=sum(EMEPrangefreq*freqres); +m1=sum(freqs.*EMEPrangefreq*freqres); +m2=sum((freqs.^2).*EMEPrangefreq*freqres); +% Calculate the Sig wave height +EMEP_range_Hsig=4*sqrt(m0); + +% Calculate the peak period Tp +[P,I]=max(EMEPrangefreq); +EMEP_range_Tp=1/(freqs(I)); + +%Calculate the Direction of the peak period DTp +[P,I]=max(real(rangeE.S(I,:))); +EMEP_range_DTp=dirs(I); + +%Calculate the Dominant Direction Dp +[P,I]=max(EMEPrangedir); +EMEP_range_Dp=dirs(I); + +%Display on the screen the SigH,Tp,Dp,DTp +disp(['EMEP range']); +disp(['SigH (meters): ' num2str(EMEP_range_Hsig)]); +disp(['peak period (seconds): ' num2str(EMEP_range_Tp)]); +disp(['Dir of peak period: ' num2str(compangle(EMEP_range_DTp, rangeE.xaxisdir))]); +disp(['Dominant Direction: ' num2str(compangle(EMEP_range_Dp, rangeE.xaxisdir))]); +disp([' ']); + +E_range_WI.hsig=EMEP_range_Hsig; +E_range_WI.tp=EMEP_range_Tp; +E_range_WI.dtp=compangle(EMEP_range_DTp, rangeE.xaxisdir); +E_range_WI.dp=compangle(EMEP_range_Dp, rangeE.xaxisdir); + + +%for Range of IMLM + +%calculate the 0,1,2 moments +m0=sum(IMLMrangefreq*freqres); +m1=sum(freqs.*IMLMrangefreq*freqres); +m2=sum((freqs.^2).*IMLMrangefreq*freqres); +% Calculate the Sig wave height +IMLM_range_Hsig=4*sqrt(m0); + +% Calculate the peak period Tp +[P,I]=max(IMLMrangefreq); +IMLM_range_Tp=1/(freqs(I)); + +%Calculate the Direction of the peak period DTp +[P,I]=max(real(rangeI.S(I,:))); +IMLM_range_DTp=dirs(I); + +%Calculate the Dominant Direction Dp +[P,I]=max(IMLMrangedir); +IMLM_range_Dp=dirs(I); + +%Display on the screen the SigH,Tp,Dp,DTp +disp(['IMLM range']); +disp(['SigH (meters): ' num2str(IMLM_range_Hsig)]); +disp(['peak period (seconds): ' num2str(IMLM_range_Tp)]); +disp(['Dir of peak period: ' num2str(compangle(IMLM_range_DTp, rangeI.xaxisdir))]); +disp(['Dominant Direction: ' num2str(compangle(IMLM_range_Dp, rangeI.xaxisdir))]); +disp([' ']); + +I_range_WI.hsig=IMLM_range_Hsig; +I_range_WI.tp=IMLM_range_Tp; +I_range_WI.dtp=compangle(IMLM_range_DTp, rangeI.xaxisdir); +I_range_WI.dp=compangle(IMLM_range_Dp, rangeI.xaxisdir); + +% for wavesmon + +%calculate the 0,1,2 moments +m0=sum(wmonfreq*wmonfreqres); +m1=sum(wmon.freqs.*wmonfreq*wmonfreqres); +m2=sum((wmon.freqs.^2).*wmonfreq*wmonfreqres); +% Calculate the Sig wave height +wmon_Hsig=4*sqrt(m0); + +% Calculate the peak period Tp +[P,I]=max(wmonfreq); +wmon_Tp=1/(wmon.freqs(I)); + +%Calculate the Direction of the peak period DTp +[P,I]=max(real(wmon.S(I,:))); +wmon_DTp=wmon.dirs(I); + +%Calculate the Dominant Direction Dp +[P,I]=max(wmondir); +wmon_Dp=wmon.dirs(I); + +%Display on the screen the SigH,Tp,Dp,DTp +disp(['Wavesmon output']); +disp(['SigH (meters): ' num2str(wmon_Hsig)]); +disp(['peak period (seconds): ' num2str(wmon_Tp)]); +disp(['Dir of peak period: ' num2str(compangle(wmon_DTp, wmon.xaxisdir))]); +disp(['Dominant Direction: ' num2str(compangle(wmon_Dp, wmon.xaxisdir))]); +disp([' ']); + +wmon_WI.hsig=wmon_Hsig; +wmon_WI.tp=wmon_Tp; +wmon_WI.dtp=compangle(wmon_DTp, wmon.xaxisdir); +wmon_WI.dp=compangle(wmon_Dp, wmon.xaxisdir); + + +%function to change from axis angles to compass bearings + +function angle=compangle(angle,xaxisdir) +angle=xaxisdir*ones(size(angle))-angle; +angle=angle+360*(angle<0); +angle=angle-360*(angle>360); + + + + + Index: adcp/trunk/adcp/diwasp_1_1GD/Contents.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/Contents.m (revision 168) @@ -1,0 +1,63 @@ +%DIWASP: DIrectional WAve SPectrum analysis +%Version 1.1 +% +%Toolbox contents: +%Main functions: +%dirspec.m Main function for directional wave analysis +%readspec.m Reads in DIWASP format spectrum files +%writespec.m Writes DIWASP format spectrum files +%plotspec.m Plots DIWASP spectrums +%testspec.m Testing function for the estimation methods +%makespec.m Makes a fake spectrum and generates fake data for testing dirspec.m +%infospec.m Returns information about a directional spectrum +% +%data_structures.m is a help file describing the new Version 1.1 data structures +% +%Private functions (some can be used as stand alone functions): +% The transfer functions +% /private/elev.m +% /private/pres.m +% /private/velx.m +% /private/vely.m +% /private/velz.m +% /private/slpx.m +% /private/slpy.m +% /private/vels.m +% /private/accs.m +% +% The estimation functions +% /private/DFTM.m +% /private/EMLM.m +% /private/IMLM.m +% /private/EMEP.m +% /private/BDM.m +% +% Miscellaneous functions +% /private/smoothspec.m +% /private/wavenumber.m +% /private/makerandomsea.m +% /private/makewavedata.m +% /private/Hsig.m +% /private/gsamp.m +% /private/check_data.m +% +% +%Type help then the function name for online help on each function. +% +%License agreement +%DIWASP, is free software; you can redistribute it and/or modify it under the terms of the +%GNU General Public License as published by the Free Software Foundation. +%However, the DIWASP license includes the following addendum concerning its usage: +%This software and any derivatives of it shall only be used for educational purposes or +%scientific research without the intention of any financial gain. +%Use of this software or derivatives for any purpose that results in financial gain +%for a person or organization without written consent from the author is a breach of the license agreement. +%This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +%without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +%In addition the author is not liable in any way for consequences arising from the application of +%software output for any design or decision-making process. +%The GNU General Public License forms the main part of the license agreement included in the package. +% +%Copyright (C) 2002 David Johnson Coastal Oceanography Group, CWR, UWA, Perth + +% Index: adcp/trunk/adcp/diwasp_1_1GD/DIWASP format.txt =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/DIWASP format.txt (revision 168) @@ -1,0 +1,18 @@ +DIWASP format +Directional Wave Spectrum + +Continuous ASCII stream: +xaxisdir DOUBLE compass direction of x axis +nspec INTEGER number of frequency bins +ndir INTEGER number of direction bins +spfreq(nspec) DOUBLE frequency bins in rad/s +spdir(ndir) DOUBLE direction bins in radians +999 INTEGER end of header marker +spden(nspec,ndir) DOUBLE density of wave component with frequency:freq ; direction:dir + +Loop order for spectral densities:: + do i=1,nspec + do j=1,ndir + read(##,*) spden(i,j) + enddo + enddo Index: adcp/trunk/adcp/diwasp_1_1GD/Version.txt =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/Version.txt (revision 168) @@ -1,0 +1,3 @@ +This package contains +DIWASP Version 1.1GD, with changes by Greg Dusek, UNC Chapel Hill + Index: adcp/trunk/adcp/diwasp_1_1GD/data_structures.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/data_structures.m (revision 168) @@ -1,0 +1,45 @@ +%DIWASP Version 1.1 help file +%This describes the three structures used in DIWASP functions +% +%The input data structure(ID) contains fields: +% ID.data measured wave data matrix - data in columns, one column per sensor +% ID.layout layout of the sensors - x,y,z in each column. +% x and y from arbitrary origin and z measured upwards from seabed (m) +% ID.datatypes sensor type. Enter as cell list: e.g. {'elev' 'pres'}. Currently supported: +% 'elev' surface elevation +% 'pres' pressure +% 'velx' x component velocity +% 'vely' y component velocity +% 'velz' z component velocity +% 'vels' vertical velocity of surface +% 'accs' vertical acceleration of surface +% 'slpx' x component surface slope +% 'slpy' y component surface slope +% ID.depth mean overall depth of measurement area (m) +% ID.fs sampling frequency of instruments - must be single figure for all (Hz) +% +%The spectral matrix structure(SM) contains fields: +% SM.freqs vector of length nf defining the bin centres of the spectral matrix frequency axis +% SM.dirs vector of length nd defining the bin centres of the spectral matrix direction axis +% SM.S matrix of size [nf,nd] containing the actual spectral density +% SM.xaxisdir compass direction of the x axis. +% +%The estimation parameter(EP) structure contains the fields: +% EP.method estimation method used. Currently supported: +% 'DFTM' Direct Fourier transform method +% 'EMLM' Extended maximum likelihood method +% 'IMLM' Iterated maximum likelihood method +% 'EMEP' Extended maximum entropy principle +% 'BDM' Bayesian direct method +% EP.nfft number of DFTs used to calculate the frequency spectra: frequency resolution is (EP.nfft)/2 +% EP.dres directional resolution of calculation itself specified as the number of directional bins +% which cover the whole circle. Note that the actual output resolution is determined by SM.dirs +% EP.iter number of iterations: this has various effects for different methods +% EP.smooth smoothing applied: 'ON' or 'OFF' +% + + + +%%Note that the name of the structures are arbitrary but the field names must not be changed. + +%This file is only a help file Index: adcp/trunk/adcp/diwasp_1_1GD/dirspec.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/dirspec.m (revision 168) @@ -1,0 +1,175 @@ +function [SM,EP]=dirspec(ID,SM,EP,varargin); + +%DIWASP V1.1 function with GD edit +%dirspec: main spectral estimation routine +% +%Note that there have been some chages made to this function since V1.1 +% +%-The outdated matlab function csd was replaced with the new version cpsd on +%line 90 +% +%-The ability to use along beam radial velocities has been added, and so the transfer +%parameters have been edited (line 109) so that the x,y position of the data input +%is also included +% +%-In addition, the first data input cell is radial velocity data, the initial 1-d +%frequency spectrum will be generated using the spectral average of all of +%the data input. Note that if the first data input cell is something other +%than 'radial' (pressure or sea surface height may be preferable), +%the initial 1-d frequency spectrum will be generated using ONLY that first +%data input. (see line 123) +% +% +%[SMout,EPout]=dirspec(ID,SM,EP,{options}) +% +%Outputs: +%SMout A spectral matrix structure containing the results +%Epout The estimation parameters structure with the values actually used for the computation including any default settings. +% +%Inputs: +%ID An instrument data structure containing the measured data +%SM A spectral matrix structure; data in field SM.S is ignored. +%EP The estimation parameters structure. For default values enter EP as [] +%[options] options entered as cell array with parameter/value pairs: e.g.{'MESSAGE',1,'PLOTTYPE',2}; +% Available options with default values: +% 'MESSAGE',1, Level of screen display: 0,1,2 (increasing output) +% 'PLOTTYPE',1, Plot type: 0 none, 1 3d surface, 2 polar type plot, 3 3d surface(compass angles), 4 polar plot(compass angles) +% 'FILEOUT','' Filename for output file: empty string means no file output +% +%Input structures ID and SM are required. Either [EP] or [options] can be included but must be in order if both are included. +%Type:%"help data_structures" for information on the DIWASP data structures + +%All of the implemented calculation algorithms are as described by: +%Hashimoto,N. 1997 "Analysis of the directional wave spectrum from field data" +%In: Advances in Coastal Engineering Vol.3. Ed:Liu,P.L-F. Pub:World Scientific,Singapore +% +%Copyright (C) 2002 Coastal Oceanography Group, CWR, UWA, Perth + +Options=struct('MESSAGE',1,'PLOTTYPE',1,'FILEOUT',''); + +if nargin<3 + error('All inputs other than OPTIONS required'); +elseif nargin>=4 + nopts=length(varargin{1}); +end + +ID=check_data(ID,1);if isempty(ID) return;end; +SM=check_data(SM,2);if isempty(SM) return;end; +EP=check_data(EP,3);if isempty(EP) return;end; + +if ~isempty(nopts) +if(rem(nopts,2)~=0) + warning('Options must be in Name/Value pairs - setting to defaults'); + else + for i=1:(nopts/2) + arg=varargin{1}{(2*i)}; + field=varargin{1}{(2*i-1)}; + Options=setfield(Options,field,arg);end;end +end + +ptype=Options.PLOTTYPE;displ=Options.MESSAGE; + +disp(' ');disp('calculating.....');disp(' ');disp('cross power spectra'); + +data=detrend(ID.data); +szd=size(ID.data,2); +dt=1/(ID.fs); + +%get resolution of FFT - if not specified, calculate a sensible value depending on sampling frequency +if isempty(EP.nfft) + nfft=2^(8+round(log2(ID.fs))); + EP.nfft=nfft; +else + nfft=EP.nfft; +end + +% NOTE: changed from csd to cpsd 6/15/07 +%calculate the cross-power spectra +for m=1:szd +for n=1:szd + [xpstmp,Ftmp]=cpsd(data(:,m),data(:,n),[],[],nfft,ID.fs); + xps(m,n,:)=xpstmp(2:(nfft/2)+1); + end +end + +F=Ftmp(2:(nfft/2)+1);nf=nfft/2; + +%calculate wavenumbers +disp('wavenumbers') +wns=wavenumber(2*pi*F,ID.depth*ones(size(F))); +pidirs=[-pi:(2*pi/EP.dres):pi-(2*pi/EP.dres)]; % this is dirs + +% NOTE: edited the transfer parameters to include x and y position +% x is (layout(1,m)),y is (layout(2,m)) (6/15/07) + +%calculate transfer parameters +disp('transfer parameters'); +disp(' '); +for m=1:szd + trm(m,:,:)=feval(ID.datatypes{m},2*pi*F,pidirs,wns,ID.layout(3,m),ID.depth,ID.layout(1,m),ID.layout(2,m)); % 2piF is ffreqs + for n=1:szd + kx(m,n,:,:)=wns*((ID.layout(1,n)-ID.layout(1,m))*cos(pidirs)+(ID.layout(2,n)-ID.layout(2,m))*sin(pidirs)); +end +end + +for m=1:szd + tfn(:,:)=trm(m,:,:); + Sxps(1:nf)=2*dt*xps(m,m,:); + Ss(m,:)=Sxps./(max(tfn').*conj(max(tfn'))); +end + +%have Ss = the spectral average if the radial velocities are used without a +%pressure or vertical range datatype first +compare=strcmp('radial',ID.datatypes(1)); + +if compare == 1 + Ss=mean(Ss); +end + +ffs=sum(F<=max(SM.freqs)); + + % call appropriate estimation function +disp(['directional spectra using' blanks(1) EP.method ' method']);disp(' ') +Specout=feval(EP.method,xps(:,:,1:ffs),trm(:,1:ffs,:),kx(:,:,1:ffs,:),Ss(:,1:ffs),pidirs,EP.iter,displ); + +Specout(find(isnan(Specout)))=0.0; +Hs=Hsig(Specout,F(2)-F(1),pidirs(2)-pidirs(1)); + +% map spectrum onto user defined spectrum matrix - need extra line of frequencies to avoid NaNs +[df,ddir]=meshgrid(SM.freqs,SM.dirs); +pidirs(EP.dres+1)=pi; +Specout=Specout'; +Specout(EP.dres+1,:)=Specout(1,:); +[Ff,Dd]=meshgrid(F(1:ffs),(180/pi)*pidirs); +S=interp2(Ff,Dd,Specout,df,ddir,'nearest'); +S=S*pi/180; +S(find(isnan(S)))=0.0; + +%check Hsig of mapped spectrum and check sufficiently close to original +Hs2=Hsig(S,SM.freqs(2)-SM.freqs(1),SM.dirs(2)-SM.dirs(1)); +if (Hs2-Hs)/Hs >0.01 + warning('User defined grid may be too coarse; try increasing resolution of ''SM.freqs'' or ''SM.dirs'''); +end + +%smooth spectrum +if(strcmp(EP.smooth,'ON')) + disp(' ');disp('smoothing spectrum...');disp(' '); + S=smoothspec(S,[1 0.5 0.25;1 0.5 0.25]); +end +SM.S=S'; + +infospec(SM); + +%write out spectrum matrix in DIWASP format +filename=Options.FILEOUT; +if(size(filename,2)>0) + disp('writing out spectrum matrix to file'); + writespec(SM,filename); +end + +%plot spectrum +if(ptype>0) + disp('finished...plotting spectrum'); + plotspec(SM,ptype); + T=['Directional spectrum estimated using ' blanks(1) EP.method ' method'];title(T); +end Index: adcp/trunk/adcp/diwasp_1_1GD/infospec.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/infospec.m (revision 168) @@ -1,0 +1,48 @@ +function [H,Tp,DTp,Dp]=infospec(SM) + +%DIWASP V1.1 function +%infospec: calculates and displays information about a directional spectrum +% +%[Hsig,Tp,DTp,Dp]=infospec(SM) +% +%Outputs: +%Hsig Signficant wave height (Hmo) +%Tp Peak period +%DTp Direction of spectral peak +%Dp Dominant direction +% +%Inputs: +%SM A spectral matrix structure containing the file data +% +%Hsig is the significant wave height. Tp is the peak frequency, the highest point in the one dimensional spectrum. +%DTp is the main direction of the peak period (i.e the highest point in the two-dimensional directional spectrum). +%Dp is the dominant direction defined as the direction with the highest energy integrated over all frequencies. +% +%"help data_structures" for information on the DIWASP data structures + +%Copyright (C) 2002 Coastal Oceanography Group, CWR, UWA, Perth + +SM=check_data(SM,2);if isempty(SM) return;end; + +H=HSig(SM); + +S=sum(real(SM.S),2); % S is freq spectrum + +[P,I]=max(S); +Tp=1/(SM.freqs(I)); +[P,I]=max(real(SM.S(I,:))); +DTp=SM.dirs(I); +[P,I]=max(real(sum(SM.S,1))); +Dp=SM.dirs(I); + +disp(['Infospec::']); +disp(['Significant wave height (Hmo): ' num2str(H)]); +disp(['Peak period: ' num2str(Tp)]); +disp(['Direction of peak period: ' num2str(DTp) ' axis angle / ' num2str(compangle(DTp,SM.xaxisdir)) ' compass bearing']); +disp(['Dominant direction: ' num2str(Dp) ' axis angle / ' num2str(compangle(Dp,SM.xaxisdir)) ' compass bearing']); + + +function dirs=compangle(dirs,xaxisdir) +dirs=xaxisdir*ones(size(dirs))-dirs; +dirs=dirs+360*(dirs<0); +dirs=dirs-360*(dirs>360); Index: adcp/trunk/adcp/diwasp_1_1GD/license.txt =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/license.txt (revision 168) @@ -1,0 +1,41 @@ +The DIWASP license agreement has two sections: +I.Distribution and modification are licensed under the terms and conditions of the GNU General Public License. +II.Usage of software and derivatives is subject to an additional terms and conditions prohibiting commercial use. + +Section I. Distribution and modification +0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". +Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. +1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. +You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. +2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: +a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. +b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. +c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) +These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. +Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. +In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. +3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: +a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, +b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, +c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) +The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. +If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. +4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. +5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. +6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. +7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. +If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. +It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. +This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. +8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. +9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. +Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. +10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. +NO WARRANTY +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +Section II. Conditions for use +1.This software and any derivatives of it shall only be used for educational purposes or scientific research without the intention of any financial gain. Use of this software or derivatives for any purpose which results in financial gain for a person or organisation without written consent from the author is a breach of the license agreement. + +END OF TERMS AND CONDITIONS Index: adcp/trunk/adcp/diwasp_1_1GD/makespec.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/makespec.m (revision 168) @@ -1,0 +1,127 @@ +function [SM,ID]= makespec(freqlph,theta,spread,weights,Ho,ID,ndat,noise) + +%DIWASP V1.1 function +%makespec: generates a directional wave spectra and pseudo data from the spectra +% +%[SM,IDout]=makespec(freqlph,theta,spread,weights,Ho,ID,ndat,noise) +% +%Outputs: +%SM A spectral matrix of the generated spectrum +%IDout Returns the input ID with data in field ID.data filled +% +%Inputs: +%freqlph 3 component vector [l p h] containing: +% the lowest frequency(l),peak, frequency(p) and highest frequency(h) +%theta vector with the mean directions of a sea state component +%spread vector with the spreading parameters of a sea state component +%weights vector with relative weights of sea state components +%Ho RMS wave height for generated spectrum +%ID Instrument data structure; field ID.data is ignored +%ndat length of simulated data +%noise level of simulated noise: +% Gaussian white noise added with variance of [noise*var(eta)] +% +% +%theta, spread and weights must all be the same length +%typical spreading parameter values are 25-100 +% +%The generated spectrum is based on an TMA spectrum (Bouws et al. 1985 JGR 90 C1,975-986) +%with directional spreading calculated with a cosine power function (Mitsuyasu et al.1975 J.Phys Oceanogr.5,750-760) +% +%"help data_structures" for information on the DIWASP data structures + +%Copyright (C) 2002 Coastal Oceanography Group, CWR, UWA, Perth + +ID=check_data(ID,1);if isempty(ID) return;end; + +%setup default values +dt=0.5;g=9.806; +siga=0.07;sigb=0.09;gamma=2;alpha=0.014; +nf=50;nd=60; + +ncom=size(theta,2); +ns=size(ID.layout,2); + +df=(freqlph(3)-freqlph(1))/nf; +ddir=2*pi/nd; + +ffreqs=[freqlph(1):df:freqlph(3)]'; +nf=size(ffreqs,1); +fpeak=freqlph(2)*ones(size(ffreqs)); + +flh=(ffreqs<=fpeak); +sigma=siga*flh-sigb*(flh-ones(size(flh))); + +omgh=2*pi*ffreqs*(ID.depth/g)^0.5; +phi=zeros(size(omgh)); +phi=phi+0.5*(omgh<=1).*omgh.^2; +phi=phi+(omgh>=2); +phi=phi+(omgh>1 & omgh <2).*(ones(size(omgh))-0.5*(2*ones(size(omgh))-omgh).^2); + +Ek=(alpha*g*g*(2*pi)^(-4.0))*phi.*(ffreqs.^(-5)); +PhiPM=exp(-(5.0/4.0)*(ffreqs./fpeak).^(-4.0)); +PhiJ=exp(log(gamma)*exp(-((ffreqs-fpeak).^2)./((2*sigma.^2).*fpeak.^2))); +ETMA=Ek.*PhiPM.*PhiJ; + +dirs=[-pi:ddir:pi-ddir]; +omg=2*pi*ffreqs; + +for i=1:ncom + GS(i,:)=(cos(0.5*(dirs-theta(i)*(pi/180)*ones(size(dirs))))).^(2*spread(i)); + sumGS(i)=sum(GS(i,:)); +end + +sumweights=sum(weights); +weights=(1/sumweights)*weights; +coeff=(1./sumGS).*weights; + +Gg=zeros(size(dirs)); +for i=1:ncom + Gg=Gg+coeff(i)*GS(i,:); +end + +spec=(ETMA*Gg); +fac=Ho/(sqrt(8*sum(sum(spec))*df*ddir*(180/pi))); +spec=fac*fac*spec; + +SM.freqs=ffreqs;SM.dirs=(180/pi)*dirs;SM.S=spec;SM.xaxisdir=90; + +disp('plotting spectrum...press any key to make data'); +plotspec(SM,1); +drawnow; +pause + +disp('writing spectrum matrix to file'); +writespec(SM,'specmat.spec'); + +wns=wavenumber(omg,ID.depth*ones(size(omg))); +eamp=sqrt(2*df*ddir*(180/pi)*spec); + +data=makewavedata(eamp,omg,wns,dirs,ID.layout,ID.datatypes,ID.depth,ID.fs,ndat); + +for i=1:ns + gsnoise=gsamp(0,noise*var(data(:,1)),ndat); + data(:,i)=data(:,i)+gsnoise; +end + +ID.data=data; + +surfout = questdlg('Do you want to see a simulated sea surface?','DIWASP','Yes','No','No'); + +if strcmp(surfout,'Yes') +xx=[1:2:50]; +yy=[1:2:100]; +surface=makerandomsea(eamp,wns,dirs,xx,yy); + +[py,px]=meshgrid(yy,xx); + +surf(px,py,surface); +axis equal; + +end + + + + + + Index: adcp/trunk/adcp/diwasp_1_1GD/plotspec.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/plotspec.m (revision 168) @@ -1,0 +1,111 @@ +function plotspec(SM,ptype); + +%DIWASP V1.1 function +%plotspec: plots the spectral matrix in 3D or polar form +% +%plotspec(SM,ptype) +% +%Inputs: +% SM A spectral matrix structure +% ptype plot type: +% 1 3D surface plot +% 2 polar type plot +% 3 3D surface plot (compass bearing angles) +% 4 polar type plot (compass bearing angles) +% +%The 3D surface plot type is a MATLAB surface plot with SM.freqs on the x axis, SM.dirs on the y axis and the spectral density, SM.S as the z value. +%The polar type plot is a MATLAB polar plot with the direction showing values in SM.dirs, the radius showing values in SM.freqs +%and contours representing the spectral density, SM.S. An example of the polar type plot is shown on the front cover of the manual. +%For both plot types, the direction is the direction of propagation (see also The DIWASP spectrum file format). +%For options 3 and 4 the direction is the compass bearing. This is calculated from the SM.xaxisdir input that defines the orientation of the axes. +%Note that if SM.xaxisdir is 90 the appearance of the polar plot is unchanged. +% +%"help data_structures" for information on the DIWASP data structures + +%Copyright (C) 2002 Coastal Oceanography Group, CWR, UWA, Perth + +fig=figure; + +SM=check_data(SM,2);if isempty(SM) return;end; +dirs=SM.dirs;ffreqs=SM.freqs;S=real(SM.S); + +if (ptype==3|ptype==4) + xaxisdir=SM.xaxisdir; + if ~(xaxisdir >=0 & xaxisdir <=360) + warning('xaxisdir must be between 0 and 360 -set to default value of 90'); + xaxisdir=90; + end +end + +if(ptype==1|ptype==3) + if(ptype==3) + dirs=xaxisdir*ones(size(dirs))-dirs; + dirs=dirs+360*(dirs<0); + dirs=dirs-360*(dirs>360); + [dirs,order]=sort(dirs); + else + order=([1:max(size(dirs))]); + end + [ddir,df]=meshgrid(dirs,ffreqs); + surf(df,ddir,real(S(:,order))); + + shading interp; + xlabel('frequency [Hz]'); + if(ptype==1) + ylabel('direction [degrees]'); + axis([0 (max(ffreqs)) -180 180 0 (max(max(S)))]); + + else + ylabel('direction [bearing]'); + axis([0 (max(ffreqs)) 0 360 0 (max(max(S)))]); + end + zlabel('m^2s / deg'); + +elseif(ptype==2|ptype==4) + if(ptype==4) + dirs=(90-xaxisdir)*ones(size(dirs))+dirs; + end + h = polar([0 2*pi], [0 0.4]); %[0 0.8*max(ffreqs)]); Changed on 5/25 + delete(h); + + [df,ddir]=meshgrid(ffreqs,dirs); + +%uses the existing polar figure function and replaces numbering of angles for compass directions. Will probably be changed in future versions. + if(ptype==4) + set(0,'ShowHiddenHandles','on') + chhs=get(gca,'Children'); + for i=1:size(chhs,1); + obj=chhs(i); + if strcmp(get(obj,'Type'),'text') + num=str2num(get(obj,'String')); + if~(isempty(num)) + if mod(num,30)==0 + num=90-num; + num=(num<0)*360+num; + set(obj,'String',num2str(num)); + end + end + end + end + set(0,'ShowHiddenHandles','off') + end + + hold on; + + [px,py]=pol2cart(ddir*pi/180,df); + contour(px,py,real(S'),20); + + caxis([0 max(max(S))]); + colorbar('vert'); + if(ptype==2) + ylabel('direction [degrees] / frequency [Hz]'); + else + ylabel('direction [bearing] / frequency [Hz]'); + end + xlabel('m^2s / deg'); + hold off; +end + +set(gca,'Color','none'); + + Index: adcp/trunk/adcp/diwasp_1_1GD/private/BDM.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/private/BDM.m (revision 168) @@ -1,0 +1,156 @@ +function [S]=BDM(xps,trm,kx,Ss,pidirs,miter,displ) + +nmod=6; + +szd=size(xps,1); +freqs=size(xps,3); +ddirs=size(trm,3); + +ddir=abs(pidirs(2)-pidirs(1)); +pi=4.0*atan(1.0); + +if(sum(kx)==0) + warning('BDM method may not work with three quantity measurements'); + disp(' '); +end + +if(displ<2) + warning off; +end + +Co=real(xps); +Quad=-imag(xps); + + +for ff=1:freqs + xpsx(:,:,ff)=diag(xps(:,:,ff))*(diag(xps(:,:,ff))'); + sigCo(:,:,ff)=sqrt(0.5*(xpsx(:,:,ff)+Co(:,:,ff).^2-Quad(:,:,ff).^2)); + sigQuad(:,:,ff)=sqrt(0.5*(xpsx(:,:,ff)-Co(:,:,ff).^2+Quad(:,:,ff).^2)); +end + +for ff=1:freqs + +index=0; +for m=1:szd + for n=m:szd + expx(1:ddirs)=exp(-i*kx(m,n,ff,1:ddirs)); + Hh(1:ddirs)=trm(m,ff,1:ddirs); + Hhs(1:ddirs)=conj(trm(n,ff,1:ddirs)); + Htemp=(Hh.*Hhs.*expx); + + if(Htemp(1)~=Htemp(2)) + index=index+1; + phi(index,ff)=real(xps(m,n,ff))./(sigCo(m,n,ff)*Ss(1,ff)); + H(1:ddirs,index,ff)=real(Htemp)./sigCo(m,n,ff); + if(kx(m,n,1,1)+kx(m,n,1,2)~=0) + index=index+1; + phi(index,ff)=imag(xps(m,n,ff))./(sigQuad(m,n,ff)*Ss(1,ff)); + H(1:ddirs,index,ff)=imag(Htemp)./sigQuad(m,n,ff); + end + end + end + end + end + M=index; + + k=ddirs; + + dd=diag(ones(k,1))+diag(-2*ones(k-1,1),-1)+diag(ones(k-2,1),-2); + dd(1,k-1:k)=[1 -2]; + dd(2,k)=1; + + + for ff=1:freqs + if(displ>0) + disp(['calculating for frequency' blanks(1) num2str(ff) ' of' blanks(1) num2str(freqs)]); + end + a(1:k,1:M)=H(1:k,1:M,ff)*ddir; + A=a'; + B=phi(:,ff); + n=0; + keepgoing=1; + + while(keepgoing) + n=n+1; + if(displ>0) + disp(strcat('model :',num2str(n))); + end + if(n<=nmod) + u=0.5^n; + x(1:k,1)=log(1/(2*pi))*ones(k,1); + stddiff=1; + rlx=1.0; + count=0; + while(stddiff>0.001); + count=count+1; + F=exp(x); + E=diag(F); + A2=A*E; + B2=B-A*F+A*E*x; + Z(1:M,1:k)=A2; + Z(M+1:M+k,1:k)=u*dd; + Z(1:M,k+1)=B2; + Z(M+1:M+k,k+1)=zeros(k,1); + + [Q,U]=qr(Z); + + UZ=U; + TA=UZ(1:k,1:k); + Tb=UZ(1:k,k+1); + + x1=TA\Tb; + stddiff=std(x-x1); + x=(1-rlx)*x+rlx*x1; + if(count>miter|sum(isfinite(x))~=k) + if(rlx>0.0625) + rlx=rlx*0.5; + if(displ==2) + disp(['relaxing computation...factor:' num2str(rlx,4)]); + end + if(sum(isfinite(x))~=k) + x(1:k,1)=log(1/(2*pi))*ones(k,1); + end + count=0; + else + if(displ==2) + warning('computation fully relaxed..bailing out'); + end + if(n>1) + keepgoing=0; + end + break; + end + end + end + sig2=((norm(A2*x-B2)).^2+(u*norm(dd*x)).^2)/M; + ABIC(n)=M*(log(2*pi*sig2)+1)-k*log(u*u)+sum(log(diag(TA).^2)); + + if(n>1) + if(ABIC(n)>ABIC(n-1)) + keepgoing=0; + n=n-1; + end + end + + if(keepgoing) + xold=x; + else + x=xold; + end + + else + keepgoing=0; + end + + end + if(displ==2) + disp(['best: ' num2str(n)]); + end + G=exp(x); + S(ff,1:k)=Ss(1,ff)*G'; +end + +warning on; + + + Index: adcp/trunk/adcp/diwasp_1_1GD/private/DFTM.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/private/DFTM.m (revision 168) @@ -1,0 +1,36 @@ +function [S]=DFTM(xps,trm,kx,Ss,W,miter,displ) + +szd=size(xps,1); +ffreqs=size(xps,3); +ddirs=size(trm,3); +ddir=8*atan(1.0)/ddirs; + +if(displ<2) + warning off; +end + +for ff=1:ffreqs + if(displ>=1) + disp(['calculating for frequency' blanks(1) num2str(ff) ' of' blanks(1) num2str(ffreqs)]); + end + nxps=xps(:,:,ff); + Sftmp=zeros(ddirs,1)+i*zeros(ddirs,1); + for m=1:szd + for n=1:szd + + H(1:ddirs)=trm(n,ff,1:ddirs); + Hs(1:ddirs)=conj(trm(m,ff,1:ddirs)); + + expx(1:ddirs)=exp(i*kx(m,n,ff,1:ddirs)); + xtemp=nxps(m,n).*H.*Hs.*expx; + Sftmp(:)=Sftmp(:)+xtemp'; + + + end + end + E=Sftmp(:)'; + E=E./(ddir*sum(E)); + S(ff,:)=Ss(1,ff)*E; +end + +warning on; Index: adcp/trunk/adcp/diwasp_1_1GD/private/EMEP.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/private/EMEP.m (revision 168) @@ -1,0 +1,182 @@ +function [S]=EMEP(xps,trm,kx,Ss,pidirs,miter,displ) + +szd=size(xps,1); +freqs=size(xps,3); +ddirs=size(trm,3); + +ddir=abs(pidirs(2)-pidirs(1)); +pi=4.0*atan(1.0); + +if(displ<2) + warning off; +end + +Co=real(xps); +Quad=-imag(xps); + +for ff=1:freqs + + xpsx(:,:,ff)=diag(xps(:,:,ff))*(diag(xps(:,:,ff))'); + sigCo(:,:,ff)=sqrt(0.5*(xpsx(:,:,ff)+Co(:,:,ff).^2-Quad(:,:,ff).^2)); + sigQuad(:,:,ff)=sqrt(0.5*(xpsx(:,:,ff)-Co(:,:,ff).^2+Quad(:,:,ff).^2)); +end + + +for ff=1:freqs + +index=0; +for m=1:szd + for n=m:szd + expx(1:ddirs)=exp(-i*kx(m,n,ff,1:ddirs)); + Hh(1:ddirs)=trm(m,ff,1:ddirs); + Hhs(1:ddirs)=conj(trm(n,ff,1:ddirs)); + Htemp=(Hh.*Hhs.*expx); + + + if(Htemp(1)~=Htemp(2)) + index=index+1; + phi(index,ff)=real(xps(m,n,ff))./(sigCo(m,n,ff)*Ss(1,ff)); + H(1:ddirs,index,ff)=real(Htemp)./sigCo(m,n,ff); + + if(kx(m,n,1,1)+kx(m,n,1,2)~=0) + index=index+1; + phi(index,ff)=imag(xps(m,n,ff))./(sigQuad(m,n,ff)*Ss(1,ff)); + H(1:ddirs,index,ff)=imag(Htemp)./sigQuad(m,n,ff); + end + end + end + end + end + M=index; + + + for eni=1:M/2+1 + cosnt(1:ddirs,1:M,eni)=cos(eni*pidirs')*ones(1,M); + sinnt(1:ddirs,1:M,eni)=sin(eni*pidirs')*ones(1,M); + end + + cosn=cos([1:M/2+1]'*pidirs); + sinn=sin([1:M/2+1]'*pidirs); + + + for ff=1:freqs + if (displ>=1) + disp(['calculating for frequency' blanks(1) num2str(ff) ' of' blanks(1) num2str(freqs)]); + end + Hi(1:ddirs,1:M)=H(1:ddirs,1:M,ff); + Phione=(ones(size(pidirs'))*phi(1:M,ff)'); + + keepgoing=1; + n=0; + AIC=[]; + + + while(keepgoing==1) + n=n+1; + + if(n<=M/2+1) + if(displ>0) + disp(strcat('model :',num2str(n))); + end + a1(1:n)=0.0; + b1(1:n)=0.0; + + a2(1:n)=100.0; + b2(1:n)=100.0; + + count=0; + rlx=1.0; + while(max(abs(a2(1:n)))>0.01 | max(abs(b2(1:n)))>0.01) + count=count+1; + Fn=(a1(1:n)*cosn(1:n,:)+b1(1:n)*sinn(1:n,:))'; + + Fnexp=exp(Fn)*ones(1,M); + PhiHF=(Phione-Hi).*Fnexp; + Z(1:M)=sum(PhiHF)./sum(Fnexp); + for eni=1:n + X(eni,1:M)=Z.*(... + ( sum(Fnexp.*cosnt(:,:,eni))./sum(Fnexp) ) -... + ( sum(PhiHF.*cosnt(:,:,eni))./sum(PhiHF) )... + ); + Y(eni,1:M)=Z.*(... + ( sum(Fnexp.*sinnt(:,:,eni))./sum(Fnexp) )-... + ( sum(PhiHF.*sinnt(:,:,eni))./sum(PhiHF) )... + ); + end + C(:,1:n)=(X(1:n,1:M))'; + C(:,n+1:2*n)=(Y(1:n,1:M))'; + + out=C(:,1:n*2)\Z'; + out=out'; + + a2old=a2(1:n); + b2old=b2(1:n); + a2=out(1:n); + b2=out(n+1:2*n); + if sum((abs(a2)-abs(a2old))>100) | sum((abs(b2)-abs(b2old))>100 |count>miter) + if(rlx>0.0625) + rlx=rlx*0.5; + if(displ==2) + disp(['relaxing computation...factor:' num2str(rlx,4)]); + end + + count=0; + a1(1:n)=0.0; + b1(1:n)=0.0; + else + if(displ==2) + warning('computation fully relaxed..bailing out'); + end + keepgoing=0; + break; + end + else + a1=a1(1:n)+rlx*a2; + b1=b1(1:n)+rlx*b2; + end + end + + error=Z-a2(1:n)*X(1:n,:)-b2(1:n)*Y(1:n,:); + + AIC(n)=M*(log(2*pi*var(error))+1)+4*n+2; + + if(n>1) + if((AIC(n)>AIC(n-1))| isnan(AIC(n))) + keepgoing=0; + end + end + + + a1held(n,1:n)=a1(1:n); + b1held(n,1:n)=b1(1:n); + best=n; + + if~(keepgoing) + if(n>1) + a1=a1held(n-1,1:n-1); + b1=b1held(n-1,1:n-1); + best=n-1; + else + a1=0.0; + b1=0.0; + end + end + + else + keepgoing=0; + end + +end + if(displ==2) + disp(['best: ' num2str(best)]); + end + + G=exp(a1*cosn(1:best,:)+b1*sinn(1:best,:))'; + + SG=G/(sum(G)*ddir); + + S(ff,1:ddirs)=Ss(1,ff)*SG'; + + end + +warning on; Index: adcp/trunk/adcp/diwasp_1_1GD/private/EMLM.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/private/EMLM.m (revision 168) @@ -1,0 +1,39 @@ +function [S]=EMLM(xps,trm,kx,Ss,pidirs,miter,displ) + +szd=size(xps,1); +ffreqs=size(xps,3); +ddirs=size(trm,3); + +ddir=8*atan(1.0)/ddirs; + +if(displ<2) + warning off; +end + +for ff=1:ffreqs + if(displ>=1) + disp(['calculating for frequency' blanks(1) num2str(ff) ' of' blanks(1) num2str(ffreqs)]); + end + invcps=inv(xps(:,:,ff)); + Sftmp=zeros(ddirs,1); + for m=1:szd + for n=1:szd + + H(1:ddirs)=trm(n,ff,1:ddirs); + Hs(1:ddirs)=conj(trm(m,ff,1:ddirs)); + + expx(1:ddirs)=exp(i*kx(m,n,ff,1:ddirs)); + xtemp=invcps(m,n).*H.*Hs.*expx; + Sftmp(:)=Sftmp(:)+xtemp'; + + end + end + + E=(1./Sftmp(:))'; + E=E./(ddir*sum(E)); + S(ff,:)=Ss(1,ff)*E; +end + +warning on; + + Index: adcp/trunk/adcp/diwasp_1_1GD/private/Hsig.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/private/Hsig.m (revision 168) @@ -1,0 +1,20 @@ +function Hs=Hmo(varargin) +%DIWASP V1.1 function to calculate significant wave height +% +%Hs=Hsig(SM) +% +%Hs is 4 times the zeroth moment wave height of spectral matrix SM +% +%"help data_structures" for information on the DIWASP data structures + +%Copyright (C) 2002 Coastal Oceanography Group, CWR, UWA, Perth + + +if nargin==1 + SM=varargin{1}; + df=SM.freqs(2)-SM.freqs(1);ddir=abs(SM.dirs(2)-SM.dirs(1));S=SM.S; +elseif nargin==3 + df=varargin{2};ddir=varargin{3};S=varargin{1}; +end + +Hs=sqrt(16*sum(sum(real(S)*df*ddir))); Index: adcp/trunk/adcp/diwasp_1_1GD/private/IMLM.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/private/IMLM.m (revision 168) @@ -1,0 +1,85 @@ +function [S]=IMLM(xps,trm,kx,Ss,pidirs,miter,displ) + +gamma=0.1; +beta=1.0; +alpha=0.1; + +szd=size(xps,1); +ffreqs=size(xps,3); +ddirs=size(trm,3); + +ddir=8*atan(1.0)/ddirs; + +if(displ<2) + warning off; +end + + +for ff=1:ffreqs + if(displ>=1) + disp(['calculating for frequency' blanks(1) num2str(ff) ' of' blanks(1) num2str(ffreqs)]); + end + + for m=1:szd + for n=1:szd + H(1:ddirs,m,n)=trm(n,ff,1:ddirs); + Hs(1:ddirs,m,n)=conj(trm(m,ff,1:ddirs)); + expx(1:ddirs,m,n)=exp(i*kx(m,n,ff,1:ddirs)); + iexpx(1:ddirs,m,n)=exp(-i*kx(m,n,ff,1:ddirs)); + Htemp(:,m,n)=H(:,m,n).*Hs(:,m,n).*expx(:,m,n); + iHtemp(:,m,n)=H(:,m,n).*Hs(:,m,n).*iexpx(:,m,n); + end + end + + + invcps=inv(xps(:,:,ff)); + Sftmp=zeros(ddirs,1); + for m=1:szd + for n=1:szd + xtemp=invcps(m,n)*Htemp(:,m,n); + Sftmp(:)=Sftmp(:)+xtemp; + end + end + Eo=(1./Sftmp(:)); + kappa=1./(ddir*sum(Eo)); + Eo=kappa*Eo; + E=Eo; + T=Eo; + + for it=1:miter + for m=1:szd + for n=1:szd + expG(m,n,:)=iHtemp(:,m,n).*E(:); + ixps(m,n)=sum(expG(m,n,:))*ddir; + end + end + invcps=inv(ixps); + Sftmp=zeros(ddirs,1); + for m=1:szd + for n=1:szd + xtemp=invcps(m,n)*Htemp(:,m,n); + Sftmp(:)=Sftmp(:)+xtemp; + end + end + Told=T; + T=(1./Sftmp(:)); + kappa=1./(ddir*sum(T)); + T=kappa*T; + + %lambda=ones(size(T))-(T./Eo) + %ei=gamma*lambda.*E; + ei=gamma*((Eo-T)+alpha*(T-Told)); + E=E+ei; + kappa=1./(ddir*sum(E)); + E=kappa*E; + + + end + + S(ff,:)=Ss(1,ff)*E'; +end + +warning on; + + + Index: adcp/trunk/adcp/diwasp_1_1GD/private/accs.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/private/accs.m (revision 168) @@ -1,0 +1,3 @@ +function trm=accs(ffreqs,dirs,wns,z,depth,xpos,ypos) + +trm=-(ffreqs.*ffreqs)*ones(size(dirs)); Index: adcp/trunk/adcp/diwasp_1_1GD/private/check_data.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/private/check_data.m (revision 168) @@ -1,0 +1,115 @@ +function DDS=check_data(DDS,type) +% internal DIWASP1.1 function +% checks data structures +% +% DDS=check_data(DDS,type) +% DDS is the data structure +% type:1, Instrument data structure 2, Spectral matrix structure 3, Estimation parameters structure + + +%defaults: +SM.xaxisdir=90; +EP.dres=180;EP.nfft=[];EP.method='EMEP';EP.iter=100; + + + +switch type +%Instrument data structure +case 1 + if ~isstruct(DDS) + disp('DIWASP data_check: Instrument data type is not a structure'); + end + error='';nc=1; + if ( isfield(DDS,'layout') ) + [nr,nc]=size(getfield(DDS,'layout')); + if nr<3 + if nr==2 DDS.layout(3,:)=0; + ;else;error='layout';end + ;end;else;error='layout';end + if ( isfield(DDS,'datatypes') ) & all(size(getfield(DDS,'datatypes'))==[1 nc])==1 + ;else;error='datatypes';end + if ( isfield(DDS,'depth') ) & length(getfield(DDS,'depth'))==1 + ;else;error='depth';end + if ( isfield(DDS,'fs') ) & length(getfield(DDS,'fs'))==1 + ;else;error='fs';end + + if ( isfield(DDS,'data') ) + if size(getfield(DDS,'data'),2)==nc; ;else;error='data';end + else + DDS.data=zeros(1,nc); + end + + if length(error)>0 + disp(['Instrument data structure error: ' error ' not specified correctly']); + DDS=[];return; + end +%Spectral matrix +case 2 + if ~isstruct(DDS) + disp('DIWASP data_check: Spectral matrix data type is not a structure'); + end + error=''; + if ( isfield(DDS,'freqs') )& min(size(getfield(DDS,'freqs')))==1 + nf=length(DDS.freqs); + ;else;error='freqs';end + if ( isfield(DDS,'dirs') )& min(size(getfield(DDS,'dirs')))==1 + nd=length(DDS.dirs); + ;else;error='dirs';end + if ( isfield(DDS,'S') ) + if ~((size(DDS.S,1)==nf & size(DDS.S,2)==nd) | isempty(DDS.S)) + error='S';end + ;else;DDS.S=[];end + if ( isfield(DDS,'xaxisdir') ) + if ~length(DDS.xaxisdir)==1 + error='xaxisdir';end + ;else;DDS.xaxisdir=SM.xaxisdir;end + + if length(error)>0 + disp(['Spectral matrix structure error: ' error ' not specified correctly']); + DDS=[];return; + end + +%Estimation parameters +case 3 + if ~isstruct(DDS) + disp('DIWASP data_check: Estimation parameter data type is not a structure'); + end + error=''; + if ( isfield(DDS,'dres') ) + if ~length(DDS.dres)==1 + error='dres'; + elseif DDS.dres<10 + DDS.dres=10; + end + ;else;DDS.dres=EP.dres;end + if ( isfield(DDS,'nfft') ) + if ~length(DDS.nfft)==1 + error='nfft'; + elseif DDS.nfft<64 + DDS.nfft=64; + end + ;else;DDS.nfft=EP.nfft;end + if ( isfield(DDS,'iter') ) + if ~length(DDS.iter)==1 + error='iter';end + ;else;DDS.iter=EP.iter;end + if ( isfield(DDS,'smooth') ) + if ~strcmp(DDS.smooth,'OFF') + DDS.smooth='ON';end + ;else;DDS.smooth='ON';end + if ( isfield(DDS,'method') ) + if ~(any(strcmp(DDS.method,{'DFTM','EMLM','IMLM','EMEP','BDM'}))) + error='method';end + ;else;DDS.method=EP.method;end + + if length(error)>0 + disp(['Estimation parameters structure error: ' error ' not specified correctly']); + DDS=[];return; + end + +otherwise + warning('DIWASP data_check: Data type unknown'); + DDS=[]; +end + + Index: adcp/trunk/adcp/diwasp_1_1GD/private/elev.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/private/elev.m (revision 168) @@ -1,0 +1,3 @@ +function trm=elev(ffreqs,dirs,wns,z,depth,xpos,ypos) + +trm=ones(size(ffreqs,1),size(dirs,2)); Index: adcp/trunk/adcp/diwasp_1_1GD/private/gsamp.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/private/gsamp.m (revision 168) @@ -1,0 +1,25 @@ +function x = gsamp(mu, covar, nsamp) +%GSAMP Sample from a Gaussian distribution. +% +% Description +% +% X = GSAMP(MU, COVAR, NSAMP) generates a sample of size NSAMP from a +% D-dimensional Gaussian distribution. The Gaussian density has mean +% vector MU and covariance matrix COVAR, and the matrix X has NSAMP +% rows in which each row represents a D-dimensional sample vector. +% +% See also +% GAUSS, DEMGAUSS +% + +% Copyright (c) Christopher M Bishop, Ian T Nabney (1996, 1997) + +d = size(covar, 1); + +mu = reshape(mu, 1, d); % Ensure that mu is a row vector + +[evec, eval] = eig(covar); + +coeffs = randn(nsamp, d)*sqrt(eval); + +x = ones(nsamp, 1)*mu + coeffs*evec'; Index: adcp/trunk/adcp/diwasp_1_1GD/private/makerandomsea.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/private/makerandomsea.m (revision 168) @@ -1,0 +1,35 @@ +function eta=makerandomsea(eamp,wns,dirs,xx,yy) + +%makerandomsea: make random sea surface elevation +% +%[eta] = makerandomsea(eamp,wns,dirs,xx,yy) +% +%outputs: +%eta output surface elevation +% +%inputs: +%eamp matrix of the component amplitudes [i,j] with i'th frequency component and j'th directional component +%wns column vector of component wavenumbers in m-1. These must correspond to the frequency bins in input eamp +%dirs row vector of component directions in rads. These must correspond to the directional bins in input eamp +%xx row vector of x direction grid spacing +%yy column vector of y direction grid spacing +% +%amplitude matrix must be [m by n] where m is number of wavenumber +%components in wns and n is number of directional components in dirs +% + + +disp('calculating sea surface elevation'); + +nx=size(xx,2); +ny=size(yy,2); + +randphase=8*atan(1.0)*rand(size(eamp)); + +for i=1:nx + for j=1:ny + eta(i,j)=sum(sum(eamp.*cos(xx(i)*wns*cos(dirs)+yy(j)*wns*sin(dirs)+randphase))); + end +end + + Index: adcp/trunk/adcp/diwasp_1_1GD/private/makewavedata.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/private/makewavedata.m (revision 168) @@ -1,0 +1,53 @@ +function eta=makewavedata(eamp,ffreqs,wns,dirs,layout,datatypes,depth,fs,ndat) + +%makewavedata: make pseudo random sea elevation data for a specified layout of probes +% +%[eta] = makewavedata(eamp,ffreqs,wns,dirs,layout,datatypes,depth,fs,ndat) +% +%outputs: +%eta is output surface elevation +% +%inputs +%eamp matrix of the component amplitudes [i,j] with i'th frequency component and j'th directional component +%ffreqs column vector of component radian frequencies. These must correspond to the frequency bins in input eamp +%wns column vector of component wavenumbers in m-1. These must correspond to the frequency bins in input eamp +%dirs row vector of component directions in rads. These must correspond to the directional bins in input eamp +%layout matrix containing x,y,z coordinates of instrument location with format: +% [x1 x2 x3...] +% [y1 y2 y3...] +% [z1 z2 z3...]) +%datatypes data type matrix containing sensor types for DIWASP transfer functions: must have same number of columns as layout +%depth mean water depth +%fs sampling frequency +%ndat length of data +% +%amplitude matrix must be [m by n] where m is number of wavenumber +%components in wns and n is number of directional components in dirs +% + +%Copyright (C) 2002 Coastal Oceanography Group, CWR, UWA, Perth + + +disp('generating instrument data'); + +randphase=2*pi*rand(size(eamp)); +nprobes=size(layout,2); +dt=1/fs; +t=[0:dt:dt*ndat]; + +freqmat=ffreqs*ones(size(dirs)); + +%get transfer functions for instrument type -------- NOTE: added layout 1 +%and 2 to account for newly added xpos and ypos needed to use radial.m +for i=1:nprobes + trf(:,:,i)=feval(datatypes{i},ffreqs,dirs,wns,layout(3,i),depth,layout(1,i),layout(2,i)); +end + +%make random data +for i=1:ndat + for j=1:nprobes + eta(i,j)=sum(sum(eamp.*trf(:,:,j).*cos(layout(1,j)*wns*cos(dirs)+layout(2,j)*wns*sin(dirs)-freqmat*t(i)+randphase))); + end +end + + Index: adcp/trunk/adcp/diwasp_1_1GD/private/pres.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/private/pres.m (revision 168) @@ -1,0 +1,8 @@ +function trm=pres(ffreqs,dirs,wns,z,depth,xpos,ypos) + +Kz=cosh(z*wns)./cosh(depth*wns); +%include a maximum cuttoff for the pressure response function +Kz(find(Kz<0.1))=0.1; +Kz(find(isnan(Kz)))=1; +trm=Kz*ones(size(dirs)); + Index: adcp/trunk/adcp/diwasp_1_1GD/private/radial.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/private/radial.m (revision 168) @@ -1,0 +1,48 @@ +function trm=radial(ffreqs,dirs,wns,z,depth,xpos,ypos); + +%This transfer function takes the along beam radial velocities from an ADCP +%and transfers them to surface displacement for use in DIWASP. +%This was added to DIWASP on 6/22/07 +% Modified from Hoshimoto (1997) + + + +transH=.4; % transducer face height off the bottom +dist=(xpos^2+ypos^2)^.5; %horizontal distance from origin +a=atan(dist/(z-transH));%beam angle from the vertical + +% compute the axis angle +if xpos > 0 & ypos > 0 % 1st quadrant + B= acos(xpos/dist); +elseif xpos < 0 & ypos < 0 % 3 quadrant + B= pi + acos(abs(xpos/dist)); +elseif xpos < 0 & ypos > 0 % 2nd quadrant + B= pi/2 + asin(abs(xpos/dist)); +elseif xpos > 0 & ypos < 0 % 4th quadrant + B = 3*pi/2 + asin(abs(xpos/dist)); +end + +%note: Dirs and B are both measured from the x-axis with positive angles +%being counterclockwise + +A1=(ones(1,length(dirs))*cos(a));%a vector of length dirs of the cos(a) + +FL=ffreqs*ones(1,length(dirs));%Create a vector of length ffreqs/length dirs so that we can multiply +%through in the trm function + +KZ=cosh(wns*z)./sinh(wns*depth); +%include a maximum cuttoff for the velocity response function +KZ(find(KZ<0.1))=0.1; +KZ(find(isnan(KZ)))=1; + +KZi=sinh(wns*z)./sinh(wns*depth); +%include a maximum cuttoff for the velocity response function +KZi(find(KZi<0.1))=0.1; +KZi(find(isnan(KZi)))=1; + + +trm=FL.*(KZ*(sin(a)*cos(dirs-B))-(i*KZi)*A1); + + + + Index: adcp/trunk/adcp/diwasp_1_1GD/private/slpx.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/private/slpx.m (revision 168) @@ -1,0 +1,3 @@ +function trm=velx(ffreqs,dirs,wns,z,depth,xpos,ypos) + +trm=(i*wns)*cos(dirs); Index: adcp/trunk/adcp/diwasp_1_1GD/private/slpy.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/private/slpy.m (revision 168) @@ -1,0 +1,3 @@ +function trm=velx(ffreqs,dirs,wns,z,depth,xpos,ypos) + +trm=(i*wns)*sin(dirs); Index: adcp/trunk/adcp/diwasp_1_1GD/private/smoothspec.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/private/smoothspec.m (revision 168) @@ -1,0 +1,22 @@ +function S=smoothspec(Sin,kernel) +% smooths a directional spectrum using the +% first dimension is frequency +% kernel is 2*3 matrix with smoothing parameters + +f1=kernel(1,3); +f2=kernel(1,2); +f3=kernel(1,1); +d1=kernel(2,3); +d2=kernel(2,2); +d3=kernel(2,1); +tot=2*f1+2*f2+f3+2*d1+2*d2+d3; + +nf=size(Sin,1); +nd=size(Sin,2); + +S=Sin; + +S(3:nf-2,3:nd-2)=(f1*Sin(1:nf-4,3:nd-2)+f2*Sin(2:nf-3,3:nd-2)+f3*Sin(3:nf-2,3:nd-2)+f2*Sin(4:nf-1,3:nd-2)+f1*Sin(5:nf,3:nd-2)+... + d1*Sin(3:nf-2,1:nd-4)+d2*Sin(3:nf-2,2:nd-3)+d3*Sin(3:nf-2,3:nd-2)+d2*Sin(3:nf-2,4:nd-1)+d1*Sin(3:nf-2,5:nd))./tot; + + Index: adcp/trunk/adcp/diwasp_1_1GD/private/specmat.spec =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/private/specmat.spec (revision 168) @@ -1,0 +1,3175 @@ + 9.0000000e+001 + 5.1000000e+001 + 6.0000000e+001 + 8.0000000e-002 + 8.2400000e-002 + 8.4800000e-002 + 8.7200000e-002 + 8.9600000e-002 + 9.2000000e-002 + 9.4400000e-002 + 9.6800000e-002 + 9.9200000e-002 + 1.0160000e-001 + 1.0400000e-001 + 1.0640000e-001 + 1.0880000e-001 + 1.1120000e-001 + 1.1360000e-001 + 1.1600000e-001 + 1.1840000e-001 + 1.2080000e-001 + 1.2320000e-001 + 1.2560000e-001 + 1.2800000e-001 + 1.3040000e-001 + 1.3280000e-001 + 1.3520000e-001 + 1.3760000e-001 + 1.4000000e-001 + 1.4240000e-001 + 1.4480000e-001 + 1.4720000e-001 + 1.4960000e-001 + 1.5200000e-001 + 1.5440000e-001 + 1.5680000e-001 + 1.5920000e-001 + 1.6160000e-001 + 1.6400000e-001 + 1.6640000e-001 + 1.6880000e-001 + 1.7120000e-001 + 1.7360000e-001 + 1.7600000e-001 + 1.7840000e-001 + 1.8080000e-001 + 1.8320000e-001 + 1.8560000e-001 + 1.8800000e-001 + 1.9040000e-001 + 1.9280000e-001 + 1.9520000e-001 + 1.9760000e-001 + 2.0000000e-001 + -1.8000000e+002 + -1.7400000e+002 + -1.6800000e+002 + -1.6200000e+002 + -1.5600000e+002 + -1.5000000e+002 + -1.4400000e+002 + -1.3800000e+002 + -1.3200000e+002 + -1.2600000e+002 + -1.2000000e+002 + -1.1400000e+002 + -1.0800000e+002 + -1.0200000e+002 + -9.6000000e+001 + -9.0000000e+001 + -8.4000000e+001 + -7.8000000e+001 + -7.2000000e+001 + -6.6000000e+001 + -6.0000000e+001 + -5.4000000e+001 + -4.8000000e+001 + -4.2000000e+001 + -3.6000000e+001 + -3.0000000e+001 + -2.4000000e+001 + -1.8000000e+001 + -1.2000000e+001 + -6.0000000e+000 + 0.0000000e+000 + 6.0000000e+000 + 1.2000000e+001 + 1.8000000e+001 + 2.4000000e+001 + 3.0000000e+001 + 3.6000000e+001 + 4.2000000e+001 + 4.8000000e+001 + 5.4000000e+001 + 6.0000000e+001 + 6.6000000e+001 + 7.2000000e+001 + 7.8000000e+001 + 8.4000000e+001 + 9.0000000e+001 + 9.6000000e+001 + 1.0200000e+002 + 1.0800000e+002 + 1.1400000e+002 + 1.2000000e+002 + 1.2600000e+002 + 1.3200000e+002 + 1.3800000e+002 + 1.4400000e+002 + 1.5000000e+002 + 1.5600000e+002 + 1.6200000e+002 + 1.6800000e+002 + 1.7400000e+002 + 9.9900000e+002 + 8.0454486e-003 + 7.8277760e-003 + 7.2083728e-003 + 6.2798433e-003 + 5.1717574e-003 + 4.0218496e-003 + 2.9490136e-003 + 2.0350965e-003 + 1.3187228e-003 + 8.0014361e-004 + 4.5306749e-004 + 2.3843956e-004 + 1.1606550e-004 + 5.1951986e-005 + 2.1233394e-005 + 7.8568834e-006 + 2.6047627e-006 + 7.6381176e-007 + 1.9495033e-007 + 4.2435132e-008 + 7.6727377e-009 + 1.1129754e-009 + 1.2354246e-010 + 9.8204977e-012 + 5.0722137e-013 + 1.4637768e-014 + 1.8328565e-016 + 6.1972510e-019 + 1.9509295e-022 + 2.7896207e-028 + 3.4616238e-025 + 5.9916771e-022 + 4.9214254e-019 + 2.0487638e-016 + 4.5393845e-014 + 5.5880901e-012 + 3.9738990e-010 + 1.6838650e-008 + 4.3592652e-007 + 7.0395847e-006 + 7.2134404e-005 + 4.7558417e-004 + 2.0396709e-003 + 5.7377246e-003 + 1.0648703e-002 + 1.3085502e-002 + 1.0667332e-002 + 5.7889128e-003 + 2.1555415e-003 + 7.1398129e-004 + 5.2519422e-004 + 8.0718209e-004 + 1.3191586e-003 + 2.0351134e-003 + 2.9490140e-003 + 4.0218496e-003 + 5.1717574e-003 + 6.2798433e-003 + 7.2083728e-003 + 7.8277760e-003 + 1.0532057e-002 + 1.0247109e-002 + 9.4362665e-003 + 8.2207560e-003 + 6.7701938e-003 + 5.2648837e-003 + 3.8604660e-003 + 2.6640844e-003 + 1.7263008e-003 + 1.0474442e-003 + 5.9309717e-004 + 3.1213413e-004 + 1.5193790e-004 + 6.8008799e-005 + 2.7796005e-005 + 1.0285212e-005 + 3.4098174e-006 + 9.9988326e-007 + 2.5520368e-007 + 5.5550569e-008 + 1.0044153e-008 + 1.4569630e-009 + 1.6172577e-010 + 1.2855721e-011 + 6.6398841e-013 + 1.9161867e-014 + 2.3993380e-016 + 8.1126370e-019 + 2.5539038e-022 + 3.6518095e-028 + 4.5315087e-025 + 7.8435262e-022 + 6.4424916e-019 + 2.6819758e-016 + 5.9423732e-014 + 7.3152026e-012 + 5.2021130e-010 + 2.2042976e-008 + 5.7065844e-007 + 9.2153109e-006 + 9.4429003e-005 + 6.2257309e-004 + 2.6700726e-003 + 7.5110847e-003 + 1.3939901e-002 + 1.7129841e-002 + 1.3964287e-002 + 7.5780936e-003 + 2.8217553e-003 + 9.3465167e-004 + 6.8751613e-004 + 1.0566581e-003 + 1.7268713e-003 + 2.6641064e-003 + 3.8604665e-003 + 5.2648837e-003 + 6.7701938e-003 + 8.2207560e-003 + 9.4362665e-003 + 1.0247109e-002 + 1.3446071e-002 + 1.3082283e-002 + 1.2047096e-002 + 1.0495278e-002 + 8.6433735e-003 + 6.7215736e-003 + 4.9285811e-003 + 3.4011842e-003 + 2.2039343e-003 + 1.3372515e-003 + 7.5719551e-004 + 3.9849552e-004 + 1.9397613e-004 + 8.6825499e-005 + 3.5486614e-005 + 1.3130929e-005 + 4.3532469e-006 + 1.2765313e-006 + 3.2581352e-007 + 7.0920321e-008 + 1.2823173e-008 + 1.8600760e-009 + 2.0647211e-010 + 1.6412647e-011 + 8.4770097e-013 + 2.4463580e-014 + 3.0631877e-016 + 1.0357244e-018 + 3.2605188e-022 + 4.6621935e-028 + 5.7852882e-025 + 1.0013676e-021 + 8.2250025e-019 + 3.4240259e-016 + 7.5865113e-014 + 9.3391755e-012 + 6.6414356e-010 + 2.8141835e-008 + 7.2854843e-007 + 1.1765007e-005 + 1.2055565e-004 + 7.9482684e-004 + 3.4088292e-003 + 9.5892544e-003 + 1.7796798e-002 + 2.1869332e-002 + 1.7827931e-002 + 9.6748033e-003 + 3.6024795e-003 + 1.1932514e-003 + 8.7773835e-004 + 1.3490146e-003 + 2.2046627e-003 + 3.4012123e-003 + 4.9285818e-003 + 6.7215736e-003 + 8.6433735e-003 + 1.0495278e-002 + 1.2047096e-002 + 1.3082283e-002 + 1.7029248e-002 + 1.6568515e-002 + 1.5257467e-002 + 1.3292112e-002 + 1.0946703e-002 + 8.5127725e-003 + 6.2419743e-003 + 4.3075489e-003 + 2.7912499e-003 + 1.6936090e-003 + 9.5897679e-004 + 5.0468862e-004 + 2.4566787e-004 + 1.0996320e-004 + 4.4943266e-005 + 1.6630125e-005 + 5.5133221e-006 + 1.6167078e-006 + 4.1263795e-007 + 8.9819525e-008 + 1.6240356e-008 + 2.3557585e-009 + 2.6149384e-010 + 2.0786372e-011 + 1.0736006e-012 + 3.0982758e-014 + 3.8794814e-016 + 1.3117295e-018 + 4.1293983e-022 + 5.9045984e-028 + 7.3269810e-025 + 1.2682171e-021 + 1.0416843e-018 + 4.3364776e-016 + 9.6082030e-014 + 1.1827926e-011 + 8.4112788e-010 + 3.5641213e-008 + 9.2269569e-007 + 1.4900205e-005 + 1.5268193e-004 + 1.0066363e-003 + 4.3172312e-003 + 1.2144647e-002 + 2.2539378e-002 + 2.7697182e-002 + 2.2578808e-002 + 1.2252994e-002 + 4.5624865e-003 + 1.5112351e-003 + 1.1116425e-003 + 1.7085068e-003 + 2.7921723e-003 + 4.3075845e-003 + 6.2419751e-003 + 8.5127725e-003 + 1.0946703e-002 + 1.3292112e-002 + 1.5257467e-002 + 1.6568515e-002 + 2.1663166e-002 + 2.1077062e-002 + 1.9409257e-002 + 1.6909099e-002 + 1.3925469e-002 + 1.0829228e-002 + 7.9405109e-003 + 5.4796988e-003 + 3.5507916e-003 + 2.1544659e-003 + 1.2199290e-003 + 6.4202211e-004 + 3.1251785e-004 + 1.3988586e-004 + 5.7173016e-005 + 2.1155436e-005 + 7.0135814e-006 + 2.0566387e-006 + 5.2492305e-007 + 1.1426079e-007 + 2.0659605e-008 + 2.9967964e-009 + 3.3265031e-010 + 2.6442662e-011 + 1.3657437e-012 + 3.9413640e-014 + 4.9351476e-016 + 1.6686712e-018 + 5.2530707e-022 + 7.5113299e-028 + 9.3207645e-025 + 1.6133183e-021 + 1.3251425e-018 + 5.5164994e-016 + 1.2222742e-013 + 1.5046486e-011 + 1.0700116e-009 + 4.5339732e-008 + 1.1737753e-006 + 1.8954778e-005 + 1.9422902e-004 + 1.2805574e-003 + 5.4920159e-003 + 1.5449391e-002 + 2.8672687e-002 + 3.5234008e-002 + 2.8722847e-002 + 1.5587221e-002 + 5.8040088e-003 + 1.9224653e-003 + 1.4141374e-003 + 2.1734177e-003 + 3.5519651e-003 + 5.4797442e-003 + 7.9405120e-003 + 1.0829228e-002 + 1.3925469e-002 + 1.6909099e-002 + 1.9409257e-002 + 2.1077062e-002 + 2.7709474e-002 + 2.6959784e-002 + 2.4826486e-002 + 2.1628521e-002 + 1.7812143e-002 + 1.3851724e-002 + 1.0156751e-002 + 7.0091126e-003 + 4.5418369e-003 + 2.7557890e-003 + 1.5604179e-003 + 8.2121397e-004 + 3.9974328e-004 + 1.7892877e-004 + 7.3130315e-005 + 2.7060033e-005 + 8.9711101e-006 + 2.6306578e-006 + 6.7143193e-007 + 1.4615160e-007 + 2.6425814e-008 + 3.8332185e-009 + 4.2549482e-010 + 3.3822953e-011 + 1.7469302e-012 + 5.0414202e-014 + 6.3125741e-016 + 2.1344064e-018 + 6.7192313e-022 + 9.6077829e-028 + 1.1922241e-024 + 2.0636043e-021 + 1.6949970e-018 + 7.0561844e-016 + 1.5634176e-013 + 1.9246042e-011 + 1.3686577e-009 + 5.7994298e-008 + 1.5013824e-006 + 2.4245160e-005 + 2.4843940e-004 + 1.6379680e-003 + 7.0248674e-003 + 1.9761401e-002 + 3.6675390e-002 + 4.5068012e-002 + 3.6739550e-002 + 1.9937699e-002 + 7.4239392e-003 + 2.4590358e-003 + 1.8088308e-003 + 2.7800303e-003 + 4.5433378e-003 + 7.0091705e-003 + 1.0156752e-002 + 1.3851724e-002 + 1.7812143e-002 + 2.1628521e-002 + 2.4826486e-002 + 2.6959784e-002 + 3.5088948e-002 + 3.4139604e-002 + 3.1438175e-002 + 2.7388541e-002 + 2.2555800e-002 + 1.7540659e-002 + 1.2861655e-002 + 8.8757509e-003 + 5.7514004e-003 + 3.4896995e-003 + 1.9759820e-003 + 1.0399163e-003 + 5.0620128e-004 + 2.2658035e-004 + 9.2606083e-005 + 3.4266551e-005 + 1.1360260e-005 + 3.3312439e-006 + 8.5024494e-007 + 1.8507410e-007 + 3.3463429e-008 + 4.8540657e-009 + 5.3881087e-010 + 4.2830544e-011 + 2.2121656e-012 + 6.3840306e-014 + 7.9937131e-016 + 2.7028328e-018 + 8.5086697e-022 + 1.2166488e-027 + 1.5097323e-024 + 2.6131749e-021 + 2.1464016e-018 + 8.9353587e-016 + 1.9797806e-013 + 2.4371569e-011 + 1.7331531e-009 + 7.3439103e-008 + 1.9012244e-006 + 3.0702032e-005 + 3.1460277e-004 + 2.0741849e-003 + 8.8957014e-003 + 2.5024176e-002 + 4.6442631e-002 + 5.7070341e-002 + 4.6523877e-002 + 2.5247425e-002 + 9.4010525e-003 + 3.1139162e-003 + 2.2905513e-003 + 3.5203967e-003 + 5.7533011e-003 + 8.8758243e-003 + 1.2861657e-002 + 1.7540659e-002 + 2.2555800e-002 + 2.7388541e-002 + 3.1438175e-002 + 3.4139604e-002 + 4.2691992e-002 + 4.1536945e-002 + 3.8250173e-002 + 3.3323067e-002 + 2.7443172e-002 + 2.1341355e-002 + 1.5648508e-002 + 1.0798941e-002 + 6.9976090e-003 + 4.2458447e-003 + 2.4041361e-003 + 1.2652445e-003 + 6.1588455e-004 + 2.7567559e-004 + 1.1267189e-004 + 4.1691399e-005 + 1.3821791e-005 + 4.0530550e-006 + 1.0344753e-006 + 2.2517580e-007 + 4.0714256e-008 + 5.9058406e-009 + 6.5555996e-010 + 5.2111030e-011 + 2.6914958e-012 + 7.7673170e-014 + 9.7257841e-016 + 3.2884803e-018 + 1.0352321e-021 + 1.4802713e-027 + 1.8368598e-024 + 3.1793955e-021 + 2.6114822e-018 + 1.0871465e-015 + 2.4087578e-013 + 2.9652380e-011 + 2.1086912e-009 + 8.9351827e-008 + 2.3131801e-006 + 3.7354523e-005 + 3.8277063e-004 + 2.5236176e-003 + 1.0823215e-002 + 3.0446394e-002 + 5.6505781e-002 + 6.9436294e-002 + 5.6604631e-002 + 3.0718016e-002 + 1.1438065e-002 + 3.7886370e-003 + 2.7868660e-003 + 4.2831933e-003 + 6.9999215e-003 + 1.0799030e-002 + 1.5648510e-002 + 2.1341355e-002 + 2.7443172e-002 + 3.3323067e-002 + 3.8250173e-002 + 4.1536945e-002 + 4.8310660e-002 + 4.7003597e-002 + 4.3284255e-002 + 3.7708696e-002 + 3.1054951e-002 + 2.4150078e-002 + 1.7707999e-002 + 1.2220183e-002 + 7.9185602e-003 + 4.8046378e-003 + 2.7205431e-003 + 1.4317626e-003 + 6.9694075e-004 + 3.1195709e-004 + 1.2750057e-004 + 4.7178379e-005 + 1.5640869e-005 + 4.5864752e-006 + 1.1706220e-006 + 2.5481105e-007 + 4.6072636e-008 + 6.6831047e-009 + 7.4183782e-010 + 5.8969332e-011 + 3.0457219e-012 + 8.7895690e-014 + 1.1005789e-015 + 3.7212753e-018 + 1.1714784e-021 + 1.6750889e-027 + 2.0786079e-024 + 3.5978339e-021 + 2.9551778e-018 + 1.2302252e-015 + 2.7257729e-013 + 3.3554912e-011 + 2.3862148e-009 + 1.0111137e-007 + 2.6176164e-006 + 4.2270730e-005 + 4.3314685e-004 + 2.8557494e-003 + 1.2247651e-002 + 3.4453426e-002 + 6.3942474e-002 + 7.8574764e-002 + 6.4054333e-002 + 3.4760796e-002 + 1.2943422e-002 + 4.2872572e-003 + 3.1536438e-003 + 4.8469018e-003 + 7.9211770e-003 + 1.2220284e-002 + 1.7708001e-002 + 2.4150078e-002 + 3.1054951e-002 + 3.7708696e-002 + 4.3284255e-002 + 4.7003597e-002 + 5.0264187e-002 + 4.8904271e-002 + 4.5034531e-002 + 3.9233514e-002 + 3.2310713e-002 + 2.5126629e-002 + 1.8424053e-002 + 1.2714328e-002 + 8.2387612e-003 + 4.9989218e-003 + 2.8305531e-003 + 1.4896585e-003 + 7.2512279e-004 + 3.2457163e-004 + 1.3265628e-004 + 4.9086120e-005 + 1.6273335e-005 + 4.7719374e-006 + 1.2179582e-006 + 2.6511479e-007 + 4.7935664e-008 + 6.9533480e-009 + 7.7183535e-010 + 6.1353862e-011 + 3.1688811e-012 + 9.1449909e-014 + 1.1450827e-015 + 3.8717517e-018 + 1.2188492e-021 + 1.7428241e-027 + 2.1626601e-024 + 3.7433187e-021 + 3.0746756e-018 + 1.2799715e-015 + 2.8359944e-013 + 3.4911765e-011 + 2.4827056e-009 + 1.0519999e-007 + 2.7234643e-006 + 4.3980022e-005 + 4.5066191e-004 + 2.9712267e-003 + 1.2742907e-002 + 3.5846611e-002 + 6.6528101e-002 + 8.1752074e-002 + 6.6644484e-002 + 3.6166411e-002 + 1.3466812e-002 + 4.4606201e-003 + 3.2811670e-003 + 5.0428949e-003 + 8.2414839e-003 + 1.2714433e-002 + 1.8424056e-002 + 2.5126629e-002 + 3.2310713e-002 + 3.9233514e-002 + 4.5034531e-002 + 4.8904271e-002 + 4.9280396e-002 + 4.7947097e-002 + 4.4153097e-002 + 3.8465620e-002 + 3.1678315e-002 + 2.4634840e-002 + 1.8063450e-002 + 1.2465478e-002 + 8.0775088e-003 + 4.9010809e-003 + 2.7751523e-003 + 1.4605023e-003 + 7.1093039e-004 + 3.1821898e-004 + 1.3005988e-004 + 4.8125387e-005 + 1.5954827e-005 + 4.6785391e-006 + 1.1941198e-006 + 2.5992586e-007 + 4.6997448e-008 + 6.8172542e-009 + 7.5672867e-010 + 6.0153019e-011 + 3.1068585e-012 + 8.9660014e-014 + 1.1226707e-015 + 3.7959721e-018 + 1.1949934e-021 + 1.7087129e-027 + 2.1203316e-024 + 3.6700529e-021 + 3.0144968e-018 + 1.2549194e-015 + 2.7804872e-013 + 3.4228458e-011 + 2.4341131e-009 + 1.0314097e-007 + 2.6701596e-006 + 4.3119227e-005 + 4.4184137e-004 + 2.9130727e-003 + 1.2493498e-002 + 3.5145007e-002 + 6.5225986e-002 + 8.0151989e-002 + 6.5340091e-002 + 3.5458547e-002 + 1.3203234e-002 + 4.3733150e-003 + 3.2169467e-003 + 4.9441933e-003 + 8.0801782e-003 + 1.2465581e-002 + 1.8063452e-002 + 2.4634840e-002 + 3.1678315e-002 + 3.8465620e-002 + 4.4153097e-002 + 4.7947097e-002 + 4.6182842e-002 + 4.4933348e-002 + 4.1377822e-002 + 3.6047836e-002 + 2.9687152e-002 + 2.3086400e-002 + 1.6928059e-002 + 1.1681952e-002 + 7.5697912e-003 + 4.5930200e-003 + 2.6007181e-003 + 1.3687014e-003 + 6.6624436e-004 + 2.9821710e-004 + 1.2188487e-004 + 4.5100431e-005 + 1.4951975e-005 + 4.3844662e-006 + 1.1190625e-006 + 2.4358803e-007 + 4.4043390e-008 + 6.3887508e-009 + 7.0916395e-010 + 5.6372058e-011 + 2.9115747e-012 + 8.4024370e-014 + 1.0521044e-015 + 3.5573736e-018 + 1.1198812e-021 + 1.6013105e-027 + 1.9870567e-024 + 3.4393691e-021 + 2.8250185e-018 + 1.1760405e-015 + 2.6057177e-013 + 3.2077003e-011 + 2.2811152e-009 + 9.6657969e-008 + 2.5023248e-006 + 4.0408937e-005 + 4.1406912e-004 + 2.7299694e-003 + 1.1708210e-002 + 3.2935942e-002 + 6.1126160e-002 + 7.5113979e-002 + 6.1233093e-002 + 3.3229775e-002 + 1.2373335e-002 + 4.0984272e-003 + 3.0147432e-003 + 4.6334225e-003 + 7.5722928e-003 + 1.1682048e-002 + 1.6928061e-002 + 2.3086400e-002 + 2.9687152e-002 + 3.6047836e-002 + 4.1377822e-002 + 4.4933348e-002 + 4.2115055e-002 + 4.0975617e-002 + 3.7733262e-002 + 3.2872741e-002 + 2.7072306e-002 + 2.1052949e-002 + 1.5437035e-002 + 1.0653005e-002 + 6.9030437e-003 + 4.1884666e-003 + 2.3716468e-003 + 1.2481461e-003 + 6.0756153e-004 + 2.7195012e-004 + 1.1114925e-004 + 4.1127983e-005 + 1.3635004e-005 + 3.9982823e-006 + 1.0204955e-006 + 2.2213279e-007 + 4.0164046e-008 + 5.8260294e-009 + 6.4670076e-010 + 5.1406805e-011 + 2.6551231e-012 + 7.6623500e-014 + 9.5943505e-016 + 3.2440400e-018 + 1.0212420e-021 + 1.4602670e-027 + 1.8120366e-024 + 3.1364293e-021 + 2.5761907e-018 + 1.0724548e-015 + 2.3762060e-013 + 2.9251660e-011 + 2.0801945e-009 + 8.8144332e-008 + 2.2819199e-006 + 3.6849716e-005 + 3.7759789e-004 + 2.4895136e-003 + 1.0676950e-002 + 3.0034943e-002 + 5.5742166e-002 + 6.8497936e-002 + 5.5839680e-002 + 3.0302895e-002 + 1.1283491e-002 + 3.7374375e-003 + 2.7492045e-003 + 4.2253105e-003 + 6.9053250e-003 + 1.0653093e-002 + 1.5437037e-002 + 2.1052949e-002 + 2.7072306e-002 + 3.2872741e-002 + 3.7733262e-002 + 4.0975617e-002 + 3.8065161e-002 + 3.7035294e-002 + 3.4104733e-002 + 2.9711612e-002 + 2.4468962e-002 + 1.9028442e-002 + 1.3952569e-002 + 9.6285840e-003 + 6.2392289e-003 + 3.7856927e-003 + 2.1435830e-003 + 1.1281211e-003 + 5.4913682e-004 + 2.4579869e-004 + 1.0046085e-004 + 3.7173009e-005 + 1.2323826e-005 + 3.6137970e-006 + 9.2236195e-007 + 2.0077192e-007 + 3.6301766e-008 + 5.2657831e-009 + 5.8451232e-010 + 4.6463392e-011 + 2.3997995e-012 + 6.9255183e-014 + 8.6717326e-016 + 2.9320846e-018 + 9.2303673e-022 + 1.3198439e-027 + 1.6377864e-024 + 2.8348221e-021 + 2.3284575e-018 + 9.6932477e-016 + 2.1477038e-013 + 2.6438743e-011 + 1.8801575e-009 + 7.9668142e-008 + 2.0624845e-006 + 3.3306151e-005 + 3.4128709e-004 + 2.2501154e-003 + 9.6502267e-003 + 2.7146704e-002 + 5.0381853e-002 + 6.1910995e-002 + 5.0469990e-002 + 2.7388889e-002 + 1.0198441e-002 + 3.3780357e-003 + 2.4848338e-003 + 3.8189935e-003 + 6.2412908e-003 + 9.6286637e-003 + 1.3952571e-002 + 1.9028442e-002 + 2.4468962e-002 + 2.9711612e-002 + 3.4104733e-002 + 3.7035294e-002 + 3.4602047e-002 + 3.3665876e-002 + 3.1001933e-002 + 2.7008492e-002 + 2.2242811e-002 + 1.7297262e-002 + 1.2683184e-002 + 8.7525892e-003 + 5.6715928e-003 + 3.4412757e-003 + 1.9485629e-003 + 1.0254862e-003 + 4.9917713e-004 + 2.2343627e-004 + 9.1321062e-005 + 3.3791061e-005 + 1.1202622e-005 + 3.2850189e-006 + 8.3844677e-007 + 1.8250597e-007 + 3.2999083e-008 + 4.7867097e-009 + 5.3133422e-010 + 4.2236218e-011 + 2.1814691e-012 + 6.2954445e-014 + 7.8827907e-016 + 2.6653277e-018 + 8.3906016e-022 + 1.1997664e-027 + 1.4887830e-024 + 2.5769140e-021 + 2.1166177e-018 + 8.8113698e-016 + 1.9523087e-013 + 2.4033384e-011 + 1.7091035e-009 + 7.2420048e-008 + 1.8748426e-006 + 3.0276005e-005 + 3.1023728e-004 + 2.0454031e-003 + 8.7722629e-003 + 2.4676936e-002 + 4.5798184e-002 + 5.6278421e-002 + 4.5878302e-002 + 2.4897087e-002 + 9.2706015e-003 + 3.0707069e-003 + 2.2587672e-003 + 3.4715469e-003 + 5.6734671e-003 + 8.7526615e-003 + 1.2683186e-002 + 1.7297262e-002 + 2.2242811e-002 + 2.7008492e-002 + 3.1001933e-002 + 3.3665876e-002 + 3.1907637e-002 + 3.1044364e-002 + 2.8587858e-002 + 2.4905380e-002 + 2.0510796e-002 + 1.5950349e-002 + 1.1695563e-002 + 8.0710380e-003 + 5.2299542e-003 + 3.1733087e-003 + 1.7968312e-003 + 9.4563314e-004 + 4.6030695e-004 + 2.0603762e-004 + 8.4210026e-005 + 3.1159801e-005 + 1.0330291e-005 + 3.0292193e-006 + 7.7315816e-007 + 1.6829450e-007 + 3.0429494e-008 + 4.4139757e-009 + 4.8996001e-010 + 3.8947346e-011 + 2.0116014e-012 + 5.8052276e-014 + 7.2689694e-016 + 2.4577826e-018 + 7.7372379e-022 + 1.1063423e-027 + 1.3728536e-024 + 2.3762535e-021 + 1.9517998e-018 + 8.1252415e-016 + 1.8002853e-013 + 2.2161940e-011 + 1.5760181e-009 + 6.6780805e-008 + 1.7288514e-006 + 2.7918457e-005 + 2.8607956e-004 + 1.8861306e-003 + 8.0891797e-003 + 2.2755379e-002 + 4.2231947e-002 + 5.1896104e-002 + 4.2305826e-002 + 2.2958388e-002 + 8.5487135e-003 + 2.8315955e-003 + 2.0828803e-003 + 3.2012227e-003 + 5.2316826e-003 + 8.0711047e-003 + 1.1695565e-002 + 1.5950349e-002 + 2.0510796e-002 + 2.4905380e-002 + 2.8587858e-002 + 3.1044364e-002 + 2.9925601e-002 + 2.9115952e-002 + 2.6812040e-002 + 2.3358310e-002 + 1.9236708e-002 + 1.4959547e-002 + 1.0969059e-002 + 7.5696819e-003 + 4.9050803e-003 + 2.9761893e-003 + 1.6852157e-003 + 8.8689237e-004 + 4.3171364e-004 + 1.9323899e-004 + 7.8979074e-005 + 2.9224219e-005 + 9.6885945e-006 + 2.8410505e-006 + 7.2513118e-007 + 1.5784040e-007 + 2.8539277e-008 + 4.1397887e-009 + 4.5952471e-010 + 3.6528018e-011 + 1.8866449e-012 + 5.4446189e-014 + 6.8174362e-016 + 2.3051102e-018 + 7.2566167e-022 + 1.0376187e-027 + 1.2875748e-024 + 2.2286456e-021 + 1.8305581e-018 + 7.6205184e-016 + 1.6884554e-013 + 2.0785286e-011 + 1.4781191e-009 + 6.2632521e-008 + 1.6214587e-006 + 2.6184220e-005 + 2.6830889e-004 + 1.7689681e-003 + 7.5866967e-003 + 2.1341862e-002 + 3.9608586e-002 + 4.8672426e-002 + 3.9677876e-002 + 2.1532260e-002 + 8.0176852e-003 + 2.6557026e-003 + 1.9534961e-003 + 3.0023694e-003 + 4.9067013e-003 + 7.5697445e-003 + 1.0969061e-002 + 1.4959547e-002 + 1.9236708e-002 + 2.3358310e-002 + 2.6812040e-002 + 2.9115952e-002 + 2.8497087e-002 + 2.7726088e-002 + 2.5532154e-002 + 2.2243289e-002 + 1.8318434e-002 + 1.4245445e-002 + 1.0445446e-002 + 7.2083393e-003 + 4.6709339e-003 + 2.8341194e-003 + 1.6047711e-003 + 8.4455612e-004 + 4.1110557e-004 + 1.8401463e-004 + 7.5208968e-005 + 2.7829187e-005 + 9.2261046e-006 + 2.7054315e-006 + 6.9051668e-007 + 1.5030581e-007 + 2.7176940e-008 + 3.9421738e-009 + 4.3758907e-010 + 3.4784335e-011 + 1.7965849e-012 + 5.1847173e-014 + 6.4920024e-016 + 2.1950747e-018 + 6.9102185e-022 + 9.8808741e-028 + 1.2261118e-024 + 2.1222601e-021 + 1.7431755e-018 + 7.2567491e-016 + 1.6078561e-013 + 1.9793090e-011 + 1.4075604e-009 + 5.9642726e-008 + 1.5440576e-006 + 2.4934304e-005 + 2.5550103e-004 + 1.6845255e-003 + 7.2245419e-003 + 2.0323098e-002 + 3.7717850e-002 + 4.6349023e-002 + 3.7783833e-002 + 2.0504407e-002 + 7.6349570e-003 + 2.5289313e-003 + 1.8602450e-003 + 2.8590498e-003 + 4.6724775e-003 + 7.2083989e-003 + 1.0445447e-002 + 1.4245445e-002 + 1.8318434e-002 + 2.2243289e-002 + 2.5532154e-002 + 2.7726088e-002 + 2.7446264e-002 + 2.6703695e-002 + 2.4590661e-002 + 2.1423073e-002 + 1.7642946e-002 + 1.3720148e-002 + 1.0060272e-002 + 6.9425335e-003 + 4.4986943e-003 + 2.7296120e-003 + 1.5455956e-003 + 8.1341331e-004 + 3.9594615e-004 + 1.7722914e-004 + 7.2435655e-005 + 2.6802992e-005 + 8.8858941e-006 + 2.6056694e-006 + 6.6505404e-007 + 1.4476332e-007 + 2.6174797e-008 + 3.7968070e-009 + 4.2145308e-010 + 3.3501671e-011 + 1.7303363e-012 + 4.9935320e-014 + 6.2526114e-016 + 2.1141318e-018 + 6.6554058e-022 + 9.5165192e-028 + 1.1808992e-024 + 2.0440022e-021 + 1.6788963e-018 + 6.9891582e-016 + 1.5485668e-013 + 1.9063225e-011 + 1.3556569e-009 + 5.7443414e-008 + 1.4871208e-006 + 2.4014857e-005 + 2.4607949e-004 + 1.6224090e-003 + 6.9581386e-003 + 1.9573688e-002 + 3.6327013e-002 + 4.4639914e-002 + 3.6390563e-002 + 1.9748312e-002 + 7.3534197e-003 + 2.4356776e-003 + 1.7916489e-003 + 2.7536230e-003 + 4.5001810e-003 + 6.9425909e-003 + 1.0060274e-002 + 1.3720148e-002 + 1.7642946e-002 + 2.1423073e-002 + 2.4590661e-002 + 2.6703695e-002 + 2.6623183e-002 + 2.5902883e-002 + 2.3853217e-002 + 2.0780621e-002 + 1.7113855e-002 + 1.3308697e-002 + 9.7585767e-003 + 6.7343351e-003 + 4.3637838e-003 + 2.6477541e-003 + 1.4992450e-003 + 7.8902001e-004 + 3.8407219e-004 + 1.7191424e-004 + 7.0263396e-005 + 2.5999202e-005 + 8.6194167e-006 + 2.5275284e-006 + 6.4510986e-007 + 1.4042204e-007 + 2.5389845e-008 + 3.6829453e-009 + 4.0881420e-010 + 3.2496995e-011 + 1.6784455e-012 + 4.8437819e-014 + 6.0651029e-016 + 2.0507315e-018 + 6.4558181e-022 + 9.2311300e-028 + 1.1454854e-024 + 1.9827050e-021 + 1.6285482e-018 + 6.7795616e-016 + 1.5021271e-013 + 1.8491541e-011 + 1.3150024e-009 + 5.5720754e-008 + 1.4425238e-006 + 2.3294680e-005 + 2.3869986e-004 + 1.5737549e-003 + 6.7494723e-003 + 1.8986697e-002 + 3.5237609e-002 + 4.3301215e-002 + 3.5299253e-002 + 1.9156083e-002 + 7.1328994e-003 + 2.3626345e-003 + 1.7379195e-003 + 2.6710451e-003 + 4.3652259e-003 + 6.7343908e-003 + 9.7585781e-003 + 1.3308697e-002 + 1.7113855e-002 + 2.0780621e-002 + 2.3853217e-002 + 2.5902883e-002 + 2.5918977e-002 + 2.5217729e-002 + 2.3222279e-002 + 2.0230955e-002 + 1.6661179e-002 + 1.2956670e-002 + 9.5004540e-003 + 6.5562062e-003 + 4.2483579e-003 + 2.5777188e-003 + 1.4595887e-003 + 7.6814975e-004 + 3.7391315e-004 + 1.6736696e-004 + 6.8404869e-005 + 2.5311501e-005 + 8.3914257e-006 + 2.4606731e-006 + 6.2804615e-007 + 1.3670775e-007 + 2.4718262e-008 + 3.5855282e-009 + 3.9800071e-010 + 3.1637422e-011 + 1.6340492e-012 + 4.7156597e-014 + 5.9046758e-016 + 1.9964879e-018 + 6.2850562e-022 + 8.9869587e-028 + 1.1151864e-024 + 1.9302608e-021 + 1.5854717e-018 + 6.6002364e-016 + 1.4623945e-013 + 1.8002424e-011 + 1.2802194e-009 + 5.4246893e-008 + 1.4043678e-006 + 2.2678516e-005 + 2.3238604e-004 + 1.5321277e-003 + 6.5709429e-003 + 1.8484482e-002 + 3.4305544e-002 + 4.2155861e-002 + 3.4365558e-002 + 1.8649389e-002 + 6.9442280e-003 + 2.3001408e-003 + 1.6919500e-003 + 2.6003937e-003 + 4.2497619e-003 + 6.5562604e-003 + 9.5004553e-003 + 1.2956670e-002 + 1.6661179e-002 + 2.0230955e-002 + 2.3222279e-002 + 2.5217729e-002 + 2.5264951e-002 + 2.4581399e-002 + 2.2636300e-002 + 1.9720458e-002 + 1.6240760e-002 + 1.2629729e-002 + 9.2607247e-003 + 6.3907704e-003 + 4.1411572e-003 + 2.5126740e-003 + 1.4227582e-003 + 7.4876668e-004 + 3.6447803e-004 + 1.6314372e-004 + 6.6678777e-005 + 2.4672804e-005 + 8.1796810e-006 + 2.3985818e-006 + 6.1219837e-007 + 1.3325814e-007 + 2.4094535e-008 + 3.4950530e-009 + 3.8795778e-010 + 3.0839100e-011 + 1.5928165e-012 + 4.5966673e-014 + 5.7556804e-016 + 1.9461096e-018 + 6.1264624e-022 + 8.7601867e-028 + 1.0870464e-024 + 1.8815536e-021 + 1.5454648e-018 + 6.4336896e-016 + 1.4254933e-013 + 1.7548161e-011 + 1.2479151e-009 + 5.2878056e-008 + 1.3689308e-006 + 2.2106258e-005 + 2.2652214e-004 + 1.4934669e-003 + 6.4051353e-003 + 1.8018055e-002 + 3.3439897e-002 + 4.1092123e-002 + 3.3498396e-002 + 1.8178800e-002 + 6.7690011e-003 + 2.2421003e-003 + 1.6492562e-003 + 2.5347768e-003 + 4.1425257e-003 + 6.3908233e-003 + 9.2607259e-003 + 1.2629729e-002 + 1.6240760e-002 + 1.9720458e-002 + 2.2636300e-002 + 2.4581399e-002 + 2.4623878e-002 + 2.3957670e-002 + 2.2061927e-002 + 1.9220071e-002 + 1.5828667e-002 + 1.2309262e-002 + 9.0257431e-003 + 6.2286110e-003 + 4.0360795e-003 + 2.4489174e-003 + 1.3866571e-003 + 7.2976747e-004 + 3.5522976e-004 + 1.5900411e-004 + 6.4986870e-005 + 2.4046756e-005 + 7.9721298e-006 + 2.3377202e-006 + 5.9666445e-007 + 1.2987685e-007 + 2.3483160e-008 + 3.4063695e-009 + 3.7811374e-010 + 3.0056589e-011 + 1.5524004e-012 + 4.4800315e-014 + 5.6096357e-016 + 1.8967290e-018 + 5.9710096e-022 + 8.5379057e-028 + 1.0594636e-024 + 1.8338111e-021 + 1.5062501e-018 + 6.2704411e-016 + 1.3893228e-013 + 1.7102894e-011 + 1.2162505e-009 + 5.1536328e-008 + 1.3341955e-006 + 2.1545334e-005 + 2.2077436e-004 + 1.4555716e-003 + 6.2426114e-003 + 1.7560865e-002 + 3.2591393e-002 + 4.0049451e-002 + 3.2648408e-002 + 1.7717531e-002 + 6.5972445e-003 + 2.1852092e-003 + 1.6074080e-003 + 2.4704593e-003 + 4.0374133e-003 + 6.2286625e-003 + 9.0257443e-003 + 1.2309262e-002 + 1.5828667e-002 + 1.9220071e-002 + 2.2061927e-002 + 2.3957670e-002 + 2.3979412e-002 + 2.3330640e-002 + 2.1484513e-002 + 1.8717036e-002 + 1.5414392e-002 + 1.1987099e-002 + 8.7895176e-003 + 6.0655933e-003 + 3.9304455e-003 + 2.3848233e-003 + 1.3503650e-003 + 7.1066770e-004 + 3.4593255e-004 + 1.5484259e-004 + 6.3286007e-005 + 2.3417395e-005 + 7.7634799e-006 + 2.2765364e-006 + 5.8104830e-007 + 1.2647766e-007 + 2.2868549e-008 + 3.3172166e-009 + 3.6821759e-010 + 2.9269936e-011 + 1.5117703e-012 + 4.3627783e-014 + 5.4628181e-016 + 1.8470870e-018 + 5.8147339e-022 + 8.3144481e-028 + 1.0317349e-024 + 1.7858158e-021 + 1.4668279e-018 + 6.1063286e-016 + 1.3529609e-013 + 1.6655270e-011 + 1.1844183e-009 + 5.0187498e-008 + 1.2992764e-006 + 2.0981441e-005 + 2.1499617e-004 + 1.4174758e-003 + 6.0792272e-003 + 1.7101254e-002 + 3.1738397e-002 + 3.9001261e-002 + 3.1793920e-002 + 1.7253821e-002 + 6.4245787e-003 + 2.1280170e-003 + 1.5653383e-003 + 2.4058015e-003 + 3.9317444e-003 + 6.0656434e-003 + 8.7895188e-003 + 1.1987099e-002 + 1.5414392e-002 + 1.8717036e-002 + 2.1484513e-002 + 2.3330640e-002 + 2.3327110e-002 + 2.2695987e-002 + 2.0900079e-002 + 1.8207884e-002 + 1.4995081e-002 + 1.1661019e-002 + 8.5504201e-003 + 5.9005935e-003 + 3.8235273e-003 + 2.3199500e-003 + 1.3136316e-003 + 6.9133571e-004 + 3.3652229e-004 + 1.5063047e-004 + 6.1564464e-005 + 2.2780381e-005 + 7.5522933e-006 + 2.2146088e-006 + 5.6524229e-007 + 1.2303714e-007 + 2.2246466e-008 + 3.2269797e-009 + 3.5820112e-010 + 2.8473718e-011 + 1.4706463e-012 + 4.2440995e-014 + 5.3142153e-016 + 1.7968415e-018 + 5.6565581e-022 + 8.0882737e-028 + 1.0036691e-024 + 1.7372370e-021 + 1.4269264e-018 + 5.9402207e-016 + 1.3161569e-013 + 1.6202203e-011 + 1.1521990e-009 + 4.8822269e-008 + 1.2639328e-006 + 2.0410691e-005 + 2.0914772e-004 + 1.3789168e-003 + 5.9138566e-003 + 1.6636056e-002 + 3.0875031e-002 + 3.7940326e-002 + 3.0929043e-002 + 1.6784472e-002 + 6.2498136e-003 + 2.0701295e-003 + 1.5227570e-003 + 2.3403575e-003 + 3.8247909e-003 + 5.9006423e-003 + 8.5504213e-003 + 1.1661019e-002 + 1.4995081e-002 + 1.8207884e-002 + 2.0900079e-002 + 2.2695987e-002 + 2.2668291e-002 + 2.2054992e-002 + 2.0309805e-002 + 1.7693646e-002 + 1.4571581e-002 + 1.1331681e-002 + 8.3089337e-003 + 5.7339452e-003 + 3.7155408e-003 + 2.2544285e-003 + 1.2765312e-003 + 6.7181057e-004 + 3.2701801e-004 + 1.4637627e-004 + 5.9825722e-005 + 2.2137003e-005 + 7.3389966e-006 + 2.1520624e-006 + 5.4927836e-007 + 1.1956225e-007 + 2.1618167e-008 + 3.1358413e-009 + 3.4808458e-010 + 2.7669545e-011 + 1.4291113e-012 + 4.1242349e-014 + 5.1641279e-016 + 1.7460940e-018 + 5.4968020e-022 + 7.8598396e-028 + 9.7532282e-025 + 1.6881729e-021 + 1.3866263e-018 + 5.7724532e-016 + 1.2789851e-013 + 1.5744611e-011 + 1.1196579e-009 + 4.7443399e-008 + 1.2282360e-006 + 1.9834240e-005 + 2.0324084e-004 + 1.3399726e-003 + 5.7468337e-003 + 1.6166210e-002 + 3.0003039e-002 + 3.6868791e-002 + 3.0055526e-002 + 1.6310435e-002 + 6.0733024e-003 + 2.0116636e-003 + 1.4797504e-003 + 2.2742596e-003 + 3.7167687e-003 + 5.7339926e-003 + 8.3089348e-003 + 1.1331681e-002 + 1.4571581e-002 + 1.7693646e-002 + 2.0309805e-002 + 2.2054992e-002 + 2.2006481e-002 + 2.1411087e-002 + 1.9716852e-002 + 1.7177072e-002 + 1.4146157e-002 + 1.1000848e-002 + 8.0663508e-003 + 5.5665402e-003 + 3.6070640e-003 + 2.1886095e-003 + 1.2392623e-003 + 6.5219676e-004 + 3.1747058e-004 + 1.4210275e-004 + 5.8079084e-005 + 2.1490704e-005 + 7.1247314e-006 + 2.0892320e-006 + 5.3324194e-007 + 1.1607158e-007 + 2.0987015e-008 + 3.0442891e-009 + 3.3792210e-010 + 2.6861721e-011 + 1.3873878e-012 + 4.0038261e-014 + 5.0133589e-016 + 1.6951160e-018 + 5.3363205e-022 + 7.6303681e-028 + 9.4684784e-025 + 1.6388859e-021 + 1.3461431e-018 + 5.6039240e-016 + 1.2416446e-013 + 1.5284940e-011 + 1.0869690e-009 + 4.6058269e-008 + 1.1923771e-006 + 1.9255171e-005 + 1.9730713e-004 + 1.3008515e-003 + 5.5790524e-003 + 1.5694231e-002 + 2.9127087e-002 + 3.5792391e-002 + 2.9178042e-002 + 1.5834244e-002 + 5.8959897e-003 + 1.9529322e-003 + 1.4365484e-003 + 2.2078616e-003 + 3.6082560e-003 + 5.5665862e-003 + 8.0663519e-003 + 1.1000848e-002 + 1.4146157e-002 + 1.7177072e-002 + 1.9716852e-002 + 2.1411087e-002 + 2.1345648e-002 + 2.0768134e-002 + 1.9124775e-002 + 1.6661262e-002 + 1.3721362e-002 + 1.0670503e-002 + 7.8241264e-003 + 5.3993826e-003 + 3.4987475e-003 + 2.1228877e-003 + 1.2020485e-003 + 6.3261195e-004 + 3.0793726e-004 + 1.3783555e-004 + 5.6335028e-005 + 2.0845360e-005 + 6.9107829e-006 + 2.0264945e-006 + 5.1722922e-007 + 1.1258607e-007 + 2.0356797e-008 + 2.9528722e-009 + 3.2777464e-010 + 2.6055090e-011 + 1.3457260e-012 + 3.8835952e-014 + 4.8628128e-016 + 1.6442134e-018 + 5.1760762e-022 + 7.4012359e-028 + 9.1841496e-025 + 1.5896718e-021 + 1.3057198e-018 + 5.4356438e-016 + 1.2043593e-013 + 1.4825948e-011 + 1.0543284e-009 + 4.4675185e-008 + 1.1565712e-006 + 1.8676957e-005 + 1.9138220e-004 + 1.2617882e-003 + 5.4115191e-003 + 1.5222949e-002 + 2.8252430e-002 + 3.4717582e-002 + 2.8301855e-002 + 1.5358758e-002 + 5.7189391e-003 + 1.8942876e-003 + 1.3934103e-003 + 2.1415617e-003 + 3.4999037e-003 + 5.3994272e-003 + 7.8241275e-003 + 1.0670503e-002 + 1.3721362e-002 + 1.6661262e-002 + 1.9124775e-002 + 2.0768134e-002 + 2.0689468e-002 + 2.0129707e-002 + 1.8536866e-002 + 1.6149083e-002 + 1.3299558e-002 + 1.0342485e-002 + 7.5836072e-003 + 5.2334018e-003 + 3.3911935e-003 + 2.0576287e-003 + 1.1650967e-003 + 6.1316502e-004 + 2.9847105e-004 + 1.3359839e-004 + 5.4603249e-005 + 2.0204559e-005 + 6.6983406e-006 + 1.9641986e-006 + 5.0132923e-007 + 1.0912509e-007 + 1.9731014e-008 + 2.8620988e-009 + 3.1769861e-010 + 2.5254139e-011 + 1.3043574e-012 + 3.7642108e-014 + 4.7133265e-016 + 1.5936691e-018 + 5.0169600e-022 + 7.1737167e-028 + 8.9018223e-025 + 1.5408042e-021 + 1.2655811e-018 + 5.2685482e-016 + 1.1673364e-013 + 1.4370188e-011 + 1.0219176e-009 + 4.3301839e-008 + 1.1210174e-006 + 1.8102814e-005 + 1.8549897e-004 + 1.2230000e-003 + 5.2451652e-003 + 1.4754985e-002 + 2.7383931e-002 + 3.3650339e-002 + 2.7431836e-002 + 1.4886619e-002 + 5.5431349e-003 + 1.8360559e-003 + 1.3505759e-003 + 2.0757286e-003 + 3.3923142e-003 + 5.2334450e-003 + 7.5836083e-003 + 1.0342485e-002 + 1.3299558e-002 + 1.6149083e-002 + 1.8536866e-002 + 2.0129707e-002 + 2.0041077e-002 + 1.9498858e-002 + 1.7955935e-002 + 1.5642984e-002 + 1.2882761e-002 + 1.0018360e-002 + 7.3459432e-003 + 5.0693912e-003 + 3.2849163e-003 + 1.9931443e-003 + 1.1285835e-003 + 5.9394892e-004 + 2.8911721e-004 + 1.2941152e-004 + 5.2892028e-005 + 1.9571364e-005 + 6.4884200e-006 + 1.9026422e-006 + 4.8561798e-007 + 1.0570520e-007 + 1.9112660e-008 + 2.7724029e-009 + 3.0774220e-010 + 2.4462694e-011 + 1.2634799e-012 + 3.6462435e-014 + 4.5656147e-016 + 1.5437248e-018 + 4.8597325e-022 + 6.9488982e-028 + 8.6228465e-025 + 1.4925167e-021 + 1.2259188e-018 + 5.1034362e-016 + 1.1307530e-013 + 1.3919838e-011 + 9.8989155e-010 + 4.1944794e-008 + 1.0858856e-006 + 1.7535487e-005 + 1.7968559e-004 + 1.1846722e-003 + 5.0807860e-003 + 1.4292575e-002 + 2.6525741e-002 + 3.2595764e-002 + 2.6572144e-002 + 1.4420084e-002 + 5.3694176e-003 + 1.7785154e-003 + 1.3082499e-003 + 2.0106770e-003 + 3.2860018e-003 + 5.0694331e-003 + 7.3459442e-003 + 1.0018360e-002 + 1.2882761e-002 + 1.5642984e-002 + 1.7955935e-002 + 1.9498858e-002 + 1.9403047e-002 + 1.8878090e-002 + 1.7384288e-002 + 1.5144972e-002 + 1.2472623e-002 + 9.6994140e-003 + 7.1120769e-003 + 4.9080015e-003 + 3.1803373e-003 + 1.9296903e-003 + 1.0926538e-003 + 5.7503990e-004 + 2.7991284e-004 + 1.2529156e-004 + 5.1208151e-005 + 1.8948288e-005 + 6.2818540e-006 + 1.8420695e-006 + 4.7015779e-007 + 1.0233996e-007 + 1.8504187e-008 + 2.6841404e-009 + 2.9794488e-010 + 2.3683897e-011 + 1.2232556e-012 + 3.5301613e-014 + 4.4202633e-016 + 1.4945786e-018 + 4.7050175e-022 + 6.7276723e-028 + 8.3483286e-025 + 1.4450007e-021 + 1.1868903e-018 + 4.9409627e-016 + 1.0947543e-013 + 1.3476685e-011 + 9.5837725e-010 + 4.0609435e-008 + 1.0513152e-006 + 1.6977225e-005 + 1.7396510e-004 + 1.1469568e-003 + 4.9190335e-003 + 1.3837555e-002 + 2.5681264e-002 + 3.1558042e-002 + 2.5726190e-002 + 1.3961005e-002 + 5.1984762e-003 + 1.7218944e-003 + 1.2666004e-003 + 1.9466648e-003 + 3.1813883e-003 + 4.9080421e-003 + 7.1120779e-003 + 9.6994140e-003 + 1.2472623e-002 + 1.5144972e-002 + 1.7384288e-002 + 1.8878090e-002 + 1.8777431e-002 + 1.8269401e-002 + 1.6823764e-002 + 1.4656650e-002 + 1.2070467e-002 + 9.3866742e-003 + 6.8827611e-003 + 4.7497520e-003 + 3.0777932e-003 + 1.8674710e-003 + 1.0574232e-003 + 5.5649880e-004 + 2.7088757e-004 + 1.2125177e-004 + 4.9557039e-005 + 1.8337335e-005 + 6.0793072e-006 + 1.7826754e-006 + 4.5499842e-007 + 9.9040193e-008 + 1.7907554e-008 + 2.5975952e-009 + 2.8833820e-010 + 2.2920254e-011 + 1.1838140e-012 + 3.4163377e-014 + 4.2777401e-016 + 1.4463887e-018 + 4.5533129e-022 + 6.5107509e-028 + 8.0791521e-025 + 1.3984094e-021 + 1.1486212e-018 + 4.7816504e-016 + 1.0594559e-013 + 1.3042154e-011 + 9.2747615e-010 + 3.9300059e-008 + 1.0174175e-006 + 1.6429826e-005 + 1.6835591e-004 + 1.1099753e-003 + 4.7604283e-003 + 1.3391389e-002 + 2.4853219e-002 + 3.0540511e-002 + 2.4896697e-002 + 1.3510858e-002 + 5.0308609e-003 + 1.6663750e-003 + 1.2257612e-003 + 1.8838982e-003 + 3.0788103e-003 + 4.7497913e-003 + 6.8827620e-003 + 9.3866743e-003 + 1.2070467e-002 + 1.4656650e-002 + 1.6823764e-002 + 1.8269401e-002 + 1.8165832e-002 + 1.7674349e-002 + 1.6275797e-002 + 1.4179269e-002 + 1.1677320e-002 + 9.0809411e-003 + 6.6585828e-003 + 4.5950480e-003 + 2.9775465e-003 + 1.8066456e-003 + 1.0229819e-003 + 5.3837309e-004 + 2.6206450e-004 + 1.1730248e-004 + 4.7942917e-005 + 1.7740070e-005 + 5.8812982e-006 + 1.7246119e-006 + 4.4017868e-007 + 9.5814357e-008 + 1.7324288e-008 + 2.5129890e-009 + 2.7894674e-010 + 2.2173719e-011 + 1.1452560e-012 + 3.3050643e-014 + 4.1384099e-016 + 1.3992784e-018 + 4.4050071e-022 + 6.2986894e-028 + 7.8160062e-025 + 1.3528618e-021 + 1.1112095e-018 + 4.6259074e-016 + 1.0249484e-013 + 1.2617358e-011 + 8.9726734e-010 + 3.8020017e-008 + 9.8427923e-007 + 1.5894690e-005 + 1.6287240e-004 + 1.0738223e-003 + 4.6053765e-003 + 1.2955218e-002 + 2.4043725e-002 + 2.9545777e-002 + 2.4085787e-002 + 1.3070796e-002 + 4.8670008e-003 + 1.6120996e-003 + 1.1858369e-003 + 1.8225378e-003 + 2.9785305e-003 + 4.5950860e-003 + 6.6585837e-003 + 9.0809411e-003 + 1.1677320e-002 + 1.4179269e-002 + 1.6275797e-002 + 1.7674349e-002 + 1.7569465e-002 + 1.7094117e-002 + 1.5741479e-002 + 1.3713777e-002 + 1.1293965e-002 + 8.7828225e-003 + 6.4399879e-003 + 4.4441969e-003 + 2.8797965e-003 + 1.7473352e-003 + 9.8939834e-004 + 5.2069881e-004 + 2.5346117e-004 + 1.1345155e-004 + 4.6368997e-005 + 1.7157681e-005 + 5.6882208e-006 + 1.6679945e-006 + 4.2572803e-007 + 9.2668863e-008 + 1.6755548e-008 + 2.4304900e-009 + 2.6978919e-010 + 2.1445777e-011 + 1.1076583e-012 + 3.1965622e-014 + 4.0025498e-016 + 1.3533414e-018 + 4.2603949e-022 + 6.0919095e-028 + 7.5594142e-025 + 1.3084486e-021 + 1.0747295e-018 + 4.4740433e-016 + 9.9130033e-014 + 1.2203142e-011 + 8.6781091e-010 + 3.6771857e-008 + 9.5196628e-007 + 1.5372883e-005 + 1.5752545e-004 + 1.0385698e-003 + 4.4541864e-003 + 1.2529911e-002 + 2.3254393e-002 + 2.8575817e-002 + 2.3295074e-002 + 1.2641694e-002 + 4.7072218e-003 + 1.5591759e-003 + 1.1469070e-003 + 1.7627056e-003 + 2.8807481e-003 + 4.4442337e-003 + 6.4399888e-003 + 8.7828225e-003 + 1.1293965e-002 + 1.3713777e-002 + 1.5741479e-002 + 1.7094117e-002 + 1.6989222e-002 + 1.6529572e-002 + 1.5221605e-002 + 1.3260870e-002 + 1.0920974e-002 + 8.4927637e-003 + 6.2273029e-003 + 4.2974243e-003 + 2.7846892e-003 + 1.6896282e-003 + 9.5672278e-004 + 5.0350238e-004 + 2.4509044e-004 + 1.0970473e-004 + 4.4837629e-005 + 1.6591037e-005 + 5.5003634e-006 + 1.6129079e-006 + 4.1166807e-007 + 8.9608410e-008 + 1.6202184e-008 + 2.3502214e-009 + 2.6087921e-010 + 2.0737515e-011 + 1.0710772e-012 + 3.0909935e-014 + 3.8703629e-016 + 1.3086464e-018 + 4.1196924e-022 + 5.8907200e-028 + 7.3097593e-025 + 1.2652362e-021 + 1.0392359e-018 + 4.3262849e-016 + 9.5856195e-014 + 1.1800125e-011 + 8.3915086e-010 + 3.5557441e-008 + 9.2052694e-007 + 1.4865183e-005 + 1.5232306e-004 + 1.0042703e-003 + 4.3070838e-003 + 1.2116102e-002 + 2.2486401e-002 + 2.7632081e-002 + 2.2525738e-002 + 1.2224194e-002 + 4.5517626e-003 + 1.5076830e-003 + 1.1090296e-003 + 1.7044911e-003 + 2.7856095e-003 + 4.2974598e-003 + 6.2273037e-003 + 8.4927637e-003 + 1.0920974e-002 + 1.3260870e-002 + 1.5221605e-002 + 1.6529572e-002 + 1.6425719e-002 + 1.5981315e-002 + 1.4716732e-002 + 1.2821031e-002 + 1.0558744e-002 + 8.2110738e-003 + 6.0207543e-003 + 4.1548863e-003 + 2.6923260e-003 + 1.6335863e-003 + 9.2498998e-004 + 4.8680210e-004 + 2.3696123e-004 + 1.0606602e-004 + 4.3350445e-005 + 1.6040741e-005 + 5.3179261e-006 + 1.5594106e-006 + 3.9801377e-007 + 8.6636258e-008 + 1.5664787e-008 + 2.2722687e-009 + 2.5222631e-010 + 2.0049689e-011 + 1.0355514e-012 + 2.9884707e-014 + 3.7419898e-016 + 1.2652409e-018 + 3.9830495e-022 + 5.6953352e-028 + 7.0673076e-025 + 1.2232706e-021 + 1.0047662e-018 + 4.1827897e-016 + 9.2676816e-014 + 1.1408736e-011 + 8.1131772e-010 + 3.4378064e-008 + 8.8999470e-007 + 1.4372131e-005 + 1.4727078e-004 + 9.7096041e-004 + 4.1642255e-003 + 1.1714232e-002 + 2.1740567e-002 + 2.6715574e-002 + 2.1778599e-002 + 1.1818739e-002 + 4.4007887e-003 + 1.4576759e-003 + 1.0722451e-003 + 1.6479561e-003 + 2.6932157e-003 + 4.1549207e-003 + 6.0207551e-003 + 8.2110738e-003 + 1.0558744e-002 + 1.2821031e-002 + 1.4716732e-002 + 1.5981315e-002 + 1.5879349e-002 + 1.5449727e-002 + 1.4227208e-002 + 1.2394563e-002 + 1.0207528e-002 + 7.9379481e-003 + 5.8204854e-003 + 4.0166820e-003 + 2.6027709e-003 + 1.5792481e-003 + 8.9422196e-004 + 4.7060955e-004 + 2.2907916e-004 + 1.0253794e-004 + 4.1908475e-005 + 1.5507177e-005 + 5.1410354e-006 + 1.5075397e-006 + 3.8477460e-007 + 8.3754468e-008 + 1.5143727e-008 + 2.1966860e-009 + 2.4383649e-010 + 1.9382774e-011 + 1.0011058e-012 + 2.8890650e-014 + 3.6175197e-016 + 1.2231551e-018 + 3.8505610e-022 + 5.5058908e-028 + 6.8322271e-025 + 1.1825808e-021 + 9.7134461e-019 + 4.0436572e-016 + 8.9594098e-014 + 1.1029246e-011 + 7.8433078e-010 + 3.3234543e-008 + 8.6039073e-007 + 1.3894070e-005 + 1.4237210e-004 + 9.3866327e-004 + 4.0257105e-003 + 1.1324581e-002 + 2.1017408e-002 + 2.5826931e-002 + 2.1054176e-002 + 1.1425611e-002 + 4.2544049e-003 + 1.4091891e-003 + 1.0365789e-003 + 1.5931400e-003 + 2.6036311e-003 + 4.0167152e-003 + 5.8204862e-003 + 7.9379481e-003 + 1.0207528e-002 + 1.2394563e-002 + 1.4227208e-002 + 1.5449727e-002 + 1.5350313e-002 + 1.4935005e-002 + 1.3753215e-002 + 1.1981627e-002 + 9.8674543e-003 + 7.6734878e-003 + 5.6265704e-003 + 3.8828624e-003 + 2.5160571e-003 + 1.5266340e-003 + 8.6443010e-004 + 4.5493075e-004 + 2.2144717e-004 + 9.9121790e-005 + 4.0512254e-005 + 1.4990540e-005 + 4.9697569e-006 + 1.4573146e-006 + 3.7195547e-007 + 8.0964108e-008 + 1.4639200e-008 + 2.1235014e-009 + 2.3571284e-010 + 1.8737018e-011 + 9.6775300e-013 + 2.7928130e-014 + 3.4969985e-016 + 1.1824045e-018 + 3.7222759e-022 + 5.3224568e-028 + 6.6046049e-025 + 1.1431820e-021 + 9.3898334e-019 + 3.9089389e-016 + 8.6609185e-014 + 1.0661796e-011 + 7.5820005e-010 + 3.2127302e-008 + 8.3172599e-007 + 1.3431175e-005 + 1.3762883e-004 + 9.0739080e-004 + 3.8915901e-003 + 1.0947292e-002 + 2.0317193e-002 + 2.4966483e-002 + 2.0352736e-002 + 1.1044956e-002 + 4.1126653e-003 + 1.3622406e-003 + 1.0020443e-003 + 1.5400630e-003 + 2.5168886e-003 + 3.8828945e-003 + 5.6265711e-003 + 7.6734878e-003 + 9.8674543e-003 + 1.1981627e-002 + 1.3753215e-002 + 1.4935005e-002 + 1.4838659e-002 + 1.4437194e-002 + 1.3294795e-002 + 1.1582257e-002 + 9.5385541e-003 + 7.4177165e-003 + 5.4390266e-003 + 3.7534395e-003 + 2.4321924e-003 + 1.4757485e-003 + 8.3561707e-004 + 4.3976708e-004 + 2.1406593e-004 + 9.5817880e-005 + 3.9161907e-005 + 1.4490878e-005 + 4.8041059e-006 + 1.4087397e-006 + 3.5955752e-007 + 7.8265427e-008 + 1.4151248e-008 + 2.0527212e-009 + 2.2785610e-010 + 1.8112479e-011 + 9.3549603e-013 + 2.6997235e-014 + 3.3804372e-016 + 1.1429928e-018 + 3.5982057e-022 + 5.1450496e-028 + 6.3844615e-025 + 1.1050777e-021 + 9.0768532e-019 + 3.7786469e-016 + 8.3722344e-014 + 1.0306419e-011 + 7.3292787e-010 + 3.1056441e-008 + 8.0400305e-007 + 1.2983490e-005 + 1.3304142e-004 + 8.7714582e-004 + 3.7618763e-003 + 1.0582398e-002 + 1.9639984e-002 + 2.4134304e-002 + 1.9674342e-002 + 1.0676808e-002 + 3.9755827e-003 + 1.3168346e-003 + 9.6864433e-004 + 1.4887299e-003 + 2.4329961e-003 + 3.7534706e-003 + 5.4390273e-003 + 7.4177165e-003 + 9.5385541e-003 + 1.1582257e-002 + 1.3294795e-002 + 1.4437194e-002 + 1.4339322e-002 + 1.3951366e-002 + 1.2847410e-002 + 1.1192501e-002 + 9.2175711e-003 + 7.1681020e-003 + 5.2559972e-003 + 3.6271321e-003 + 2.3503464e-003 + 1.4260879e-003 + 8.0749762e-004 + 4.2496842e-004 + 2.0686238e-004 + 9.2593501e-005 + 3.7844065e-005 + 1.4003244e-005 + 4.6424423e-006 + 1.3613340e-006 + 3.4745800e-007 + 7.5631708e-008 + 1.3675043e-008 + 1.9836448e-009 + 2.2018849e-010 + 1.7502974e-011 + 9.0401554e-013 + 2.6088747e-014 + 3.2666817e-016 + 1.1045298e-018 + 3.4771220e-022 + 4.9719129e-028 + 6.1696172e-025 + 1.0678906e-021 + 8.7714069e-019 + 3.6514912e-016 + 8.0904993e-014 + 9.9595967e-012 + 7.0826402e-010 + 3.0011357e-008 + 7.7694744e-007 + 1.2546581e-005 + 1.2856442e-004 + 8.4762887e-004 + 3.6352850e-003 + 1.0226289e-002 + 1.8979077e-002 + 2.3322158e-002 + 1.9012278e-002 + 1.0317521e-002 + 3.8417999e-003 + 1.2725217e-003 + 9.3604836e-004 + 1.4386325e-003 + 2.3511231e-003 + 3.6271621e-003 + 5.2559979e-003 + 7.1681020e-003 + 9.2175711e-003 + 1.1192501e-002 + 1.2847410e-002 + 1.3951366e-002 + 1.3847395e-002 + 1.3472749e-002 + 1.2406665e-002 + 1.0808530e-002 + 8.9013517e-003 + 6.9221920e-003 + 5.0756842e-003 + 3.5026991e-003 + 2.2697150e-003 + 1.3771643e-003 + 7.7979548e-004 + 4.1038939e-004 + 1.9976572e-004 + 8.9416974e-005 + 3.6545781e-005 + 1.3522847e-005 + 4.4831780e-006 + 1.3146319e-006 + 3.3553806e-007 + 7.3037075e-008 + 1.3205905e-008 + 1.9155936e-009 + 2.1263467e-010 + 1.6902514e-011 + 8.7300225e-013 + 2.5193743e-014 + 3.1546144e-016 + 1.0666376e-018 + 3.3578353e-022 + 4.8013457e-028 + 5.9579613e-025 + 1.0312554e-021 + 8.4704937e-019 + 3.5262226e-016 + 7.8129454e-014 + 9.6179213e-012 + 6.8396621e-010 + 2.8981783e-008 + 7.5029337e-007 + 1.2116156e-005 + 1.2415387e-004 + 8.1854999e-004 + 3.5105723e-003 + 9.8754642e-003 + 1.8327978e-002 + 2.2522064e-002 + 1.8360040e-002 + 9.9635666e-003 + 3.7100025e-003 + 1.2288663e-003 + 9.0393615e-004 + 1.3892786e-003 + 2.2704651e-003 + 3.5027281e-003 + 5.0756849e-003 + 6.9221920e-003 + 8.9013517e-003 + 1.0808530e-002 + 1.2406665e-002 + 1.3472749e-002 + 1.3364371e-002 + 1.3002793e-002 + 1.1973896e-002 + 1.0431507e-002 + 8.5908550e-003 + 6.6807323e-003 + 4.8986343e-003 + 3.3805181e-003 + 2.1905429e-003 + 1.3291261e-003 + 7.5259468e-004 + 3.9607420e-004 + 1.9279750e-004 + 8.6297934e-005 + 3.5270992e-005 + 1.3051143e-005 + 4.3267959e-006 + 1.2687749e-006 + 3.2383383e-007 + 7.0489398e-008 + 1.2745257e-008 + 1.8487739e-009 + 2.0521755e-010 + 1.6312921e-011 + 8.4255021e-013 + 2.4314935e-014 + 3.0445753e-016 + 1.0294312e-018 + 3.2407074e-022 + 4.6338653e-028 + 5.7501359e-025 + 9.9528313e-022 + 8.1750262e-019 + 3.4032210e-016 + 7.5404144e-014 + 9.2824292e-012 + 6.6010812e-010 + 2.7970841e-008 + 7.2412165e-007 + 1.1693521e-005 + 1.1982314e-004 + 7.8999735e-004 + 3.3881167e-003 + 9.5309886e-003 + 1.7688662e-002 + 2.1736450e-002 + 1.7719606e-002 + 9.6160177e-003 + 3.5805903e-003 + 1.1860011e-003 + 8.7240507e-004 + 1.3408178e-003 + 2.1912668e-003 + 3.3805460e-003 + 4.8986350e-003 + 6.6807323e-003 + 8.5908550e-003 + 1.0431507e-002 + 1.1973896e-002 + 1.3002793e-002 + 1.2891453e-002 + 1.2542670e-002 + 1.1550182e-002 + 1.0062373e-002 + 8.2868551e-003 + 6.4443249e-003 + 4.7252890e-003 + 3.2608935e-003 + 2.1130273e-003 + 1.2820930e-003 + 7.2596302e-004 + 3.8205854e-004 + 1.8597508e-004 + 8.3244156e-005 + 3.4022876e-005 + 1.2589309e-005 + 4.1736859e-006 + 1.2238775e-006 + 3.1237450e-007 + 6.7995028e-008 + 1.2294247e-008 + 1.7833524e-009 + 1.9795563e-010 + 1.5735665e-011 + 8.1273534e-013 + 2.3454516e-014 + 2.9368385e-016 + 9.9300330e-019 + 3.1260302e-022 + 4.4698892e-028 + 5.5466590e-025 + 9.6006359e-022 + 7.8857409e-019 + 3.2827930e-016 + 7.2735859e-014 + 8.9539569e-012 + 6.3674923e-010 + 2.6981052e-008 + 6.9849755e-007 + 1.1279728e-005 + 1.1558302e-004 + 7.6204214e-004 + 3.2682232e-003 + 9.1937206e-003 + 1.7062722e-002 + 2.0967274e-002 + 1.7092572e-002 + 9.2757409e-003 + 3.4538859e-003 + 1.1440327e-003 + 8.4153375e-004 + 1.2933710e-003 + 2.1137256e-003 + 3.2609205e-003 + 4.7252896e-003 + 6.4443249e-003 + 8.2868551e-003 + 1.0062373e-002 + 1.1550182e-002 + 1.2542670e-002 + 1.2429587e-002 + 1.2093300e-002 + 1.1136371e-002 + 9.7018656e-003 + 7.9899598e-003 + 6.2134424e-003 + 4.5559949e-003 + 3.1440647e-003 + 2.0373234e-003 + 1.2361592e-003 + 6.9995376e-004 + 3.6837043e-004 + 1.7931210e-004 + 8.0261746e-005 + 3.2803930e-005 + 1.2138269e-005 + 4.0241542e-006 + 1.1800293e-006 + 3.0118298e-007 + 6.5558953e-008 + 1.1853778e-008 + 1.7194597e-009 + 1.9086342e-010 + 1.5171899e-011 + 7.8361726e-013 + 2.2614205e-014 + 2.8316197e-016 + 9.5742671e-019 + 3.0140332e-022 + 4.3097454e-028 + 5.3479374e-025 + 9.2566714e-022 + 7.6032165e-019 + 3.1651796e-016 + 7.0129933e-014 + 8.6331612e-012 + 6.1393625e-010 + 2.6014395e-008 + 6.7347230e-007 + 1.0875607e-005 + 1.1144200e-004 + 7.3474027e-004 + 3.1511317e-003 + 8.8643349e-003 + 1.6451412e-002 + 2.0216075e-002 + 1.6480192e-002 + 8.9434166e-003 + 3.3301427e-003 + 1.1030451e-003 + 8.1138390e-004 + 1.2470331e-003 + 2.0379966e-003 + 3.1440907e-003 + 4.5559955e-003 + 6.2134424e-003 + 7.9899598e-003 + 9.7018656e-003 + 1.1136371e-002 + 1.2093300e-002 + 1.1979499e-002 + 1.1655389e-002 + 1.0733111e-002 + 9.3505505e-003 + 7.7006346e-003 + 5.9884469e-003 + 4.3910173e-003 + 3.0302146e-003 + 1.9635497e-003 + 1.1913965e-003 + 6.7460767e-004 + 3.5503133e-004 + 1.7281902e-004 + 7.7355381e-005 + 3.1616064e-005 + 1.1698729e-005 + 3.8784352e-006 + 1.1372992e-006 + 2.9027681e-007 + 6.3184991e-008 + 1.1424540e-008 + 1.6571962e-009 + 1.8395205e-010 + 1.4622508e-011 + 7.5524163e-013 + 2.1795320e-014 + 2.7290836e-016 + 9.2275725e-019 + 2.9048917e-022 + 4.1536848e-028 + 5.1542827e-025 + 8.9214773e-022 + 7.3278957e-019 + 3.0505650e-016 + 6.7590451e-014 + 8.3205450e-012 + 5.9170495e-010 + 2.5072385e-008 + 6.4908514e-007 + 1.0481789e-005 + 1.0740656e-004 + 7.0813452e-004 + 3.0370258e-003 + 8.5433476e-003 + 1.5855688e-002 + 1.9484028e-002 + 1.5883426e-002 + 8.6195657e-003 + 3.2095546e-003 + 1.0631027e-003 + 7.8200281e-004 + 1.2018766e-003 + 1.9641986e-003 + 3.0302397e-003 + 4.3910179e-003 + 5.9884469e-003 + 7.7006346e-003 + 9.3505505e-003 + 1.0733111e-002 + 1.1655389e-002 + 1.1541721e-002 + 1.1229455e-002 + 1.0340881e-002 + 9.0088446e-003 + 7.4192232e-003 + 5.7696055e-003 + 4.2305523e-003 + 2.9194787e-003 + 1.8917938e-003 + 1.1478582e-003 + 6.4995485e-004 + 3.4205709e-004 + 1.6650353e-004 + 7.4528511e-005 + 3.0460689e-005 + 1.1271211e-005 + 3.7367019e-006 + 1.0957378e-006 + 2.7966896e-007 + 6.0875963e-008 + 1.1007042e-008 + 1.5966358e-009 + 1.7722972e-010 + 1.4088144e-011 + 7.2764213e-013 + 2.0998833e-014 + 2.6293522e-016 + 8.8903607e-019 + 2.7987356e-022 + 4.0018928e-028 + 4.9659250e-025 + 8.5954514e-022 + 7.0601056e-019 + 2.9390853e-016 + 6.5120430e-014 + 8.0164796e-012 + 5.7008173e-010 + 2.4156142e-008 + 6.2536501e-007 + 1.0098743e-005 + 1.0348151e-004 + 6.8225650e-004 + 2.9260410e-003 + 8.2311401e-003 + 1.5276259e-002 + 1.8772005e-002 + 1.5302983e-002 + 8.3045729e-003 + 3.0922648e-003 + 1.0242527e-003 + 7.5342535e-004 + 1.1579553e-003 + 1.8924190e-003 + 2.9195028e-003 + 4.2305528e-003 + 5.7696055e-003 + 7.4192232e-003 + 9.0088446e-003 + 1.0340881e-002 + 1.1229455e-002 + 1.1116627e-002 + 1.0815862e-002 + 9.9600154e-003 + 8.6770394e-003 + 7.1459654e-003 + 5.5571049e-003 + 4.0747366e-003 + 2.8119512e-003 + 1.8221171e-003 + 1.1055814e-003 + 6.2601633e-004 + 3.2945877e-004 + 1.6037103e-004 + 7.1783548e-005 + 2.9338790e-005 + 1.0856081e-005 + 3.5990753e-006 + 1.0553806e-006 + 2.6936846e-007 + 5.8633838e-008 + 1.0601642e-008 + 1.5378300e-009 + 1.7070216e-010 + 1.3569263e-011 + 7.0084231e-013 + 2.0225424e-014 + 2.5325104e-016 + 8.5629194e-019 + 2.6956552e-022 + 3.8544989e-028 + 4.7830248e-025 + 8.2788719e-022 + 6.8000745e-019 + 2.8308357e-016 + 6.2721977e-014 + 7.7212243e-012 + 5.4908502e-010 + 2.3266446e-008 + 6.0233216e-007 + 9.7267959e-006 + 9.9670174e-005 + 6.5712828e-004 + 2.8182718e-003 + 7.9279786e-003 + 1.4713619e-002 + 1.8080613e-002 + 1.4739358e-002 + 7.9987068e-003 + 2.9783735e-003 + 9.8652842e-004 + 7.2567590e-004 + 1.1153066e-003 + 1.8227192e-003 + 2.8119745e-003 + 4.0747372e-003 + 5.5571049e-003 + 7.1459654e-003 + 8.6770394e-003 + 9.9600154e-003 + 1.0815862e-002 + 1.0704454e-002 + 1.0414841e-002 + 9.5907265e-003 + 8.3553196e-003 + 6.8810135e-003 + 5.3510633e-003 + 3.9236570e-003 + 2.7076921e-003 + 1.7545582e-003 + 1.0645896e-003 + 6.0280544e-004 + 3.1724338e-004 + 1.5442493e-004 + 6.9122019e-005 + 2.8250991e-005 + 1.0453569e-005 + 3.4656319e-006 + 1.0162501e-006 + 2.5938104e-007 + 5.6459863e-008 + 1.0208563e-008 + 1.4808117e-009 + 1.6437302e-010 + 1.3066154e-011 + 6.7485708e-013 + 1.9475523e-014 + 2.4386122e-016 + 8.2454309e-019 + 2.5957080e-022 + 3.7115851e-028 + 4.6056839e-025 + 7.9719151e-022 + 6.5479472e-019 + 2.7258765e-016 + 6.0396425e-014 + 7.4349434e-012 + 5.2872652e-010 + 2.2403793e-008 + 5.7999941e-007 + 9.3661542e-006 + 9.5974689e-005 + 6.3276384e-004 + 2.7137784e-003 + 7.6340319e-003 + 1.4168080e-002 + 1.7410235e-002 + 1.4192865e-002 + 7.7021376e-003 + 2.8679439e-003 + 9.4995077e-004 + 6.9876992e-004 + 1.0739542e-003 + 1.7551380e-003 + 2.7077145e-003 + 3.9236576e-003 + 5.3510633e-003 + 6.8810135e-003 + 8.3553196e-003 + 9.5907265e-003 + 1.0414841e-002 + 1.0305324e-002 + 1.0026510e-002 + 9.2331231e-003 + 8.0437801e-003 + 6.6244454e-003 + 5.1515416e-003 + 3.7773581e-003 + 2.6067321e-003 + 1.6891371e-003 + 1.0248949e-003 + 5.8032901e-004 + 3.0541453e-004 + 1.4866699e-004 + 6.6544710e-005 + 2.7197614e-005 + 1.0063793e-005 + 3.3364110e-006 + 9.7835783e-007 + 2.4970967e-007 + 5.4354679e-008 + 9.8279227e-009 + 1.4255976e-009 + 1.5824414e-010 + 1.2578964e-011 + 6.4969411e-013 + 1.8749352e-014 + 2.3476851e-016 + 7.9379887e-019 + 2.4989235e-022 + 3.5731936e-028 + 4.4339547e-025 + 7.6746713e-022 + 6.3037980e-019 + 2.6242384e-016 + 5.8144462e-014 + 7.1577213e-012 + 5.0901222e-010 + 2.1568436e-008 + 5.5837334e-007 + 9.0169243e-006 + 9.2396141e-005 + 6.0917037e-004 + 2.6125914e-003 + 7.3493865e-003 + 1.3639803e-002 + 1.6761071e-002 + 1.3663665e-002 + 7.4149528e-003 + 2.7610087e-003 + 9.1453055e-004 + 6.7271532e-004 + 1.0339104e-003 + 1.6896953e-003 + 2.6067537e-003 + 3.7773586e-003 + 5.1515416e-003 + 6.6244454e-003 + 8.0437801e-003 + 9.2331231e-003 + 1.0026510e-002 + 9.9192609e-003 + 9.6508916e-003 + 8.8872274e-003 + 7.7424401e-003 + 6.3762773e-003 + 4.9585520e-003 + 3.6358489e-003 + 2.5090774e-003 + 1.6258578e-003 + 9.8649978e-004 + 5.5858844e-004 + 2.9397294e-004 + 1.4309755e-004 + 6.4051780e-005 + 2.6178724e-005 + 9.6867782e-006 + 3.2114208e-006 + 9.4170611e-007 + 2.4035492e-007 + 5.2318418e-008 + 9.4597443e-009 + 1.3721911e-009 + 1.5231592e-010 + 1.2107725e-011 + 6.2535495e-013 + 1.8046955e-014 + 2.2597350e-016 + 7.6406119e-019 + 2.4053076e-022 + 3.4393329e-028 + 4.2678477e-025 + 7.3871590e-022 + 6.0676421e-019 + 2.5259279e-016 + 5.5966226e-014 + 6.8895753e-012 + 4.8994336e-010 + 2.0760429e-008 + 5.3745529e-007 + 8.6791279e-006 + 8.8934752e-005 + 5.8634934e-004 + 2.5147172e-003 + 7.0740602e-003 + 1.3128823e-002 + 1.6133160e-002 + 1.3151790e-002 + 7.1371703e-003 + 2.6575744e-003 + 8.8026996e-004 + 6.4751374e-004 + 9.9517754e-004 + 1.6263951e-003 + 2.5090982e-003 + 3.6358494e-003 + 4.9585520e-003 + 6.3762773e-003 + 7.7424401e-003 + 8.8872274e-003 + 9.6508916e-003 + 9.5462094e-003 + 9.2879332e-003 + 8.5529894e-003 + 7.4512562e-003 + 6.1364731e-003 + 4.7720668e-003 + 3.4991090e-003 + 2.4147140e-003 + 1.5647113e-003 + 9.4939871e-004 + 5.3758060e-004 + 2.8291697e-004 + 1.3771582e-004 + 6.1642869e-005 + 2.5194174e-005 + 9.3224701e-006 + 3.0906431e-006 + 9.0628967e-007 + 2.3131546e-007 + 5.0350785e-008 + 9.1039747e-009 + 1.3205847e-009 + 1.4658751e-010 + 1.1652368e-011 + 6.0183610e-013 + 1.7368230e-014 + 2.1747491e-016 + 7.3532576e-019 + 2.3148469e-022 + 3.3099837e-028 + 4.1073391e-025 + 7.1093368e-022 + 5.8394453e-019 + 2.4309308e-016 + 5.3861403e-014 + 6.6304666e-012 + 4.7151718e-010 + 1.9979654e-008 + 5.1724224e-007 + 8.3527163e-006 + 8.5590023e-005 + 5.6429744e-004 + 2.4201417e-003 + 6.8080133e-003 + 1.2635063e-002 + 1.5526411e-002 + 1.2657167e-002 + 6.8687499e-003 + 2.5576262e-003 + 8.4716406e-004 + 6.2316152e-004 + 9.5775010e-004 + 1.5652283e-003 + 2.4147340e-003 + 3.4991094e-003 + 4.7720668e-003 + 6.1364731e-003 + 7.4512562e-003 + 8.5529894e-003 + 9.2879332e-003 Index: adcp/trunk/adcp/diwasp_1_1GD/private/vels.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/private/vels.m (revision 168) @@ -1,0 +1,3 @@ +function trm=vels(ffreqs,dirs,wns,z,depth,xpos,ypos) + +trm=(-i*ffreqs)*ones(size(dirs)); Index: adcp/trunk/adcp/diwasp_1_1GD/private/velx.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/private/velx.m (revision 168) @@ -1,0 +1,7 @@ +function trm=velx(ffreqs,dirs,wns,z,depth,xpos,ypos) + +Kz=cosh(z*wns)./sinh(depth*wns); +%include a maximum cuttoff for the velocity response function +Kz(find(Kz<0.1))=0.1; +Kz(find(isnan(Kz)))=1; +trm=(ffreqs.*Kz)*cos(dirs); Index: adcp/trunk/adcp/diwasp_1_1GD/private/vely.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/private/vely.m (revision 168) @@ -1,0 +1,7 @@ +function trm=vely(ffreqs,dirs,wns,z,depth,xpos,ypos) + +Kz=cosh(z*wns)./sinh(depth*wns); +%include a maximum cuttoff for the velocity response function +Kz(find(Kz<0.1))=0.1; +Kz(find(isnan(Kz)))=1; +trm=(ffreqs.*Kz)*sin(dirs); Index: adcp/trunk/adcp/diwasp_1_1GD/private/velz.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/private/velz.m (revision 168) @@ -1,0 +1,7 @@ +function trm=velz(ffreqs,dirs,wns,z,depth,xpos,ypos) + +Kz=sinh(z*wns)./sinh(depth*wns); +%include a maximum cuttoff for the velocity response function +Kz(find(Kz<0.1))=0.1; +Kz(find(isnan(Kz)))=1; +trm=-i*(ffreqs.*Kz)*ones(size(dirs)); Index: adcp/trunk/adcp/diwasp_1_1GD/private/wavenumber.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/private/wavenumber.m (revision 168) @@ -1,0 +1,35 @@ +function [k]= wavenumber(sigma,h) +%k = wavenumber(sigma,h) +% +%k is the matrix of same size as sigma and h containing the calculated wave numbers +% +%sigma is the wave frequencies in rad/s +%h is the water depth +% +%sigma and h must be scalars,vectors or matricies of the same dimensions +% + +%modified from R.Dalrymple's java code +% + +g=9.81; + + a0=(sigma.*sigma.*h)./g; + b1=1.0./(tanh(a0.^0.75)); + a1=a0.*(b1.^0.666); + da1=1000.0; + +d1=ones(size(h)); + while(max(d1)==1) + d1 = (abs(da1./a1) > .00000001); + th=tanh(a1); + ch=cosh(a1); + f1=a0-(a1.*th); + f2= - a1.*((1.0./ch).^2) -th; + da1= -f1./f2; + a1=a1+da1; + end + +k=a1./h; + + Index: adcp/trunk/adcp/diwasp_1_1GD/readspec.f =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/readspec.f (revision 168) @@ -1,0 +1,44 @@ +c skeleton subroutine to read directional wave spectra + subroutine readspec(filename,spden,spfreq,spdir, + &nspec,ndir,xd) + + integer nspec,ndir,iitemp + real spden(100,100),spfreq(100),spdir(100),nd + character*50 filename + + +c enter wave spectrum -ASCII format +c reads spectral density in variable "spden(f,d)" with indicies f and d corresponding to +c the frequencies and directions spfreq(f) and spdir(d) respectively + + + open(11,file=filename) + read(11,*) xd + read(11,*) nspec + read(11,*) ndir + if((nspec.gt.100).OR.(ndir.GT.100))then + write(*,*) 'wave spectrum dimensions too large' + close(11) + stop + endif + do i=1,nspec + read(11,*) spfreq(i) + enddo + do j=1,ndir + read(11,*) spdir(j) + enddo + read(11,*)iitemp + if (iitemp.NE.999) then + write(*,*)'wave spectrum:corrupt file header' + close (11) + stop + endif + do i=1,nspec + do j=1,ndir + read(11,*) spden(i,j) + enddo + enddo + close(11) + + end + Index: adcp/trunk/adcp/diwasp_1_1GD/readspec.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/readspec.m (revision 168) @@ -1,0 +1,34 @@ +function [SM]=readspec(filename) + +%DIWASP V1.1 function +%readspec: reads in spectrum file in DIWASP format and displays surface plot +% +%[SM]=readspec(filename) +% +%Outputs: +%SM A spectral matrix structure containing the file data +% +%Inputs: +%filename filename for the file in DIWASP format including file extension +% +%"help data_structures" for information on the DIWASP data structures + +%Copyright (C) 2002 Coastal Oceanography Group, CWR, UWA, Perth + +datain=load(filename); + +SM.xaxisdir=datain(1); +nfreq=datain(2); +ndirs=datain(3); +SM.freqs=datain(4:nfreq+3); +SM.dirs=datain(nfreq+4:nfreq+3+ndirs); +headercheck=datain(nfreq+ndirs+4); +if headercheck~=999 + error('corrupt file header'); +end +mat=datain(nfreq+ndirs+5:nfreq+ndirs+4+(nfreq*ndirs)); + +S=reshape(mat,ndirs,nfreq); +SM.S=S'; + +plotspec(SM,1); Index: adcp/trunk/adcp/diwasp_1_1GD/specmat.spec =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/specmat.spec (revision 168) @@ -1,0 +1,3175 @@ + 9.0000000e+001 + 5.1000000e+001 + 6.0000000e+001 + 7.0000000e-002 + 7.4600000e-002 + 7.9200000e-002 + 8.3800000e-002 + 8.8400000e-002 + 9.3000000e-002 + 9.7600000e-002 + 1.0220000e-001 + 1.0680000e-001 + 1.1140000e-001 + 1.1600000e-001 + 1.2060000e-001 + 1.2520000e-001 + 1.2980000e-001 + 1.3440000e-001 + 1.3900000e-001 + 1.4360000e-001 + 1.4820000e-001 + 1.5280000e-001 + 1.5740000e-001 + 1.6200000e-001 + 1.6660000e-001 + 1.7120000e-001 + 1.7580000e-001 + 1.8040000e-001 + 1.8500000e-001 + 1.8960000e-001 + 1.9420000e-001 + 1.9880000e-001 + 2.0340000e-001 + 2.0800000e-001 + 2.1260000e-001 + 2.1720000e-001 + 2.2180000e-001 + 2.2640000e-001 + 2.3100000e-001 + 2.3560000e-001 + 2.4020000e-001 + 2.4480000e-001 + 2.4940000e-001 + 2.5400000e-001 + 2.5860000e-001 + 2.6320000e-001 + 2.6780000e-001 + 2.7240000e-001 + 2.7700000e-001 + 2.8160000e-001 + 2.8620000e-001 + 2.9080000e-001 + 2.9540000e-001 + 3.0000000e-001 + -1.8000000e+002 + -1.7400000e+002 + -1.6800000e+002 + -1.6200000e+002 + -1.5600000e+002 + -1.5000000e+002 + -1.4400000e+002 + -1.3800000e+002 + -1.3200000e+002 + -1.2600000e+002 + -1.2000000e+002 + -1.1400000e+002 + -1.0800000e+002 + -1.0200000e+002 + -9.6000000e+001 + -9.0000000e+001 + -8.4000000e+001 + -7.8000000e+001 + -7.2000000e+001 + -6.6000000e+001 + -6.0000000e+001 + -5.4000000e+001 + -4.8000000e+001 + -4.2000000e+001 + -3.6000000e+001 + -3.0000000e+001 + -2.4000000e+001 + -1.8000000e+001 + -1.2000000e+001 + -6.0000000e+000 + 0.0000000e+000 + 6.0000000e+000 + 1.2000000e+001 + 1.8000000e+001 + 2.4000000e+001 + 3.0000000e+001 + 3.6000000e+001 + 4.2000000e+001 + 4.8000000e+001 + 5.4000000e+001 + 6.0000000e+001 + 6.6000000e+001 + 7.2000000e+001 + 7.8000000e+001 + 8.4000000e+001 + 9.0000000e+001 + 9.6000000e+001 + 1.0200000e+002 + 1.0800000e+002 + 1.1400000e+002 + 1.2000000e+002 + 1.2600000e+002 + 1.3200000e+002 + 1.3800000e+002 + 1.4400000e+002 + 1.5000000e+002 + 1.5600000e+002 + 1.6200000e+002 + 1.6800000e+002 + 1.7400000e+002 + 9.9900000e+002 + 2.2756783e-023 + 3.0214682e-026 + 1.9209987e-029 + 5.3107132e-033 + 5.6488802e-037 + 1.9738363e-041 + 1.8387488e-046 + 3.4395894e-052 + 8.6778079e-059 + 1.6473819e-066 + 9.5160843e-076 + 3.6675821e-087 + 5.4802904e-102 + 5.3340673e-123 + 4.7307528e-159 + 0.0000000e+000 + 4.7307528e-159 + 5.3340673e-123 + 5.4802904e-102 + 3.6675821e-087 + 9.5160843e-076 + 1.6473819e-066 + 8.6778079e-059 + 3.4395894e-052 + 1.8387488e-046 + 1.9738363e-041 + 5.6488802e-037 + 5.3107132e-033 + 1.9209987e-029 + 3.0214682e-026 + 2.2756783e-023 + 8.8659563e-021 + 1.9020501e-018 + 2.3649827e-016 + 1.7777836e-014 + 8.3673207e-013 + 2.5387311e-011 + 5.0878010e-010 + 6.8725694e-009 + 6.3631136e-008 + 4.0941522e-007 + 1.8511341e-006 + 5.9333758e-006 + 1.3571645e-005 + 2.2255603e-005 + 2.6236785e-005 + 2.2255603e-005 + 1.3571645e-005 + 5.9333758e-006 + 1.8511341e-006 + 4.0941522e-007 + 6.3631136e-008 + 6.8725694e-009 + 5.0878010e-010 + 2.5387311e-011 + 8.3673207e-013 + 1.7777836e-014 + 2.3649827e-016 + 1.9020501e-018 + 8.8659563e-021 + 2.1279127e-022 + 2.8252765e-025 + 1.7962633e-028 + 4.9658749e-032 + 5.2820838e-036 + 1.8456700e-040 + 1.7193541e-045 + 3.2162480e-051 + 8.1143355e-058 + 1.5404132e-065 + 8.8981804e-075 + 3.4294366e-086 + 5.1244411e-101 + 4.9877125e-122 + 4.4235728e-158 + 0.0000000e+000 + 4.4235728e-158 + 4.9877125e-122 + 5.1244411e-101 + 3.4294366e-086 + 8.8981804e-075 + 1.5404132e-065 + 8.1143355e-058 + 3.2162480e-051 + 1.7193541e-045 + 1.8456700e-040 + 5.2820838e-036 + 4.9658749e-032 + 1.7962633e-028 + 2.8252765e-025 + 2.1279127e-022 + 8.2902670e-020 + 1.7785451e-017 + 2.2114183e-015 + 1.6623475e-013 + 7.8240090e-012 + 2.3738847e-010 + 4.7574370e-009 + 6.4263158e-008 + 5.9499403e-007 + 3.8283084e-006 + 1.7309352e-005 + 5.5481065e-005 + 1.2690403e-004 + 2.0810489e-004 + 2.4533163e-004 + 2.0810489e-004 + 1.2690403e-004 + 5.5481065e-005 + 1.7309352e-005 + 3.8283084e-006 + 5.9499403e-007 + 6.4263158e-008 + 4.7574370e-009 + 2.3738847e-010 + 7.8240090e-012 + 1.6623475e-013 + 2.2114183e-015 + 1.7785451e-017 + 8.2902670e-020 + 1.0559755e-021 + 1.4020419e-024 + 8.9139467e-028 + 2.4643126e-031 + 2.6212312e-035 + 9.1591272e-040 + 8.5322850e-045 + 1.5960613e-050 + 4.0267344e-057 + 7.6442919e-065 + 4.4157171e-074 + 1.7018560e-085 + 2.5430010e-100 + 2.4751496e-121 + 2.1951955e-157 + 0.0000000e+000 + 2.1951955e-157 + 2.4751496e-121 + 2.5430010e-100 + 1.7018560e-085 + 4.4157171e-074 + 7.6442919e-065 + 4.0267344e-057 + 1.5960613e-050 + 8.5322850e-045 + 9.1591272e-040 + 2.6212312e-035 + 2.4643126e-031 + 8.9139467e-028 + 1.4020419e-024 + 1.0559755e-021 + 4.1140404e-019 + 8.8260200e-017 + 1.0974151e-014 + 8.2493902e-013 + 3.8826601e-011 + 1.1780390e-009 + 2.3608754e-008 + 3.1890556e-007 + 2.9526545e-006 + 1.8997959e-005 + 8.5897564e-005 + 2.7532447e-004 + 6.2976054e-004 + 1.0327194e-003 + 1.2174568e-003 + 1.0327194e-003 + 6.2976054e-004 + 2.7532447e-004 + 8.5897564e-005 + 1.8997959e-005 + 2.9526545e-006 + 3.1890556e-007 + 2.3608754e-008 + 1.1780390e-009 + 3.8826601e-011 + 8.2493902e-013 + 1.0974151e-014 + 8.8260200e-017 + 4.1140404e-019 + 3.3764257e-021 + 4.4829547e-024 + 2.8501873e-027 + 7.8795092e-031 + 8.3812478e-035 + 2.9285824e-039 + 2.7281529e-044 + 5.1033214e-050 + 1.2875270e-056 + 2.4442218e-064 + 1.4119022e-073 + 5.4415944e-085 + 8.1311111e-100 + 7.9141597e-121 + 7.0190215e-157 + 0.0000000e+000 + 7.0190215e-157 + 7.9141597e-121 + 8.1311111e-100 + 5.4415944e-085 + 1.4119022e-073 + 2.4442218e-064 + 1.2875270e-056 + 5.1033214e-050 + 2.7281529e-044 + 2.9285824e-039 + 8.3812478e-035 + 7.8795092e-031 + 2.8501873e-027 + 4.4829547e-024 + 3.3764257e-021 + 1.3154426e-018 + 2.8220732e-016 + 3.5089266e-014 + 2.6376988e-012 + 1.2414600e-010 + 3.7667172e-009 + 7.5487742e-008 + 1.0196836e-006 + 9.4409565e-006 + 6.0744967e-005 + 2.7465291e-004 + 8.8033543e-004 + 2.0136260e-003 + 3.3020655e-003 + 3.8927537e-003 + 3.3020655e-003 + 2.0136260e-003 + 8.8033543e-004 + 2.7465291e-004 + 6.0744967e-005 + 9.4409565e-006 + 1.0196836e-006 + 7.5487742e-008 + 3.7667172e-009 + 1.2414600e-010 + 2.6376988e-012 + 3.5089266e-014 + 2.8220732e-016 + 1.3154426e-018 + 7.9135095e-021 + 1.0506941e-023 + 6.6801364e-027 + 1.8467627e-030 + 1.9643579e-034 + 6.8638754e-039 + 6.3941181e-044 + 1.1960928e-049 + 3.0176460e-056 + 5.7286536e-064 + 3.3091506e-073 + 1.2753756e-084 + 1.9057320e-099 + 1.8548840e-120 + 1.6450856e-156 + 0.0000000e+000 + 1.6450856e-156 + 1.8548840e-120 + 1.9057320e-099 + 1.2753756e-084 + 3.3091506e-073 + 5.7286536e-064 + 3.0176460e-056 + 1.1960928e-049 + 6.3941181e-044 + 6.8638754e-039 + 1.9643579e-034 + 1.8467627e-030 + 6.6801364e-027 + 1.0506941e-023 + 7.9135095e-021 + 3.0830733e-018 + 6.6142439e-016 + 8.2240590e-014 + 6.1821159e-012 + 2.9096763e-010 + 8.8282568e-009 + 1.7692466e-007 + 2.3898871e-006 + 2.2127275e-005 + 1.4237123e-004 + 6.4371873e-004 + 2.0632893e-003 + 4.7194430e-003 + 7.7392277e-003 + 9.1236553e-003 + 7.7392277e-003 + 4.7194430e-003 + 2.0632893e-003 + 6.4371873e-004 + 1.4237123e-004 + 2.2127275e-005 + 2.3898871e-006 + 1.7692466e-007 + 8.8282568e-009 + 2.9096763e-010 + 6.1821159e-012 + 8.2240590e-014 + 6.6142439e-016 + 3.0830733e-018 + 1.4868638e-020 + 1.9741418e-023 + 1.2551262e-026 + 3.4698696e-030 + 3.6908183e-034 + 1.2896487e-038 + 1.2013864e-043 + 2.2473303e-049 + 5.6698339e-056 + 1.0763527e-063 + 6.2175400e-073 + 2.3962943e-084 + 3.5806666e-099 + 3.4851285e-120 + 3.0909399e-156 + 0.0000000e+000 + 3.0909399e-156 + 3.4851285e-120 + 3.5806666e-099 + 2.3962943e-084 + 6.2175400e-073 + 1.0763527e-063 + 5.6698339e-056 + 2.2473303e-049 + 1.2013864e-043 + 1.2896487e-038 + 3.6908183e-034 + 3.4698696e-030 + 1.2551262e-026 + 1.9741418e-023 + 1.4868638e-020 + 5.7927648e-018 + 1.2427457e-015 + 1.5452127e-013 + 1.1615534e-011 + 5.4669704e-010 + 1.6587350e-008 + 3.3242251e-007 + 4.4903422e-006 + 4.1574782e-005 + 2.6750031e-004 + 1.2094786e-003 + 3.8766997e-003 + 8.8673285e-003 + 1.4541181e-002 + 1.7142372e-002 + 1.4541181e-002 + 8.8673285e-003 + 3.8766997e-003 + 1.2094786e-003 + 2.6750031e-004 + 4.1574782e-005 + 4.4903422e-006 + 3.3242251e-007 + 1.6587350e-008 + 5.4669704e-010 + 1.1615534e-011 + 1.5452127e-013 + 1.2427457e-015 + 5.7927648e-018 + 2.4016794e-020 + 3.1887626e-023 + 2.0273617e-026 + 5.6047598e-030 + 5.9616506e-034 + 2.0831248e-038 + 1.9405577e-043 + 3.6300346e-049 + 9.1582857e-056 + 1.7385951e-063 + 1.0042976e-072 + 3.8706509e-084 + 5.7837263e-099 + 5.6294070e-120 + 4.9926878e-156 + 0.0000000e+000 + 4.9926878e-156 + 5.6294070e-120 + 5.7837263e-099 + 3.8706509e-084 + 1.0042976e-072 + 1.7385951e-063 + 9.1582857e-056 + 3.6300346e-049 + 1.9405577e-043 + 2.0831248e-038 + 5.9616506e-034 + 5.6047598e-030 + 2.0273617e-026 + 3.1887626e-023 + 2.4016794e-020 + 9.3568517e-018 + 2.0073639e-015 + 2.4959284e-013 + 1.8762169e-011 + 8.8306074e-010 + 2.6792970e-008 + 5.3695053e-007 + 7.2530938e-006 + 6.7154302e-005 + 4.3208396e-004 + 1.9536288e-003 + 6.2618984e-003 + 1.4323088e-002 + 2.3487864e-002 + 2.7689478e-002 + 2.3487864e-002 + 1.4323088e-002 + 6.2618984e-003 + 1.9536288e-003 + 4.3208396e-004 + 6.7154302e-005 + 7.2530938e-006 + 5.3695053e-007 + 2.6792970e-008 + 8.8306074e-010 + 1.8762169e-011 + 2.4959284e-013 + 2.0073639e-015 + 9.3568517e-018 + 3.5687225e-020 + 4.7382715e-023 + 3.0125133e-026 + 8.3282692e-030 + 8.8585832e-034 + 3.0953733e-038 + 2.8835288e-043 + 5.3939698e-049 + 1.3608553e-055 + 2.5834271e-063 + 1.4923139e-072 + 5.7515083e-084 + 8.5942005e-099 + 8.3648931e-120 + 7.4187743e-156 + 0.0000000e+000 + 7.4187743e-156 + 8.3648931e-120 + 8.5942005e-099 + 5.7515083e-084 + 1.4923139e-072 + 2.5834271e-063 + 1.3608553e-055 + 5.3939698e-049 + 2.8835288e-043 + 3.0953733e-038 + 8.8585832e-034 + 8.3282692e-030 + 3.0125133e-026 + 4.7382715e-023 + 3.5687225e-020 + 1.3903607e-017 + 2.9827981e-015 + 3.7087697e-013 + 2.7879231e-011 + 1.3121646e-009 + 3.9812423e-008 + 7.9786979e-007 + 1.0777575e-005 + 9.9786452e-005 + 6.4204562e-004 + 2.9029516e-003 + 9.3047298e-003 + 2.1283076e-002 + 3.4901273e-002 + 4.1144569e-002 + 3.4901273e-002 + 2.1283076e-002 + 9.3047298e-003 + 2.9029516e-003 + 6.4204562e-004 + 9.9786452e-005 + 1.0777575e-005 + 7.9786979e-007 + 3.9812423e-008 + 1.3121646e-009 + 2.7879231e-011 + 3.7087697e-013 + 2.9827981e-015 + 1.3903607e-017 + 5.2174642e-020 + 6.9273421e-023 + 4.4042877e-026 + 1.2175911e-029 + 1.2951229e-033 + 4.5254288e-038 + 4.2157126e-043 + 7.8859716e-049 + 1.9895673e-055 + 3.7769645e-063 + 2.1817595e-072 + 8.4086921e-084 + 1.2564702e-098 + 1.2229455e-119 + 1.0846231e-155 + 0.0000000e+000 + 1.0846231e-155 + 1.2229455e-119 + 1.2564702e-098 + 8.4086921e-084 + 2.1817595e-072 + 3.7769645e-063 + 1.9895673e-055 + 7.8859716e-049 + 4.2157126e-043 + 4.5254288e-038 + 1.2951229e-033 + 1.2175911e-029 + 4.4042877e-026 + 6.9273421e-023 + 5.2174642e-020 + 2.0327042e-017 + 4.3608440e-015 + 5.4222129e-013 + 4.0759373e-011 + 1.9183817e-009 + 5.8205672e-008 + 1.1664838e-006 + 1.5756790e-005 + 1.4588757e-004 + 9.3866925e-004 + 4.2441087e-003 + 1.3603494e-002 + 3.1115809e-002 + 5.1025583e-002 + 6.0153267e-002 + 5.1025583e-002 + 3.1115809e-002 + 1.3603494e-002 + 4.2441087e-003 + 9.3866925e-004 + 1.4588757e-004 + 1.5756790e-005 + 1.1664838e-006 + 5.8205672e-008 + 1.9183817e-009 + 4.0759373e-011 + 5.4222129e-013 + 4.3608440e-015 + 2.0327042e-017 + 7.7175449e-020 + 1.0246754e-022 + 6.5147142e-026 + 1.8010308e-029 + 1.9157139e-033 + 6.6939032e-038 + 6.2357786e-043 + 1.1664736e-048 + 2.9429191e-055 + 5.5867932e-063 + 3.2272052e-072 + 1.2437931e-083 + 1.8585398e-098 + 1.8089509e-119 + 1.6043479e-155 + 0.0000000e+000 + 1.6043479e-155 + 1.8089509e-119 + 1.8585398e-098 + 1.2437931e-083 + 3.2272052e-072 + 5.5867932e-063 + 2.9429191e-055 + 1.1664736e-048 + 6.2357786e-043 + 6.6939032e-038 + 1.9157139e-033 + 1.8010308e-029 + 6.5147142e-026 + 1.0246754e-022 + 7.7175449e-020 + 3.0067262e-017 + 6.4504534e-015 + 8.0204042e-013 + 6.0290263e-011 + 2.8376231e-009 + 8.6096400e-008 + 1.7254342e-006 + 2.3307057e-005 + 2.1579331e-004 + 1.3884565e-003 + 6.2777814e-003 + 2.0121954e-002 + 4.6025740e-002 + 7.5475789e-002 + 8.8977235e-002 + 7.5475789e-002 + 4.6025740e-002 + 2.0121954e-002 + 6.2777814e-003 + 1.3884565e-003 + 2.1579331e-004 + 2.3307057e-005 + 1.7254342e-006 + 8.6096400e-008 + 2.8376231e-009 + 6.0290263e-011 + 8.0204042e-013 + 6.4504534e-015 + 3.0067262e-017 + 1.0827096e-019 + 1.4375373e-022 + 9.1396207e-026 + 2.5267016e-029 + 2.6875928e-033 + 9.3910085e-038 + 8.7482965e-043 + 1.6364687e-048 + 4.1286791e-055 + 7.8378221e-063 + 4.5275096e-072 + 1.7449418e-083 + 2.6073821e-098 + 2.5378128e-119 + 2.2507712e-155 + 0.0000000e+000 + 2.2507712e-155 + 2.5378128e-119 + 2.6073821e-098 + 1.7449418e-083 + 4.5275096e-072 + 7.8378221e-063 + 4.1286791e-055 + 1.6364687e-048 + 8.7482965e-043 + 9.3910085e-038 + 2.6875928e-033 + 2.5267016e-029 + 9.1396207e-026 + 1.4375373e-022 + 1.0827096e-019 + 4.2181954e-017 + 9.0494680e-015 + 1.1251983e-012 + 8.4582397e-011 + 3.9809573e-009 + 1.2078633e-007 + 2.4206456e-006 + 3.2697928e-005 + 3.0274068e-004 + 1.9478929e-003 + 8.8072230e-003 + 2.8229485e-002 + 6.4570417e-002 + 1.0588647e-001 + 1.2482791e-001 + 1.0588647e-001 + 6.4570417e-002 + 2.8229485e-002 + 8.8072230e-003 + 1.9478929e-003 + 3.0274068e-004 + 3.2697928e-005 + 2.4206456e-006 + 1.2078633e-007 + 3.9809573e-009 + 8.4582397e-011 + 1.1251983e-012 + 9.0494680e-015 + 4.2181954e-017 + 1.2741209e-019 + 1.6916784e-022 + 1.0755407e-025 + 2.9733951e-029 + 3.1627301e-033 + 1.1051237e-037 + 1.0294901e-042 + 1.9257787e-048 + 4.8585850e-055 + 9.2234644e-063 + 5.3279244e-072 + 2.0534287e-083 + 3.0683391e-098 + 2.9864707e-119 + 2.6486833e-155 + 0.0000000e+000 + 2.6486833e-155 + 2.9864707e-119 + 3.0683391e-098 + 2.0534287e-083 + 5.3279244e-072 + 9.2234644e-063 + 4.8585850e-055 + 1.9257787e-048 + 1.0294901e-042 + 1.1051237e-037 + 3.1627301e-033 + 2.9733951e-029 + 1.0755407e-025 + 1.6916784e-022 + 1.2741209e-019 + 4.9639267e-017 + 1.0649316e-014 + 1.3241212e-012 + 9.9535650e-011 + 4.6847475e-009 + 1.4214005e-007 + 2.8485896e-006 + 3.8478569e-005 + 3.5626196e-004 + 2.2922594e-003 + 1.0364245e-002 + 3.3220153e-002 + 7.5985769e-002 + 1.2460605e-001 + 1.4689614e-001 + 1.2460605e-001 + 7.5985769e-002 + 3.3220153e-002 + 1.0364245e-002 + 2.2922594e-003 + 3.5626196e-004 + 3.8478569e-005 + 2.8485896e-006 + 1.4214005e-007 + 4.6847475e-009 + 9.9535650e-011 + 1.3241212e-012 + 1.0649316e-014 + 4.9639267e-017 + 1.2530205e-019 + 1.6636630e-022 + 1.0577290e-025 + 2.9241535e-029 + 3.1103530e-033 + 1.0868221e-037 + 1.0124410e-042 + 1.8938864e-048 + 4.7781233e-055 + 9.0707171e-063 + 5.2396901e-072 + 2.0194224e-083 + 3.0175251e-098 + 2.9370126e-119 + 2.6048191e-155 + 0.0000000e+000 + 2.6048191e-155 + 2.9370126e-119 + 3.0175251e-098 + 2.0194224e-083 + 5.2396901e-072 + 9.0707171e-063 + 4.7781233e-055 + 1.8938864e-048 + 1.0124410e-042 + 1.0868221e-037 + 3.1103530e-033 + 2.9241535e-029 + 1.0577290e-025 + 1.6636630e-022 + 1.2530205e-019 + 4.8817205e-017 + 1.0472956e-014 + 1.3021928e-012 + 9.7887267e-011 + 4.6071647e-009 + 1.3978611e-007 + 2.8014149e-006 + 3.7841335e-005 + 3.5036200e-004 + 2.2542979e-003 + 1.0192605e-002 + 3.2670003e-002 + 7.4727389e-002 + 1.2254249e-001 + 1.4446343e-001 + 1.2254249e-001 + 7.4727389e-002 + 3.2670003e-002 + 1.0192605e-002 + 2.2542979e-003 + 3.5036200e-004 + 3.7841335e-005 + 2.8014149e-006 + 1.3978611e-007 + 4.6071647e-009 + 9.7887267e-011 + 1.3021928e-012 + 1.0472956e-014 + 4.8817205e-017 + 1.1063121e-019 + 1.4688749e-022 + 9.3388598e-026 + 2.5817824e-029 + 2.7461809e-033 + 9.5957276e-038 + 8.9390049e-043 + 1.6721429e-048 + 4.2186822e-055 + 8.0086826e-063 + 4.6262070e-072 + 1.7829806e-083 + 2.6642217e-098 + 2.5931358e-119 + 2.2998369e-155 + 0.0000000e+000 + 2.2998369e-155 + 2.5931358e-119 + 2.6642217e-098 + 1.7829806e-083 + 4.6262070e-072 + 8.0086826e-063 + 4.2186822e-055 + 1.6721429e-048 + 8.9390049e-043 + 9.5957276e-038 + 2.7461809e-033 + 2.5817824e-029 + 9.3388598e-026 + 1.4688749e-022 + 1.1063121e-019 + 4.3101498e-017 + 9.2467418e-015 + 1.1497270e-012 + 8.6426249e-011 + 4.0677401e-009 + 1.2341941e-007 + 2.4734145e-006 + 3.3410726e-005 + 3.0934027e-004 + 1.9903560e-003 + 8.9992159e-003 + 2.8844874e-002 + 6.5978019e-002 + 1.0819474e-001 + 1.2754910e-001 + 1.0819474e-001 + 6.5978019e-002 + 2.8844874e-002 + 8.9992159e-003 + 1.9903560e-003 + 3.0934027e-004 + 3.3410726e-005 + 2.4734145e-006 + 1.2341941e-007 + 4.0677401e-009 + 8.6426249e-011 + 1.1497270e-012 + 9.2467418e-015 + 4.3101498e-017 + 9.4273300e-020 + 1.2516874e-022 + 7.9580179e-026 + 2.2000405e-029 + 2.3401312e-033 + 8.1769053e-038 + 7.6172855e-043 + 1.4249002e-048 + 3.5949087e-055 + 6.8245205e-063 + 3.9421770e-072 + 1.5193495e-083 + 2.2702904e-098 + 2.2097153e-119 + 1.9597835e-155 + 0.0000000e+000 + 1.9597835e-155 + 2.2097153e-119 + 2.2702904e-098 + 1.5193495e-083 + 3.9421770e-072 + 6.8245205e-063 + 3.5949087e-055 + 1.4249002e-048 + 7.6172855e-043 + 8.1769053e-038 + 2.3401312e-033 + 2.2000405e-029 + 7.9580179e-026 + 1.2516874e-022 + 9.4273300e-020 + 3.6728520e-017 + 7.8795205e-015 + 9.7972863e-013 + 7.3647282e-011 + 3.4662849e-009 + 1.0517065e-007 + 2.1076959e-006 + 2.8470623e-005 + 2.6360128e-004 + 1.6960624e-003 + 7.6685937e-003 + 2.4579877e-002 + 5.6222523e-002 + 9.2197088e-002 + 1.0868972e-001 + 9.2197088e-002 + 5.6222523e-002 + 2.4579877e-002 + 7.6685937e-003 + 1.6960624e-003 + 2.6360128e-004 + 2.8470623e-005 + 2.1076959e-006 + 1.0517065e-007 + 3.4662849e-009 + 7.3647282e-011 + 9.7972863e-013 + 7.8795205e-015 + 3.6728520e-017 + 8.2089970e-020 + 1.0899266e-022 + 6.9295702e-026 + 1.9157202e-029 + 2.0377063e-033 + 7.1201699e-038 + 6.6328721e-043 + 1.2407544e-048 + 3.1303238e-055 + 5.9425594e-063 + 3.4327131e-072 + 1.3229976e-083 + 1.9768914e-098 + 1.9241446e-119 + 1.7065125e-155 + 0.0000000e+000 + 1.7065125e-155 + 1.9241446e-119 + 1.9768914e-098 + 1.3229976e-083 + 3.4327131e-072 + 5.9425594e-063 + 3.1303238e-055 + 1.2407544e-048 + 6.6328721e-043 + 7.1201699e-038 + 2.0377063e-033 + 1.9157202e-029 + 6.9295702e-026 + 1.0899266e-022 + 8.2089970e-020 + 3.1981941e-017 + 6.8612173e-015 + 8.5311424e-013 + 6.4129538e-011 + 3.0183225e-009 + 9.1579006e-008 + 1.8353096e-006 + 2.4791246e-005 + 2.2953499e-004 + 1.4768732e-003 + 6.6775495e-003 + 2.1403317e-002 + 4.8956653e-002 + 8.0282076e-002 + 9.4643292e-002 + 8.0282076e-002 + 4.8956653e-002 + 2.1403317e-002 + 6.6775495e-003 + 1.4768732e-003 + 2.2953499e-004 + 2.4791246e-005 + 1.8353096e-006 + 9.1579006e-008 + 3.0183225e-009 + 6.4129538e-011 + 8.5311424e-013 + 6.8612173e-015 + 3.1981941e-017 + 7.4523183e-020 + 9.8946071e-023 + 6.2908249e-026 + 1.7391353e-029 + 1.8498771e-033 + 6.4638557e-038 + 6.0214754e-043 + 1.1263857e-048 + 2.8417807e-055 + 5.3947935e-063 + 3.1162967e-072 + 1.2010480e-083 + 1.7946679e-098 + 1.7467832e-119 + 1.5492117e-155 + 0.0000000e+000 + 1.5492117e-155 + 1.7467832e-119 + 1.7946679e-098 + 1.2010480e-083 + 3.1162967e-072 + 5.3947935e-063 + 2.8417807e-055 + 1.1263857e-048 + 6.0214754e-043 + 6.4638557e-038 + 1.8498771e-033 + 1.7391353e-029 + 6.2908249e-026 + 9.8946071e-023 + 7.4523183e-020 + 2.9033949e-017 + 6.2287725e-015 + 7.7447693e-013 + 5.8218285e-011 + 2.7401033e-009 + 8.3137550e-008 + 1.6661367e-006 + 2.2506070e-005 + 2.0837720e-004 + 1.3407398e-003 + 6.0620346e-003 + 1.9430429e-002 + 4.4443987e-002 + 7.2881934e-002 + 8.5919380e-002 + 7.2881934e-002 + 4.4443987e-002 + 1.9430429e-002 + 6.0620346e-003 + 1.3407398e-003 + 2.0837720e-004 + 2.2506070e-005 + 1.6661367e-006 + 8.3137550e-008 + 2.7401033e-009 + 5.8218285e-011 + 7.7447693e-013 + 6.2287725e-015 + 2.9033949e-017 + 6.9965519e-020 + 9.2894761e-023 + 5.9060928e-026 + 1.6327739e-029 + 1.7367430e-033 + 6.0685414e-038 + 5.6532161e-043 + 1.0574986e-048 + 2.6679840e-055 + 5.0648605e-063 + 2.9257113e-072 + 1.1275947e-083 + 1.6849102e-098 + 1.6399540e-119 + 1.4544656e-155 + 0.0000000e+000 + 1.4544656e-155 + 1.6399540e-119 + 1.6849102e-098 + 1.1275947e-083 + 2.9257113e-072 + 5.0648605e-063 + 2.6679840e-055 + 1.0574986e-048 + 5.6532161e-043 + 6.0685414e-038 + 1.7367430e-033 + 1.6327739e-029 + 5.9060928e-026 + 9.2894761e-023 + 6.9965519e-020 + 2.7258301e-017 + 5.8478354e-015 + 7.2711173e-013 + 5.4657791e-011 + 2.5725250e-009 + 7.8053052e-008 + 1.5642397e-006 + 2.1129651e-005 + 1.9563334e-004 + 1.2587433e-003 + 5.6912948e-003 + 1.8242109e-002 + 4.1725897e-002 + 6.8424646e-002 + 8.0664752e-002 + 6.8424646e-002 + 4.1725897e-002 + 1.8242109e-002 + 5.6912948e-003 + 1.2587433e-003 + 1.9563334e-004 + 2.1129651e-005 + 1.5642397e-006 + 7.8053052e-008 + 2.5725250e-009 + 5.4657791e-011 + 7.2711173e-013 + 5.8478354e-015 + 2.7258301e-017 + 6.6826614e-020 + 8.8727168e-023 + 5.6411242e-026 + 1.5595217e-029 + 1.6588264e-033 + 5.7962848e-038 + 5.3995924e-043 + 1.0100554e-048 + 2.5482886e-055 + 4.8376327e-063 + 2.7944534e-072 + 1.0770068e-083 + 1.6093191e-098 + 1.5663798e-119 + 1.3892130e-155 + 0.0000000e+000 + 1.3892130e-155 + 1.5663798e-119 + 1.6093191e-098 + 1.0770068e-083 + 2.7944534e-072 + 4.8376327e-063 + 2.5482886e-055 + 1.0100554e-048 + 5.3995924e-043 + 5.7962848e-038 + 1.6588264e-033 + 1.5595217e-029 + 5.6411242e-026 + 8.8727168e-023 + 6.6826614e-020 + 2.6035395e-017 + 5.5854804e-015 + 6.9449088e-013 + 5.2205646e-011 + 2.4571123e-009 + 7.4551311e-008 + 1.4940623e-006 + 2.0181699e-005 + 1.8685652e-004 + 1.2022716e-003 + 5.4359628e-003 + 1.7423702e-002 + 3.9853923e-002 + 6.5354870e-002 + 7.7045841e-002 + 6.5354870e-002 + 3.9853923e-002 + 1.7423702e-002 + 5.4359628e-003 + 1.2022716e-003 + 1.8685652e-004 + 2.0181699e-005 + 1.4940623e-006 + 7.4551311e-008 + 2.4571123e-009 + 5.2205646e-011 + 6.9449088e-013 + 5.5854804e-015 + 2.6035395e-017 + 6.4145526e-020 + 8.5167428e-023 + 5.4148019e-026 + 1.4969536e-029 + 1.5922742e-033 + 5.5637375e-038 + 5.1829604e-043 + 9.6953190e-049 + 2.4460511e-055 + 4.6435465e-063 + 2.6823397e-072 + 1.0337972e-083 + 1.5447531e-098 + 1.5035365e-119 + 1.3334777e-155 + 0.0000000e+000 + 1.3334777e-155 + 1.5035365e-119 + 1.5447531e-098 + 1.0337972e-083 + 2.6823397e-072 + 4.6435465e-063 + 2.4460511e-055 + 9.6953190e-049 + 5.1829604e-043 + 5.5637375e-038 + 1.5922742e-033 + 1.4969536e-029 + 5.4148019e-026 + 8.5167428e-023 + 6.4145526e-020 + 2.4990854e-017 + 5.3613906e-015 + 6.6662786e-013 + 5.0111152e-011 + 2.3585328e-009 + 7.1560308e-008 + 1.4341204e-006 + 1.9372008e-005 + 1.7935983e-004 + 1.1540363e-003 + 5.2178716e-003 + 1.6724662e-002 + 3.8254981e-002 + 6.2732828e-002 + 7.3954757e-002 + 6.2732828e-002 + 3.8254981e-002 + 1.6724662e-002 + 5.2178716e-003 + 1.1540363e-003 + 1.7935983e-004 + 1.9372008e-005 + 1.4341204e-006 + 7.1560308e-008 + 2.3585328e-009 + 5.0111152e-011 + 6.6662786e-013 + 5.3613906e-015 + 2.4990854e-017 + 6.1518116e-020 + 8.1678958e-023 + 5.1930108e-026 + 1.4356382e-029 + 1.5270544e-033 + 5.3358460e-038 + 4.9706656e-043 + 9.2981973e-049 + 2.3458605e-055 + 4.4533462e-063 + 2.5724707e-072 + 9.9145270e-084 + 1.4814798e-098 + 1.4419515e-119 + 1.2788582e-155 + 0.0000000e+000 + 1.2788582e-155 + 1.4419515e-119 + 1.4814798e-098 + 9.9145270e-084 + 2.5724707e-072 + 4.4533462e-063 + 2.3458605e-055 + 9.2981973e-049 + 4.9706656e-043 + 5.3358460e-038 + 1.5270544e-033 + 1.4356382e-029 + 5.1930108e-026 + 8.1678958e-023 + 6.1518116e-020 + 2.3967224e-017 + 5.1417873e-015 + 6.3932269e-013 + 4.8058592e-011 + 2.2619269e-009 + 6.8629187e-008 + 1.3753786e-006 + 1.8578527e-005 + 1.7201322e-004 + 1.1067668e-003 + 5.0041468e-003 + 1.6039618e-002 + 3.6688051e-002 + 6.0163282e-002 + 7.0925559e-002 + 6.0163282e-002 + 3.6688051e-002 + 1.6039618e-002 + 5.0041468e-003 + 1.1067668e-003 + 1.7201322e-004 + 1.8578527e-005 + 1.3753786e-006 + 6.8629187e-008 + 2.2619269e-009 + 4.8058592e-011 + 6.3932269e-013 + 5.1417873e-015 + 2.3967224e-017 + 5.8845183e-020 + 7.8130046e-023 + 4.9673770e-026 + 1.3732604e-029 + 1.4607046e-033 + 5.1040060e-038 + 4.7546926e-043 + 8.8941951e-049 + 2.2439340e-055 + 4.2598504e-063 + 2.4606981e-072 + 9.4837455e-084 + 1.4171102e-098 + 1.3792994e-119 + 1.2232925e-155 + 0.0000000e+000 + 1.2232925e-155 + 1.3792994e-119 + 1.4171102e-098 + 9.4837455e-084 + 2.4606981e-072 + 4.2598504e-063 + 2.2439340e-055 + 8.8941951e-049 + 4.7546926e-043 + 5.1040060e-038 + 1.4607046e-033 + 1.3732604e-029 + 4.9673770e-026 + 7.8130046e-023 + 5.8845183e-020 + 2.2925860e-017 + 4.9183790e-015 + 6.1154442e-013 + 4.5970469e-011 + 2.1636473e-009 + 6.5647282e-008 + 1.3156191e-006 + 1.7771299e-005 + 1.6453933e-004 + 1.0586783e-003 + 4.7867191e-003 + 1.5342704e-002 + 3.5093973e-002 + 5.7549216e-002 + 6.7843877e-002 + 5.7549216e-002 + 3.5093973e-002 + 1.5342704e-002 + 4.7867191e-003 + 1.0586783e-003 + 1.6453933e-004 + 1.7771299e-005 + 1.3156191e-006 + 6.5647282e-008 + 2.1636473e-009 + 4.5970469e-011 + 6.1154442e-013 + 4.9183790e-015 + 2.2925860e-017 + 5.6141556e-020 + 7.4540381e-023 + 4.7391521e-026 + 1.3101663e-029 + 1.3935929e-033 + 4.8695038e-038 + 4.5362394e-043 + 8.4855536e-049 + 2.1408370e-055 + 4.0641327e-063 + 2.3476419e-072 + 9.0480173e-084 + 1.3520014e-098 + 1.3159278e-119 + 1.1670886e-155 + 0.0000000e+000 + 1.1670886e-155 + 1.3159278e-119 + 1.3520014e-098 + 9.0480173e-084 + 2.3476419e-072 + 4.0641327e-063 + 2.1408370e-055 + 8.4855536e-049 + 4.5362394e-043 + 4.8695038e-038 + 1.3935929e-033 + 1.3101663e-029 + 4.7391521e-026 + 7.4540381e-023 + 5.6141556e-020 + 2.1872537e-017 + 4.6924054e-015 + 5.8344717e-013 + 4.3858367e-011 + 2.0642391e-009 + 6.2631134e-008 + 1.2551733e-006 + 1.6954802e-005 + 1.5697961e-004 + 1.0100376e-003 + 4.5667945e-003 + 1.4637787e-002 + 3.3481589e-002 + 5.4905132e-002 + 6.4726808e-002 + 5.4905132e-002 + 3.3481589e-002 + 1.4637787e-002 + 4.5667945e-003 + 1.0100376e-003 + 1.5697961e-004 + 1.6954802e-005 + 1.2551733e-006 + 6.2631134e-008 + 2.0642391e-009 + 4.3858367e-011 + 5.8344717e-013 + 4.6924054e-015 + 2.1872537e-017 + 5.3377134e-020 + 7.0869997e-023 + 4.5057953e-026 + 1.2456534e-029 + 1.3249721e-033 + 4.6297284e-038 + 4.3128741e-043 + 8.0677232e-049 + 2.0354218e-055 + 3.8640139e-063 + 2.2320435e-072 + 8.6024910e-084 + 1.2854286e-098 + 1.2511312e-119 + 1.1096209e-155 + 0.0000000e+000 + 1.1096209e-155 + 1.2511312e-119 + 1.2854286e-098 + 8.6024910e-084 + 2.2320435e-072 + 3.8640139e-063 + 2.0354218e-055 + 8.0677232e-049 + 4.3128741e-043 + 4.6297284e-038 + 1.3249721e-033 + 1.2456534e-029 + 4.5057953e-026 + 7.0869997e-023 + 5.3377134e-020 + 2.0795529e-017 + 4.4613504e-015 + 5.5471811e-013 + 4.1698772e-011 + 1.9625955e-009 + 5.9547164e-008 + 1.1933683e-006 + 1.6119944e-005 + 1.4924990e-004 + 9.6030318e-004 + 4.3419246e-003 + 1.3917020e-002 + 3.1832949e-002 + 5.2201592e-002 + 6.1539646e-002 + 5.2201592e-002 + 3.1832949e-002 + 1.3917020e-002 + 4.3419246e-003 + 9.6030318e-004 + 1.4924990e-004 + 1.6119944e-005 + 1.1933683e-006 + 5.9547164e-008 + 1.9625955e-009 + 4.1698772e-011 + 5.5471811e-013 + 4.4613504e-015 + 2.0795529e-017 + 5.0539012e-020 + 6.7101760e-023 + 4.2662171e-026 + 1.1794206e-029 + 1.2545219e-033 + 4.3835605e-038 + 4.0835537e-043 + 7.6387533e-049 + 1.9271961e-055 + 3.6585600e-063 + 2.1133633e-072 + 8.1450869e-084 + 1.2170809e-098 + 1.1846072e-119 + 1.0506211e-155 + 0.0000000e+000 + 1.0506211e-155 + 1.1846072e-119 + 1.2170809e-098 + 8.1450869e-084 + 2.1133633e-072 + 3.6585600e-063 + 1.9271961e-055 + 7.6387533e-049 + 4.0835537e-043 + 4.3835605e-038 + 1.2545219e-033 + 1.1794206e-029 + 4.2662171e-026 + 6.7101760e-023 + 5.0539012e-020 + 1.9689807e-017 + 4.2241354e-015 + 5.2522313e-013 + 3.9481602e-011 + 1.8582421e-009 + 5.6380974e-008 + 1.1299156e-006 + 1.5262828e-005 + 1.4131412e-004 + 9.0924278e-004 + 4.1110596e-003 + 1.3177036e-002 + 3.0140355e-002 + 4.9425975e-002 + 5.8267514e-002 + 4.9425975e-002 + 3.0140355e-002 + 1.3177036e-002 + 4.1110596e-003 + 9.0924278e-004 + 1.4131412e-004 + 1.5262828e-005 + 1.1299156e-006 + 5.6380974e-008 + 1.8582421e-009 + 3.9481602e-011 + 5.2522313e-013 + 4.2241354e-015 + 1.9689807e-017 + 4.7690623e-020 + 6.3319891e-023 + 4.0257722e-026 + 1.1129482e-029 + 1.1838168e-033 + 4.1365022e-038 + 3.8534038e-043 + 7.2082315e-049 + 1.8185789e-055 + 3.4523628e-063 + 1.9942537e-072 + 7.6860281e-084 + 1.1484860e-098 + 1.1178425e-119 + 9.9140790e-156 + 0.0000000e+000 + 9.9140790e-156 + 1.1178425e-119 + 1.1484860e-098 + 7.6860281e-084 + 1.9942537e-072 + 3.4523628e-063 + 1.8185789e-055 + 7.2082315e-049 + 3.8534038e-043 + 4.1365022e-038 + 1.1838168e-033 + 1.1129482e-029 + 4.0257722e-026 + 6.3319891e-023 + 4.7690623e-020 + 1.8580086e-017 + 3.9860622e-015 + 4.9562144e-013 + 3.7256410e-011 + 1.7535112e-009 + 5.3203331e-008 + 1.0662333e-006 + 1.4402612e-005 + 1.3334963e-004 + 8.5799767e-004 + 3.8793594e-003 + 1.2434376e-002 + 2.8441639e-002 + 4.6640317e-002 + 5.4983545e-002 + 4.6640317e-002 + 2.8441639e-002 + 1.2434376e-002 + 3.8793594e-003 + 8.5799767e-004 + 1.3334963e-004 + 1.4402612e-005 + 1.0662333e-006 + 5.3203331e-008 + 1.7535112e-009 + 3.7256410e-011 + 4.9562144e-013 + 3.9860622e-015 + 1.8580086e-017 + 4.4879649e-020 + 5.9587698e-023 + 3.7884857e-026 + 1.0473490e-029 + 1.1140404e-033 + 3.8926890e-038 + 3.6262769e-043 + 6.7833649e-049 + 1.7113885e-055 + 3.2488741e-063 + 1.8767086e-072 + 7.2329993e-084 + 1.0807921e-098 + 1.0519548e-119 + 9.3297247e-156 + 0.0000000e+000 + 9.3297247e-156 + 1.0519548e-119 + 1.0807921e-098 + 7.2329993e-084 + 1.8767086e-072 + 3.2488741e-063 + 1.7113885e-055 + 6.7833649e-049 + 3.6262769e-043 + 3.8926890e-038 + 1.1140404e-033 + 1.0473490e-029 + 3.7884857e-026 + 5.9587698e-023 + 4.4879649e-020 + 1.7484941e-017 + 3.7511163e-015 + 4.6640859e-013 + 3.5060448e-011 + 1.6501560e-009 + 5.0067427e-008 + 1.0033875e-006 + 1.3553695e-005 + 1.2548975e-004 + 8.0742568e-004 + 3.6507027e-003 + 1.1701470e-002 + 2.6765235e-002 + 4.3891249e-002 + 5.1742712e-002 + 4.3891249e-002 + 2.6765235e-002 + 1.1701470e-002 + 3.6507027e-003 + 8.0742568e-004 + 1.2548975e-004 + 1.3553695e-005 + 1.0033875e-006 + 5.0067427e-008 + 1.6501560e-009 + 3.5060448e-011 + 4.6640859e-013 + 3.7511163e-015 + 1.7484941e-017 + 4.2140800e-020 + 5.5951268e-023 + 3.5572876e-026 + 9.8343294e-030 + 1.0460544e-033 + 3.6551317e-038 + 3.4049779e-043 + 6.3693998e-049 + 1.6069484e-055 + 3.0506066e-063 + 1.7621797e-072 + 6.7915945e-084 + 1.0148351e-098 + 9.8775762e-120 + 8.7603641e-156 + 0.0000000e+000 + 8.7603641e-156 + 9.8775762e-120 + 1.0148351e-098 + 6.7915945e-084 + 1.7621797e-072 + 3.0506066e-063 + 1.6069484e-055 + 6.3693998e-049 + 3.4049779e-043 + 3.6551317e-038 + 1.0460544e-033 + 9.8343294e-030 + 3.5572876e-026 + 5.5951268e-023 + 4.2140800e-020 + 1.6417896e-017 + 3.5221987e-015 + 4.3794530e-013 + 3.2920831e-011 + 1.5494527e-009 + 4.7011987e-008 + 9.4215427e-007 + 1.2726560e-005 + 1.1783155e-004 + 7.5815131e-004 + 3.4279130e-003 + 1.0987370e-002 + 2.5131846e-002 + 4.1212719e-002 + 4.8585034e-002 + 4.1212719e-002 + 2.5131846e-002 + 1.0987370e-002 + 3.4279130e-003 + 7.5815131e-004 + 1.1783155e-004 + 1.2726560e-005 + 9.4215427e-007 + 4.7011987e-008 + 1.5494527e-009 + 3.2920831e-011 + 4.3794530e-013 + 3.5221987e-015 + 1.6417896e-017 + 3.9498452e-020 + 5.2442965e-023 + 3.3342355e-026 + 9.2176889e-030 + 9.8046380e-034 + 3.4259446e-038 + 3.1914761e-043 + 5.9700203e-049 + 1.5061882e-055 + 2.8593249e-063 + 1.6516860e-072 + 6.3657422e-084 + 9.5120205e-099 + 9.2582241e-120 + 8.2110643e-156 + 0.0000000e+000 + 8.2110643e-156 + 9.2582241e-120 + 9.5120205e-099 + 6.3657422e-084 + 1.6516860e-072 + 2.8593249e-063 + 1.5061882e-055 + 5.9700203e-049 + 3.1914761e-043 + 3.4259446e-038 + 9.8046380e-034 + 9.2176889e-030 + 3.3342355e-026 + 5.2442965e-023 + 3.9498452e-020 + 1.5388447e-017 + 3.3013468e-015 + 4.1048488e-013 + 3.0856601e-011 + 1.4522976e-009 + 4.4064201e-008 + 8.8307851e-007 + 1.1928569e-005 + 1.1044317e-004 + 7.1061306e-004 + 3.2129731e-003 + 1.0298431e-002 + 2.3556008e-002 + 3.8628564e-002 + 4.5538614e-002 + 3.8628564e-002 + 2.3556008e-002 + 1.0298431e-002 + 3.2129731e-003 + 7.1061306e-004 + 1.1044317e-004 + 1.1928569e-005 + 8.8307851e-007 + 4.4064201e-008 + 1.4522976e-009 + 3.0856601e-011 + 4.1048488e-013 + 3.3013468e-015 + 1.5388447e-017 + 3.6968878e-020 + 4.9084393e-023 + 3.1207032e-026 + 8.6273664e-030 + 9.1767258e-034 + 3.2065390e-038 + 2.9870864e-043 + 5.5876861e-049 + 1.4097283e-055 + 2.6762070e-063 + 1.5459081e-072 + 5.9580650e-084 + 8.9028482e-099 + 8.6653056e-120 + 7.6852084e-156 + 0.0000000e+000 + 7.6852084e-156 + 8.6653056e-120 + 8.9028482e-099 + 5.9580650e-084 + 1.5459081e-072 + 2.6762070e-063 + 1.4097283e-055 + 5.5876861e-049 + 2.9870864e-043 + 3.2065390e-038 + 9.1767258e-034 + 8.6273664e-030 + 3.1207032e-026 + 4.9084393e-023 + 3.6968878e-020 + 1.4402934e-017 + 3.0899208e-015 + 3.8419646e-013 + 2.8880472e-011 + 1.3592890e-009 + 4.1242226e-008 + 8.2652408e-007 + 1.1164635e-005 + 1.0337013e-004 + 6.6510372e-004 + 3.0072067e-003 + 9.6388951e-003 + 2.2047425e-002 + 3.6154700e-002 + 4.2622214e-002 + 3.6154700e-002 + 2.2047425e-002 + 9.6388951e-003 + 3.0072067e-003 + 6.6510372e-004 + 1.0337013e-004 + 1.1164635e-005 + 8.2652408e-007 + 4.1242226e-008 + 1.3592890e-009 + 2.8880472e-011 + 3.8419646e-013 + 3.0899208e-015 + 1.4402934e-017 + 3.4562089e-020 + 4.5888847e-023 + 2.9175358e-026 + 8.0656981e-030 + 8.5792926e-034 + 2.9977834e-038 + 2.7926179e-043 + 5.2239104e-049 + 1.3179506e-055 + 2.5019776e-063 + 1.4452647e-072 + 5.5701766e-084 + 8.3232452e-099 + 8.1011673e-120 + 7.1848775e-156 + 0.0000000e+000 + 7.1848775e-156 + 8.1011673e-120 + 8.3232452e-099 + 5.5701766e-084 + 1.4452647e-072 + 2.5019776e-063 + 1.3179506e-055 + 5.2239104e-049 + 2.7926179e-043 + 2.9977834e-038 + 8.5792926e-034 + 8.0656981e-030 + 2.9175358e-026 + 4.5888847e-023 + 3.4562089e-020 + 1.3465259e-017 + 2.8887574e-015 + 3.5918408e-013 + 2.7000263e-011 + 1.2707951e-009 + 3.8557229e-008 + 7.7271480e-007 + 1.0437783e-005 + 9.6640417e-005 + 6.2180341e-004 + 2.8114283e-003 + 9.0113732e-003 + 2.0612070e-002 + 3.3800917e-002 + 3.9847376e-002 + 3.3800917e-002 + 2.0612070e-002 + 9.0113732e-003 + 2.8114283e-003 + 6.2180341e-004 + 9.6640417e-005 + 1.0437783e-005 + 7.7271480e-007 + 3.8557229e-008 + 1.2707951e-009 + 2.7000263e-011 + 3.5918408e-013 + 2.8887574e-015 + 1.3465259e-017 + 3.2283326e-020 + 4.2863284e-023 + 2.7251755e-026 + 7.5339070e-030 + 8.0136389e-034 + 2.8001322e-038 + 2.6084937e-043 + 4.8794853e-049 + 1.2310549e-055 + 2.3370161e-063 + 1.3499749e-072 + 5.2029212e-084 + 7.7744734e-099 + 7.5670376e-120 + 6.7111610e-156 + 0.0000000e+000 + 6.7111610e-156 + 7.5670376e-120 + 7.7744734e-099 + 5.2029212e-084 + 1.3499749e-072 + 2.3370161e-063 + 1.2310549e-055 + 4.8794853e-049 + 2.6084937e-043 + 2.8001322e-038 + 8.0136389e-034 + 7.5339070e-030 + 2.7251755e-026 + 4.2863284e-023 + 3.2283326e-020 + 1.2577461e-017 + 2.6982945e-015 + 3.3550220e-013 + 2.5220070e-011 + 1.1870085e-009 + 3.6015057e-008 + 7.2176783e-007 + 9.7495942e-006 + 9.0268678e-005 + 5.8080640e-004 + 2.6260639e-003 + 8.4172314e-003 + 1.9253066e-002 + 3.1572340e-002 + 3.7220141e-002 + 3.1572340e-002 + 1.9253066e-002 + 8.4172314e-003 + 2.6260639e-003 + 5.8080640e-004 + 9.0268678e-005 + 9.7495942e-006 + 7.2176783e-007 + 3.6015057e-008 + 1.1870085e-009 + 2.5220070e-011 + 3.3550220e-013 + 2.6982945e-015 + 1.2577461e-017 + 3.0134247e-020 + 4.0009903e-023 + 2.5437624e-026 + 7.0323798e-030 + 7.4801763e-034 + 2.6137293e-038 + 2.4348480e-043 + 4.5546612e-049 + 1.1491044e-055 + 2.1814425e-063 + 1.2601079e-072 + 4.8565662e-084 + 7.2569318e-099 + 7.0633050e-120 + 6.2644035e-156 + 0.0000000e+000 + 6.2644035e-156 + 7.0633050e-120 + 7.2569318e-099 + 4.8565662e-084 + 1.2601079e-072 + 2.1814425e-063 + 1.1491044e-055 + 4.5546612e-049 + 2.4348480e-043 + 2.6137293e-038 + 7.4801763e-034 + 7.0323798e-030 + 2.5437624e-026 + 4.0009903e-023 + 3.0134247e-020 + 1.1740188e-017 + 2.5186709e-015 + 3.1316804e-013 + 2.3541187e-011 + 1.1079901e-009 + 3.3617558e-008 + 6.7372023e-007 + 9.1005702e-006 + 8.4259552e-005 + 5.4214250e-004 + 2.4512486e-003 + 7.8569019e-003 + 1.7971402e-002 + 2.9470590e-002 + 3.4742421e-002 + 2.9470590e-002 + 1.7971402e-002 + 7.8569019e-003 + 2.4512486e-003 + 5.4214250e-004 + 8.4259552e-005 + 9.1005702e-006 + 6.7372023e-007 + 3.3617558e-008 + 1.1079901e-009 + 2.3541187e-011 + 3.1316804e-013 + 2.5186709e-015 + 1.1740188e-017 + 2.8113867e-020 + 3.7327401e-023 + 2.3732134e-026 + 6.5608871e-030 + 6.9786606e-034 + 2.4384893e-038 + 2.2716013e-043 + 4.2492895e-049 + 1.0720616e-055 + 2.0351856e-063 + 1.1756228e-072 + 4.5309530e-084 + 6.7703838e-099 + 6.5897389e-120 + 5.8444005e-156 + 0.0000000e+000 + 5.8444005e-156 + 6.5897389e-120 + 6.7703838e-099 + 4.5309530e-084 + 1.1756228e-072 + 2.0351856e-063 + 1.0720616e-055 + 4.2492895e-049 + 2.2716013e-043 + 2.4384893e-038 + 6.9786606e-034 + 6.5608871e-030 + 2.3732134e-026 + 3.7327401e-023 + 2.8113867e-020 + 1.0953056e-017 + 2.3498041e-015 + 2.9217138e-013 + 2.1962845e-011 + 1.0337038e-009 + 3.1363637e-008 + 6.2855000e-007 + 8.4904137e-006 + 7.8610289e-005 + 5.0579403e-004 + 2.2869023e-003 + 7.3301283e-003 + 1.6766492e-002 + 2.7494706e-002 + 3.2413082e-002 + 2.7494706e-002 + 1.6766492e-002 + 7.3301283e-003 + 2.2869023e-003 + 5.0579403e-004 + 7.8610289e-005 + 8.4904137e-006 + 6.2855000e-007 + 3.1363637e-008 + 1.0337038e-009 + 2.1962845e-011 + 2.9217138e-013 + 2.3498041e-015 + 1.0953056e-017 + 2.6219301e-020 + 3.4811943e-023 + 2.2132848e-026 + 6.1187553e-030 + 6.5083754e-034 + 2.2741618e-038 + 2.1185203e-043 + 3.9629340e-049 + 9.9981642e-056 + 1.8980364e-063 + 1.0963987e-072 + 4.2256165e-084 + 6.3141342e-099 + 6.1456627e-120 + 5.4505520e-156 + 0.0000000e+000 + 5.4505520e-156 + 6.1456627e-120 + 6.3141342e-099 + 4.2256165e-084 + 1.0963987e-072 + 1.8980364e-063 + 9.9981642e-056 + 3.9629340e-049 + 2.1185203e-043 + 2.2741618e-038 + 6.5083754e-034 + 6.1187553e-030 + 2.2132848e-026 + 3.4811943e-023 + 2.6219301e-020 + 1.0214940e-017 + 2.1914531e-015 + 2.7248224e-013 + 2.0482790e-011 + 9.6404354e-010 + 2.9250072e-008 + 5.8619263e-007 + 7.9182529e-006 + 7.3312818e-005 + 4.7170906e-004 + 2.1327902e-003 + 6.8361581e-003 + 1.5636614e-002 + 2.5641865e-002 + 3.0228796e-002 + 2.5641865e-002 + 1.5636614e-002 + 6.8361581e-003 + 2.1327902e-003 + 4.7170906e-004 + 7.3312818e-005 + 7.9182529e-006 + 5.8619263e-007 + 2.9250072e-008 + 9.6404354e-010 + 2.0482790e-011 + 2.7248224e-013 + 2.1914531e-015 + 1.0214940e-017 + 2.4446330e-020 + 3.2457931e-023 + 2.0636207e-026 + 5.7050001e-030 + 6.0682738e-034 + 2.1203812e-038 + 1.9752642e-043 + 3.6949572e-049 + 9.3220802e-056 + 1.7696896e-063 + 1.0222593e-072 + 3.9398769e-084 + 5.8871673e-099 + 5.7300880e-120 + 5.0819813e-156 + 0.0000000e+000 + 5.0819813e-156 + 5.7300880e-120 + 5.8871673e-099 + 3.9398769e-084 + 1.0222593e-072 + 1.7696896e-063 + 9.3220802e-056 + 3.6949572e-049 + 1.9752642e-043 + 2.1203812e-038 + 6.0682738e-034 + 5.7050001e-030 + 2.0636207e-026 + 3.2457931e-023 + 2.4446330e-020 + 9.5241976e-018 + 2.0432653e-015 + 2.5405677e-013 + 1.9097728e-011 + 8.9885414e-010 + 2.7272158e-008 + 5.4655381e-007 + 7.3828142e-006 + 6.8355346e-005 + 4.3981171e-004 + 1.9885692e-003 + 6.3738915e-003 + 1.4579254e-002 + 2.3907941e-002 + 2.8184700e-002 + 2.3907941e-002 + 1.4579254e-002 + 6.3738915e-003 + 1.9885692e-003 + 4.3981171e-004 + 6.8355346e-005 + 7.3828142e-006 + 5.4655381e-007 + 2.7272158e-008 + 8.9885414e-010 + 1.9097728e-011 + 2.5405677e-013 + 2.0432653e-015 + 9.5241976e-018 + 2.2789848e-020 + 3.0258583e-023 + 1.9237899e-026 + 5.3184295e-030 + 5.6570878e-034 + 1.9767042e-038 + 1.8414204e-043 + 3.4445870e-049 + 8.6904164e-056 + 1.6497755e-063 + 9.5299108e-073 + 3.6729110e-084 + 5.4882531e-099 + 5.3418175e-120 + 4.7376264e-156 + 0.0000000e+000 + 4.7376264e-156 + 5.3418175e-120 + 5.4882531e-099 + 3.6729110e-084 + 9.5299108e-073 + 1.6497755e-063 + 8.6904164e-056 + 3.4445870e-049 + 1.8414204e-043 + 1.9767042e-038 + 5.6570878e-034 + 5.3184295e-030 + 1.9237899e-026 + 3.0258583e-023 + 2.2789848e-020 + 8.8788383e-018 + 1.9048137e-015 + 2.3684189e-013 + 1.7803666e-011 + 8.3794781e-010 + 2.5424198e-008 + 5.0951934e-007 + 6.8825550e-006 + 6.3723590e-005 + 4.1001009e-004 + 1.8538238e-003 + 5.9419968e-003 + 1.3591364e-002 + 2.2287940e-002 + 2.6274906e-002 + 2.2287940e-002 + 1.3591364e-002 + 5.9419968e-003 + 1.8538238e-003 + 4.1001009e-004 + 6.3723590e-005 + 6.8825550e-006 + 5.0951934e-007 + 2.5424198e-008 + 8.3794781e-010 + 1.7803666e-011 + 2.3684189e-013 + 1.9048137e-015 + 8.8788383e-018 + 2.1244191e-020 + 2.8206380e-023 + 1.7933142e-026 + 4.9577219e-030 + 5.2734117e-034 + 1.8426398e-038 + 1.7165312e-043 + 3.2109676e-049 + 8.1010134e-056 + 1.5378841e-063 + 8.8835714e-073 + 3.4238061e-084 + 5.1160278e-099 + 4.9795237e-120 + 4.4163102e-156 + 0.0000000e+000 + 4.4163102e-156 + 4.9795237e-120 + 5.1160278e-099 + 3.4238061e-084 + 8.8835714e-073 + 1.5378841e-063 + 8.1010134e-056 + 3.2109676e-049 + 1.7165312e-043 + 1.8426398e-038 + 5.2734117e-034 + 4.9577219e-030 + 1.7933142e-026 + 2.8206380e-023 + 2.1244191e-020 + 8.2766560e-018 + 1.7756251e-015 + 2.2077876e-013 + 1.6596183e-011 + 7.8111636e-010 + 2.3699873e-008 + 4.7496262e-007 + 6.4157651e-006 + 5.9401717e-005 + 3.8220231e-004 + 1.7280934e-003 + 5.5389976e-003 + 1.2669568e-002 + 2.0776323e-002 + 2.4492884e-002 + 2.0776323e-002 + 1.2669568e-002 + 5.5389976e-003 + 1.7280934e-003 + 3.8220231e-004 + 5.9401717e-005 + 6.4157651e-006 + 4.7496262e-007 + 2.3699873e-008 + 7.8111636e-010 + 1.6596183e-011 + 2.2077876e-013 + 1.7756251e-015 + 8.2766560e-018 + 1.9803394e-020 + 2.6293403e-023 + 1.6716904e-026 + 4.6214857e-030 + 4.9157652e-034 + 1.7176707e-038 + 1.6001149e-043 + 2.9931975e-049 + 7.5515968e-056 + 1.4335837e-063 + 8.2810813e-073 + 3.1916011e-084 + 4.7690551e-099 + 4.6418089e-120 + 4.1167929e-156 + 0.0000000e+000 + 4.1167929e-156 + 4.6418089e-120 + 4.7690551e-099 + 3.1916011e-084 + 8.2810813e-073 + 1.4335837e-063 + 7.5515968e-056 + 2.9931975e-049 + 1.6001149e-043 + 1.7176707e-038 + 4.9157652e-034 + 4.6214857e-030 + 1.6716904e-026 + 2.6293403e-023 + 1.9803394e-020 + 7.7153273e-018 + 1.6552009e-015 + 2.0580538e-013 + 1.5470618e-011 + 7.2814049e-010 + 2.2092531e-008 + 4.4275032e-007 + 5.9806433e-006 + 5.5373050e-005 + 3.5628107e-004 + 1.6108929e-003 + 5.1633388e-003 + 1.1810309e-002 + 1.9367258e-002 + 2.2831759e-002 + 1.9367258e-002 + 1.1810309e-002 + 5.1633388e-003 + 1.6108929e-003 + 3.5628107e-004 + 5.5373050e-005 + 5.9806433e-006 + 4.4275032e-007 + 2.2092531e-008 + 7.2814049e-010 + 1.5470618e-011 + 2.0580538e-013 + 1.6552009e-015 + 7.7153273e-018 + 1.8461382e-020 + 2.4511584e-023 + 1.5584053e-026 + 4.3083025e-030 + 4.5826396e-034 + 1.6012697e-038 + 1.4916802e-043 + 2.7903581e-049 + 7.0398495e-056 + 1.3364344e-063 + 7.7198991e-073 + 2.9753166e-084 + 4.4458716e-099 + 4.3272485e-120 + 3.8378111e-156 + 0.0000000e+000 + 3.8378111e-156 + 4.3272485e-120 + 4.4458716e-099 + 2.9753166e-084 + 7.7198991e-073 + 1.3364344e-063 + 7.0398495e-056 + 2.7903581e-049 + 1.4916802e-043 + 1.6012697e-038 + 4.5826396e-034 + 4.3083025e-030 + 1.5584053e-026 + 2.4511584e-023 + 1.8461382e-020 + 7.1924845e-018 + 1.5430333e-015 + 1.9185862e-013 + 1.4422224e-011 + 6.7879676e-010 + 2.0595391e-008 + 4.1274656e-007 + 5.5753544e-006 + 5.1620597e-005 + 3.3213705e-004 + 1.5017279e-003 + 4.8134360e-003 + 1.1009962e-002 + 1.8054801e-002 + 2.1284525e-002 + 1.8054801e-002 + 1.1009962e-002 + 4.8134360e-003 + 1.5017279e-003 + 3.3213705e-004 + 5.1620597e-005 + 5.5753544e-006 + 4.1274656e-007 + 2.0595391e-008 + 6.7879676e-010 + 1.4422224e-011 + 1.9185862e-013 + 1.5430333e-015 + 7.1924845e-018 + 1.7212102e-020 + 2.2852887e-023 + 1.4529482e-026 + 4.0167601e-030 + 4.2725329e-034 + 1.4929119e-038 + 1.3907384e-043 + 2.6015349e-049 + 6.5634636e-056 + 1.2459980e-063 + 7.1974943e-073 + 2.7739772e-084 + 4.1450199e-099 + 4.0344240e-120 + 3.5781068e-156 + 0.0000000e+000 + 3.5781068e-156 + 4.0344240e-120 + 4.1450199e-099 + 2.7739772e-084 + 7.1974943e-073 + 1.2459980e-063 + 6.5634636e-056 + 2.6015349e-049 + 1.3907384e-043 + 1.4929119e-038 + 4.2725329e-034 + 4.0167601e-030 + 1.4529482e-026 + 2.2852887e-023 + 1.7212102e-020 + 6.7057698e-018 + 1.4386164e-015 + 1.7887556e-013 + 1.3446273e-011 + 6.3286265e-010 + 1.9201703e-008 + 3.8481604e-007 + 5.1980707e-006 + 4.8127436e-005 + 3.0966137e-004 + 1.4001061e-003 + 4.4877113e-003 + 1.0264919e-002 + 1.6833035e-002 + 1.9844203e-002 + 1.6833035e-002 + 1.0264919e-002 + 4.4877113e-003 + 1.4001061e-003 + 3.0966137e-004 + 4.8127436e-005 + 5.1980707e-006 + 3.8481604e-007 + 1.9201703e-008 + 6.3286265e-010 + 1.3446273e-011 + 1.7887556e-013 + 1.4386164e-015 + 6.7057698e-018 + 1.6049627e-020 + 2.1309444e-023 + 1.3548186e-026 + 3.7454753e-030 + 3.9839736e-034 + 1.3920833e-038 + 1.2968104e-043 + 2.4258318e-049 + 6.1201789e-056 + 1.1618455e-063 + 6.7113883e-073 + 2.5866277e-084 + 3.8650726e-099 + 3.7619461e-120 + 3.3364478e-156 + 0.0000000e+000 + 3.3364478e-156 + 3.7619461e-120 + 3.8650726e-099 + 2.5866277e-084 + 6.7113883e-073 + 1.1618455e-063 + 6.1201789e-056 + 2.4258318e-049 + 1.2968104e-043 + 1.3920833e-038 + 3.9839736e-034 + 3.7454753e-030 + 1.3548186e-026 + 2.1309444e-023 + 1.6049627e-020 + 6.2528740e-018 + 1.3414548e-015 + 1.6679462e-013 + 1.2538136e-011 + 5.9012023e-010 + 1.7904854e-008 + 3.5882625e-007 + 4.8470022e-006 + 4.4876994e-005 + 2.8874739e-004 + 1.3055454e-003 + 4.1846192e-003 + 9.5716448e-003 + 1.5696161e-002 + 1.8503961e-002 + 1.5696161e-002 + 9.5716448e-003 + 4.1846192e-003 + 1.3055454e-003 + 2.8874739e-004 + 4.4876994e-005 + 4.8470022e-006 + 3.5882625e-007 + 1.7904854e-008 + 5.9012023e-010 + 1.2538136e-011 + 1.6679462e-013 + 1.3414548e-015 + 6.2528740e-018 + 1.4968224e-020 + 1.9873641e-023 + 1.2635327e-026 + 3.4931100e-030 + 3.7155386e-034 + 1.2982865e-038 + 1.2094330e-043 + 2.2623824e-049 + 5.7078091e-056 + 1.0835619e-063 + 6.2591836e-073 + 2.4123441e-084 + 3.6046490e-099 + 3.5084710e-120 + 3.1116423e-156 + 0.0000000e+000 + 3.1116423e-156 + 3.5084710e-120 + 3.6046490e-099 + 2.4123441e-084 + 6.2591836e-073 + 1.0835619e-063 + 5.7078091e-056 + 2.2623824e-049 + 1.2094330e-043 + 1.2982865e-038 + 3.7155386e-034 + 3.4931100e-030 + 1.2635327e-026 + 1.9873641e-023 + 1.4968224e-020 + 5.8315634e-018 + 1.2510693e-015 + 1.5555622e-013 + 1.1693332e-011 + 5.5035869e-010 + 1.6698448e-008 + 3.3464900e-007 + 4.5204175e-006 + 4.1853240e-005 + 2.6929196e-004 + 1.2175794e-003 + 3.9026650e-003 + 8.9267197e-003 + 1.4638574e-002 + 1.7257188e-002 + 1.4638574e-002 + 8.9267197e-003 + 3.9026650e-003 + 1.2175794e-003 + 2.6929196e-004 + 4.1853240e-005 + 4.5204175e-006 + 3.3464900e-007 + 1.6698448e-008 + 5.5035869e-010 + 1.1693332e-011 + 1.5555622e-013 + 1.2510693e-015 + 5.8315634e-018 + 1.3962400e-020 + 1.8538185e-023 + 1.1786267e-026 + 3.2583823e-030 + 3.4658643e-034 + 1.2110451e-038 + 1.1281623e-043 + 2.1103563e-049 + 5.3242596e-056 + 1.0107494e-063 + 5.8385831e-073 + 2.2502410e-084 + 3.3624262e-099 + 3.2727112e-120 + 2.9025482e-156 + 0.0000000e+000 + 2.9025482e-156 + 3.2727112e-120 + 3.3624262e-099 + 2.2502410e-084 + 5.8385831e-073 + 1.0107494e-063 + 5.3242596e-056 + 2.1103563e-049 + 1.1281623e-043 + 1.2110451e-038 + 3.4658643e-034 + 3.2583823e-030 + 1.1786267e-026 + 1.8538185e-023 + 1.3962400e-020 + 5.4396979e-018 + 1.1670008e-015 + 1.4510325e-013 + 1.0907572e-011 + 5.1337605e-010 + 1.5576357e-008 + 3.1216148e-007 + 4.2166575e-006 + 3.9040814e-005 + 2.5119626e-004 + 1.1357613e-003 + 3.6404163e-003 + 8.3268680e-003 + 1.3654901e-002 + 1.6097551e-002 + 1.3654901e-002 + 8.3268680e-003 + 3.6404163e-003 + 1.1357613e-003 + 2.5119626e-004 + 3.9040814e-005 + 4.2166575e-006 + 3.1216148e-007 + 1.5576357e-008 + 5.1337605e-010 + 1.0907572e-011 + 1.4510325e-013 + 1.1670008e-015 + 5.4396979e-018 + 1.3026930e-020 + 1.7296141e-023 + 1.0996596e-026 + 3.0400732e-030 + 3.2336541e-034 + 1.1299060e-038 + 1.0525763e-043 + 1.9689641e-049 + 4.9675383e-056 + 9.4302997e-064 + 5.4474026e-073 + 2.0994766e-084 + 3.1371463e-099 + 3.0534420e-120 + 2.7080797e-156 + 0.0000000e+000 + 2.7080797e-156 + 3.0534420e-120 + 3.1371463e-099 + 2.0994766e-084 + 5.4474026e-073 + 9.4302997e-064 + 4.9675383e-056 + 1.9689641e-049 + 1.0525763e-043 + 1.1299060e-038 + 3.2336541e-034 + 3.0400732e-030 + 1.0996596e-026 + 1.7296141e-023 + 1.3026930e-020 + 5.0752423e-018 + 1.0888126e-015 + 1.3538145e-013 + 1.0176773e-011 + 4.7898025e-010 + 1.4532753e-008 + 2.9124690e-007 + 3.9341447e-006 + 3.6425110e-005 + 2.3436631e-004 + 1.0596662e-003 + 3.3965112e-003 + 7.7689743e-003 + 1.2740033e-002 + 1.5019027e-002 + 1.2740033e-002 + 7.7689743e-003 + 3.3965112e-003 + 1.0596662e-003 + 2.3436631e-004 + 3.6425110e-005 + 3.9341447e-006 + 2.9124690e-007 + 1.4532753e-008 + 4.7898025e-010 + 1.0176773e-011 + 1.3538145e-013 + 1.0888126e-015 + 5.0752423e-018 + 1.2156876e-020 + 1.6140952e-023 + 1.0262146e-026 + 2.8370302e-030 + 3.0176820e-034 + 1.0544409e-038 + 9.8227595e-044 + 1.8374593e-049 + 4.6357622e-056 + 8.8004609e-064 + 5.0835769e-073 + 1.9592550e-084 + 2.9276199e-099 + 2.8495062e-120 + 2.5272102e-156 + 0.0000000e+000 + 2.5272102e-156 + 2.8495062e-120 + 2.9276199e-099 + 1.9592550e-084 + 5.0835769e-073 + 8.8004609e-064 + 4.6357622e-056 + 1.8374593e-049 + 9.8227595e-044 + 1.0544409e-038 + 3.0176820e-034 + 2.8370302e-030 + 1.0262146e-026 + 1.6140952e-023 + 1.2156876e-020 + 4.7362727e-018 + 1.0160921e-015 + 1.2633948e-013 + 9.4970779e-012 + 4.4698972e-010 + 1.3562127e-008 + 2.7179486e-007 + 3.6713877e-006 + 3.3992319e-005 + 2.1871325e-004 + 9.8889233e-004 + 3.1696622e-003 + 7.2500935e-003 + 1.1889141e-002 + 1.4015924e-002 + 1.1889141e-002 + 7.2500935e-003 + 3.1696622e-003 + 9.8889233e-004 + 2.1871325e-004 + 3.3992319e-005 + 3.6713877e-006 + 2.7179486e-007 + 1.3562127e-008 + 4.4698972e-010 + 9.4970779e-012 + 1.2633948e-013 + 1.0160921e-015 + 4.7362727e-018 + 1.1347592e-020 + 1.5066448e-023 + 9.5789945e-027 + 2.6481690e-030 + 2.8167948e-034 + 9.8424673e-039 + 9.1688579e-044 + 1.7151395e-049 + 4.3271593e-056 + 8.2146138e-064 + 4.7451629e-073 + 1.8288273e-084 + 2.7327281e-099 + 2.6598144e-120 + 2.3589737e-156 + 0.0000000e+000 + 2.3589737e-156 + 2.6598144e-120 + 2.7327281e-099 + 1.8288273e-084 + 4.7451629e-073 + 8.2146138e-064 + 4.3271593e-056 + 1.7151395e-049 + 9.1688579e-044 + 9.8424673e-039 + 2.8167948e-034 + 2.6481690e-030 + 9.5789945e-027 + 1.5066448e-023 + 1.1347592e-020 + 4.4209789e-018 + 9.4845078e-016 + 1.1792905e-013 + 8.8648570e-012 + 4.1723359e-010 + 1.2659296e-008 + 2.5370146e-007 + 3.4269833e-006 + 3.1729449e-005 + 2.0415350e-004 + 9.2306172e-004 + 2.9586576e-003 + 6.7674544e-003 + 1.1097680e-002 + 1.3082883e-002 + 1.1097680e-002 + 6.7674544e-003 + 2.9586576e-003 + 9.2306172e-004 + 2.0415350e-004 + 3.1729449e-005 + 3.4269833e-006 + 2.5370146e-007 + 1.2659296e-008 + 4.1723359e-010 + 8.8648570e-012 + 1.1792905e-013 + 9.4845078e-016 + 4.4209789e-018 + 1.0594723e-020 + 1.4066847e-023 + 8.9434648e-027 + 2.4724731e-030 + 2.6299112e-034 + 9.1894572e-039 + 8.5605393e-044 + 1.6013466e-049 + 4.0400688e-056 + 7.6696056e-064 + 4.4303395e-073 + 1.7074916e-084 + 2.5514220e-099 + 2.4833459e-120 + 2.2024648e-156 + 0.0000000e+000 + 2.2024648e-156 + 2.4833459e-120 + 2.5514220e-099 + 1.7074916e-084 + 4.4303395e-073 + 7.6696056e-064 + 4.0400688e-056 + 1.6013466e-049 + 8.5605393e-044 + 9.1894572e-039 + 2.6299112e-034 + 2.4724731e-030 + 8.9434648e-027 + 1.4066847e-023 + 1.0594723e-020 + 4.1276638e-018 + 8.8552470e-016 + 1.1010491e-013 + 8.2767076e-012 + 3.8955174e-010 + 1.1819400e-008 + 2.3686934e-007 + 3.1996160e-006 + 2.9624321e-005 + 1.9060870e-004 + 8.6182010e-004 + 2.7623620e-003 + 6.3184597e-003 + 1.0361392e-002 + 1.2214884e-002 + 1.0361392e-002 + 6.3184597e-003 + 2.7623620e-003 + 8.6182010e-004 + 1.9060870e-004 + 2.9624321e-005 + 3.1996160e-006 + 2.3686934e-007 + 1.1819400e-008 + 3.8955174e-010 + 8.2767076e-012 + 1.1010491e-013 + 8.8552470e-016 + 4.1276638e-018 + 9.8941978e-021 + 1.3136744e-023 + 8.3521212e-027 + 2.3089927e-030 + 2.4560210e-034 + 8.5818486e-039 + 7.9945148e-044 + 1.4954652e-049 + 3.7729387e-056 + 7.1624898e-064 + 4.1374046e-073 + 1.5945919e-084 + 2.3827215e-099 + 2.3191466e-120 + 2.0568374e-156 + 0.0000000e+000 + 2.0568374e-156 + 2.3191466e-120 + 2.3827215e-099 + 1.5945919e-084 + 4.1374046e-073 + 7.1624898e-064 + 3.7729387e-056 + 1.4954652e-049 + 7.9945148e-044 + 8.5818486e-039 + 2.4560210e-034 + 2.3089927e-030 + 8.3521212e-027 + 1.3136744e-023 + 9.8941978e-021 + 3.8547419e-018 + 8.2697364e-016 + 1.0282475e-013 + 7.7294502e-012 + 3.6379450e-010 + 1.1037899e-008 + 2.2120749e-007 + 2.9880568e-006 + 2.7665555e-005 + 1.7800561e-004 + 8.0483640e-004 + 2.5797141e-003 + 5.9006819e-003 + 9.6762946e-003 + 1.1407233e-002 + 9.6762946e-003 + 5.9006819e-003 + 2.5797141e-003 + 8.0483640e-004 + 1.7800561e-004 + 2.7665555e-005 + 2.9880568e-006 + 2.2120749e-007 + 1.1037899e-008 + 3.6379450e-010 + 7.7294502e-012 + 1.0282475e-013 + 8.2697364e-016 + 3.8547419e-018 + 9.2422231e-021 + 1.2271103e-023 + 7.8017611e-027 + 2.1568424e-030 + 2.2941824e-034 + 8.0163507e-039 + 7.4677190e-044 + 1.3969221e-049 + 3.5243222e-056 + 6.6905201e-064 + 3.8647718e-073 + 1.4895168e-084 + 2.2257129e-099 + 2.1663272e-120 + 1.9213029e-156 + 0.0000000e+000 + 1.9213029e-156 + 2.1663272e-120 + 2.2257129e-099 + 1.4895168e-084 + 3.8647718e-073 + 6.6905201e-064 + 3.5243222e-056 + 1.3969221e-049 + 7.4677190e-044 + 8.0163507e-039 + 2.2941824e-034 + 2.1568424e-030 + 7.8017611e-027 + 1.2271103e-023 + 9.2422231e-021 + 3.6007350e-018 + 7.7248050e-016 + 9.6049152e-014 + 7.2201207e-012 + 3.3982239e-010 + 1.0310560e-008 + 2.0663110e-007 + 2.7911598e-006 + 2.5842543e-005 + 1.6627600e-004 + 7.5180198e-004 + 2.4097247e-003 + 5.5118586e-003 + 9.0386786e-003 + 1.0655558e-002 + 9.0386786e-003 + 5.5118586e-003 + 2.4097247e-003 + 7.5180198e-004 + 1.6627600e-004 + 2.5842543e-005 + 2.7911598e-006 + 2.0663110e-007 + 1.0310560e-008 + 3.3982239e-010 + 7.2201207e-012 + 9.6049152e-014 + 7.7248050e-016 + 3.6007350e-018 + 8.6352692e-021 + 1.1465237e-023 + 7.2894051e-027 + 2.0151986e-030 + 2.1435192e-034 + 7.4899021e-039 + 6.9773001e-044 + 1.3051836e-049 + 3.2928735e-056 + 6.2511413e-064 + 3.6109651e-073 + 1.3916975e-084 + 2.0795463e-099 + 2.0240605e-120 + 1.7951274e-156 + 0.0000000e+000 + 1.7951274e-156 + 2.0240605e-120 + 2.0795463e-099 + 1.3916975e-084 + 3.6109651e-073 + 6.2511413e-064 + 3.2928735e-056 + 1.3051836e-049 + 6.9773001e-044 + 7.4899021e-039 + 2.1435192e-034 + 2.0151986e-030 + 7.2894051e-027 + 1.1465237e-023 + 8.6352692e-021 + 3.3642681e-018 + 7.2175028e-016 + 8.9741427e-014 + 6.7459621e-012 + 3.1750563e-010 + 9.6334470e-009 + 1.9306126e-007 + 2.6078592e-006 + 2.4145416e-005 + 1.5535635e-004 + 7.0242976e-004 + 2.2514737e-003 + 5.1498846e-003 + 8.4450919e-003 + 9.9557876e-003 + 8.4450919e-003 + 5.1498846e-003 + 2.2514737e-003 + 7.0242976e-004 + 1.5535635e-004 + 2.4145416e-005 + 2.6078592e-006 + 1.9306126e-007 + 9.6334470e-009 + 3.1750563e-010 + 6.7459621e-012 + 8.9741427e-014 + 7.2175028e-016 + 3.3642681e-018 Index: adcp/trunk/adcp/diwasp_1_1GD/subplotspec.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/subplotspec.m (revision 168) @@ -1,0 +1,115 @@ +function plotspec(SM,ptype); + +%DIWASP V1.1 function +%plotspec: plots the spectral matrix in 3D or polar form +% +%plotspec(SM,ptype) +% +%Inputs: +% SM A spectral matrix structure +% ptype plot type: +% 1 3D surface plot +% 2 polar type plot +% 3 3D surface plot (compass bearing angles) +% 4 polar type plot (compass bearing angles) +% +%The 3D surface plot type is a MATLAB surface plot with SM.freqs on the x axis, SM.dirs on the y axis and the spectral density, SM.S as the z value. +%The polar type plot is a MATLAB polar plot with the direction showing values in SM.dirs, the radius showing values in SM.freqs +%and contours representing the spectral density, SM.S. An example of the polar type plot is shown on the front cover of the manual. +%For both plot types, the direction is the direction of propagation (see also The DIWASP spectrum file format). +%For options 3 and 4 the direction is the compass bearing. This is calculated from the SM.xaxisdir input that defines the orientation of the axes. +%Note that if SM.xaxisdir is 90 the appearance of the polar plot is unchanged. +% +%"help data_structures" for information on the DIWASP data structures + +%Copyright (C) 2002 Coastal Oceanography Group, CWR, UWA, Perth + + + +SM=check_data(SM,2);if isempty(SM) return;end; +dirs=SM.dirs;ffreqs=SM.freqs;S=real(SM.S); + +if (ptype==3|ptype==4) + xaxisdir=SM.xaxisdir; + if ~(xaxisdir >=0 & xaxisdir <=360) + warning('xaxisdir must be between 0 and 360 -set to default value of 90'); + xaxisdir=90; + end +end + +if(ptype==1|ptype==3) + if(ptype==3) + dirs=xaxisdir*ones(size(dirs))-dirs; + dirs=dirs+360*(dirs<0); + dirs=dirs-360*(dirs>360); + [dirs,order]=sort(dirs); + else + order=([1:max(size(dirs))]); + end + [ddir,df]=meshgrid(dirs,ffreqs); + surf(df,ddir,real(S(:,order))); + + shading interp; + xlabel('frequency [Hz]'); + if(ptype==1) + ylabel('direction [degrees]'); + axis([0 (max(ffreqs)) -180 180 0 (max(max(S)))]); + + else + ylabel('direction [bearing]'); + axis([0 (max(ffreqs)) 0 360 0 (max(max(S)))]); + end + zlabel('m^2s / deg'); + +elseif(ptype==2|ptype==4) + if(ptype==4) + dirs=(90-xaxisdir)*ones(size(dirs))+dirs; + end + h = polar([0 2*pi], [0 0.4]); %[0 0.8*max(ffreqs)]); Changed on 5/25/07 + delete(h); + + [df,ddir]=meshgrid(ffreqs,dirs); + +%uses the existing polar figure function and replaces numbering of angles for compass directions. Will probably be changed in future versions. + if(ptype==4) + set(0,'ShowHiddenHandles','on') + chhs=get(gca,'Children'); + for i=1:size(chhs,1); + obj=chhs(i); + if strcmp(get(obj,'Type'),'text') + num=str2num(get(obj,'String')); + if~(isempty(num)) + if mod(num,30)==0 + num=90-num; + num=(num<0)*360+num; + set(obj,'String',num2str(num)); + end + end + end + end + set(0,'ShowHiddenHandles','off') + end + + hold on; + + [px,py]=pol2cart(ddir*pi/180,df); + contour(px,py,real(S'),20); + + + + caxis([0 max(max(S))]); %caxis([0 0.02]); + cb=colorbar('vert'); + %set(cb,'CLim',[0 0.02]); + + if(ptype==2) + ylabel('direction [degrees] / frequency [Hz]'); + else + ylabel('direction [bearing] / frequency [Hz]'); + end + xlabel('m^2s / deg'); + hold off; +end + +set(gca,'Color','none'); + + Index: adcp/trunk/adcp/diwasp_1_1GD/testspec.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/testspec.m (revision 168) @@ -1,0 +1,115 @@ +function EP=testspec(ID,theta,spread,weights,EP); + +%DIWASP V1.1 function +%testspec: Testing routine for directional wave spectrum estimation methods +% +%[EPout] = testspec(ID,theta,spread,weights,EP) +% +%Outputs: +%EPout The estimation parameters structure used in the test. +% +%Inputs: +%ID An instrument data structure containing the measured data. The ID.data field is ignored. +%theta vector with the mean directions of a sea state component +%spread vector with the spreading parameters of a sea state component +%weights vector with relative weights of sea state components +%EP The estimation parameters structure with the values under test used. Default settings are used where not specified. +% +%All inputs are required +% +%Testspec details: +% +%The fields ID.layout and ID.datatypes and ID.depth are used to specify the arrangement of the imaginary sensors. +% +%The function outputs a plot of the specified spreading function (solid line) and the estimated spreading shape (dotted line). +% +%The calculation is carried out for a frequency of 0.2 Hz. +%The inputs theta, spread and weights determine the shape of the directional spreading function. +%Each of these inputs is a vector of length n where n is the number of sea state components. +%Each sea state component has a mean direction and a spreading parameter. +%The directional spreading is calculated with a cosine power function (Mitsuyasu et al.1975 J.Phys Oceanogr.5,750-760) +% +%"help data_structures" for information on the DIWASP data structures +% +%All of the implemented calculation algorithms are as described by: +%Hashimoto,N. 1997 "Analysis of the directional wave spectrum from field data" +%In: Advances in Coastal Engineering Vol.3. Ed:Liu,P.L-F. Pub:World Scientific,Singapore +% +%Copyright (C) 2002 Coastal Oceanography Group, CWR, UWA, Perth + +S=1;F=0.2;ddir=2*pi/EP.dres;ncom=size(theta,2); + +ID=check_data(ID,1);if isempty(ID) return;end; +EP=check_data(EP,3);if isempty(EP) return;end; + +szd=size(ID.layout,2); +szdt=size(ID.datatypes,2); + +dirs=[-180:1:179]; + +disp(' ');disp('calculating.....');disp(' '); + +disp('wavenumbers') +wns=wavenumber(2*pi*F,ID.depth); + +dres=EP.dres; +pidirs=[-pi:(2*pi/dres):pi-(2*pi/dres)]; + +%generate spreading function +for ni=1:ncom + GS(ni,:)=(cos(0.5*(pidirs-theta(ni)*(pi/180)*ones(size(pidirs))))).^(2*spread(ni)); + sumGS(ni)=sum(GS(ni,:)); +end + +sumweights=sum(weights); +weights=(1/sumweights)*weights; +coeff=(1./(sumGS*ddir)).*weights; + +Gg=zeros(size(pidirs)); +for ni=1:ncom + Gg=Gg+coeff(ni)*GS(ni,:); +end + +disp('transfer parameters'); +for m=1:szd + trm(m,:,:)=feval(ID.datatypes{m},2*pi*F,pidirs,wns,ID.layout(3,m),ID.depth); + for n=1:szd + kx(m,n,:,:)=wns*((ID.layout(1,n)-ID.layout(1,m))*cos(pidirs)+(ID.layout(2,n)-ID.layout(2,m))*sin(pidirs)); +end +end + +disp('cross power spectra');disp(' '); +for m=1:szd + Ss(m,1)=S; +for n=1:szd + expx(1:dres)=exp(-i*kx(m,n,1,1:dres)); + Hh(1:dres)=trm(m,1,1:dres); + Hhs(1:dres)=conj(trm(n,1,1:dres)); + Htemp=(Hh.*Hhs.*expx); + expG=Htemp.*Gg; + xps(m,n,1)=sum(expG)*ddir; + end +end + + +% call appropriate estimation function +disp(['directional spectra using' blanks(1) EP.method ' method']); +disp(' ') + Specout=feval(EP.method,xps,trm,kx,Ss,pidirs,200,2); + +% map spectrum onto user defined direction vector +Dd=pidirs*(180/pi); + +disp('finished...plotting spectrum'); +fig=figure; +plot(Dd,real(Specout),'b.',Dd,Gg,'k'); + +nse=sum((real(Specout)-Gg).^2)./sum(Gg.^2); + +T=['Directional spreading estimated using ' blanks(1) EP.method ' method' blanks(2) 'NSE:' num2str(nse,3)]; +title(T); +ylabel(''); +xlabel('direction [degrees]'); +zlabel('m^2'); + + Index: adcp/trunk/adcp/diwasp_1_1GD/writespec.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/diwasp_1_1GD/writespec.m (revision 168) @@ -1,0 +1,35 @@ +function writespec(SM,filename) + +%DIWASP V1.1 function +%writespec: writes spectrum matrix to file using DIWASP format +% +%writespec(SM,filename) +% +%Inputs: +%SM A spectral matrix structure +%filename String containing the filename including file extension if required +% +%All inputs required +% +%"help data_structures" for information on the DIWASP data structures + +%Copyright (C) 2002 Coastal Oceanography Group, CWR, UWA, Perth + + +SM=check_data(SM,2);if isempty(SM) return;end; + +nf=max(size(SM.freqs));nd=max(size(SM.dirs)); + +streamout(1)=SM.xaxisdir; +streamout(2)=nf; +streamout(3)=nd; +streamout(4:nf+3)=SM.freqs; +streamout(nf+4:nf+nd+3)=SM.dirs; +streamout(nf+nd+4)=999; +streamout(nf+nd+5:nf+nd+4+(nf*nd))=reshape(real(SM.S'),nf*nd,1); + +streamout=streamout'; + +eval(['save ',filename,' streamout -ASCII']); + + Index: adcp/trunk/adcp/nortek/nortek.py =================================================================== --- adcp/trunk/adcp/nortek/nortek.py (revision 95) +++ adcp/trunk/adcp/nortek/nortek.py (revision 168) @@ -1,4 +1,4 @@ """This code takes the raw data from the Nortek AWAC and prepares it -for matlab You input a raw binary *.WPR file from the AWAC and it outs three Currents files with all of the currents +for matlab You input a raw binary *.WPR file from the AWAC and it outputs three Currents files with all of the currents data, as well as a waves orbital velocity, range, pressure and sysinfo file for each wave burst""" Index: adcp/trunk/adcp/nortek/nortek_Winfo_plot.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/nortek/nortek_Winfo_plot.m (revision 168) @@ -1,0 +1,60 @@ +function [fig_sigh,fig_pp,fig_dp,fig_dd]=nortek_Winfo_plot(Winfo); + +%This function takes the wave info (sigH, peak period, direction of peak and dominant direction +%for a series of bursts and plots it as a function of time + + +%plot sig wave height +scrsz = get(0,'ScreenSize'); +fig_sigh=figure('Position',[scrsz]); +h1=plot(Winfo.time,Winfo.hsig(1,:),'b.-'); +hold on +h2=plot(Winfo.time,Winfo.hsig(2,:),'r.-'); +h3=plot(Winfo.time,Winfo.hsig(3,:),'k.-'); + +datetick('x',15,'keepticks'); +legend([h1, h2, h3],'EMEP','IMLM','nortek','location','best'); +title(['Significant Wave Height starting on ',datestr(Winfo.time(:,1),0)]); +xlabel('time'); +ylabel('Wave Height (m)'); + +%plot peak period +fig_pp=figure('Position',[scrsz]); +h1=plot(Winfo.time,Winfo.peakP(1,:),'b.-'); +hold on +h2=plot(Winfo.time,Winfo.peakP(2,:),'r.-'); +h3=plot(Winfo.time,Winfo.peakP(3,:),'k.-'); + +datetick('x',15,'keepticks'); +legend([h1, h2, h3],'EMEP','IMLM','nortek','location','best'); +title(['Peak Period starting on ',datestr(Winfo.time(:,1),0)]); +xlabel('time'); +ylabel('Period (seconds)'); + +%plot dir of peak period +fig_dp=figure('Position',[scrsz]); +h1=plot(Winfo.time,Winfo.dirP(1,:),'b.-'); +hold on +h2=plot(Winfo.time,Winfo.dirP(2,:),'r.-'); +h3=plot(Winfo.time,Winfo.dirP(3,:),'k.-'); + +datetick('x',15,'keepticks'); +legend([h1, h2, h3],'EMEP','IMLM','nortek','location','best'); +title(['Direction of Peak Period starting on ',datestr(Winfo.time(:,1),0)]); +xlabel('time'); +ylabel('Direction (Degrees True)'); + +%plot the dominant direction + +fig_dd=figure('Position',[scrsz]); +h1=plot(Winfo.time,Winfo.Ddir(1,:),'b.-'); +hold on +h2=plot(Winfo.time,Winfo.Ddir(2,:),'r.-'); +h3=plot(Winfo.time,Winfo.Ddir(3,:),'k.-'); + +datetick('x',15,'keepticks'); +legend([h1, h2, h3],'EMEP','IMLM','nortek','location','best'); +title(['Dominant Direction starting on ',datestr(Winfo.time(:,1),0)]); +xlabel('time'); +ylabel('Direction (Degrees True)'); + Index: adcp/trunk/adcp/nortek/nortek_radialtouvw.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/nortek/nortek_radialtouvw.m (revision 168) @@ -1,0 +1,200 @@ +function [ID,SM,EP]=nortek_radialtouvw(pressure,range,orbit,sysinfo,data_type) + + +%This code takes the loaded orbit, pressure and system info data from an +%ADCP waves output and computes the uvw velocities in earth coordinates. +%It also interpolates to remove bad data points and prepares the data +%structure required for running the DIWASP program. The output will be in +%the structures ID, SM and EP. + +%data_type is: +%1 to use uvw and pressure to generate the data structures, +%2 to use ranges +%3 to use radial velocity data + + + +%make sure to load: pressure=load('pressure data'), +%orbit=load('orbital data'),sysinfo=load('sysinfo data') and range + +%what is the transducer face height off the bottom? +adcpheight=0.5; + +%whats the magnetic variation +magvar=9.63; + +%set up pressure +press=pressure/1000; + +%find the average depth +avgdepth=mean(press)+adcpheight; + +%set up range +range=range/1000; +meanrange=mean(range); +meanrange=repmat(meanrange,4096,1); +dmrange=range-meanrange; +std_range=std(dmrange); + +%need to decrease the number of range samples + +dmrange=decimate(dmrange,2); + + +%set up sysinfo file +heading=sysinfo(6,:); +pitch=sysinfo(7,:); +roll=sysinfo(8,:); +binheight=sysinfo(11,:); + +%Find the std deviation of orbitals +orbit=orbit/1000; +std_orbit=std(orbit); +orbitnew=orbit; + +%interpolate to take out any NaNs +for i=1:3 + ibad=find(abs(orbit(:,i)) > 5*std_orbit(:,i)); + orbit(ibad,i)=NaN; + time=[1:1:length(orbit(:,i))]; + NaNs=isnan(orbit(:,i)); + igood=find(NaNs == 0); + ibad=find(NaNs == 1); + + intValues= interp1(time(igood),orbit(igood,i),time(ibad)); + orbitnew(ibad,i)=intValues; +end + +% Do the same for the range data +rangenew=dmrange; + +ibad=find(abs(dmrange(:)) > 5*std_range(:)); +dmrange(ibad)=NaN; +time=[1:1:length(dmrange(:))]; +NaNs=isnan(dmrange(:)); +igood=find(NaNs == 0); +ibad=find(NaNs == 1); + +intValues= interp1(time(igood),dmrange(igood),time(ibad)); +rangenew(ibad)=intValues; + +dmrange=rangenew; + +%change heading, pitch, roll into degrees + +heading = heading/10; +pitch=pitch/10; +roll=roll/10; + +%compute the original x,y,z positions for each beam for each bin to be accurate we need to take out the adcpheight + +xyzpos=ones(3,3); +height=binheight; +pos=height*tan(25*pi/180); + +xyzpos(:,1)=[0,pos,height]; +xyzpos(:,2)=[pos*cos(30*pi/180),-pos*.5,height]; +xyzpos(:,3)=[-pos*cos(30*pi/180),-pos*.5,height]; +beam4xpos=mean(press)*tan(roll*(pi/180)); +beam4ypos=mean(press)*tan(-pitch*(pi/180)); + + +% set up the new coordinate transformation matrix +CH = cos((heading+magvar)*pi/180); +SH = sin((heading+magvar)*pi/180); +CP = cos((pitch)*pi/180); +SP = sin((pitch)*pi/180); +CR = cos((-roll)*pi/180); +SR = sin((-roll)*pi/180); + +% let the matrix elements be ( a b c; d e f; g h j); +a = CH.*CR - SH.*SP.*SR; b = SH.*CP; c = -CH.*SR - SH.*SP.*CR; +d = -SH.*CR - CH.*SP.*SR; e = CH.*CP; f = SH.*SR - CH.*SP.*CR; +g = CP.*SR; h = SP; j = CP.*CR; + +%transform the original x,y,z positions to the new positions accounting for +%heading, pitch and roll... we also add adcpheight back in +newxyzpos=ones(3,3); +new_xyzpos(1,:)=xyzpos(1,:)*a+xyzpos(2,:)*b+xyzpos(3,:)*c; +new_xyzpos(2,:)=xyzpos(1,:)*d+xyzpos(2,:)*e+xyzpos(3,:)*f; +new_xyzpos(3,:)=xyzpos(1,:)*g+xyzpos(2,:)*h+xyzpos(3,:)*j+adcpheight; +new_xyzpos(:,4)=[beam4xpos,beam4ypos,avgdepth];%this is for the vertical beam...the z position will always =the avg depth + +xyzpositions=new_xyzpos; + + + + +%compute the x,y positions for each beam for each bin and the surface + +%sin45=0.7071 +xypositions=ones(1,4); + + +%beam 1 +bearing=(heading+magvar)*(pi/180); +distfromz=binheight*tan((25-pitch)*(pi/180)); +xpos=sin(bearing)*distfromz; +ypos=cos(bearing)*distfromz; + +distroll=binheight*tan(roll*(pi/180)); +beam1xpos=xpos+0.7071*distroll; +beam1ypos=ypos+0.7071*distroll; + +%beam 2 +bearing=bearing+2/3*pi; +distfromz=binheight*tan(25*(pi/180)); +xpos=sin(bearing)*distfromz; +ypos=cos(bearing)*distfromz; +beam2xpos=xpos+binheight*tan(roll*(pi/180)); +beam2ypos=ypos+binheight*tan(-pitch*(pi/180)); + +%beam 3 +bearing=bearing+2/3*pi; +distfromz=binheight*tan(25*(pi/180)); +xpos=sin(bearing)*distfromz; +ypos=cos(bearing)*distfromz; +beam3xpos=xpos+binheight*tan(-roll*(pi/180)); +beam3ypos=ypos+binheight*tan(-pitch*(pi/180)); + + + +xypositions=[beam1xpos beam2xpos beam3xpos beam4xpos; beam1ypos beam2ypos beam3ypos beam4ypos]; + + +%Put into structures for DIWASP + +%sampling frequency +ID.fs=2; +%depth +ID.depth=(adcpheight+mean(press)); +%the spectral matrix structure +SM.freqs=[0.01:0.01:0.4]; +SM.dirs=[-180:2:180]; +SM.xaxisdir= 90; +%the estimation parameter +EP.method= 'EMEP'; +EP.iter=100; + +if data_type == 1 + %For radial velocities and the range beam + % the datatypes + ID.datatypes={'elev' 'radial' 'radial' 'radial'}; + % the layout + ID.layout = [xyzpositions(1,4) xyzpositions(1,1) xyzpositions(1,2) xyzpositions(1,3);xyzpositions(2,4) xyzpositions(2,1) xyzpositions(2,2) xyzpositions(2,3); + xyzpositions(3,4) xyzpositions(3,1) xyzpositions(3,2) xyzpositions(3,3)]; + % the data + ID.data = horzcat(dmrange, orbitnew(:,1), orbitnew(:,2), orbitnew(:,3)); + +end + + + + + + + + + + + Index: adcp/trunk/adcp/nortek/nortek_specmultiplot.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/nortek/nortek_specmultiplot.m (revision 168) @@ -1,0 +1,114 @@ +function [Winfo]=nortek_specmultiplot(dateinfo1,dateinfo2,timestep); + +%NOTE: This function is for the Nortek AWAC profiler! + +%where dateinfo1 and 2 are the strings of the first and last date extension +%of the pressure,range,etc files and timestep is the time in hours between +%each burst + +%This function takes the pressure, range, orbit and sysinfo files created +%in python and outputs a Winfo data structure with the sig wave height, +%peak period, direction of peak period and dominant dir. It also generates +%polar plots and 2d freq and directional plots of a variety of different +%estimation methods, resolutions and the wavesmon output. + + +%first set up the time vector going from dateinfo1 to dateinfo2 +Winfo.time=[]; + +date1=datevec(dateinfo1, 'yymmddHHMM'); +date2=datevec(dateinfo2,'yymmddHHMM'); + +if date1 == date2 + Winfo.time=[datenum(date1)]; +else + Winfo.time=[datenum(date1)]; + newdate=date1; + while datenum(newdate) ~= datenum(date2) + newdate=newdate+[0 0 0 timestep 0 0]; + Winfo.time=[horzcat(Winfo.time,datenum(newdate))]; + end +end + + +%set up time, which is Winfo.time as date str in the yymmddHHMM format +time=datestr(Winfo.time, 'yymmddHHMM'); + +%set up data structure for wave info +Winfo.setup={'EMEP','IMLM' 'nortek'}'; +Winfo.hsig=[]; +Winfo.peakP=[]; +Winfo.dirP=[]; +Winfo.Ddir=[]; +Winfo.Spectrum.EMEP=[]; +Winfo.Spectrum.IMLM=[]; +Winfo.Spectrum.nortek=[]; + +%load the wave data from the nortek quick wave software +wavedata=load('BPWave01.wap'); + +%Load the data and run the script +for i=1:length(time(:,1)) + dateinfo=time(i,:); + + pressure=strcat('pressure_',dateinfo,'.txt'); + range=strcat('range_',dateinfo,'.txt'); + orbit=strcat('orbit_',dateinfo,'.txt'); + sysinfo=strcat('sysinfo_',dateinfo,'.txt'); + nortekspec=strcat('nortekspec_',dateinfo,'.txt'); + + pressure=load(pressure); + range=load(range); + orbit=load(orbit); + sysinfo=load(sysinfo); + nortekspec=load(nortekspec); + + %set up data with standard AST freq at 0.01 and dir at 2 + [ID,SM,EP]=nortek_radialtouvw(pressure,range,orbit,sysinfo,1); + + %run diwasp to generate this spectrum + [E_F01_D2, EPout]=dirspectest(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0}); + + %now for IMLM + EP.method='IMLM'; + EP.iter=3; + [I_F01_D2, EPout]=dirspectest(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0}); + + + %Use waveplot to plot the polar, freq and dir plots of the spectra + + [E_WI,I_WI,nortek_WI,fig1,fig2]=nortek_waveplot(E_F01_D2,I_F01_D2,sysinfo,nortekspec); + + saveas(fig1,['polar1_' dateinfo '.fig']); + saveas(fig2,['dirfreq1_' dateinfo '.fig']); + + + %Fill up the Winfo data structure + + hsig=[vertcat(E_WI.hsig,I_WI.hsig,nortek_WI.hsig)]; + peakP=[vertcat(E_WI.tp,I_WI.tp,nortek_WI.tp)]; + dirP=[vertcat(E_WI.dtp,I_WI.dtp,nortek_WI.dtp)]; + Ddir=[vertcat(E_WI.dp,I_WI.dp,nortek_WI.dp)]; + + Winfo.hsig=[horzcat(Winfo.hsig,hsig)]; + Winfo.peakP=[horzcat(Winfo.peakP,peakP)]; + Winfo.dirP=[horzcat(Winfo.dirP,dirP)]; + Winfo.Ddir=[horzcat(Winfo.Ddir,Ddir)]; + Winfo.Spectrum.EMEP=[cat(3,Winfo.Spectrum.EMEP,E_F01_D2.S)]; + Winfo.Spectrum.IMLM=[cat(3,Winfo.Spectrum.IMLM,I_F01_D2.S)]; + Winfo.Spectrum.nortek=[cat(3,Winfo.Spectrum.nortek,nortekspec)]; + +end + +%now create the time series plots of the wave info +[fig_sigh,fig_pp,fig_dp,fig_dd]=nortek_Winfo_plot(Winfo); + +saveas(fig_sigh,['sigh_' dateinfo '.fig']); +saveas(fig_pp,['peakp_' dateinfo '.fig']); +saveas(fig_dp,['dirpeak_' dateinfo '.fig']); +saveas(fig_dd,['domdir_' dateinfo '.fig']); + +close all; + + + Index: adcp/trunk/adcp/nortek/nortek_specread.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/nortek/nortek_specread.m (revision 168) @@ -1,0 +1,50 @@ +%This script is designed to separate the nortek processed wave directional +%spectra into seperate date files + +%first load the spectral file as spec and the wave detail file as details +%also load the directional energy file as dirspec and the frequency +%spectrum file as freqspec + +month=details(:,1); +day=details(:,2); +year=details(:,3); +hour=details(:,4); +minute=details(:,5); +second=details(:,6); + + +%next set up the data and time in the right format +time=datenum(year,month,day,hour,minute,second); + +datelist=datestr(time, 'yymmddHHMM'); + + +%now go through each spectrum, cut out each one from the file and create a +%new text file with the datestamp. +for i=2:length(datelist) + startpos=(i*40)-39; %(where 40 is the number of frequencies used per spectra) + stoppos=(i*40); + specfile=spec(startpos:stoppos,:); + freqs=freqspec(i,:); %need to change from normalized values so have to multiply through by the freq power spectrum + mult=freqs'*ones(1,90); + specfilemult=(mult.*specfile)/4; %this is the 3d spectrum in m^2s/deg + dateinfo=datelist(i-1,:); + name=strcat('nortekspec_',dateinfo,'.txt'); + dlmwrite(name, specfilemult, ' '); +end + +%now do the same thing for the dirspec file and the freqspec file + +for i=2:length(datelist) + dirspecfile=dirspec(i,:); + freqspecfile=freqspec(i,:); + dateinfo=datelist(i,:); + namedir=strcat('nortekdirspec_',dateinfo,'.txt'); + namefreq=strcat('nortekfreqspec_',dateinfo,'.txt'); + dlmwrite(namedir, dirspecfile, ' '); + dlmwrite(namefreq, freqspecfile, ' '); +end + + + + Index: adcp/trunk/adcp/nortek/nortek_waveplot.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/nortek/nortek_waveplot.m (revision 168) @@ -1,0 +1,240 @@ +function [E_WI,I_WI,nortek_WI,fig1,fig2]=nortek_waveplot(EMEP,IMLM,sysinfo,nortekspec) + +%make sure to load the EMEP, IMLM and wavesmon samples +%EMEP=load('emep'), IMLM=load('imlm'), spec=load('wavesmon') +%rangeE=load('EMEP_range'), rangeI=load('IMLM_range') + +%set up the wavesmon data in a structure + +%what is the magnetic variation to nearest degree +magvar=10; + +%what is the frequency and dir resolution for those generated in DIWASP +freqres=0.01; +freqs=[0.01:0.01:.4]; +dirres=2; +dirs=[-180:2:180]; + +%what is the frequency and dir resolution for those created by nortek +%freqres is the same +nortekfreqs=[0.01:0.01:.4]; +nortekdirres=4; +nortekdirs=[270:-4:-86]; +nortek.S=nortekspec; +nortek.dirs=nortekdirs; +nortek.freqs=nortekfreqs; +nortek.xaxisdir=90; + +% plot the spectrum generated through DIWASP + +scrsz = get(0,'ScreenSize'); +fig1=figure('Position',[scrsz]); +subplot(2,2,1); +subplotspec(EMEP,4); +title('EMEP AST beam and radial velocities'); + +subplot(2,2,2); +subplotspec(IMLM,4); +title('IMLM AST beam and radial velocities'); + +subplot(2,2,3); +subplotspec(nortek,4); +title('nortek quick wave spectrum'); + + +%calculate just the dir energy spectrum on a single graph + +EMEPdir=sum(EMEP.S)*freqres; +IMLMdir=sum(real(IMLM.S))*freqres; +nortekdir=sum(nortek.S)*freqres; + + +%calculate just the frequency energy spectrum +EMEPfreq=sum(EMEP.S')*dirres; +IMLMfreq=sum(real(IMLM.S)')*dirres; +nortekfreq=sum(nortek.S')*nortekdirres; + +%Find the maximum for the directional spectrum so we can set up the proper +%x-axis +[maxvalue,maxindex] = max(EMEPdir); +maxdir=dirs(maxindex); +% set up the x-axis for all of the spectra depending on the max +if ((100 < maxdir) | (maxdir < -100)); + %for diwasp spectra + index1=find(dirs < 0); + index2=find(dirs > -1); + dirs(index1)=dirs(index1) +360; + %for nortek + Aindex=find(nortek.dirs < 0); + Bindex=find((-1 < nortek.dirs) & (nortek.dirs < 361)); + Bindex2=find(nortek.dirs > 360); + nortek.dirs(Bindex2)=nortek.dirs(Bindex2)-360; + nortek.dirs(Aindex)=nortek.dirs(Aindex)+360; + + %plot the directional energy spectrum + fig2=figure('Position',[scrsz]); + subplot(1,2,1); + h1 = plot(dirs(index2),EMEPdir(index2),'b'); + hold on + h1a= plot(dirs(index1),EMEPdir(index1),'b'); + h2 = plot(dirs(index2),IMLMdir(index2),'r'); + h2a= plot(dirs(index1),IMLMdir(index1),'r'); + %plot the nortek data + h3 = plot(nortek.dirs(Bindex2),nortekdir(Bindex2),'k'); + h3a = plot(nortek.dirs(Bindex),nortekdir(Bindex),'k'); + h3b= plot(nortek.dirs(Aindex),nortekdir(Aindex),'k'); +else + %for diwasp spectra do nothing + + %for nortek + Aindex=find(nortek.dirs > 180); + Bindex=find(nortek.dirs < 181); + nortek.dirs(Aindex)=nortek.dirs(Aindex)-360; + %plot the directional energy spectrum + fig2=figure('Position',[scrsz]); + subplot(1,2,1); + h1 = plot(dirs,EMEPdir,'b'); + hold on + h2 = plot(dirs,IMLMdir,'r'); + %plot the nortek data + h3a = plot(nortek.dirs(Bindex),nortekdir(Bindex),'k'); + h3b = plot(nortek.dirs(Aindex),nortekdir(Aindex),'k'); + +end + +legend([h1, h2, h3a],'EMEP','IMLM','nortek quickwave','location','best'); +title('directional wave spectrum integrated over frequency'); +xlabel('axis angle (degrees true)'); +ylabel('m^2 / deg'); + +%plot the frequency energy spectrum +subplot(1,2,2); +plot(freqs,EMEPfreq,'b'); +hold on +plot(freqs,IMLMfreq,'r'); +plot(nortekfreqs,nortekfreq,'k'); +legend('EMEP','IMLM','nortek quickwave','location','best'); +title('directional wave spectrum integrated over direction'); +xlabel('frequency in Hz'); +ylabel('m^2 / hz'); + +% ______Calculate and display the wave parameters SigH, Tp, Dp,DTp_______ + +%For EMEP AST and radial velocities + +%calculate the 0,1,2 moments +m0=sum(EMEPfreq*freqres); +m1=sum(freqs.*EMEPfreq*freqres); +m2=sum((freqs.^2).*EMEPfreq*freqres); +% Calculate the Sig wave height +EMEP_Hsig=4*sqrt(m0); + +% Calculate the peak period Tp +[P,I]=max(EMEPfreq); +EMEP_Tp=1/(freqs(I)); + +%Calculate the Direction of the peak period DTp +[P,I]=max(real(EMEP.S(I,:))); +EMEP_DTp=dirs(I); + +%Calculate the Dominant Direction Dp +[P,I]=max(EMEPdir); +EMEP_Dp=dirs(I); + +%Display on the screen the SigH,Tp,Dp,DTp +disp(['EMEP']); +disp(['SigH (meters): ' num2str(EMEP_Hsig)]); +disp(['peak period (seconds): ' num2str(EMEP_Tp)]); +disp(['Dir of peak period: ' num2str(compangle(EMEP_DTp, EMEP.xaxisdir))]); +disp(['Dominant Direction: ' num2str(compangle(EMEP_Dp, EMEP.xaxisdir))]); +disp([' ']); + +E_WI.hsig=EMEP_Hsig; +E_WI.tp=EMEP_Tp; +E_WI.dtp=compangle(EMEP_DTp, EMEP.xaxisdir); +E_WI.dp=compangle(EMEP_Dp, EMEP.xaxisdir); + + +% For IMLM AST and radial velocities + +%calculate the 0,1,2 moments +m0=sum(IMLMfreq*freqres); +m1=sum(freqs.*IMLMfreq*freqres); +m2=sum((freqs.^2).*IMLMfreq*freqres); +% Calculate the Sig wave height +IMLM_Hsig=4*sqrt(m0); + +% Calculate the peak period Tp +[P,I]=max(IMLMfreq); +IMLM_Tp=1/(freqs(I)); + +%Calculate the Direction of the peak period DTp +[P,I]=max(real(IMLM.S(I,:))); +IMLM_DTp=dirs(I); + +%Calculate the Dominant Direction Dp +[P,I]=max(IMLMdir); +IMLM_Dp=dirs(I); + +%Display on the screen the SigH,Tp,Dp,DTp +disp(['IMLM']); +disp(['SigH (meters): ' num2str(IMLM_Hsig)]); +disp(['peak period (seconds): ' num2str(IMLM_Tp)]); +disp(['Dir of peak period: ' num2str(compangle(IMLM_DTp, IMLM.xaxisdir))]); +disp(['Dominant Direction: ' num2str(compangle(IMLM_Dp, IMLM.xaxisdir))]); +disp([' ']); + +I_WI.hsig=IMLM_Hsig; +I_WI.tp=IMLM_Tp; +I_WI.dtp=compangle(IMLM_DTp, IMLM.xaxisdir); +I_WI.dp=compangle(IMLM_Dp, IMLM.xaxisdir); + + + +%for nortek generated spectrum + +%calculate the 0,1,2 moments +m0=sum(nortekfreq*freqres); +m1=sum(nortekfreqs.*nortekfreq*freqres); +m2=sum((nortekfreqs.^2).*nortekfreq*freqres); +% Calculate the Sig wave height +nortek_Hsig=4*sqrt(m0); + +% Calculate the peak period Tp +[P,I]=max(nortekfreq); +nortek_Tp=1/(nortekfreqs(I)); + +%Calculate the Direction of the peak period DTp +[P,I]=max(real(nortek.S(I,:))); +nortek_DTp=nortekdirs(I); + +%Calculate the Dominant Direction Dp +[P,I]=max(nortekdir); +nortek_Dp=nortekdirs(I); + +%Display on the screen the SigH,Tp,Dp,DTp +disp(['nortek']); +disp(['SigH (meters): ' num2str(nortek_Hsig)]); +disp(['peak period (seconds): ' num2str(nortek_Tp)]); +disp(['Dir of peak period: ' num2str(compangle(nortek_DTp, nortek.xaxisdir))]); +disp(['Dominant Direction: ' num2str(compangle(nortek_Dp, nortek.xaxisdir))]); +disp([' ']); + +nortek_WI.hsig=nortek_Hsig; +nortek_WI.tp=nortek_Tp; +nortek_WI.dtp=compangle(nortek_DTp, nortek.xaxisdir); +nortek_WI.dp=compangle(nortek_Dp, nortek.xaxisdir); + + + +%function to change from axis angles to compass bearings + +function angle=compangle(angle,xaxisdir) +angle=xaxisdir*ones(size(angle))-angle; +angle=angle+360*(angle<0); +angle=angle-360*(angle>360); + + + + + Index: adcp/trunk/adcp/radialtouvw1.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/radialtouvw1.m (revision 168) @@ -1,0 +1,304 @@ +function [ID,SM,EP,orbitnew]=radialtouvw(pressure,range,orbit,sysinfo,data_type) + + +%This code takes the loaded orbit, pressure and system info data from an +%ADCP waves output and computes the uvw velocities in earth coordinates. +%It also interpolates to remove bad data points and prepares the data +%structure required for running the DIWASP program. The output will be in +%the structures ID, SM and EP. + +%data_type is: +%1 to use uvw and pressure to generate the data structures, +%2 to use ranges +%3 to use radial velocity data + + + +%make sure to load: pressure=load('pressure data'), +%orbit=load('orbital data'),sysinfo=load('sysinfo data') and range + +%what is the transducer face height off the bottom? +adcpheight=0.4; + +%whats the magnetic variation +magvar=9.63; + +%set up sysinfo file +samplesInBurst=sysinfo(3,:); +bin1height=sysinfo(9,:); +bin2height=sysinfo(10,:); +bin3height=sysinfo(11,:); +bin4height=sysinfo(12,:); +bin5height=sysinfo(13,:); +heading=sysinfo(18,:); +pitch=sysinfo(19,:); +roll=sysinfo(20,:); + +%set up pressure +press=pressure/1000; + +%find the average depth +avgdepth=mean(press)+adcpheight; + +%set up range +range=range/1000; +meanrange=mean(range); +meanrange=repmat(meanrange,samplesInBurst,1); +dmrange=range-meanrange; +std_range=std(dmrange); + +% Take out any bad data points in orbital data +ibad=find(orbit < -32000); +orbit(ibad) = NaN; +orbit=orbit/1000; +orbitnew=orbit; +%interpolate to take out any NaNs and QC for bad data in orbital data +std_orbit=ones(1,20); +for i=1:20 + + %first take out any points outside of 4 std deviations + std_orbit(i)=nanstd(orbit(:,i)); + ibad_std=find(abs(orbit(:,i)) > 4*std_orbit(i)); + orbit(ibad_std,i)=NaN; +end +%find the avg std deviation for each group 4 beams +for i=4:4:20 + 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 + ibad_std=find(abs(orbit(:,i)) > 4*avgstd_orbit(i)); + orbit(ibad_std,i)=NaN; + + time=[1:1:length(orbit(:,i))]; + NaNs=isnan(orbit(:,i)); + igood=find(NaNs == 0); + ibad=find(NaNs == 1); + + intValues= interp1(time(igood),orbit(igood,i),time(ibad),'linear','extrap'); + orbitnew(ibad,i)=intValues; +end + +% Do similar QC for the range data +rangenew=dmrange; +for i=1:4 + ibad=find(abs(dmrange(:,i)) > 4*std_range(:,i)); + dmrange(ibad,i)=NaN; + time=[1:1:length(range(:,i))]; + NaNs=isnan(dmrange(:,i)); + igood=find(NaNs == 0); + ibad=find(NaNs == 1); + + intValues= interp1(time(igood),dmrange(igood,i),time(ibad),'linear','extrap'); + rangenew(ibad,i)=intValues; +end + +dmrange=rangenew; + +%change heading, pitch, roll into degrees + +heading = heading/100; +pitch=pitch/100; +roll=roll/100; +pitch_out=pitch; +roll_out=roll; + +%When converting to earth coordinates, the directions will be wrong unless we +%correct for bottom/up facing ADCPs, simply by rotating the roll by 180 +roll=roll+180; + +%Set up geometry for transformation from beam to instrument +C1 = 1; +A1 = 1/(2*sin(20*pi/180)); +B1 = 1/(4*cos(20*pi/180)); +D1 = A1/sqrt(2); + +% coordinate transformation matrix +CH = cos((heading+magvar)*pi/180); +SH = sin((heading+magvar)*pi/180); +CP = cos((pitch)*pi/180); +SP = sin((pitch)*pi/180); +CR = cos((roll)*pi/180); +SR = sin((roll)*pi/180); + +% let the matrix elements be ( a b c; d e f; g h j); +a = CH.*CR + SH.*SP.*SR; b = SH.*CP; c = CH.*SR - SH.*SP.*CR; +d = -SH.*CR + CH.*SP.*SR; e = CH.*CP; f = -SH.*SR - CH.*SP.*CR; +g = -CP.*SR; h = SP; j = CP.*CR; +uno=1; + +%reshape the orbital matrix to 3 dimensions + +radial=reshape(orbitnew,samplesInBurst,4,5); + +% Compute uvw velocities and change to earth coordinates + +u = C1*A1*(radial(:,1,:)-radial(:,2,:)); +v = C1*A1*(radial(:,4,:)-radial(:,3,:)); +w = B1*(radial(:,1,:)+radial(:,2,:)+radial(:,3,:)+radial(:,4,:)); +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); + +[m,n] = size(u); +uno = ones(m,5); +unew = u.*(uno*a) + v.*(uno*b) + w.*(uno*c); +vnew = u.*(uno*d) + v.*(uno*e) + w.*(uno*f); +wnew = u.*(uno*g) + v.*(uno*h) + w.*(uno*j); + +u_all = unew;v_all=vnew;w_all=wnew; +error_vel_all = error_vel; + +%compute the original x,y,z positions for each beam for each bin to be accurate we need to take out the adcpheight + +xyzpos=ones(3,4,5); +heights=[bin1height bin2height bin3height bin4height bin5height avgdepth]-adcpheight; +pos=heights*tan(20*pi/180); +for i=1:5 + xyzpos(:,1,i)=[pos(i),0,heights(i)]; + xyzpos(:,2,i)=[-pos(i),0,heights(i)]; + xyzpos(:,3,i)=[0,pos(i),heights(i)]; + xyzpos(:,4,i)=[0,-pos(i),heights(i)]; +end + +% set up the new coordinate transformation matrix +CH = cos((heading+magvar)*pi/180); +SH = sin((heading+magvar)*pi/180); +CP = cos((pitch_out)*pi/180); +SP = sin((pitch_out)*pi/180); +CR = cos((-roll_out)*pi/180); +SR = sin((-roll_out)*pi/180); + +% let the matrix elements be ( a b c; d e f; g h j), a slightly different +% matrix from before; +a = CH.*CR - SH.*SP.*SR; b = SH.*CP; c = -CH.*SR - SH.*SP.*CR; +d = -SH.*CR - CH.*SP.*SR; e = CH.*CP; f = SH.*SR - CH.*SP.*CR; +g = CP.*SR; h = SP; j = CP.*CR; + +%transform the original x,y,z positions to the new positions accounting for +%heading, pitch and roll... we also add adcpheight back in +newxyzpos=ones(3,4,5); +new_xyzpos(1,:,:)=xyzpos(1,:,:)*a+xyzpos(2,:,:)*b+xyzpos(3,:,:)*c; +new_xyzpos(2,:,:)=xyzpos(1,:,:)*d+xyzpos(2,:,:)*e+xyzpos(3,:,:)*f; +new_xyzpos(3,:,:)=xyzpos(1,:,:)*g+xyzpos(2,:,:)*h+xyzpos(3,:,:)*j+adcpheight; + +xyzpositions=new_xyzpos; + + +%now we need to figure out the xyz positions at the surface for the range +%sin45=0.7071 + +binheight=heights(:,6); + +%beam 3 +bearing=(heading+magvar)*(pi/180); +distfromz=binheight*tan((20-pitch_out)*(pi/180)); +xpos=sin(bearing)*distfromz; +ypos=cos(bearing)*distfromz; + +distroll=binheight*tan(roll_out*(pi/180)); +beam3xpos=xpos+0.7071*distroll; +beam3ypos=ypos+0.7071*distroll; + +%beam 4 +bearing=bearing+pi; +distfromz=binheight*tan((20+pitch_out)*(pi/180)); +xpos=sin(bearing)*distfromz; +ypos=cos(bearing)*distfromz; + +distroll=binheight*tan(roll_out*(pi/180)); +beam4xpos=xpos+0.7071*distroll; +beam4ypos=ypos+0.7071*distroll; + +%beam 1 +bearing=bearing-pi/2; +distfromz=binheight*tan((20+roll_out)*(pi/180)); +xpos=sin(bearing)*distfromz; +ypos=cos(bearing)*distfromz; + +distroll=binheight*tan(pitch_out*(pi/180)); +beam1xpos=xpos+0.7071*distroll; +beam1ypos=ypos+0.7071*distroll; + +%beam2 +bearing=bearing+pi; +distfromz=binheight*tan((20-roll_out)*(pi/180)); +xpos=sin(bearing)*distfromz; +ypos=cos(bearing)*distfromz; + +distroll=binheight*tan(pitch_out*(pi/180)); +beam2xpos=xpos+0.7071*distroll; +beam2ypos=ypos+0.7071*distroll; + +xypositions(:,:)=[beam1xpos beam2xpos beam3xpos beam4xpos; beam1ypos beam2ypos beam3ypos beam4ypos]; + +%Put into structures for DIWASP + + +%sampling frequency +ID.fs=2; +%depth +ID.depth=(adcpheight+mean(press)); +%the spectral matrix structure +SM.freqs=[0.01:0.01:0.4]; +SM.dirs=[-180:2:180]; +SM.xaxisdir= 90; +%the estimation parameter +EP.method= 'EMEP'; +EP.iter=100; + +if data_type == 1 + %For uvw and pressure for bins 2,3,4 + % the datatypes + ID.datatypes={'pres' 'velx' 'vely' 'velz' 'velx' 'vely' 'velz' 'velx' 'vely' 'velz'}; + % the layout + ID.layout = [ 0 0 0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0 0 0; + adcpheight bin2height bin2height bin2height bin3height bin3height bin3height bin4height bin4height bin4height]; + % the data + ID.data = horzcat(press, u_all(:,2), v_all(:,2), w_all(:,2), u_all(:,3), v_all(:,3), w_all(:,3),u_all(:,4), v_all(:,4), w_all(:,4)); + +elseif data_type == 2 + %For the ranges of each beam + % the datatypes + ID.datatypes={'elev' 'elev' 'elev' 'elev'}; + % the layout + ID.layout = [xypositions(1,1) xypositions(1,2) xypositions(1,3) xypositions(1,4); + xypositions(2,1) xypositions(2,2) xypositions(2,3) xypositions(2,4); + avgdepth avgdepth avgdepth avgdepth]; + % the data + ID.data = horzcat(dmrange(:,1), dmrange(:,2), dmrange(:,3), dmrange(:,4)); + +elseif data_type == 3 + % For the radial velocities bins 2,3,4 + % the datatypes + ID.datatypes={'radial' 'radial' 'radial' 'radial' 'radial' 'radial' 'radial' 'radial' 'radial' 'radial' 'radial' 'radial'}; + % the layout + %ID.layout = [xyzpositions(1,1,2) xyzpositions(1,2,2) xyzpositions(1,3,2) xyzpositions(1,4,2) xyzpositions(1,1,3) xyzpositions(1,2,3) xyzpositions(1,3,3) xyzpositions(1,4,3) xyzpositions(1,1,4) xyzpositions(1,2,4) xyzpositions(1,3,4) xyzpositions(1,4,4); + %xyzpositions(2,1,2) xyzpositions(2,2,2) xyzpositions(2,3,2) xyzpositions(2,4,2) xyzpositions(2,1,3) xyzpositions(2,2,3) xyzpositions(2,3,3) xyzpositions(2,4,3) xyzpositions(2,1,4) xyzpositions(2,2,4) xyzpositions(2,3,4) xyzpositions(2,4,4); + %xyzpositions(3,1,2) xyzpositions(3,2,2) xyzpositions(3,3,2) xyzpositions(3,4,2) xyzpositions(3,1,3) xyzpositions(3,2,3) xyzpositions(3,3,3) xyzpositions(3,4,3) xyzpositions(3,1,4) xyzpositions(3,2,4) xyzpositions(3,3,4) xyzpositions(3,4,4)]; + % the data + %ID.data = horzcat(orbitnew(:,5),orbitnew(:,6),orbitnew(:,7),orbitnew(:,8),orbitnew(:,9),orbitnew(:,10),orbitnew(:,11),orbitnew(:,12),orbitnew(:,13),orbitnew(:,14),orbitnew(:,15),orbitnew(:,16)); + + % the layout using bins 3,4,5 + ID.layout = [xyzpositions(1,1,5) xyzpositions(1,2,5) xyzpositions(1,3,5) xyzpositions(1,4,5) xyzpositions(1,1,4) xyzpositions(1,2,4) xyzpositions(1,3,4) xyzpositions(1,4,4) xyzpositions(1,1,3) xyzpositions(1,2,3) xyzpositions(1,3,3) xyzpositions(1,4,3); + xyzpositions(2,1,3) xyzpositions(2,2,3) xyzpositions(2,3,3) xyzpositions(2,4,3) xyzpositions(2,1,4) xyzpositions(2,2,4) xyzpositions(2,3,4) xyzpositions(2,4,4) xyzpositions(2,1,3) xyzpositions(2,2,3) xyzpositions(2,3,3) xyzpositions(2,4,3); + xyzpositions(3,1,3) xyzpositions(3,2,3) xyzpositions(3,3,3) xyzpositions(3,4,3) xyzpositions(3,1,4) xyzpositions(3,2,4) xyzpositions(3,3,4) xyzpositions(3,4,4) xyzpositions(3,1,3) xyzpositions(3,2,3) xyzpositions(3,3,3) xyzpositions(3,4,3)]; + % the data + ID.data = horzcat(orbitnew(:,17),orbitnew(:,18),orbitnew(:,19),orbitnew(:,20),orbitnew(:,13),orbitnew(:,14),orbitnew(:,15),orbitnew(:,16),orbitnew(:,9),orbitnew(:,10),orbitnew(:,11),orbitnew(:,12)); + +end + + + + + + + + + + + Index: adcp/trunk/adcp/rdradcp.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/rdradcp.m (revision 168) @@ -1,0 +1,863 @@ +function [adcp,cfg,ens]=rdradcp(name,varargin); +% RDRADCP Read (raw binary) RDI ADCP files, +% ADCP=RDRADCP(NAME) reads the raw binary RDI BB/Workhorse ADCP file NAME and +% puts all the relevant configuration and measured data into a data structure +% ADCP (which is self-explanatory). This program is designed for handling data +% recorded by moored instruments (primarily Workhorse-type but can also read +% Broadband) and then downloaded post-deployment. For vessel-mount data I +% usually make p-files (which integrate nav info and do coordinate transformations) +% and then use RDPADCP. +% +% This current version does have some handling of VMDAS and WINRIVER output +% files, but it is still 'beta'. +% +% [ADCP,CFG]=RDRADCP(...) returns configuration data in a +% separate data structure. +% +% Various options can be specified on input: +% [..]=RDRADCP(NAME,NUMAV) averages NUMAV ensembles together in the result. +% [..]=RDRADCP(NAME,NUMAV,NENS) reads only NENS ensembles (-1 for all). +% [..]=RDRADCP(NAME,NUMAV,[NFIRST NEND]) reads only the specified range +% of ensembles. This is useful if you want to get rid of bad data before/after +% the deployment period. +% +% Note - sometimes the ends of files are filled with garbage. In this case you may +% have to rerun things explicitly specifying how many records to read (or the +% last record to read). I don't handle bad data very well. +% +% - I don't read in absolutely every parameter stored in the binaries; +% just the ones that are 'most' useful. +% +% String parameter/option pairs can be added after these initial parameters: +% +% 'baseyear' : Base century for BB/v8WH firmware (default to 2000). +% +% 'despike' : [ 'no' | 'yes' | 3-element vector ] +% Controls ensemble averaging. With 'no' a simple mean is used +% (default). With 'yes' a mean is applied to all values that fall +% within a window around the median (giving some outlier rejection). +% This is useful for noisy data. Window sizes are [.3 .3 .3] m/s +% for [ horiz_vel vert_vel error_vel ] values. If you want to +% change these values, set 'despike' to the 3-element vector. +% +% R. Pawlowicz (rich@ocgy.ubc.ca) - 17/09/99 + +% R. Pawlowicz - 17/Oct/99 +% 5/july/00 - handled byte offsets (and mysterious 'extra" bytes) slightly better, Y2K +% 5/Oct/00 - bug fix - size of ens stayed 2 when NUMAV==1 due to initialization, +% hopefully this is now fixed. +% 10/Mar/02 - #bytes per record changes mysteriously, +% tried a more robust workaround. Guess that we have an extra +% 2 bytes if the record length is even? +% 28/Mar/02 - added more firmware-dependent changes to format; hopefully this +% works for everything now (put previous changes on firmer footing?) +% 30/Mar/02 - made cfg output more intuitive by decoding things. +% - An early version of WAVESMON and PARSE which split out this +% data from a wave recorder inserted an extra two bytes per record. +% I have removed the code to handle this but if you need it see line 509 +% 29/Nov/02 - A change in the bottom-track block for version 4.05 (very old!). +% 29/Jan/03 - Status block in v4.25 150khzBB two bytes short? +% 14/Oct/03 - Added code to at least 'ignore' WinRiver GPS blocks. +% 11/Nov/03 - VMDAS navigation block, added hooks to output +% navigation data. + +num_av=5; % Block filtering and decimation parameter (# ensembles to block together). +nens=-1; % Read all ensembles. +century=2000; % ADCP clock does not have century prior to firmware 16.05. +vels='no'; % Default to simple averaging + +lv=length(varargin); +if lv>=1 & ~isstr(varargin{1}), + num_av=varargin{1}; % Block filtering and decimation parameter (# ensembles to block together). + varargin(1)=[]; + lv=lv-1; + if lv>=1 & ~isstr(varargin{1}), + nens=varargin{1}; + varargin(1)=[]; + lv=lv-1; + end; +end; + +% Read optional args +while length(varargin)>0, + switch varargin{1}(1:3), + case 'bas', + century = varargin{2}; + case 'des', + if isstr(varargin{2}), + if strcmp(varargin{2},'no'), vels='no'; + else vels=[.3 .3 .3]; end; + else + vels=varargin{2}; + end; + otherwise, + error(['Unknown command line option ->' varargin{1}]); + end; + varargin([1 2])=[]; +end; + + + + +% Check file information first + +naminfo=dir(name); + +if isempty(naminfo), + fprintf('ERROR******* Can''t find file %s\n',name); + return; +end; + +fprintf('\nOpening file %s\n\n',name); +fd=fopen(name,'r','ieee-le'); + +% Read first ensemble to initialize parameters + +[ens,hdr,cfg]=rd_buffer(fd,-2); % Initialize and read first two records +fseek(fd,0,'bof'); % Rewind + +if (cfg.prog_ver<16.05 & cfg.prog_ver>5.999) | cfg.prog_ver<5.55, + fprintf('**************Assuming that the century begins year %d *********** \n\n',century); +else + century=0; % century included in clock. +end; + +dats=datenum(century+ens.rtc(1,:),ens.rtc(2,:),ens.rtc(3,:),ens.rtc(4,:),ens.rtc(5,:),ens.rtc(6,:)+ens.rtc(7,:)/100); +t_int=diff(dats); +fprintf('Record begins at %s\n',datestr(dats(1),0)); +fprintf('Ping interval appears to be %s\n',datestr(t_int,13)); + + +% Estimate number of records (since I don't feel like handling EOFs correctly, +% we just don't read that far!) + + +% Now, this is a puzzle - it appears that this is not necessary in +% a firmware v16.12 sent to me, and I can't find any example for +% which it *is* necessary so I'm not sure why its there. It could be +% a leftoever from dealing with the bad WAVESMON/PARSE problem (now +% fixed) that inserted extra bytes. +% ...So its out for now. +%if cfg.prog_ver>=16.05, extrabytes=2; else extrabytes=0; end; % Extra bytes +extrabytes=0; + +if length(nens)==1, + if nens==-1, + nens=fix(naminfo.bytes/(hdr.nbyte+2+extrabytes)); + fprintf('\nEstimating %d ensembles in this file\nReducing by a factor of %d\n',nens,num_av); + else + fprintf('\nReading %d ensembles in this file\nReducing by a factor of %d\n',nens,num_av); + end; +else + fprintf('\nReading ensembles %d-%d in this file\nReducing by a factor of %d\n',nens,num_av); + fseek(fd,(hdr.nbyte+2+extrabytes)*(nens(1)-1),'bof'); + nens=diff(nens)+1; +end; + +if num_av>1, + if isstr(vels), + fprintf('\n Simple mean used for ensemble averaging\n'); + else + fprintf('\n Averaging after outlier rejection with parameters [%f %f %f]\n',vels); + end; +end; + +% Number of records after averaging. + +n=fix(nens/num_av); + +% Structure to hold all ADCP data +% Note that I am not storing all the data contained in the raw binary file, merely +% things I think are useful. + +switch cfg.sourceprog, + case 'WINRIVER', + adcp=struct('name','adcp','config',cfg,'mtime',zeros(1,n),'number',zeros(1,n),'pitch',zeros(1,n),... + 'roll',zeros(1,n),'heading',zeros(1,n),'pitch_std',zeros(1,n),... + 'roll_std',zeros(1,n),'heading_std',zeros(1,n),'depth',zeros(1,n),... + 'temperature',zeros(1,n),'salinity',zeros(1,n),... + 'pressure',zeros(1,n),'pressure_std',zeros(1,n),... + 'east_vel',zeros(cfg.n_cells,n),'north_vel',zeros(cfg.n_cells,n),'vert_vel',zeros(cfg.n_cells,n),... + 'error_vel',zeros(cfg.n_cells,n),'corr',zeros(cfg.n_cells,4,n),... + 'status',zeros(cfg.n_cells,4,n),'intens',zeros(cfg.n_cells,4,n),... + 'bt_range',zeros(4,n),'bt_vel',zeros(4,n),... + 'nav_longitude',zeros(1,n),'nav_latitude',zeros(1,n)); + case 'VMDAS', + adcp=struct('name','adcp','config',cfg,'mtime',zeros(1,n),'number',zeros(1,n),'pitch',zeros(1,n),... + 'roll',zeros(1,n),'heading',zeros(1,n),'pitch_std',zeros(1,n),... + 'roll_std',zeros(1,n),'heading_std',zeros(1,n),'depth',zeros(1,n),... + 'temperature',zeros(1,n),'salinity',zeros(1,n),... + 'pressure',zeros(1,n),'pressure_std',zeros(1,n),... + 'east_vel',zeros(cfg.n_cells,n),'north_vel',zeros(cfg.n_cells,n),'vert_vel',zeros(cfg.n_cells,n),... + 'error_vel',zeros(cfg.n_cells,n),'corr',zeros(cfg.n_cells,4,n),... + 'status',zeros(cfg.n_cells,4,n),'intens',zeros(cfg.n_cells,4,n),... + 'bt_range',zeros(4,n),'bt_vel',zeros(4,n),... + 'nav_smtime',zeros(1,n),'nav_emtime',zeros(1,n),... + 'nav_slongitude',zeros(1,n),'nav_elongitude',zeros(1,n),... + 'nav_slatitude',zeros(1,n),'nav_elatitude',zeros(1,n)); + otherwise + adcp=struct('name','adcp','config',cfg,'mtime',zeros(1,n),'number',zeros(1,n),'pitch',zeros(1,n),... + 'roll',zeros(1,n),'heading',zeros(1,n),'pitch_std',zeros(1,n),... + 'roll_std',zeros(1,n),'heading_std',zeros(1,n),'depth',zeros(1,n),... + 'temperature',zeros(1,n),'salinity',zeros(1,n),... + 'pressure',zeros(1,n),'pressure_std',zeros(1,n),... + 'east_vel',zeros(cfg.n_cells,n),'north_vel',zeros(cfg.n_cells,n),'vert_vel',zeros(cfg.n_cells,n),... + 'error_vel',zeros(cfg.n_cells,n),'corr',zeros(cfg.n_cells,4,n),... + 'status',zeros(cfg.n_cells,4,n),'intens',zeros(cfg.n_cells,4,n),... + 'bt_range',zeros(4,n),'bt_vel',zeros(4,n)); +end; + + +% Calibration factors for backscatter data + +clear global ens +% Loop for all records +for k=1:n, + + % Gives display so you know something is going on... + + if rem(k,50)==0, fprintf('\n%d',k*num_av);end; + fprintf('.'); + + % Read an ensemble + + ens=rd_buffer(fd,num_av); + + + if ~isstruct(ens), % If aborting... + fprintf('Only %d records found..suggest re-running RDRADCP using this parameter\n',(k-1)*num_av); + fprintf('(If this message preceded by a POSSIBLE PROGRAM PROBLEM message, re-run using %d)\n',(k-1)*num_av-1); + break; + end; + + dats=datenum(century+ens.rtc(1,:),ens.rtc(2,:),ens.rtc(3,:),ens.rtc(4,:),ens.rtc(5,:),ens.rtc(6,:)+ens.rtc(7,:)/100); + adcp.mtime(k)=median(dats); + adcp.number(k) =ens.number(1); + adcp.heading(k) =mean(ens.heading); + adcp.pitch(k) =mean(ens.pitch); + adcp.roll(k) =mean(ens.roll); + adcp.heading_std(k) =mean(ens.heading_std); + adcp.pitch_std(k) =mean(ens.pitch_std); + adcp.roll_std(k) =mean(ens.roll_std); + adcp.depth(k) =mean(ens.depth); + adcp.temperature(k) =mean(ens.temperature); + adcp.salinity(k) =mean(ens.salinity); + adcp.pressure(k) =mean(ens.pressure); + adcp.pressure_std(k)=mean(ens.pressure_std); + + if isstr(vels), + adcp.east_vel(:,k) =nmean(ens.east_vel ,2); + adcp.north_vel(:,k) =nmean(ens.north_vel,2); + adcp.vert_vel(:,k) =nmean(ens.vert_vel ,2); + adcp.error_vel(:,k) =nmean(ens.error_vel,2); + else + adcp.east_vel(:,k) =nmedian(ens.east_vel ,vels(1),2); + adcp.north_vel(:,k) =nmedian(ens.north_vel,vels(1),2); + adcp.vert_vel(:,k) =nmedian(ens.vert_vel ,vels(2),2); + adcp.error_vel(:,k) =nmedian(ens.error_vel,vels(3),2); + end; + + adcp.corr(:,:,k) =nmean(ens.corr,3); % added correlation RKD 9/00 + adcp.status(:,:,k) =nmean(ens.status,3); + + adcp.intens(:,:,k) =nmean(ens.intens,3); + + adcp.bt_range(:,k) =nmean(ens.bt_range,2); + adcp.bt_vel(:,k) =nmean(ens.bt_vel,2); + + switch cfg.sourceprog, + case 'WINRIVER', + adcp.nav_longitude(k)=nmean(ens.slongitude); + adcp.nav_latitude(k)=nmean(ens.slatitude); + case 'VMDAS', + adcp.nav_smtime(k) =ens.smtime(1); + adcp.nav_emtime(k) =ens.emtime(end); + adcp.nav_slatitude(k)=ens.slatitude(1); + adcp.nav_elatitude(k)=ens.elatitude(end); + adcp.nav_slongitude(k)=ens.slongitude(1); + adcp.nav_elongitude(k)=ens.elongitude(end); + end; +end; + +fprintf('\n'); +fclose(fd); + + +%------------------------------------- +function hdr=rd_hdr(fd); +% Read config data + +cfgid=fread(fd,1,'uint16'); +if cfgid~=hex2dec('7F7F'), + error(['File ID is ' dec2hex(cfgid) ' not 7F7F - data corrupted or not a BB/WH raw file?']); +end; + +hdr=rd_hdrseg(fd); + +%------------------------------------- +function cfg=rd_fix(fd); +% Read config data + +cfgid=fread(fd,1,'uint16'); +if cfgid~=hex2dec('0000'), + warning(['Fixed header ID ' cfgid 'incorrect - data corrupted or not a BB/WH raw file?']); +end; + +cfg=rd_fixseg(fd); + + + +%-------------------------------------- +function [hdr,nbyte]=rd_hdrseg(fd); +% Reads a Header + +hdr.nbyte =fread(fd,1,'int16'); +fseek(fd,1,'cof'); +ndat=fread(fd,1,'int8'); +hdr.dat_offsets =fread(fd,ndat,'int16'); +nbyte=4+ndat*2; + +%------------------------------------- +function opt=getopt(val,varargin); +% Returns one of a list (0=first in varargin, etc.) +if val+1>length(varargin), + opt='unknown'; +else + opt=varargin{val+1}; +end; + +% +%------------------------------------- +function [cfg,nbyte]=rd_fixseg(fd); +% Reads the configuration data from the fixed leader + +%%disp(fread(fd,10,'uint8')) +%%fseek(fd,-10,'cof'); + +cfg.name='wh-adcp'; +cfg.sourceprog='instrument'; % default - depending on what data blocks are + % around we can modify this later in rd_buffer. +cfg.prog_ver =fread(fd,1,'uint8')+fread(fd,1,'uint8')/100; + +if fix(cfg.prog_ver)==4 | fix(cfg.prog_ver)==5, + cfg.name='bb-adcp'; +elseif fix(cfg.prog_ver)==8 | fix(cfg.prog_ver)==16, + cfg.name='wh-adcp'; +else + cfg.name='unrecognized firmware version' ; +end; + +config =fread(fd,2,'uint8'); % Coded stuff +cfg.config =[dec2base(config(2),2,8) '-' dec2base(config(1),2,8)]; + cfg.beam_angle =getopt(bitand(config(2),3),15,20,30); + cfg.beam_freq =getopt(bitand(config(1),7),75,150,300,600,1200,2400); + cfg.beam_pattern =getopt(bitand(config(1),8)==8,'concave','convex'); % 1=convex,0=concave + cfg.orientation =getopt(bitand(config(1),128)==128,'down','up'); % 1=up,0=down +cfg.simflag =getopt(fread(fd,1,'uint8'),'real','simulated'); % Flag for simulated data +fseek(fd,1,'cof'); +cfg.n_beams =fread(fd,1,'uint8'); +cfg.n_cells =fread(fd,1,'uint8'); +cfg.pings_per_ensemble=fread(fd,1,'uint16'); +cfg.cell_size =fread(fd,1,'uint16')*.01; % meters +cfg.blank =fread(fd,1,'uint16')*.01; % meters +cfg.prof_mode =fread(fd,1,'uint8'); % +cfg.corr_threshold =fread(fd,1,'uint8'); +cfg.n_codereps =fread(fd,1,'uint8'); +cfg.min_pgood =fread(fd,1,'uint8'); +cfg.evel_threshold =fread(fd,1,'uint16'); +cfg.time_between_ping_groups=sum(fread(fd,3,'uint8').*[60 1 .01]'); % seconds +coord_sys =fread(fd,1,'uint8'); % Lots of bit-mapped info + cfg.coord=dec2base(coord_sys,2,8); + cfg.coord_sys =getopt(bitand(bitshift(coord_sys,-3),3),'beam','instrument','ship','earth'); + cfg.use_pitchroll =getopt(bitand(coord_sys,4)==4,'no','yes'); + cfg.use_3beam =getopt(bitand(coord_sys,2)==2,'no','yes'); + cfg.bin_mapping =getopt(bitand(coord_sys,1)==1,'no','yes'); +cfg.xducer_misalign=fread(fd,1,'int16')*.01; % degrees +cfg.magnetic_var =fread(fd,1,'int16')*.01; % degrees +cfg.sensors_src =dec2base(fread(fd,1,'uint8'),2,8); +cfg.sensors_avail =dec2base(fread(fd,1,'uint8'),2,8); +cfg.bin1_dist =fread(fd,1,'uint16')*.01; % meters +cfg.xmit_pulse =fread(fd,1,'uint16')*.01; % meters +cfg.water_ref_cells=fread(fd,2,'uint8'); +cfg.fls_target_threshold =fread(fd,1,'uint8'); +fseek(fd,1,'cof'); +cfg.xmit_lag =fread(fd,1,'uint16')*.01; % meters +nbyte=40; + +if cfg.prog_ver>=8.14, % Added CPU serial number with v8.14 + cfg.serialnum =fread(fd,8,'uint8'); + nbyte=nbyte+8; +end; + +if cfg.prog_ver>=8.24, % Added 2 more bytes with v8.24 firmware + cfg.sysbandwidth =fread(fd,2,'uint8'); + nbyte=nbyte+2; +end; + +if cfg.prog_ver>=16.05, % Added 1 more bytes with v16.05 firmware + cfg.syspower =fread(fd,1,'uint8'); + nbyte=nbyte+1; +end; + +% It is useful to have this precomputed. + +cfg.ranges=cfg.bin1_dist+[0:cfg.n_cells-1]'*cfg.cell_size; +if cfg.orientation==1, cfg.ranges=-cfg.ranges; end + + +%----------------------------- +function [ens,hdr,cfg]=rd_buffer(fd,num_av); + +% To save it being re-initialized every time. +global ens hdr + +% A fudge to try and read files not handled quite right. +global FIXOFFSET SOURCE + +% If num_av<0 we are reading only 1 element and initializing +if num_av<0 | isempty(ens), + FIXOFFSET=0; + SOURCE=0; % 0=instrument, 1=VMDAS, 2=WINRIVER + n=abs(num_av); + pos=ftell(fd); + hdr=rd_hdr(fd); + cfg=rd_fix(fd); + fseek(fd,pos,'bof'); + clear global ens + global ens + + ens=struct('number',zeros(1,n),'rtc',zeros(7,n),'BIT',zeros(1,n),'ssp',zeros(1,n),'depth',zeros(1,n),'pitch',zeros(1,n),... + 'roll',zeros(1,n),'heading',zeros(1,n),'temperature',zeros(1,n),'salinity',zeros(1,n),... + 'mpt',zeros(1,n),'heading_std',zeros(1,n),'pitch_std',zeros(1,n),... + 'roll_std',zeros(1,n),'adc',zeros(8,n),'error_status_wd',zeros(1,n),... + 'pressure',zeros(1,n),'pressure_std',zeros(1,n),... + 'east_vel',zeros(cfg.n_cells,n),'north_vel',zeros(cfg.n_cells,n),'vert_vel',zeros(cfg.n_cells,n),... + 'error_vel',zeros(cfg.n_cells,n),'intens',zeros(cfg.n_cells,4,n),'percent',zeros(cfg.n_cells,4,n),... + 'corr',zeros(cfg.n_cells,4,n),'status',zeros(cfg.n_cells,4,n),'bt_range',zeros(4,n),'bt_vel',zeros(4,n),... + 'smtime',zeros(1,n),'emtime',zeros(1,n),'slatitude',zeros(1,n),... + 'slongitude',zeros(1,n),'elatitude',zeros(1,n),'elongitude',zeros(1,n),... + 'flags',zeros(1,n)); + num_av=abs(num_av); +end; + +k=0; +while k' id1]); + end; + startpos=ftell(fd)-2; % Starting position. + + + % Read the # data types. + [hdr,nbyte]=rd_hdrseg(fd); + byte_offset=nbyte+2; +%%disp(length(hdr.dat_offsets)) + % Read all the data types. + for n=1:length(hdr.dat_offsets), + + id=fread(fd,1,'uint16'); +%% fprintf('ID=%s\n',dec2hex(id,4)); + + % handle all the various segments of data. Note that since I read the IDs as a two + % byte number in little-endian order the high and low bytes are exchanged compared to + % the values given in the manual. + % + + switch dec2hex(id,4), + case '0000', % Fixed leader + [cfg,nbyte]=rd_fixseg(fd); + nbyte=nbyte+2; + + case '0080' % Variable Leader + k=k+1; + ens.number(k) =fread(fd,1,'uint16'); + ens.rtc(:,k) =fread(fd,7,'uint8'); + ens.number(k) =ens.number(k)+65536*fread(fd,1,'uint8'); + ens.BIT(k) =fread(fd,1,'uint16'); + ens.ssp(k) =fread(fd,1,'uint16'); + ens.depth(k) =fread(fd,1,'uint16')*.1; % meters + ens.heading(k) =fread(fd,1,'uint16')*.01; % degrees + ens.pitch(k) =fread(fd,1,'int16')*.01; % degrees + ens.roll(k) =fread(fd,1,'int16')*.01; % degrees + ens.salinity(k) =fread(fd,1,'int16'); % PSU + ens.temperature(k) =fread(fd,1,'int16')*.01; % Deg C + ens.mpt(k) =sum(fread(fd,3,'uint8').*[60 1 .01]'); % seconds + ens.heading_std(k) =fread(fd,1,'uint8'); % degrees + ens.pitch_std(k) =fread(fd,1,'int8')*.1; % degrees + ens.roll_std(k) =fread(fd,1,'int8')*.1; % degrees + ens.adc(:,k) =fread(fd,8,'uint8'); + nbyte=2+40; + + if strcmp(cfg.name,'bb-adcp'), + + if cfg.prog_ver>=5.55, + fseek(fd,15,'cof'); % 14 zeros and one byte for number WM4 bytes + cent=fread(fd,1,'uint8'); % possibly also for 5.55-5.58 but + ens.rtc(:,k)=fread(fd,7,'uint8'); % I have no data to test. + ens.rtc(1,k)=ens.rtc(1,k)+cent*100; + nbyte=nbyte+15+8; + end; + + elseif strcmp(cfg.name,'wh-adcp'), % for WH versions. + + ens.error_status_wd(k)=fread(fd,1,'uint32'); + nbyte=nbyte+4;; + + if cfg.prog_ver>=8.13, % Added pressure sensor stuff in 8.13 + fseek(fd,2,'cof'); + ens.pressure(k) =fread(fd,1,'uint32'); + ens.pressure_std(k) =fread(fd,1,'uint32'); + nbyte=nbyte+10; + end; + + if cfg.prog_ver>8.24, % Spare byte added 8.24 + fseek(fd,1,'cof'); + nbyte=nbyte+1; + end; + + if cfg.prog_ver>=16.05, % Added more fields with century in clock 16.05 + cent=fread(fd,1,'uint8'); + ens.rtc(:,k)=fread(fd,7,'uint8'); + ens.rtc(1,k)=ens.rtc(1,k)+cent*100; + nbyte=nbyte+8; + end; + end; + + case '0100', % Velocities + vels=fread(fd,[4 cfg.n_cells],'int16')'*.001; % m/s + ens.east_vel(:,k) =vels(:,1); + ens.north_vel(:,k)=vels(:,2); + ens.vert_vel(:,k) =vels(:,3); + ens.error_vel(:,k)=vels(:,4); + nbyte=2+4*cfg.n_cells*2; + + case '0200', % Correlations + ens.corr(:,:,k) =fread(fd,[4 cfg.n_cells],'uint8')'; + nbyte=2+4*cfg.n_cells; + + case '0300', % Echo Intensities + ens.intens(:,:,k) =fread(fd,[4 cfg.n_cells],'uint8')'; + nbyte=2+4*cfg.n_cells; + + case '0400', % Percent good + ens.percent(:,:,k) =fread(fd,[4 cfg.n_cells],'uint8')'; + nbyte=2+4*cfg.n_cells; + + case '0500', % Status + % Note in one case with a 4.25 firmware SC-BB, it seems like + % this block was actually two bytes short! + ens.status(:,:,k) =fread(fd,[4 cfg.n_cells],'uint8')'; + nbyte=2+4*cfg.n_cells; + + case '0600', % Bottom track + % In WINRIVER GPS data is tucked into here in odd ways, as long + % as GPS is enabled. + if SOURCE==2, + fseek(fd,2,'cof'); + long1=fread(fd,1,'uint16'); + fseek(fd,6,'cof'); + cfac=180/2^31; + ens.slatitude(k) =fread(fd,1,'int32')*cfac; + else + fseek(fd,14,'cof'); % Skip over a bunch of stuff + end; + ens.bt_range(:,k)=fread(fd,4,'uint16')*.01; % + ens.bt_vel(:,k) =fread(fd,4,'int16'); + if SOURCE==2, + fseek(fd,12+2,'cof'); + ens.slongitude(k)=(long1+65536*fread(fd,1,'uint16'))*cfac; + if ens.slongitude(k)>180, ens.slongitude(k)=ens.slongitude(k)-360; end; + fseek(fd,71-33-16,'cof'); + nbyte=2+68; + else + fseek(fd,71-33,'cof'); + nbyte=2+68; + end; + if cfg.prog_ver>=5.3, % Version 4.05 firmware seems to be missing these last 11 bytes. + fseek(fd,78-71,'cof'); + ens.bt_range(:,k)=ens.bt_range(:,k)+fread(fd,4,'uint8')*655.36; + nbyte=nbyte+11; + if cfg.prog_ver>=16, % RDI documentation claims these extra bytes were added in v 8.17 + fseek(fd,4,'cof'); % but they don't appear in my 8.33 data. + nbyte=nbyte+4; + end; + end; + +% The raw files produced by VMDAS contain a binary navigation data +% block. + + case '2000', % Something from VMDAS. + cfg.sourceprog='VMDAS'; + SOURCE=1; + utim =fread(fd,4,'uint8'); + mtime =datenum(utim(3)+utim(4)*256,utim(2),utim(1)); + ens.smtime(k) =mtime+fread(fd,1,'uint32')/8640000; + fseek(fd,4,'cof'); + cfac=180/2^31; + ens.slatitude(k) =fread(fd,1,'int32')*cfac; + ens.slongitude(k) =fread(fd,1,'int32')*cfac; + ens.emtime(k) =mtime+fread(fd,1,'uint32')/8640000; + ens.elatitude(k) =fread(fd,1,'int32')*cfac; + ens.elongitude(k) =fread(fd,1,'int32')*cfac; + fseek(fd,12,'cof'); + ens.flags(k) =fread(fd,1,'uint16'); + fseek(fd,30,'cof'); + nbyte=2+76; + +% The following blocks come from WINRIVER files, they aparently contain +% the raw NMEA data received from a serial port. +% +% Note that for WINRIVER files somewhat decoded data is also available +% tucked into the bottom track block. + + case '2100', % $xxDBT (Winriver addition) 38 + cfg.sourceprog='WINRIVER'; + SOURCE=2; + str=fread(fd,38,'uchar')'; + nbyte=2+38; + + case '2101', % $xxGGA (Winriver addition) 94 in maanual but 97 seems to work + cfg.sourceprog='WINRIVER'; + SOURCE=2; + str=fread(fd,97,'uchar')'; + nbyte=2+97; + % disp(setstr(str(1:80))); + + case '2102', % $xxVTG (Winriver addition) 45 + cfg.sourceprog='WINRIVER'; + SOURCE=2; + str=fread(fd,45,'uchar')'; + nbyte=2+45; +% disp(setstr(str)); + + case '2103', % $xxGSA (Winriver addition) 60 + cfg.sourceprog='WINRIVER'; + SOURCE=2; + str=fread(fd,60,'uchar')'; +% disp(setstr(str)); + nbyte=2+60; + + case '2104', %xxHDT or HDG (Winriver addition) 38 + cfg.sourceprog='WINRIVER'; + SOURCE=2; + str=fread(fd,38,'uchar')'; +% disp(setstr(str)); + nbyte=2+38; + + + + case '0701', % Number of good pings + fseek(fd,4*cfg.n_cells,'cof'); + nbyte=2+4*cfg.n_cells; + + case '0702', % Sum of squared velocities + fseek(fd,4*cfg.n_cells,'cof'); + nbyte=2+4*cfg.n_cells; + + case '0703', % Sum of velocities + fseek(fd,4*cfg.n_cells,'cof'); + nbyte=2+4*cfg.n_cells; + +% These blocks were implemented for 5-beam systems + + case '0A00', % Beam 5 velocity (not implemented) + fseek(fd,cfg.n_cells,'cof'); + nbyte=2+cfg.n_cells; + + case '0301', % Beam 5 Number of good pings (not implemented) + fseek(fd,cfg.n_cells,'cof'); + nbyte=2+cfg.n_cells; + + case '0302', % Beam 5 Sum of squared velocities (not implemented) + fseek(fd,cfg.n_cells,'cof'); + nbyte=2+cfg.n_cells; + + case '0303', % Beam 5 Sum of velocities (not implemented) + fseek(fd,cfg.n_cells,'cof'); + nbyte=2+cfg.n_cells; + + case '020C', % Ambient sound profile (not implemented) + fseek(fd,4,'cof'); + nbyte=2+4; + + otherwise, + + fprintf('Unrecognized ID code: %s\n',dec2hex(id,4)); + nbyte=2; + %% ens=-1; + %% return; + + + end; + + % here I adjust the number of bytes so I am sure to begin + % reading at the next valid offset. If everything is working right I shouldn't have + % to do this but every so often firware changes result in some differences. + + %%fprintf('#bytes is %d, original offset is %d\n',nbyte,byte_offset); + byte_offset=byte_offset+nbyte; + + if n=16.05, + % fseek(fd,2,'cof'); + %end; + +end; + +% Blank out stuff bigger than error velocity +% big_err=abs(ens.error_vel)>.2; +big_err=0; + +% Blank out invalid data +ens.east_vel(ens.east_vel==-32.768 | big_err)=NaN; +ens.north_vel(ens.north_vel==-32.768 | big_err)=NaN; +ens.vert_vel(ens.vert_vel==-32.768 | big_err)=NaN; +ens.error_vel(ens.error_vel==-32.768 | big_err)=NaN; + + + + +%-------------------------------------- +function y=nmedian(x,window,dim); +% Copied from median but with handling of NaN different. + +if nargin==2, + dim = min(find(size(x)~=1)); + if isempty(dim), dim = 1; end +end + +siz = [size(x) ones(1,dim-ndims(x))]; +n = size(x,dim); + +% Permute and reshape so that DIM becomes the row dimension of a 2-D array +perm = [dim:max(length(size(x)),dim) 1:dim-1]; +x = reshape(permute(x,perm),n,prod(siz)/n); + +% Sort along first dimension +x = sort(x,1); +[n1,n2]=size(x); + +if n1==1, + y=x; +else + if n2==1, + kk=sum(finite(x),1); + if kk>0, + x1=x(max(fix(kk/2),1)); + x2=x(max(ceil(kk/2),1)); + x(abs(x-(x1+x2)/2)>window)=NaN; + end; + x = sort(x,1); + kk=sum(finite(x),1); + x(isnan(x))=0; + y=NaN; + if kk>0, + y=sum(x)/kk; + end; + else + kk=sum(finite(x),1); + ll=kkwindow)=NaN; + x = sort(x,1); + kk=sum(finite(x),1); + x(isnan(x))=0; + y=NaN+ones(1,n2); + if any(kk), + y(kk>0)=sum(x(:,kk>0))./kk(kk>0); + end; + end; +end; + +% Permute and reshape back +siz(dim) = 1; +y = ipermute(reshape(y,siz(perm)),perm); + +%-------------------------------------- +function y=nmean(x,dim); +% R_NMEAN Computes the mean of matrix ignoring NaN +% values +% R_NMEAN(X,DIM) takes the mean along the dimension DIM of X. +% + +kk=finite(x); +x(~kk)=0; + +if nargin==1, + % Determine which dimension SUM will use + dim = min(find(size(x)~=1)); + if isempty(dim), dim = 1; end +end; + +if dim>length(size(x)), + y=x; % For matlab 5.0 only!!! Later versions have a fixed 'sum' +else + ndat=sum(kk,dim); + indat=ndat==0; + ndat(indat)=1; % If there are no good data then it doesn't matter what + % we average by - and this avoid div-by-zero warnings. + + y = sum(x,dim)./ndat; + y(indat)=NaN; +end; + + + + + + + + + + + + + + + + + + + + + + + + + Index: adcp/trunk/adcp/specmultiplot_wfreqdirs.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/specmultiplot_wfreqdirs.m (revision 168) @@ -1,0 +1,148 @@ +function [Winfo]=specmultiplot(dateinfo1,dateinfo2,timestep); +%where dateinfo1 and 2 are the strings of the first and last date extension +%of the pressure,range,etc files and timestep is the time in hours between +%each burst + +%This function takes the pressure, range, orbit and sysinfo files created +%in python and outputs a Winfo data structure with the sig wave height, +%peak period, direction of peak period and dominant dir. It also generates +%polar plots and 2d freq and directional plots of a variety of different +%estimation methods, resolutions and the wavesmon output. + + +%first set up the time vector going from dateinfo1 to dateinfo2 +Winfo.time=[]; + +date1=datevec(dateinfo1, 'yymmddHHMM'); +date2=datevec(dateinfo2,'yymmddHHMM'); + +if date1 == date2 + Winfo.time=[datenum(date1)]; +else + Winfo.time=[datenum(date1)]; + newdate=date1; + while datenum(newdate) ~= datenum(date2) + newdate=newdate+[0 0 0 timestep 0 0]; + Winfo.time=[horzcat(Winfo.time,datenum(newdate))]; + end +end + + +%set up time, which is Winfo.time as date str in the yymmddHHMM format +time=datestr(Winfo.time, 'yymmddHHMM'); + +%set up data structure for wave info +Winfo.setup={'EMEP UVW','EMEP UVW F005','EMEP UVW D01','IMLM UVW','IMLM UVW F005','IMLM UVW D01','EMEP range','IMLM range','EMEP radial','IMLM radial','wavesmon'}'; +Winfo.hsig=[]; +Winfo.peakP=[]; +Winfo.dirP=[]; +Winfo.Ddir=[]; + +%Load the data and run the script +for i=1:length(time(:,1)) + dateinfo=time(i,:); + + pressure=strcat('pressure_',dateinfo,'.txt'); + range=strcat('range_',dateinfo,'.txt'); + orbit=strcat('orbit_',dateinfo,'.txt'); + sysinfo=strcat('sysinfo_',dateinfo,'.txt'); + spec=strcat('DSpec',dateinfo,'.txt'); + + pressure=load(pressure); + range=load(range); + orbit=load(orbit); + sysinfo=load(sysinfo); + spec=load(spec); + + %set up data with uvw and pressure, freq at 0.01 and dir at 2 + [ID,SM,EP]=radialtouvw(pressure,range,orbit,sysinfo,1); + + %run diwasp to generate this spectrum + [E_uvw_F01_D2, EPout]=dirspectest(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0}); + + %now for IMLM + EP.method='IMLM'; + EP.iter=3; + [I_uvw_F01_D2, EPout]=dirspectest(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0}); + + %now for IMLM with increased Freq resolution + SM.freqs=[0.005:0.005:0.4]; + [I_uvw_F005_D2, EPout]=dirspectest(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0}); + + %now for IMLM with increased Dir resolution + SM.freqs=[0.01:0.01:0.4]; + SM.dirs=[-180:1:180]; + [I_uvw_F01_D1, EPout]=dirspectest(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0}); + + %now for EMEP with increased Freq res and then Dir res + EP.method='EMEP'; + EP.iter=100; + SM.freqs=[0.005:0.005:0.4]; + SM.dirs=[-180:2:180]; + [E_uvw_F005_D2, EPout]=dirspectest(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0}); + + SM.freqs=[0.01:0.01:0.4]; + SM.dirs=[-180:1:180]; + [E_uvw_F01_D1, EPout]=dirspectest(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0}); + + + %set up data with ranges, freq and dir at default + [ID,SM,EP]=radialtouvw(pressure,range,orbit,sysinfo,2); + + % run diwasp to generate this spectrum with EMEP + [E_range_F01_D2, EPout]=dirspectest(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0}); + + %now with IMLM + EP.method='IMLM'; + EP.iter=3; + [I_range_F01_D2, EPout]=dirspectest(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0}); + + %set up data with radial velocities, freq and dir at default + [ID,SM,EP]=radialtouvw(pressure,range,orbit,sysinfo,3); + + % run diwasp to generate this spectrum with EMEP + [E_radial_F01_D2, EPout]=dirspectest(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0}); + + %now with IMLM + EP.method='IMLM'; + EP.iter=3; + [I_radial_F01_D2, EPout]=dirspectest(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0}); + + %Use waveplot to plot the polar, freq and dir plots of the spectra + + [E_UVW_WI,I_UVW_WI,E_range_WI,I_range_WI,wmon_WI,fig1,fig2]=waveplot(E_uvw_F01_D2,I_uvw_F01_D2,E_range_F01_D2,I_range_F01_D2,spec,sysinfo); + + saveas(fig1,['polar1_' dateinfo '.fig']); + saveas(fig2,['dirfreq1_' dateinfo '.fig']); + + [E_UVW_F_WI,E_UVW_D_WI,I_UVW_F_WI,I_UVW_D_WI,fig3,fig4]=waveplot2(E_uvw_F01_D2,I_uvw_F01_D2,E_uvw_F005_D2,I_uvw_F005_D2,E_uvw_F01_D1,I_uvw_F01_D1,sysinfo); + + saveas(fig3,['polar2_' dateinfo '.fig']); + saveas(fig4,['dirfreq2_' dateinfo '.fig']); + + [E_radial_WI,I_radial_WI,fig5,fig6]=radialwaveplot(E_radial_F01_D2,I_radial_F01_D2,spec,sysinfo); + + saveas(fig5,['polar3_' dateinfo '.fig']); + saveas(fig6,['dirfreq3_' dateinfo '.fig']); + + close all; + + %Fill up the Winfo data structure + + hsig=[vertcat(E_UVW_WI.hsig,E_UVW_F_WI.hsig,E_UVW_D_WI.hsig,I_UVW_WI.hsig,I_UVW_F_WI.hsig,I_UVW_D_WI.hsig,E_range_WI.hsig,I_range_WI.hsig,E_radial_WI.hsig,I_radial_WI.hsig,wmon_WI.hsig)]; + peakP=[vertcat(E_UVW_WI.tp,E_UVW_F_WI.tp,E_UVW_D_WI.tp,I_UVW_WI.tp,I_UVW_F_WI.tp,I_UVW_D_WI.tp,E_range_WI.tp,I_range_WI.tp,E_radial_WI.tp,I_radial_WI.tp,wmon_WI.tp)]; + dirP=[vertcat(E_UVW_WI.dtp,E_UVW_F_WI.dtp,E_UVW_D_WI.dtp,I_UVW_WI.dtp,I_UVW_F_WI.dtp,I_UVW_D_WI.dtp,E_range_WI.dtp,I_range_WI.dtp,E_radial_WI.dtp,I_radial_WI.dtp,wmon_WI.dtp)]; + Ddir=[vertcat(E_UVW_WI.dp,E_UVW_F_WI.dp,E_UVW_D_WI.dp,I_UVW_WI.dp,I_UVW_F_WI.dp,I_UVW_D_WI.dp,E_range_WI.dp,I_range_WI.dp,E_radial_WI.dp,I_radial_WI.dp,wmon_WI.dp)]; + + Winfo.hsig=[horzcat(Winfo.hsig,hsig)]; + Winfo.peakP=[horzcat(Winfo.peakP,peakP)]; + Winfo.dirP=[horzcat(Winfo.dirP,dirP)]; + Winfo.Ddir=[horzcat(Winfo.Ddir,Ddir)]; + +end + +% change Winfo.time back to a matlab datenum + +%Winfo.time=datenum(Winfo.time); + + Index: adcp/trunk/adcp/waveplot2.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/waveplot2.m (revision 168) @@ -1,0 +1,310 @@ +function [E_UVW_F_WI,E_UVW_D_WI,I_UVW_F_WI,I_UVW_D_WI,fig3,fig4]=waveplot2(EMEP,IMLM,freqE,freqI,dirE,dirI,sysinfo) + +%make sure to load the EMEP, IMLM and wavesmon samples +%EMEP=load('emep'), IMLM=load('imlm'), spec=load('wavesmon') +%rangeE=load('EMEP_range'), rangeI=load('IMLM_range') + +%what is the magnetic variation to nearest degree +magvar=10; + +%what is the start angle +heading=sysinfo(18,:); +heading=heading/100; +sangle=heading+magvar; + +%what is the frequency and dir resolution for those generated in DIWASP +freqres=0.01; +freqresH=0.005; +freqs=[0.01:0.01:.4]; +freqsH=[0.005:0.005:0.4]; +dirres=2; +dirresH=1; +dirs=[-180:2:180]; +dirsH=[-180:1:180]; + +%set up the directions +adj_angle=90-sangle+360+180; + +% plot the spectrum generated through DIWASP +scrsz = get(0,'ScreenSize'); +fig3=figure('Position',[scrsz]); +subplot(2,3,1); +subplotspec(EMEP,4); +title('EMEP UVW'); + +subplot(2,3,2); +subplotspec(freqE,4); +title('EMEP UVW, freq = 0.005'); + +subplot(2,3,3); +subplotspec(dirE,4); +title('EMEP UVW, dir res = 1'); + +subplot(2,3,4); +subplotspec(IMLM,4); +title('IMLM UVW'); + +subplot(2,3,5); +subplotspec(freqI,4); +title('IMLM UVW, freq = 0.005'); + +subplot(2,3,6); +subplotspec(dirI,4); +title('IMLM UVW, dir res = 1'); + +%calculate just the dir energy spectrum on a single graph + +EMEPdir=sum(EMEP.S)*freqres; +IMLMdir=sum(real(IMLM.S))*freqres; +freqEdir=sum(freqE.S)*freqresH; +dirEdir=sum(dirE.S)*freqres; +freqIdir=sum(real(freqI.S))*freqresH; +dirIdir=sum(real(dirI.S))*freqres; + +%calculate just the frequency energy spectrum +EMEPfreq=sum(EMEP.S')*dirres; +IMLMfreq=sum(real(IMLM.S)')*dirres; +freqEfreq=sum(freqE.S')*dirres; +dirEfreq=sum(dirE.S')*dirresH; +freqIfreq=sum(real(freqI.S)')*dirres; +dirIfreq=sum(real(dirI.S)')*dirresH; + +%plot the directional energy spectrum +fig4=figure('Position',[scrsz]); +subplot(1,2,1); +plot(dirs,EMEPdir,'b'); +hold on +plot(dirs,freqEdir,'r'); +plot(dirsH,dirEdir,'g'); +axis(axis); +plot(dirs,IMLMdir,'c'); +plot(dirs,freqIdir,'m'); +plot(dirsH,dirIdir,'k'); + + +legend('EMEP uvw','EMEP uvw freq=0.005','EMEP uvw dir=1','IMLM uvw','IMLM uvw freq=0.005','IMLM uvw dir=1','location','best'); +title('directional wave spectrum integrated over frequency'); +xlabel('axis angle (degrees true)'); +ylabel('m^2 / hz'); + +%plot the frequency energy spectrum +subplot(1,2,2); +plot(freqs,EMEPfreq,'b'); +hold on +plot(freqsH,freqEfreq,'r'); +plot(freqs,dirEfreq,'g'); +plot(freqs,IMLMfreq,'c'); +plot(freqsH,freqIfreq,'m'); +plot(freqs,dirIfreq,'k'); +legend('EMEP uvw','EMEP uvw freq=0.005','EMEP uvw dir=1','IMLM uvw','IMLM uvw freq=0.005','IMLM uvw dir=1','location','best'); +title('directional wave spectrum integrated over direction'); +xlabel('frequency in Hz'); +ylabel('m^2 / deg'); + +% ______Calculate and display the wave parameters SigH, Tp, Dp,DTp_______ + +%For EMEP uvw + +%calculate the 0,1,2 moments +m0=sum(EMEPfreq*freqres); +m1=sum(freqs.*EMEPfreq*freqres); +m2=sum((freqs.^2).*EMEPfreq*freqres); +% Calculate the Sig wave height +Hsig=4*sqrt(m0); + +% Calculate the peak period Tp +[P,I]=max(EMEPfreq); +Tp=1/(freqs(I)); + +%Calculate the Direction of the peak period DTp +[P,I]=max(real(EMEP.S(I,:))); +DTp=dirs(I); + +%Calculate the Dominant Direction Dp +[P,I]=max(EMEPdir); +Dp=dirs(I); + +%Display on the screen the SigH,Tp,Dp,DTp +disp(['EMEP uvw']); +disp(['SigH (meters): ' num2str(Hsig)]); +disp(['peak period (seconds): ' num2str(Tp)]); +disp(['Dir of peak period: ' num2str(compangle(DTp, EMEP.xaxisdir))]); +disp(['Dominant Direction: ' num2str(compangle(Dp, EMEP.xaxisdir))]); +disp([' ']); + +% For IMLM uvw + +%calculate the 0,1,2 moments +m0=sum(IMLMfreq*freqres); +m1=sum(freqs.*IMLMfreq*freqres); +m2=sum((freqs.^2).*IMLMfreq*freqres); +% Calculate the Sig wave height +Hsig=4*sqrt(m0); + +% Calculate the peak period Tp +[P,I]=max(IMLMfreq); +Tp=1/(freqs(I)); + +%Calculate the Direction of the peak period DTp +[P,I]=max(real(IMLM.S(I,:))); +DTp=dirs(I); + +%Calculate the Dominant Direction Dp +[P,I]=max(IMLMdir); +Dp=dirs(I); + +%Display on the screen the SigH,Tp,Dp,DTp +disp(['IMLM uvw']); +disp(['SigH (meters): ' num2str(Hsig)]); +disp(['peak period (seconds): ' num2str(Tp)]); +disp(['Dir of peak period: ' num2str(compangle(DTp, IMLM.xaxisdir))]); +disp(['Dominant Direction: ' num2str(compangle(Dp, IMLM.xaxisdir))]); +disp([' ']); + +% for EMEP freq=0.005 + +%calculate the 0,1,2 moments +m0=sum(freqEfreq*freqresH); +m1=sum(freqsH.*freqEfreq*freqresH); +m2=sum((freqsH.^2).*freqEfreq*freqresH); +% Calculate the Sig wave height +E_UVW_F_Hsig=4*sqrt(m0); + +% Calculate the peak period Tp +[P,I]=max(freqEfreq); +E_UVW_F_Tp=1/(freqsH(I)); + +%Calculate the Direction of the peak period DTp +[P,I]=max(real(freqE.S(I,:))); +E_UVW_F_DTp=dirs(I); + +%Calculate the Dominant Direction Dp +[P,I]=max(freqEdir); +E_UVW_F_Dp=dirs(I); + +%Display on the screen the SigH,Tp,Dp,DTp +disp(['EMEP UVW freq=0.005']); +disp(['SigH (meters): ' num2str(E_UVW_F_Hsig)]); +disp(['peak period (seconds): ' num2str(E_UVW_F_Tp)]); +disp(['Dir of peak period: ' num2str(compangle(E_UVW_F_DTp, freqE.xaxisdir))]); +disp(['Dominant Direction: ' num2str(compangle(E_UVW_F_Dp, freqE.xaxisdir))]); +disp([' ']); + +E_UVW_F_WI.hsig=E_UVW_F_Hsig; +E_UVW_F_WI.tp=E_UVW_F_Tp; +E_UVW_F_WI.dtp=compangle(E_UVW_F_DTp, freqE.xaxisdir); +E_UVW_F_WI.dp=compangle(E_UVW_F_Dp, freqE.xaxisdir); + +%for EMEP uvw dir=1 + +%calculate the 0,1,2 moments +m0=sum(dirEfreq*freqres); +m1=sum(freqs.*dirEfreq*freqres); +m2=sum((freqs.^2).*dirEfreq*freqres); +% Calculate the Sig wave height +E_UVW_D_Hsig=4*sqrt(m0); + +% Calculate the peak period Tp +[P,I]=max(dirEfreq); +E_UVW_D_Tp=1/(freqs(I)); + +%Calculate the Direction of the peak period DTp +[P,I]=max(real(dirE.S(I,:))); +E_UVW_D_DTp=dirsH(I); + +%Calculate the Dominant Direction Dp +[P,I]=max(dirEdir); +E_UVW_D_Dp=dirsH(I); + +%Display on the screen the SigH,Tp,Dp,DTp +disp(['EMEP UVW dir=1']); +disp(['SigH (meters): ' num2str(E_UVW_D_Hsig)]); +disp(['peak period (seconds): ' num2str(E_UVW_D_Tp)]); +disp(['Dir of peak period: ' num2str(compangle(E_UVW_D_DTp, dirE.xaxisdir))]); +disp(['Dominant Direction: ' num2str(compangle(E_UVW_D_Dp, dirE.xaxisdir))]); +disp([' ']); + +E_UVW_D_WI.hsig=E_UVW_D_Hsig; +E_UVW_D_WI.tp=E_UVW_D_Tp; +E_UVW_D_WI.dtp=compangle(E_UVW_D_DTp, dirE.xaxisdir); +E_UVW_D_WI.dp=compangle(E_UVW_D_Dp, dirE.xaxisdir); + +% for IMLM freq=0.005 + +%calculate the 0,1,2 moments +m0=sum(freqIfreq*freqresH); +m1=sum(freqsH.*freqIfreq*freqresH); +m2=sum((freqsH.^2).*freqIfreq*freqresH); +% Calculate the Sig wave height +I_UVW_F_Hsig=4*sqrt(m0); + +% Calculate the peak period Tp +[P,I]=max(freqIfreq); +I_UVW_F_Tp=1/(freqsH(I)); + +%Calculate the Direction of the peak period DTp +[P,I]=max(real(freqI.S(I,:))); +I_UVW_F_DTp=dirs(I); + +%Calculate the Dominant Direction Dp +[P,I]=max(freqIdir); +I_UVW_F_Dp=dirs(I); + +%Display on the screen the SigH,Tp,Dp,DTp +disp(['IMLM UVW freq=0.005']); +disp(['SigH (meters): ' num2str(I_UVW_F_Hsig)]); +disp(['peak period (seconds): ' num2str(I_UVW_F_Tp)]); +disp(['Dir of peak period: ' num2str(compangle(I_UVW_F_DTp, freqI.xaxisdir))]); +disp(['Dominant Direction: ' num2str(compangle(I_UVW_F_Dp, freqI.xaxisdir))]); +disp([' ']); + +I_UVW_F_WI.hsig=I_UVW_F_Hsig; +I_UVW_F_WI.tp=I_UVW_F_Tp; +I_UVW_F_WI.dtp=compangle(I_UVW_F_DTp, freqI.xaxisdir); +I_UVW_F_WI.dp=compangle(I_UVW_F_Dp, freqI.xaxisdir); + +%for IMLM uvw dir=1 + +%calculate the 0,1,2 moments +m0=sum(dirIfreq*freqres); +m1=sum(freqs.*dirIfreq*freqres); +m2=sum((freqs.^2).*dirIfreq*freqres); +% Calculate the Sig wave height +I_UVW_D_Hsig=4*sqrt(m0); + +% Calculate the peak period Tp +[P,I]=max(dirIfreq); +I_UVW_D_Tp=1/(freqs(I)); + +%Calculate the Direction of the peak period DTp +[P,I]=max(real(dirI.S(I,:))); +I_UVW_D_DTp=dirsH(I); + +%Calculate the Dominant Direction Dp +[P,I]=max(dirIdir); +I_UVW_D_Dp=dirsH(I); + +%Display on the screen the SigH,Tp,Dp,DTp +disp(['IMLM UVW dir=1']); +disp(['SigH (meters): ' num2str(I_UVW_D_Hsig)]); +disp(['peak period (seconds): ' num2str(I_UVW_D_Tp)]); +disp(['Dir of peak period: ' num2str(compangle(I_UVW_D_DTp, dirI.xaxisdir))]); +disp(['Dominant Direction: ' num2str(compangle(I_UVW_D_Dp, dirI.xaxisdir))]); +disp([' ']); + +I_UVW_D_WI.hsig=I_UVW_D_Hsig; +I_UVW_D_WI.tp=I_UVW_D_Tp; +I_UVW_D_WI.dtp=compangle(I_UVW_D_DTp, freqI.xaxisdir); +I_UVW_D_WI.dp=compangle(I_UVW_D_Dp, freqI.xaxisdir); + +%function to change from axis angles to compass bearings + +function angle=compangle(angle,xaxisdir) +angle=xaxisdir*ones(size(angle))-angle; +angle=angle+360*(angle<0); +angle=angle-360*(angle>360); + + + + + Index: adcp/trunk/adcp/waveplot3.m =================================================================== --- (revision ) +++ adcp/trunk/adcp/waveplot3.m (revision 168) @@ -1,0 +1,262 @@ +function waveplot3(EMEP,IMLM,rangeE,rangeI,spec) + +%make sure to load the EMEP, IMLM and wavesmon samples +%EMEP=load('emep'), IMLM=load('imlm'), spec=load('wavesmon') +%rangeE=load('EMEP_range'), rangeI=load('IMLM_range') + +%set up the wavesmon data in a structure + +%what is the magnetic variation to nearest degree +magvar=10; + +%first change to m^2/Hz/deg +wmon.S=spec/(360*1000*1000); + +%what is the start angle +sangle=281+magvar; + +%what is the frequency and dir resolution for those generated in DIWASP +freqres=0.01; +freqs=[0.01:0.01:.4]; +dirres=2; +dirs=[-180:2:180]; + +%set up the directions +adj_angle=90-sangle+360+180; +wmon.dirs=[adj_angle:-4:-(356-adj_angle)]; +wmondirres=4; +wmon.xaxisdir=90; +wmon.freqs=[0.00781250:0.00781250:1]; +wmonfreqres=0.00781250; + +% plot the spectrum generated through DIWASP + +subplot(2,3,1); +subplotspec(EMEP.SMout,4); +title('EMEP Range'); + +subplot(2,3,2); +subplotspec(IMLM.SMout,4); +title('IMLM Range'); + +subplot(2,3,3); +subplotspec(wmon,4); +title('Wavesmon output'); + +subplot(2,3,4); +subplotspec(rangeE.SMout,4); +title('EMEP Range cpsd'); + +subplot(2,3,5); +subplotspec(rangeI.SMout,4); +title('IMLM Range cpsd'); + +%calculate just the dir energy spectrum on a single graph + +EMEPdir=sum(EMEP.SMout.S)*freqres; +IMLMdir=sum(real(IMLM.SMout.S))*freqres; +EMEPrangedir=sum(rangeE.SMout.S)*freqres; +IMLMrangedir=sum(real(rangeI.SMout.S))*freqres; +wmondir=sum(wmon.S)*wmonfreqres; + +%calculate just the frequency energy spectrum +EMEPfreq=sum(EMEP.SMout.S')*dirres; +IMLMfreq=sum(real(IMLM.SMout.S)')*dirres; +EMEPrangefreq=sum(rangeE.SMout.S')*dirres; +IMLMrangefreq=sum(real(rangeI.SMout.S)')*dirres; +wmonfreq=sum(wmon.S')*wmondirres; + +%plot the directional energy spectrum +figure; +subplot(1,2,1); +plot(dirs,EMEPdir,'b'); +hold on +plot(dirs,EMEPrangedir,'r'); +plot(dirs,IMLMrangedir,'g'); +%need to make sure the wmon plot has the same x-axis as the others +Aindex=find(wmon.dirs > 180); +Bindex=find(wmon.dirs <181); +wmon.dirs(Aindex)=wmon.dirs(Aindex)-360; + +plot(wmon.dirs(Aindex),wmondir(Aindex),'k'); +plot(wmon.dirs(Bindex),wmondir(Bindex),'k'); +axis(axis); +plot(dirs,IMLMdir,'c'); +legend('EMEP range','EMEP range cpsd','IMLM range cpsd','wavesmon','','IMLM range'); +title('directional wave spectrum integrated over frequency'); +xlabel('axis angle (degrees true)'); +ylabel('m^2 / deg'); + +%plot the frequency energy spectrum +subplot(1,2,2); +plot(freqs,EMEPfreq,'b'); +hold on +plot(freqs,EMEPrangefreq,'r'); +plot(freqs,IMLMrangefreq,'g'); +plot(wmon.freqs,wmonfreq,'k'); +axis(axis); +plot(freqs,IMLMfreq,'c'); +legend('EMEP range','EMEP range cpsd','IMLM range cpsd','wavesmon','IMLM range'); +title('directional wave spectrum integrated over direction'); +xlabel('frequency in Hz'); +ylabel('m^2 / hz'); + +% ______Calculate and display the wave parameters SigH, Tp, Dp,DTp_______ + +%For EMEP uvw + +%calculate the 0,1,2 moments +m0=sum(EMEPfreq*freqres); +m1=sum(freqs.*EMEPfreq*freqres); +m2=sum((freqs.^2).*EMEPfreq*freqres); +% Calculate the Sig wave height +Hsig=4*sqrt(m0); + +% Calculate the peak period Tp +[P,I]=max(EMEPfreq); +Tp=1/(freqs(I)); + +%Calculate the Direction of the peak period DTp +[P,I]=max(real(EMEP.SMout.S(I,:))); +DTp=dirs(I); + +%Calculate the Dominant Direction Dp +[P,I]=max(EMEPdir); +Dp=dirs(I); + +%Display on the screen the SigH,Tp,Dp,DTp +disp(['EMEP range']); +disp(['SigH (meters): ' num2str(Hsig)]); +disp(['peak period (seconds): ' num2str(Tp)]); +disp(['Dir of peak period: ' num2str(compangle(DTp, EMEP.SMout.xaxisdir))]); +disp(['Dominant Direction: ' num2str(compangle(Dp, EMEP.SMout.xaxisdir))]); +disp([' ']); + +% For IMLM uvw + +%calculate the 0,1,2 moments +m0=sum(IMLMfreq*freqres); +m1=sum(freqs.*IMLMfreq*freqres); +m2=sum((freqs.^2).*IMLMfreq*freqres); +% Calculate the Sig wave height +Hsig=4*sqrt(m0); + +% Calculate the peak period Tp +[P,I]=max(IMLMfreq); +Tp=1/(freqs(I)); + +%Calculate the Direction of the peak period DTp +[P,I]=max(real(IMLM.SMout.S(I,:))); +DTp=dirs(I); + +%Calculate the Dominant Direction Dp +[P,I]=max(IMLMdir); +Dp=dirs(I); + +%Display on the screen the SigH,Tp,Dp,DTp +disp(['IMLM range']); +disp(['SigH (meters): ' num2str(Hsig)]); +disp(['peak period (seconds): ' num2str(Tp)]); +disp(['Dir of peak period: ' num2str(compangle(DTp, IMLM.SMout.xaxisdir))]); +disp(['Dominant Direction: ' num2str(compangle(Dp, IMLM.SMout.xaxisdir))]); +disp([' ']); + +% for Range of EMEP + +%calculate the 0,1,2 moments +m0=sum(EMEPrangefreq*freqres); +m1=sum(freqs.*EMEPrangefreq*freqres); +m2=sum((freqs.^2).*EMEPrangefreq*freqres); +% Calculate the Sig wave height +Hsig=4*sqrt(m0); + +% Calculate the peak period Tp +[P,I]=max(EMEPrangefreq); +Tp=1/(freqs(I)); + +%Calculate the Direction of the peak period DTp +[P,I]=max(real(rangeE.SMout.S(I,:))); +DTp=dirs(I); + +%Calculate the Dominant Direction Dp +[P,I]=max(EMEPrangedir); +Dp=dirs(I); + +%Display on the screen the SigH,Tp,Dp,DTp +disp(['EMEP range cpsd']); +disp(['SigH (meters): ' num2str(Hsig)]); +disp(['peak period (seconds): ' num2str(Tp)]); +disp(['Dir of peak period: ' num2str(compangle(DTp, rangeE.SMout.xaxisdir))]); +disp(['Dominant Direction: ' num2str(compangle(Dp, rangeE.SMout.xaxisdir))]); +disp([' ']); + +%for Range of IMLM + +%calculate the 0,1,2 moments +m0=sum(IMLMrangefreq*freqres); +m1=sum(freqs.*IMLMrangefreq*freqres); +m2=sum((freqs.^2).*IMLMrangefreq*freqres); +% Calculate the Sig wave height +Hsig=4*sqrt(m0); + +% Calculate the peak period Tp +[P,I]=max(IMLMrangefreq); +Tp=1/(freqs(I)); + +%Calculate the Direction of the peak period DTp +[P,I]=max(real(rangeI.SMout.S(I,:))); +DTp=dirs(I); + +%Calculate the Dominant Direction Dp +[P,I]=max(IMLMrangedir); +Dp=dirs(I); + +%Display on the screen the SigH,Tp,Dp,DTp +disp(['IMLM range cpsd']); +disp(['SigH (meters): ' num2str(Hsig)]); +disp(['peak period (seconds): ' num2str(Tp)]); +disp(['Dir of peak period: ' num2str(compangle(DTp, rangeI.SMout.xaxisdir))]); +disp(['Dominant Direction: ' num2str(compangle(Dp, rangeI.SMout.xaxisdir))]); +disp([' ']); + +% for wavesmon + +%calculate the 0,1,2 moments +m0=sum(wmonfreq*wmonfreqres); +m1=sum(wmon.freqs.*wmonfreq*wmonfreqres); +m2=sum((wmon.freqs.^2).*wmonfreq*wmonfreqres); +% Calculate the Sig wave height +Hsig=4*sqrt(m0); + +% Calculate the peak period Tp +[P,I]=max(wmonfreq); +Tp=1/(wmon.freqs(I)); + +%Calculate the Direction of the peak period DTp +[P,I]=max(real(wmon.S(I,:))); +DTp=wmon.dirs(I); + +%Calculate the Dominant Direction Dp +[P,I]=max(wmondir); +Dp=wmon.dirs(I); + +%Display on the screen the SigH,Tp,Dp,DTp +disp(['Wavesmon output']); +disp(['SigH (meters): ' num2str(Hsig)]); +disp(['peak period (seconds): ' num2str(Tp)]); +disp(['Dir of peak period: ' num2str(compangle(DTp, wmon.xaxisdir))]); +disp(['Dominant Direction: ' num2str(compangle(Dp, wmon.xaxisdir))]); +disp([' ']); + + +%function to change from axis angles to compass bearings + +function angle=compangle(angle,xaxisdir) +angle=xaxisdir*ones(size(angle))-angle; +angle=angle+360*(angle<0); +angle=angle-360*(angle>360); + + + + +