      SUBROUTINE XBTNEEDSCONV(nobsdp,xprobe,xswitch,iyear,ifix)

C     XBTCONV CORRECTS XBT DEPTHS FOR DROP RATE ERROR AS PER
C     SZABADOS PERSONAL COMMUNICATION (1992)

c***************************************************************
c
c     Passed Variable:
c
c      nobsdp - number of depth readings
c      xprobe - probe type
c        probe types which need depth conversion:
c           2 - XBT: TYPE UNKNOWN <- ONLY IF DEPTH IS <= 825 METERS
c         201 - XBT: T7 (UNKNOWN BRAND)
c         202 - XBT: T4 (UNKNOWN BRAND)
c         203 - XBT: T6 (UNKNOWN BRAND)
c         207 - XBT: T7 (SIPPICAN)
c         208 - XBT: T4 (SIPPICAN)
c         209 - XBT: T6 (SIPPICAN)
c         214 - XBT: DEEP BLUE (SIPPICAN)
c         215 - XBT: T4 (TSK)
c         216 - XBT: T6 (TSK)
c         217 - XBT: T7 (TSK)
c         219 - XBT: T5 (TSK) *different depth equation
c         223 - XBT: T4 (SPARTON)
c         227 - XBT: T7 (SPARTON)
c         228 - XBT: T7DB (SPARTON)
c      xswitch - set to one if XBT has already been depth corrected
c
c***************************************************************

c***************************************************************
c
c     Parameters:
c
c      maxlevel - maximum number of levels
c      maxcalc - maximum number of measured and calculated parameters
c      bmiss - missing value marker
c
c***************************************************************

      parameter (maxlevel=6000, maxcalc=200, bmiss=-1.E10)

c***************************************************************
c
c    Common Block:
c
c     thedata - contains depths and parameter data (temp)
c
c***************************************************************

      common /thedata/ depth(maxlevel),temp(maxlevel,maxcalc)

      ifix=0

c***************************************************************
c
c     If the depth of this probe reaches deeper than 925 meters,
c     it is probably a T5 or Fast Deep probe, which does not need adjustment
c
c***************************************************************

c     Hanawa fix already applied
      if ( xswitch .gt. 0. ) then
       ifix=0
       return
      endif
 
c     Unknown probe type
      if ( xprobe .le. bmiss ) ifix=-1

c     Probe not an XBT
      iprobe=xprobe
      if ( iprobe- mod(iprobe,200) .ne. 200 .and. iprobe
     *     .ne. 2 ) ifix=-1

c     Maximum depth of non-T5/non-Fast Deep XBT was 840. m
c     until 1997 when max depth of Deep Blue was increased
c     to > 900 m depth
c     For now, to be safe, we use a depth of 1005 meters.
c     Only T5s and Fast Deeps (maybe) go deeper

      xdepmax=1005.

      if ( depth(nobsdp) .gt. xdepmax .and. 
     *     iprobe .ne. 204 .and. iprobe .ne. 210 .and.
     *     iprobe .ne. 219 .and. iprobe .ne. 224 .and.
     *     iprobe .ne. 225 .and. iprobe .ne. 213. .and.
     *     iprobe .ne. 236) ifix=-1.

c      depth equation unknown in or after 1996
      if ( xswitch .lt. 0. .and. iyear .ge. 1996 ) ifix=-1

c     T-10s, Fast Deep, AXBTs ,SXBTs not corrected
c     MHI, Sparton 20, 20DB not corrected
c     non-TSK T5s not corrected

c     T-10s not corrected to Hanawa
      it10=0
      if ( iprobe .eq. 205 .or. iprobe .eq. 211 .or.
     *     iprobe .eq. 220 .or. iprobe .eq. 229 ) it10=1 

c     Fast Deep not corrected to Hanawa
      ifd=0
      if ( iprobe .eq. 213 .or. iprobe .eq. 236 ) ifd=1

c     Air drop XBT not corrected to Hanawa
      iaxbt=0
      if ( iprobe .eq. 233 .or. iprobe .eq. 234 .or.
     *     iprobe .eq. 238 .or. iprobe .eq.
     *      239 ) iaxbt=1

c     Submarine drop XBT not corrected (237)
c     MHI drop rate not corrected (218)
c     Sparton 20,20DB not corrected (230,231)
c     T11 not corrected (212)
      ioth=0
      if ( iprobe .eq. 218 .or. iprobe .eq. 230 .or.
     *     iprobe .eq. 231 .or. iprobe .eq. 237 .or.
     *     iprobe .eq. 212) ioth=1

c      T5 other than TSK not corrected (204,210,224,225)
       it5=0
       if ( iprobe .eq. 204 .or. iprobe .eq. 210 .or.
     *      iprobe .eq. 224 .or. iprobe .eq. 225 ) it5=1

      inofix=it5+ioth+iaxbt+ifd+it10

c     Hanawa et al. 1994 for T4,T6,T7
      if ( ifix .gt. -1 .and. inofix .eq. 0 ) then
       if ( iprobe .ne. 219  ) then
        ifix=1
       else
c       Kizu et al. 2005 for TSK T5
        ifix=2
       endif
      endif
 
      return
      end

