SUBROUTINE CPG2(CDCONF,KNUMB,KSTGLO,PB1,PB2,PGMV,PGMVS,&
 & PRCORI,PGM,PRATATH,PRATATX,PGOMVRL,PGOMVRM,&
 & POROG,POROGL,POROGM,&
 & PUT0,PVT0,PUT0L,PVT0L,PDIVT0,PVORT0,&
 & PSPT0,PSPT0L,PSPT0M,&
 & PUT9,PVT9,PDIVT9,PSPNLT9,&
 & PSPT9,PSPT9L,PSPT9M,&
 & PUT1,PVT1,PSPT1)  

USE PARKIND1 , ONLY : JPIM     ,JPRB
USE PTRSLB1  , ONLY : MSLB1U9  ,MSLB1V9  ,MSLB1SP9 ,MSLB1U0  ,MSLB1V0  , &
 &                    MSLB1SP0 ,MSLB1UR0 ,MSLB1VR0 ,MSLBUF1
USE PTRSLB2  , ONLY : MSLB2USI ,MSLB2VSI ,MSLB2URL ,MSLB2VRL ,MSLBUF2  
USE YOMCT0   , ONLY : NCONF    ,LSLAG    ,LTWOTL
USE YOMCT3   , ONLY : NSTEP
USE YOMDIM   , ONLY : NPROMA   ,LUVDER   ,LVOR
USE YOMDYN   , ONLY : SIVP     ,TDT      ,BETADT   ,LELTRA   ,LIMPF    ,LSIDG
USE YOMGEM   , ONLY : RSTRET
USE YOMGMV   , ONLY : NDIMGMV  ,NDIMGMVS
USE YOMHOOK  , ONLY : LHOOK    ,DR_HOOK
USE YOMSC2   , ONLY : NFLDSLB1 ,NFLDSLB2
USE YOMTRSL  , ONLY : NTRSLTYPE

!**** *CPG2* - Grid point calculations - 2-D model.

!     Purpose.
!     --------
!           Grid point calculations in dynamics - 2-D MODEL.

!**   Interface.
!     ----------
!        *CALL* *CPG2(...)

!        Explicit arguments :
!        --------------------

!        CDCONF    : configuration of work                       (I)
!        KNUMB     : number of elements of arrays for which          
!                    computations are performed (MP version)     (I)
!        KSTGLO    : global offset (MP version)                  (I)
!        PB1       : SL buffer for quantities to be interpolated (O)
!        PB2       : Buffer for t+dt quantities                  (O)
!        PRCORI    : Coriolis parameter                          (I)
!        PGM       : Mapping factor                              (I)
!        PRATATH   : First curvature term                        (I)
!        PRATATX   : Second curvature term                       (I)
!        PGOMVRL   : Zonal component of 2*Omega vectorial r      (I)
!        PGOMVRM   : Meridian component of 2*Omega vectorial r   (I)
!        POROG     : Orography                                   (I)
!        POROGL    : Zonal component of orography derivative     (I/O)
!        POROGM    : Meridian component of orography derivative  (I/O)
!        PUT0      : zonal wind time t                           (I/O)
!        PVT0      : meridian wind time t                        (I/O)
!        PUT0L     : zonal derivative of zonal wind time t       (I/O)
!        PVT0L     : zonal derivative of meridian wind time t    (I/O)
!        PDIVT0    : divergence  time t                          (I/O)
!        PVORT0    : vorticity  time t                           (I/O)
!        PSPT0     : equivalent height time t                    (I)
!        PSPT0L    : zonal derivative of PSPT0                   (I/O)
!        PSPT0M    : meridian derivative of PSPT0                (I/O)

!        Implicit arguments :
!        --------------------

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

!     Externals.
!     ----------
!        Calls LACDYNSHD if SL scheme.
!        Calls WRSLTRAJ if writing semi-Lagrangian trajectory.
!        Is called by SCAN2MSM (if SM) or SCAN2M (if DM).

!     Reference.
!     ----------
!        ECMWF Research Department documentation of the IFS

!     Author.
!     -------
!        Mats Hamrud and Philippe Courtier  *ECMWF*

! Modifications
! -------------
!   Original : 88-02-04
!   Modified by F. Rabier : 91-07-14
!   Modified 92-02-01 by M.H. Hamrud (IO scheme)
!   Modified 92-07-08 by V. Ducrocq (new curvature term)
!   K. YESSAD: DECEMBER 1992 (introduction of a decentering factor
!              in semi-implicit terms and terms averaged along the
!              semi-lagrangian trajectory).
!   Modified 93-04-13 by L. Labbe (orographic term in S.W.)
!   Modified OCT 1993 by K. YESSAD: semi-implicit computations
!              with not reduced divergence + harmonisation of
!              notations between eulerian and semi-lag computations.
!   Modified 94-01-28 by M. Tolstykh (orography term in shallow water
!              semi-lagrangian scheme).
!   Modified 93-11-10 by R. EL Khatib (Interface to GPTF1/GPTF2)
!   Modified 94-08-31 by M. Tolstykh:
!              * CUD-5 semi-lagrangian scheme.
!              * Variable decentering.
!              * Modification of decentering: VESL+VESL1*M for
!                 semi-implicit terms and VESL1*M for explicit terms.
!              * Coriolis term now explicit in momentum SL equation.
!              * t-terms now averaged along the SL trajectory in
!                 momentum equation.
!   K. YESSAD (JAN 1995):
!       - Modify call to LACUDL for optimisations.
!       - Constant part of decentering factor becomes VESLA for
!         explicit terms (+ corrections of bugs with decentering factor).
!       - Use of switch LADVF to choose explicit or implicit formulation
!         for Coriolis term.
!       - Treat semi-implicit terms at time t as an average along the
!         semi-lagrangian trajectory, even for equations where t terms
!         are interpolated at the medium point, for consistency with
!         3D model.
!       - Simplification of treatment of NVLAG=2 formulation of
!         continuity equation (buffer SLB1WR0 no longer required).
!   Modified 95-03-01 by M.Hamrud (F90 re-write)
!   Modified (OCT 1995) by K. YESSAD: redimensioning of Z(X)NLT9 for
!     2TL SL scheme.
!   Modified APRIL 1996 by K. YESSAD: call to INIPEX.
!   Modified OCT 1996 by K. YESSAD: removal of variable uncentering.
!   Modified 97-05-14 by C.Temperton (options NVLAG=3, NWLAG=3 added)
!   Modified 97-05-19 by C.Temperton (options LCORAN,LEVGO,LIMPF added)
!   Modified 98-01-14 by E.Holm (changed argument order in calls to 
!                                SC2RDT9/WRT9 and GPTF1/2)
!   Modified 98-01-19 by C.Temperton (2TL semi-Lagrangian scheme)      
!   Modified 98-04-03 by C.Temperton (option LSETTLS added)      
!   Modified 98-03-20 by K.YESSAD (use RPARSL1 instead of ZPARITY, allows
!     to correct a bug in the DM SL code). 
!   Modified 98-08-05 by K. YESSAD and C. TEMPERTON: cleanings.
!     - change NFLEVG into "1"
!     - add missing dummy arguments in CALL SC2WRT9/SC2RDT9.
!     - NVLAG has now negative values for Lagrangian formulation of
!       continuity equation (NVLAG=-2 instead of NVLAG=2).
!     - Make the definition of NWLAG consistent with the one of the 3D
!       model (NWLAG=1 becomes NWLAG=2).
!     - Use PTRSLB1 and PTRSLB2 pointers.
!     - Removal of the CUD-5 interpolations.
!     - Removal of VESLA.
!     - For SL calculations put all the code in a new routine LACDYNSHW.
!     - Correction of false comments.
!   Modified 98-08-10 by K. YESSAD: removal of LRPOLE option.
!    - LRPOLE removed from YOMCT0 and 'CALL INIPEX'.
!   Modified 99-01-21 by C.Temperton (semi-Lagrangian trajectory)  
!   Modified 99-01-26 by C.Temperton (NTRSLTYPE=2)  
!   Modified 99-03-15 by C.Temperton: Bugfix for semi-Lag. trajectory
!                                      when LMESSP=.TRUE.
!   Modified 99-03-31 by P. SMOLIKOVA: option LRDAORG (double averaging).
!   Modified 99-06-17 by C.Temperton (T/L of L2TLFF option)
!   Modified 99-08-16 by C.Temperton: removed redundant RKROMA
!   Modified 99-08-20 by C.Temperton (WRSLTRAJ -> WRSLTRAJ2)
!   Modified 01-07-11 by K. YESSAD: relaxation of thin layer hyp for SL2TL.
!   Modified 01-08-30 by K. YESSAD: pruning and some other cleanings.
!   Modified 03-2002  J.Vivoda iterface to SC2...9 routines
!   Modified 02-09-30 by P. Smolikova: iterface to SC2...9 for d4 in NH
!   01-Oct-2003 M. Hamrud  CY28 Cleaning
!   Modified 04-01-22 by C.Temperton: Bugfixes (use of LUVDER,LVOR,PSPNLT9)
!   09-Jun-2004 J. Masek   NH cleaning (LLFULLIMP)
!   K. Yessad Nov 2008: rationalisation of dummy argument interfaces
! End Modifications
!------------------------------------------------------------------

IMPLICIT NONE

CHARACTER(LEN=1)  ,INTENT(IN)    :: CDCONF 
INTEGER(KIND=JPIM),INTENT(IN)    :: KNUMB 
INTEGER(KIND=JPIM),INTENT(IN)    :: KSTGLO 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PB1(NPROMA,NFLDSLB1) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PB2(NPROMA,NFLDSLB2) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PGMV(NPROMA,1,NDIMGMV) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PGMVS(NPROMA,NDIMGMVS) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRCORI(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PGM(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRATATH(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRATATX(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PGOMVRL(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PGOMVRM(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: POROG(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: POROGL(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: POROGM(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PUT0(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PVT0(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PUT0L(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PVT0L(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PDIVT0(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PVORT0(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PSPT0(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PSPT0L(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PSPT0M(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PUT9(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PVT9(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PDIVT9(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PSPNLT9(NPROMA)
REAL(KIND=JPRB)   ,INTENT(IN)    :: PSPT9(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PSPT9L(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PSPT9M(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PUT1(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PVT1(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PSPT1(NPROMA) 

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

REAL(KIND=JPRB) :: ZBDT(NPROMA)
REAL(KIND=JPRB) :: ZDUM(NPROMA)
INTEGER(KIND=JPIM) :: IEND, IST, JROF
LOGICAL :: LLFSTEP, LLSHW, LLVEQ
REAL(KIND=JPRB) :: ZBT, ZDT, ZTE
REAL(KIND=JPRB) :: ZHOOK_HANDLE

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

#include "abor1.intfb.h"
#include "gptf2.intfb.h"
#include "lacdynshw.intfb.h"
#include "wrsltraj2.intfb.h"

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

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

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

!*       1.    PRELIMINARY INITIALISATIONS.
!              ----------------------------

IF    (CDCONF == 'A')THEN
  ZDT=TDT
  ZTE=1.0_JPRB
ELSEIF(CDCONF == 'E')THEN
  ZDT=1.0_JPRB
  ZTE=0.0_JPRB
ELSEIF(CDCONF == 'B')THEN
  ZDT=0.0_JPRB
  ZTE=1.0_JPRB
ELSE
  CALL ABOR1(' CPG2 - UNKNOWN CONFIGURATION ')
ENDIF

LLSHW= NCONF == 201.OR.NCONF == 421.OR.NCONF == 521
LLVEQ= NCONF == 202.OR.NCONF == 422.OR.NCONF == 522

IF(NSTEP > 0) THEN
  LLFSTEP=.FALSE.
ELSE
  LLFSTEP=.TRUE.
ENDIF

IST =1
IEND=KNUMB

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

!*       2.    INTERFACE TO GLOBAL ARRAYS.
!              ---------------------------

!*       2.2   TIME FILTER (PART 2).

CALL GPTF2(&
 ! --- INPUT ---------------------------------------------------------
 & IST,IEND,LLFSTEP,&
 ! --- INPUT for P.T0.; INPUT/OUTPUT for P.T9. ----------------------- 
 ! --- INPUT for P.T0.; INPUT/OUTPUT for P.T9. -----------------------
 & PGMV,PGMVS,ZDUM)

!*       2.3   MAP FACTOR

DO JROF=IST,IEND
  PUT0  (JROF)=PUT0  (JROF)* PGM(JROF)
  PVT0  (JROF)=PVT0  (JROF)* PGM(JROF)
  IF (LUVDER) THEN
    PUT0L (JROF)=PUT0L (JROF)*(PGM(JROF)**2)
    PVT0L (JROF)=PVT0L (JROF)*(PGM(JROF)**2)
  ENDIF
  PDIVT0(JROF)=PDIVT0(JROF)*(PGM(JROF)**2)
  IF (LVOR) THEN
    PVORT0(JROF)=PVORT0(JROF)*(PGM(JROF)**2)
  ENDIF
  PSPT0L(JROF)=PSPT0L(JROF)* PGM(JROF)
  PSPT0M(JROF)=PSPT0M(JROF)* PGM(JROF)
  IF (.NOT.LELTRA) THEN
    PUT9  (JROF)=PUT9  (JROF)* PGM(JROF)
    PVT9  (JROF)=PVT9  (JROF)* PGM(JROF)
  ENDIF
  IF (.NOT.LTWOTL) THEN
    PDIVT9(JROF)=PDIVT9(JROF)*(PGM(JROF)**2)
    PSPT9L(JROF)=PSPT9L(JROF)* PGM(JROF)
    PSPT9M(JROF)=PSPT9M(JROF)* PGM(JROF)
  ENDIF
  POROGL(JROF)=POROGL(JROF)* PGM(JROF)
  POROGM(JROF)=POROGM(JROF)* PGM(JROF)
ENDDO

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

!*       3.    SHALLOW WATER MODEL.
!              --------------------

IF(LLSHW)THEN

  IF(.NOT.LSLAG) THEN

!*        3.1  EULERIAN SCHEME.

!*        3.1.1   EXPLICIT STEP FOR EULERIAN SCHEME.

    DO JROF=IST,IEND
      PUT1(JROF)=PUT9(JROF)*ZTE+ZDT*(&
       & PVORT0(JROF)*PVT0(JROF)&
       & - PVT0L(JROF)*PVT0(JROF)&
       & - PUT0L(JROF)*PUT0(JROF)&
       & +(PUT0 (JROF)*PUT0(JROF)+PVT0(JROF)*PVT0(JROF))*0.5_JPRB &
       & *PRATATX(JROF)&
       & +PRCORI(JROF)*PVT0(JROF)&
       & -PSPT0L(JROF)               )  
      PVT1(JROF)=PVT9(JROF)*ZTE+ZDT*(&
       & -PDIVT0(JROF)*PVT0(JROF)&
       & - PVT0L(JROF)*PUT0(JROF)&
       & + PUT0L(JROF)*PVT0(JROF)&
       & -(PUT0 (JROF)*PUT0(JROF)+PVT0(JROF)*PVT0(JROF))*0.5_JPRB &
       & *PRATATH(JROF)&
       & -PRCORI(JROF)*PUT0(JROF)&
       & -PSPT0M(JROF)               )  
      PSPT1(JROF)=PSPT9(JROF)*ZTE-ZDT*(&
       & PUT0(JROF)*(PSPT0L(JROF)-POROGL(JROF))&
       & + PVT0(JROF)*(PSPT0M(JROF)-POROGM(JROF))&
       & + PDIVT0(JROF)*(PSPT0(JROF)-POROG(JROF)) )  
    ENDDO

!*        3.1.2   SEMI-IMPLICIT ADJUSTMENT FOR EULERIAN SCHEME.

    ZBT=BETADT*0.5_JPRB*ZDT*ZTE
    DO JROF=IST,IEND
      IF (LSIDG) THEN
        ZBDT(JROF)=ZBT*SIVP(1)
      ELSE
        ZBDT(JROF)=ZBT*SIVP(1)*RSTRET*RSTRET/(PGM(JROF)*PGM(JROF))
      ENDIF
    ENDDO

    DO JROF=IST,IEND
      PSPT1(JROF)=PSPT1(JROF)&
       & +ZBDT(JROF)*(2.0_JPRB*PDIVT0(JROF)-PDIVT9(JROF))  
      PUT1(JROF)=PUT1(JROF)&
       & +ZBT*(2.0_JPRB*PSPT0L(JROF)-PSPT9L(JROF))  
      PVT1(JROF)=PVT1(JROF)&
       & +ZBT*(2.0_JPRB*PSPT0M(JROF)-PSPT9M(JROF))  
      IF (LIMPF) THEN
        PUT1(JROF)=PUT1(JROF)&
         & -ZBT*PRCORI(JROF)*(2.0_JPRB*PVT0(JROF)-PVT9(JROF))  
        PVT1(JROF)=PVT1(JROF)&
         & +ZBT*PRCORI(JROF)*(2.0_JPRB*PUT0(JROF)-PUT9(JROF))  
      ENDIF
    ENDDO

  ELSE

!*        3.2  SEMI-LAGRANGIAN SCHEME.

!*          3.2.1   WRITE t-dt VARIABLES.

    IF((NCONF == 421.OR.NCONF == 521).AND.(NTRSLTYPE == 1)) THEN
      CALL WRSLTRAJ2(NSTEP,IST,IEND,KSTGLO,3,&
       & PUT9,PVT9,PSPNLT9,ZDUM,ZDUM,&
       & ZDUM,ZDUM,ZDUM,ZDUM,ZDUM,ZDUM,ZDUM,ZDUM,ZDUM,ZDUM,ZDUM,ZDUM)  
    ENDIF

!         * Preliminary fill buffers with zero.

    PB1(IST:IEND,MSLBUF1:NFLDSLB1)=0.0_JPRB
    PB2(IST:IEND,MSLBUF2:NFLDSLB2)=0.0_JPRB

!         * Fill buffers.

    CALL LACDYNSHW(CDCONF,NPROMA,IST,IEND,ZDT,&
     & PUT9,PVT9,PSPT9,PDIVT9,PSPT9L,PSPT9M,&
     & PUT0,PVT0,PSPT0,PDIVT0,PSPT0L,PSPT0M,&
     & PGM,PRCORI,PGOMVRL,PGOMVRM,POROG,POROGL,POROGM,&
     & PSPNLT9,&
     & PB1(1,MSLB1U9),PB1(1,MSLB1V9),PB1(1,MSLB1SP9),&
     & PB1(1,MSLB1U0),PB1(1,MSLB1V0),PB1(1,MSLB1SP0),&
     & PUT1,PVT1,PSPT1,&
     & PB1(1,MSLB1UR0),PB1(1,MSLB1VR0),&
     & PB2(1,MSLB2USI),PB2(1,MSLB2VSI),&
     & PB2(1,MSLB2URL),PB2(1,MSLB2VRL))  

!*          3.2.2   WRITE SL BUFFERS (saving trajectory)

    IF((NCONF == 421.OR.NCONF == 521).AND.(NTRSLTYPE == 2)) THEN
      CALL WRSLTRAJ2(NSTEP,IST,IEND,KSTGLO,14,ZDUM,ZDUM,ZDUM,&
       & PB1(1,MSLB1U9),PB1(1,MSLB1V9),&
       & PB1(1,MSLB1SP9),PB1(1,MSLB1U0),&
       & PB1(1,MSLB1V0),PB1(1,MSLB1SP0),&
       & PB1(1,MSLB1UR0),PB1(1,MSLB1VR0),&
       & PB2(1,MSLB2URL),PB2(1,MSLB2VRL),&
       & PB2(1,MSLB2USI),PB2(1,MSLB2VSI),&
       & PUT1,PVT1 )  
    ENDIF

  ENDIF

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

!*       4.    VORTICITY EQUATION MODEL.
!              -------------------------

ELSEIF(LLVEQ)THEN
  DO JROF=IST,IEND
    PUT1(JROF)=PUT9(JROF)*ZTE+ZDT*(&
     & PVORT0(JROF)*PVT0(JROF)&
     & - PVT0L(JROF)*PVT0(JROF)&
     & - PUT0L(JROF)*PUT0(JROF)&
     & +(PUT0 (JROF)*PUT0(JROF)+PVT0(JROF)*PVT0(JROF))*0.5_JPRB &
     & *PRATATX(JROF)&
     & +PRCORI(JROF)*PVT0(JROF)    )  
    PVT1(JROF)=PVT9(JROF)*ZTE+ZDT*(&
     & -PDIVT0(JROF)*PVT0(JROF)&
     & - PVT0L(JROF)*PUT0(JROF)&
     & + PUT0L(JROF)*PVT0(JROF)&
     & -(PUT0 (JROF)*PUT0(JROF)+PVT0(JROF)*PVT0(JROF))*0.5_JPRB &
     & *PRATATH(JROF)&
     & -PRCORI(JROF)*PUT0(JROF)    )  
    PSPT1(JROF)=0.0_JPRB
  ENDDO

ENDIF

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

!*       6.    MAP FACTOR
!              -----------

DO JROF=IST,IEND
  PUT0  (JROF)=PUT0  (JROF)/ PGM(JROF)
  PVT0  (JROF)=PVT0  (JROF)/ PGM(JROF)
  IF (LUVDER) THEN
    PUT0L (JROF)=PUT0L (JROF)/(PGM(JROF)**2)
    PVT0L (JROF)=PVT0L (JROF)/(PGM(JROF)**2)
  ENDIF
  PDIVT0(JROF)=PDIVT0(JROF)/(PGM(JROF)**2)
  IF (LVOR) THEN
    PVORT0(JROF)=PVORT0(JROF)/(PGM(JROF)**2)
  ENDIF
  PSPT0L(JROF)=PSPT0L(JROF)/ PGM(JROF)
  PSPT0M(JROF)=PSPT0M(JROF)/ PGM(JROF)
  IF (.NOT.LELTRA) THEN
    PUT9  (JROF)=PUT9  (JROF)/ PGM(JROF)
    PVT9  (JROF)=PVT9  (JROF)/ PGM(JROF)
  ENDIF
  IF (.NOT.LTWOTL) THEN
    PDIVT9(JROF)=PDIVT9(JROF)/(PGM(JROF)**2)
    PSPT9L(JROF)=PSPT9L(JROF)/ PGM(JROF)
    PSPT9M(JROF)=PSPT9M(JROF)/ PGM(JROF)
  ENDIF
  POROGL(JROF)=POROGL(JROF)/ PGM(JROF)
  POROGM(JROF)=POROGM(JROF)/ PGM(JROF)
ENDDO

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

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