SURFEX v7.3
General documentation of Surfex
 All Classes Files Functions Variables Typedefs
/home/dasprezs/EXPORT_v7_3/src/SURFEX/get_adj_mes_lonlat_reg.F90
Go to the documentation of this file.
00001 !     #########
00002       SUBROUTINE GET_ADJ_MES_LONLAT_REG(KGRID_PAR,KL,PGRID_PAR,KLEFT,KRIGHT,KTOP,KBOTTOM)
00003 !     ##############################################################
00004 !
00005 !!**** *GET_ADJ_MES_LONLAT_REG* get the near grid mesh indices
00006 !!
00007 !!    PURPOSE
00008 !!    -------
00009 !!
00010 !!    METHOD
00011 !!    ------
00012 !!   
00013 !!    REFERENCE
00014 !!    ---------
00015 !!
00016 !!    AUTHOR
00017 !!    ------
00018 !!
00019 !!    V. Masson         Meteo-France
00020 !!
00021 !!    MODIFICATION
00022 !!    ------------
00023 !!
00024 !!    Original    03/2004
00025 !!
00026 !----------------------------------------------------------------------------
00027 !
00028 !*    0.     DECLARATION
00029 !            -----------
00030 !
00031 USE MODE_GRIDTYPE_LONLAT_REG
00032 !
00033 !
00034 USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK
00035 USE PARKIND1  ,ONLY : JPRB
00036 !
00037 IMPLICIT NONE
00038 !
00039 !*    0.1    Declaration of arguments
00040 !            ------------------------
00041 !
00042 INTEGER,                         INTENT(IN)    :: KGRID_PAR ! size of PGRID_PAR
00043 INTEGER,                         INTENT(IN)    :: KL        ! number of points
00044 REAL,    DIMENSION(KGRID_PAR),   INTENT(IN)    :: PGRID_PAR ! grid parameters
00045 INTEGER, DIMENSION(KL),          INTENT(OUT)   :: KLEFT     ! left   mesh index
00046 INTEGER, DIMENSION(KL),          INTENT(OUT)   :: KRIGHT    ! right  mesh index
00047 INTEGER, DIMENSION(KL),          INTENT(OUT)   :: KTOP      ! top    mesh index
00048 INTEGER, DIMENSION(KL),          INTENT(OUT)   :: KBOTTOM   ! bottom mesh index
00049 !
00050 !*    0.2    Declaration of other local variables
00051 !            ------------------------------------
00052 !
00053 REAL    :: ZLONMIN ! minimum longitude (degrees)
00054 REAL    :: ZLONMAX ! maximum longitude (degrees)
00055 REAL    :: ZLATMIN ! minimum latitude  (degrees)
00056 REAL    :: ZLATMAX ! maximum latitude  (degrees)
00057 INTEGER :: ILON    ! number of points in longitude
00058 INTEGER :: ILAT    ! number of points in latitude
00059 INTEGER :: JLAT, JLON
00060 INTEGER :: JL
00061 REAL(KIND=JPRB) :: ZHOOK_HANDLE
00062 !----------------------------------------------------------------------------
00063 !
00064 IF (LHOOK) CALL DR_HOOK('GET_ADJ_MES_LONLAT_REG',0,ZHOOK_HANDLE)
00065  CALL GET_GRIDTYPE_LONLAT_REG(PGRID_PAR,ZLONMIN,ZLONMAX, &
00066                                ZLATMIN,ZLATMAX,ILON,ILAT  )  
00067 !
00068 KLEFT  (:) = 0
00069 KRIGHT (:) = 0
00070 KTOP   (:) = 0
00071 KBOTTOM(:) = 0
00072 !
00073 IF (ILON*ILAT==KL) THEN
00074   DO JLAT=1,ILAT
00075     DO JLON=1,ILON
00076       JL = JLON + ILON * (JLAT-1)
00077       IF (JLON>1   ) KLEFT  (JL) = JL-1
00078       IF (JLON<ILON) KRIGHT (JL) = JL+1
00079       IF (JLAT>1   ) KBOTTOM(JL) = JL-ILON
00080       IF (JLAT<ILAT) KTOP   (JL) = JL+ILON
00081       IF (JLON==1    .AND. ZLONMIN + 360. == ZLONMAX) KLEFT  (JL) = JL+ILON-1
00082       IF (JLON==ILON .AND. ZLONMIN + 360. == ZLONMAX) KRIGHT (JL) = JL-ILON+1
00083     END DO
00084   END DO
00085 END IF
00086 IF (LHOOK) CALL DR_HOOK('GET_ADJ_MES_LONLAT_REG',1,ZHOOK_HANDLE)
00087 !
00088 !-------------------------------------------------------------------------------
00089 !
00090 END SUBROUTINE GET_ADJ_MES_LONLAT_REG