snr=lidar.SNR;
rws=lidar.RWS;
[na,nr]=size(snr);
for j=1:na
    P=findpeaksnr(1:nr,(lidar.SNR(j,:)-1),0.001,2.0,10,20,1);
    [npeaks,a]=size(P);
    if P(1)==0
        ind=find(snr(j,:)<1.01);
        snr(j,ind)=NaN;
        rws(j,ind)=-999;
    else
        for k=1:npeaks
            minr=floor(P(k,2))-floor(P(k,4)/2);
            maxr=floor(P(k,2))+floor(P(k,4)/2);
            if maxr>nr
                maxr=nr;
            end
            snr(j,minr:maxr)=999;
            rws(j,minr:maxr)=999;
        end
        ind=find(snr(j,:)<1.01);
        snr(j,ind)=NaN;
        rws(j,ind)=-999;
    end

end