SUBROUTINE EMIS_MW(K_ISENSOR,PLS,PTS,PSN,PWS,PIC,PEM)

!     PURPOSE.
!     -------
!     Routine called by TOVCLR to compute microwave surface emissivity 
!     for various surface conditions

!     INTERFACE.
!     ---------
!     call emis_mw(ISENSOR,PLS,PTS,PSN,PWS,PEM)

!     ARGUMENTS
!     ---------
!     ISENSOR - input satellite sensor indicator
!     PLS - input model land/sea flag
!     PTS - input model skin temperature
!     PSN - input model snow cover
!     PWS - input model soil moisture
!     PIC - input model sea-ice cover
!     PEM - output microwave surface emissivity        

!     EXTERNALS
!     ---------
!     * none * all routines self contained here

!     AUTHOR
!     ------
!     Tony McNally - March 1998

!     MODIFICATIONS
!     -------------
!     * none *
!        M.Hamrud      01-Oct-2003 CY28 Cleaning
!        N Bormann     17 Feb 2006 Cleaning

USE YOMTVRAD  , ONLY : MSENSOR_MSU,MSENSOR_AMSUA,MSENSOR_AMSUB,&
 & MSENSOR_SSMI,MSENSOR_SSMIS,MSENSOR_AMSRE,MSENSOR_TMI,&
 & MSENSOR_MHS,&
 & MSENSOR_CHANOFFL,MSENSOR_CHANCOUNT 
USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK
USE YOMDIMO   , ONLY : NMXTCH

USE PARKIND1  ,ONLY : JPIM     ,JPRB

IMPLICIT NONE
INTEGER(KIND=JPIM),INTENT(IN)    :: K_ISENSOR 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PLS 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PTS 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PSN 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PWS 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PIC 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PEM(NMXTCH) 
INTEGER(KIND=JPIM) ::IOFF
REAL(KIND=JPRB) :: ZHOOK_HANDLE

#include "abor1.intfb.h"

IF (LHOOK) CALL DR_HOOK('EMIS_MW',0,ZHOOK_HANDLE)
PEM(:)=0.99_JPRB

!     *** VARIOUS CONDITIONS NOW FOLLOW FOR EMISSIVITY ESTIMATION ***
!     ===============================================================

!     1.0 Ice free open sea or mixed ice               
!     ==================================
IF(NINT(PLS) == 0 .AND. PIC <= 0.6_JPRB) THEN
!IF(NINT(PLS) == 0.AND.PTS >= 265.0_JPRB) THEN 
  PEM(:)=0.60_JPRB
  IOFF=MSENSOR_CHANOFFL(K_ISENSOR)

  IF (K_ISENSOR == MSENSOR_MSU   .OR. K_ISENSOR == MSENSOR_AMSUA .OR. &
   &  K_ISENSOR == MSENSOR_AMSUB .OR. K_ISENSOR == MSENSOR_MHS   .OR. &
   &  K_ISENSOR == MSENSOR_SSMIS .OR. K_ISENSOR == MSENSOR_SSMI  .OR. &
   &  K_ISENSOR == MSENSOR_AMSRE .OR. K_ISENSOR == MSENSOR_TMI) THEN

    PEM (IOFF+1:IOFF+MSENSOR_CHANCOUNT(K_ISENSOR)) = -1.0_JPRB   ! activate FASTEM o/ ocean

  ELSE
    write(0,*) 'EMIS_MW: INVALID SENSOR TYPE FOR MW EMISSIVITY: SENSOR=',K_ISENSOR
    CALL ABOR1('INVALID SENSOR TYPE FOR MW EMISSIVITY')

  ENDIF

  IF (LHOOK) CALL DR_HOOK('EMIS_MW',1,ZHOOK_HANDLE)
  RETURN

ENDIF

!     2.0 Sea ice
!     ===========

!     2.1 Exposed sea ice
!     -------------------
IF(NINT(PLS) == 0.AND.PTS < 273.0_JPRB) THEN
!      PRINT*,'FOUND EXPOSED SEA ICE',PLS,PTS,PSN,PWS
  PEM(:)=0.97_JPRB
  IF (LHOOK) CALL DR_HOOK('EMIS_MW',1,ZHOOK_HANDLE)
  RETURN
ENDIF

!     2.2 Sea ice with snow cover
!     ---------------------------
IF(NINT(PLS) == 0.AND.PTS < 271.0_JPRB.AND.PSN > 0.0_JPRB) THEN
  PEM(:)=0.90_JPRB
!      PRINT*,'FOUND SEA ICE WITH SNOW COVER',PLS,PTS,PSN,PWS
  IF (LHOOK) CALL DR_HOOK('EMIS_MW',1,ZHOOK_HANDLE)
  RETURN
ENDIF

!     3.0 Land
!     ========

!     3.1 Exposed dry land
!     --------------------
IF(NINT(PLS) == 1.AND.PSN <= 0.0_JPRB.AND.PWS <= 10.0_JPRB) THEN
!      PRINT*,'FOUND EXPOSED DRY LAND',PLS,PTS,PSN,PWS
  PEM(:)=0.92_JPRB
  IF (LHOOK) CALL DR_HOOK('EMIS_MW',1,ZHOOK_HANDLE)
  RETURN
ENDIF

!     3.2 Exposed moist land or light snow cover
!     ------------------------------------------
IF(NINT(PLS) == 1.AND.PSN <= 20.0_JPRB.AND.PWS > 10.0_JPRB) THEN
!      PRINT*,'FOUND EXPOSED MOIST LAND',PLS,PTS,PSN,PWS
  PEM(:)=0.95_JPRB
  IF (LHOOK) CALL DR_HOOK('EMIS_MW',1,ZHOOK_HANDLE)
  RETURN
ENDIF

!     3.3 Land with deep snow cover
!     -----------------------------
IF(NINT(PLS) == 1.AND.PSN > 20.0_JPRB.AND.PSN <= 80.0_JPRB) THEN
  IF(PTS <= 265.0_JPRB) THEN
!        PRINT*,'FOUND LAND WITH LIGHT SNOW COVER',PLS,PTS,PSN,PWS
    PEM(:)=0.83_JPRB
    IF (LHOOK) CALL DR_HOOK('EMIS_MW',1,ZHOOK_HANDLE)
    RETURN
  ELSE
    PEM(:)=0.95_JPRB !revert to moist land value
    IF (LHOOK) CALL DR_HOOK('EMIS_MW',1,ZHOOK_HANDLE)
    RETURN
  ENDIF
ENDIF

!     3.4 Land with very deep snow cover
!     ----------------------------------
IF(NINT(PLS) == 1.AND.PSN > 80.0_JPRB) THEN
  IF(PTS <= 265.0_JPRB) THEN
!       PRINT*,'FOUND LAND WITH DEEP SNOW COVER',PLS,PTS,PSN,PWS
    PEM(:)=0.80_JPRB
    IF (LHOOK) CALL DR_HOOK('EMIS_MW',1,ZHOOK_HANDLE)
    RETURN
  ELSE
    PEM(:)=0.95_JPRB !revert to moist land value
    IF (LHOOK) CALL DR_HOOK('EMIS_MW',1,ZHOOK_HANDLE)
    RETURN
  ENDIF
ENDIF

IF (LHOOK) CALL DR_HOOK('EMIS_MW',1,ZHOOK_HANDLE)
END SUBROUTINE EMIS_MW
