anchor.diff:     DO J=1,p%grid%NPoints
         DO I=J,p%grid%NPoints  ! The coherence matrix is symmetric so we're going to skip the other side      
            Indx        = Indx + 1
  -         UM          = 0.5*( U(I) + U(J) )
  +         UM          = p%UHub ! was: 0.5*( U(I) + U(J) )
            DistU(Indx) = Dist(Indx)/UM
         END DO ! I  
      END DO ! J 
      
  +   !.................
  +   ! DEBUGGING
  +   !.................
  +IF ( COH_OUT ) THEN !debugging info...
  +
  +      ! Write the coherence for three frequencies, for debugging purposes
  +      CALL GetNewUnit( UC, ErrStat2, ErrMsg2 );  CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, 'CalcFourierCoeffs_General')
  +      
  +      CALL OpenFOutFile( UC, TRIM(p%RootName)//'.coh', ErrStat2, ErrMsg2 )
  +         CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, 'CalcFourierCoeffs_General')
  +         IF (ErrStat >= AbortErrLev) THEN
  +            CALL Cleanup()
  +            RETURN
  +         END IF
  +      
  +      WRITE( UC, '(A4,X,A16,1X,'//Num2LSTR(p%grid%NPacked)//'(G10.4,1X))' ) 'Comp','Freq',(I,I=1,p%grid%NPacked)
  +      WRITE( UC,   '(5X,A16,1X,'//Num2LSTR(p%grid%NPacked)//'(G10.4,1X))' ) 'Distance',   Dist(:)
  +      WRITE( UC,   '(5X,A16,1X,'//Num2LSTR(p%grid%NPacked)//'(G10.4,1X))' ) '(r/u)', DistU(:)
  +      WRITE( UC,   '(5X,A16,1X,'//Num2LSTR(p%grid%NPacked)//'(G10.4,1X))' ) '(u)',  p%met%URef
  +      WRITE( UC,   '(5X,A16,1X,'//Num2LSTR(p%grid%NPacked)//'(G10.4,1X))' ) '-(r/z_m)^CohExp', DistZMExp(:)
  +ENDIF
  +
      
      !--------------------------------------------------------------------------------
      ! Calculate the fourier coefficients
  
positive.code:          SpecModel_WF_14D, &
           SpecModel_USRVKM, &
           SpecModel_TIDAL,  &
           SpecModel_RIVER   ) ! Do reynolds stress for HYDRO also.
                 
     
        CALL TimeSeriesScaling_ReynoldsStress(p, V, ErrStat, ErrMsg)
  
negative.code:    
     ! Internal variables
  
  INTEGER                      :: UC              ! I/O unit for Coherence debugging file.
  LOGICAL,    PARAMETER        :: COH_OUT = .FALSE.                       ! This parameter has been added to replace the NON-STANDARD compiler directive previously used
  
  REAL(ReKi), ALLOCATABLE       :: Dist(:)        ! The distance between points
  REAL(ReKi), ALLOCATABLE       :: DistU(:)
  REAL(ReKi), ALLOCATABLE       :: DistZMExp(:)
  