anchor.diff:    return
   end function decode_ip_2
   !===============================================================================================
  +!****f* rmnlib/encode_ip_3
  +! SUMMARY
   ! vector version of encode_ip_2 (ConvertPKtoIP)
  +! AUTHOR
  +!  M.Valin 2013
  +! SYNOPSIS
   function encode_ip_3(IP,RP,kind) result(status) BIND(C,name='ConvertPKtoIP_v')
  +! RESULT
  +! same as encode_ip_2
  +! NOTES
  +! see encode_ip_2
   implicit none  ! explicit, independent (rp,kind) to (ip) conversion
   
  +! ARGUMENTS
     integer(C_INT) :: status
     integer(C_INT), dimension(3), intent(OUT) :: IP
     real(C_FLOAT), dimension(3), intent(IN)   :: RP
     integer(C_INT), dimension(3), intent(IN)  :: kind
  +!******
   
     status=encode_ip_2(IP(1),IP(2),IP(3),RP(1),kind(1),RP(2),kind(2),RP(3),kind(3))
   
   return
   end function encode_ip_3
   !===============================================================================================
  -!vector version of decode_ip_2 (ConvertIPtoPK)
  +!****f* rmnlib/decode_ip_3
  +! SUMMARY
  +!vector version of decode_ip_2
  +! SYNOPSIS
   function decode_ip_3(RP,kind,IP) result(status) BIND(C,name='ConvertIPtoPK_v')
  +! RESULT
  +! same as decode_ip_2
  +! NOTES
  +! see decode_ip_2
   implicit none ! explicit, independent (ip) to (rp,kind) conversion
  -
  +! ARGUMENTS
     integer(C_INT) :: status
     real(C_FLOAT),  dimension(3), intent(OUT) :: RP
     integer(C_INT), dimension(3), intent(OUT) :: kind
     integer(C_INT), dimension(3), intent(IN)  :: IP
  -
  +!******
     status=decode_ip_2(RP(1),kind(1),RP(2),kind(2),RP(3),kind(3),IP(1),IP(2),IP(3))
   
   return
  
positive.code: private :: swap, swapi, is_invalid_kind, is_level, ascending, descending
  
  contains
  !===============================================================================================
  function is_level(kind) result(status)  ! is this kind a level ?
    logical :: status
  
negative.code:   return
  end function decode_ip_0
  !===============================================================================================
  !****f* rmnlib/encode_ip_1
  ! SUMMARY
  ! vector version of encode_ip_0
  ! AUTHOR
  !  M.Valin 2013
  ! SYNOPSIS
  function encode_ip_1(IP,RP) result(status) BIND (C,name='EncodeIp_v')
  ! NOTES
  ! (see encode_ip_0) 
    implicit none  ! coupled (rp1,rp2,rp3) to (ip1,ip2,ip3) conversion with type enforcement
  ! ARGUMENTS
    integer(C_INT) :: status
    integer(C_INT), dimension(3), intent(OUT) :: IP
    type(FLOAT_IP), dimension(3), intent(IN)  :: RP
  ! RESULT
  ! same as encode_ip_0
  !******
  
    status=encode_ip_0(IP(1),IP(2),IP(3),RP(1),RP(2),RP(3))
  
    return
  end function encode_ip_1
  !===============================================================================================
  !****f* rmnlib/decode_ip_1
  ! SUMMARY
  ! vector version of decode_ip_0
  ! SYNOPSIS
  function decode_ip_1(RP,IP) result(status) BIND (C,name='DecodeIp_v')
  ! NOTES
  ! (see decode_ip_0) 
    implicit none ! coupled (ip1,ip2,ip3) to (rp1,rp2,rp3) conversion with type enforcement
  
  ! ARGUMENTS
    integer(C_INT) :: status
    integer(C_INT), dimension(3), intent(IN)  :: IP
    type(FLOAT_IP), dimension(3), intent(OUT) :: RP
  ! RESULT
  ! same as decode_ip_0
  !******
  
    status=decode_ip_0(RP(1),RP(2),RP(3),IP(1),IP(2),IP(3))
  
  return
  end function decode_ip_1
  !===============================================================================================
  !****f* rmnlib/encode_ip_2
  ! SUMMARY
  ! encode three (value,kind) pairs into three ip values
  ! AUTHOR
  !  M.Valin 2013
  ! SYNOPSIS
  function encode_ip_2(IP1,IP2,IP3,P1,kkind1,P2,kkind2,P3,kkind3) result(status) BIND(C,name='ConvertPKtoIP')
  ! INPUTS
  !  P1,kkind1 must be a level
  !  P2,kkind2 should be a time but a level is accepted (and flagged as a WARNING)
  !  P3,kkind3 may be anything
  ! OUTPUTS
  !  IP1,IP2,IP3 will contain the encoded values in case of success, and are undefined otherwise
  ! RESULT
  !     CONVERT_OK           everything is OK
  !     CONVERT_ERROR        error (kind1 not a level, kind2 not level or time)
  !     CONVERT_WARNING      coding convention error, corrected
  !
  ! NOTES
  ! - this function is C interoperable
  ! - tolerated coding deviations: kind2 a level instead of a time (will be pushed to position 3 and flagged as warning)
  ! - ip1/ip3 forced to the proper atmospheric ascending order coding (not flagged as warning)
  ! - ip2/ip3 forced to proper descending order (not flagged as warning)
  ! - in case of error, the contents of ip1/2/3 is undefined (possibly -1)
  ! the FORTRAN user must
  !  use convert_ip123
  ! in order to access this function
  implicit none  ! explicit, almost independent (rp,kind) to (ip) conversion
  
  ! ARGUMENTS
    integer(C_INT) :: status
    integer(C_INT),        intent(OUT) :: IP1,IP2,IP3
    real(C_FLOAT), value, intent(IN)   :: P1,P2,P3
    integer(C_INT), value, intent(IN)  :: kkind1,kkind2,kkind3
  !******
  
    character(len=1) :: dummy
    integer(C_INT) :: kind1,kind2,kind3
  