!OCL NOEVAL
SUBROUTINE TRANSINV_NHCONVPRHS(&
 ! ----- OUTPUT --------------------------------------------------------------
 & PT,PSPD,PSP,PQ,PL,PI,PR,PS,PG)

!* TRANSINV_NHCONVPRHS
!  - Conversion of NH variables (model to file and vice-versa)
!    Inverse transforms
!    Part of the conversion relevant if LRWSDLR=T, to convert quantities
!    based on "prehyd" towards quantities based on "presim" (or the reverse
!    one).


! Purpose
! -------

! Interface
! ---------
!  * OUTPUT:
!     PT     : temperature
!     PSPD   : NH pressure departure variable "spd"
!     PSP    : log(prehyd)
!     PQ     : moisture
!     PL     : liquid water
!     PI     : ice
!     PR     : rain
!     PS     : snow
!     PG     : graupels

! Externals
! ---------

! Method
! ------
!   See documentation

! Reference
! ---------
!        ECMWF Research Department documentation of the IFS
!        ARPEGE documentation (IDEUL)
!        Wood and Staniforth, 2003 (in QJRMS)

! Author
! ------
!   March-2008 K. Yessad (METEO-FRANCE/CNRM/GMAP)

! Modifications
! -------------
! End Modifications
!------------------------------------------------------------------------------

USE PARKIND1 , ONLY : JPIM     ,JPRB
USE YOMHOOK  , ONLY : LHOOK    ,DR_HOOK

USE YOMDIM   , ONLY : NFLSUR   ,NFLEVG
USE YOMGEM   , ONLY : NGPTOT
USE YOMSP    , ONLY : SPT      ,SPQ      ,SPL      ,SPI      ,SPSPD    ,SPSP
USE YOM_YGFL , ONLY : YQ       ,YL       ,YI

!------------------------------------------------------------------------------

IMPLICIT NONE

REAL(KIND=JPRB),INTENT(OUT) :: PT   (NGPTOT,NFLEVG)
REAL(KIND=JPRB),INTENT(OUT) :: PSPD (NGPTOT,NFLEVG)
REAL(KIND=JPRB),INTENT(OUT) :: PSP  (NGPTOT)
REAL(KIND=JPRB),INTENT(OUT) :: PQ   (NGPTOT,NFLEVG)
REAL(KIND=JPRB),INTENT(OUT) :: PL   (NGPTOT,NFLEVG)
REAL(KIND=JPRB),INTENT(OUT) :: PI   (NGPTOT,NFLEVG)
REAL(KIND=JPRB),INTENT(OUT) :: PR   (NGPTOT,NFLEVG)
REAL(KIND=JPRB),INTENT(OUT) :: PS   (NGPTOT,NFLEVG)
REAL(KIND=JPRB),INTENT(OUT) :: PG   (NGPTOT,NFLEVG)

!------------------------------------------------------------------------------

REAL(KIND=JPRB) :: ZHOOK_HANDLE

!------------------------------------------------------------------------------

#include "speree.intfb.h"

!------------------------------------------------------------------------------

IF (LHOOK) CALL DR_HOOK('TRANSINV_NHCONVPRHS',0,ZHOOK_HANDLE)

!------------------------------------------------------------------------------

!* 1. TRANSFORM SPECTRAL FIELDS TO GRID POINT SPACE
!     ---------------------------------------------

!  1.1 GMV variables

! * temperature
CALL SPEREE(NFLSUR,NFLEVG,SPT,PT)

! * NH pressure departure variable
CALL SPEREE(NFLSUR,NFLEVG,SPSPD,PSPD)

!  1.2 GMVS variables

! * surface pressure
CALL SPEREE(1,1,SPSP,PSP)

!  1.3 GFL variables

! remark: this part has to be rewritten in the future with
!  "global treatment of GFL".

! * specific humidity
IF (YQ%LSP) THEN
  CALL SPEREE(NFLSUR,NFLEVG,SPQ,PQ)
ELSE
  PQ (1:NGPTOT,1:NFLEVG)=0.0_JPRB
ENDIF

! * specific mass of liquid
IF (YL%LSP) THEN
  CALL SPEREE(NFLSUR,NFLEVG,SPL,PL)
ELSE
  PL (1:NGPTOT,1:NFLEVG)=0.0_JPRB
ENDIF

! * specific mass of ice
IF (YI%LSP) THEN
  CALL SPEREE(NFLSUR,NFLEVG,SPI,PI)
ELSE
  PI (1:NGPTOT,1:NFLEVG)=0.0_JPRB
ENDIF

! * Rain, graupel and snow for AROME
PR(1:NGPTOT,1:NFLEVG) =0.0_JPRB
PS(1:NGPTOT,1:NFLEVG) =0.0_JPRB
PG(1:NGPTOT,1:NFLEVG) =0.0_JPRB

!------------------------------------------------------------------------------

IF (LHOOK) CALL DR_HOOK('TRANSINV_NHCONVPRHS',1,ZHOOK_HANDLE)

END SUBROUTINE TRANSINV_NHCONVPRHS

