SUBROUTINE ARORDGP_SURF(CDHMODE,KGPTOTG,PGPTOTG,KGPTOT,PGPTOT,KOFFSET, KLUOUT)
 
!**** *ARORDGP_SURF*  - 
 
!     Purpose.
!     --------
!     Split a global array in a local array for the actual proc   
 
!**   Interface.
!     ----------
!        *CALL* *ARORDGP_SURF*

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

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

!     Externals.
!     ----------

!           Processor communication routines

!     Reference.
!     ----------

!     Author.
!     -------
!         S.Malardel *METEO-FRANCE*

!     Modifications.
!     --------------

!     ------------------------------------------------------------------
 
USE PARKIND1  ,ONLY : JPIM     ,JPRB
USE YOMHOOK   ,ONLY : LHOOK, DR_HOOK
 
!*      0.1   Declarations of arguments
 
IMPLICIT NONE

CHARACTER(LEN=6),  INTENT(IN) :: CDHMODE          ! IO MODE
INTEGER(KIND=JPIM),INTENT(IN) :: KGPTOTG          ! SIZE OF PGPTOTG
REAL(KIND=JPRB),   INTENT(IN) :: PGPTOTG(KGPTOTG) ! array containing 
                                                  !all the data
INTEGER(KIND=JPIM),INTENT(IN) :: KGPTOT           ! SIZE OF PGPTOT
INTEGER(KIND=JPIM),INTENT(IN) :: KOFFSET          ! offset for this proc
INTEGER(KIND=JPIM),INTENT(IN) :: KLUOUT           ! output listing unit
REAL(KIND=JPRB),   INTENT(OUT):: PGPTOT(KGPTOT)   ! array with only the
                                                  !data for this proc

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

REAL(KIND=JPRB)     :: ZHOOK_HANDLE
INTEGER(KIND=JPIM)  :: JI

#include "disgrid_surf_ext.intfb.h"
#include "abor1.intfb.h" 

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

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

IF (CDHMODE == 'RUN   ') THEN
 
  CALL DISGRID_SURF_EXT(KGPTOTG,PGPTOTG,PGPTOT)
 
ELSEIF (CDHMODE == 'PRE   ') THEN
 
  DO JI = 1, KGPTOT
    PGPTOT(JI) = PGPTOTG(KOFFSET+JI)
  ENDDO
 
ELSE
 
  WRITE(KLUOUT,*) ' '
  WRITE(KLUOUT,*) ' IO MODE DOES NOT EXIST YET'
  CALL ABOR1(' ARORDGP_SURF: IO MODE DOES NOT EXIST YET')
 
ENDIF

!     ------------------------------------------------------------------
IF(LHOOK) CALL DR_HOOK('ARORDGP_SURF',1,ZHOOK_HANDLE)
END SUBROUTINE ARORDGP_SURF
