CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
      SUBROUTINE CORRECT_VTH_H(VTH, MOMENT)
C+
C
C FUNCTIONAL DESCRIPTION:
C
C     Subroutine to correct the solar wind thermal speed from the PM.  The
C     correction is based on the bulk speed and is based on a series of linear
C     fits to several different speed ranges.
C
C FORMAL ARGUMENTS:
C
C     VTH:
C       R*4      I/O	Variable containing the solar wind thermal speed.  Upon
C			return it will contain the corrected solar wind thermal
C			speed.
C
C     MOMENT:
C       R*4      I/O	
C
C INTERFACE:
C
!	INTERFACE
!	  SUBROUTINE CORRECT_VTH(VTH, MOMENT)
!	    REAL(KIND=4), INTENT(INOUT) :: VTH, MOMENT
!	  END SUBROUTINE CORRECT_VTH
!	END INTERFACE
C
C IMPLICIT INPUTS:
C
C     None
C
C IMPLICIT OUTPUTS:
C
C     None
C
C SIDE EFFECTS:
C
C     None
C
C COMMON BLOCKS:
C
C     None
C
C INCLUDE FILES:
C
C     None
C
C DESIGN:
C
C     
C
C CREATED:
C
C     18-FEB-1997    John Paquette
C
C This version:   1.0   18-FEB-1997
C
C DEVELOPMENT HISTORY:
C 
C  Author       Date            Description of Change 
C  --------     -----------     --------------------- 
C  J. PAQUETTE  18-FEB-1997     Created
C  L. Bleau	15-NOV-1999	added comments
C  L. Bleau	15-MAR-2000	added comments
C
C-
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CDEC$ IDENT	'1.0'
C
      PARAMETER NUM_SEG=3
      LOGICAL SEGMENT
      INTEGER I
      REAL*8 MOMENT, VTH
      REAL*8 LLIMIT(NUM_SEG)/0, 0.09, 0.22/  
      REAL*8 ULIMIT(NUM_SEG)/0.09, 0.22, 1.0/
      REAL*8 OFFSET(NUM_SEG)/12.154, -0.436, -28.535/
      REAL*8 SLOPE(NUM_SEG)/103.17, 243.06, 370.78/
C
C The results of this calculation overrides the results of FISH
C
      VTH = 0.0
      MOMENT=SQRT(MOMENT)
C           
C Set flag telling us whether we've found the right segment to .FALSE.
C
      SEGMENT = .FALSE.
C
C Find the segment that the current velocity lies in, then apply correction
C
      I = 1
      DO 200 WHILE((.NOT.SEGMENT).AND.(I .LE. NUM_SEG))
        IF((MOMENT .GE. LLIMIT(I)).AND.(MOMENT .LT. ULIMIT(I)))THEN
          VTH = OFFSET(I) + MOMENT*SLOPE(I)
          SEGMENT = .TRUE. 
        ENDIF
        I = I + 1
 200  CONTINUE
C
C Final Correction
C
      IF(VTH .GE. 1000.)VTH=1000.0
      VTH = VTH/(1.039-3.0997E-4*VTH)
C
      RETURN
      END
