SURFEX v7.3
General documentation of Surfex
 All Classes Files Functions Variables Typedefs
/home/dasprezs/EXPORT_v7_3/src/SURFEX/latlonmask_lonlat_reg.F90
Go to the documentation of this file.
00001 !     ##################################
00002       SUBROUTINE LATLONMASK_LONLAT_REG(KGRID_PAR,PGRID_PAR,OLATLONMASK)
00003 !     ##################################
00004 !
00005 !!**** *LATLONMASK* builds the latiude and longitude mask including the grid
00006 !!
00007 !!    PURPOSE
00008 !!    -------
00009 !!
00010 !!    METHOD
00011 !!    ------
00012 !!
00013 !!    Two tests are performed:
00014 !!
00015 !!   1) test if the points of the mask are in the domain
00016 !!
00017 !!   2) fills the mask points corresponding to points scanning
00018 !!   
00019 !!    EXTERNAL
00020 !!    --------
00021 !!
00022 !!
00023 !!    IMPLICIT ARGUMENTS
00024 !!    ------------------
00025 !!
00026 !!
00027 !!    REFERENCE
00028 !!    ---------
00029 !!
00030 !!    AUTHOR
00031 !!    ------
00032 !!
00033 !!      V. Masson       Meteo-France
00034 !!
00035 !!    MODIFICATION
00036 !!    ------------
00037 !!      
00038 !!      Original        19/07/95
00039 !----------------------------------------------------------------------------
00040 !
00041 !*    0.     DECLARATION
00042 !            -----------
00043 !
00044 USE MODE_GRIDTYPE_LONLAT_REG
00045 !
00046 !
00047 USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK
00048 USE PARKIND1  ,ONLY : JPRB
00049 !
00050 IMPLICIT NONE
00051 !
00052 !*    0.1    Declaration of arguments
00053 !            ------------------------
00054 !
00055 INTEGER,                       INTENT(IN)  :: KGRID_PAR   ! size of PGRID_PAR
00056 REAL,    DIMENSION(KGRID_PAR), INTENT(IN)  :: PGRID_PAR   ! parameters defining this grid
00057 LOGICAL, DIMENSION(720,360),   INTENT(OUT) :: OLATLONMASK ! mask where data are to be read
00058 !
00059 !*    0.2    Declaration of local variables
00060 !            ------------------------------
00061 !
00062 REAL    :: ZLONMIN
00063 REAL    :: ZLONMAX
00064 REAL    :: ZLATMIN
00065 REAL    :: ZLATMAX
00066 REAL    :: ZLON0
00067 !
00068 INTEGER :: JLAT
00069 INTEGER :: JLON
00070 !
00071 REAL, DIMENSION(720,360) :: ZLON_MASK! mask points longitudes
00072 REAL, DIMENSION(720,360) :: ZLAT_MASK! mask points latitudes
00073 REAL(KIND=JPRB) :: ZHOOK_HANDLE
00074 !----------------------------------------------------------------------------
00075 !
00076 IF (LHOOK) CALL DR_HOOK('LATLONMASK_LONLAT_REG',0,ZHOOK_HANDLE)
00077  CALL GET_GRIDTYPE_LONLAT_REG(PGRID_PAR,ZLONMIN,ZLONMAX, &
00078                                ZLATMIN,ZLATMAX            )  
00079 !
00080 !-------------------------------------------------------------------------------
00081 !
00082 OLATLONMASK(:,:) = .FALSE.
00083 !
00084 !-------------------------------------------------------------------------------
00085 !
00086 !*      2.   Definition of the coordinates at center of the mask meshes
00087 !            ----------------------------------------------------------
00088 !
00089 !
00090 ZLON_MASK(:,:)= SPREAD( (/ (  JLON     /2. - 0.25 , JLON=1,720 ) /) , DIM=2, NCOPIES=360 )
00091 ZLAT_MASK(:,:)= SPREAD( (/ ( (JLAT-180)/2. - 0.25 , JLAT=1,360 ) /) , DIM=1, NCOPIES=720 )
00092 !
00093 !-------------------------------------------------------------------------------
00094 !
00095 !*      3.   Set definition of longitudes according to grid 
00096 !            ----------------------------------------------
00097 !
00098 ZLON0 = 0.5*(ZLONMIN+ZLONMAX)
00099 ZLON_MASK(:,:)=ZLON_MASK(:,:)+NINT((ZLON0-ZLON_MASK(:,:))/360.)*360.
00100 !
00101 !-------------------------------------------------------------------------------
00102 !
00103 DO JLAT=1,360
00104   DO JLON=1,720
00105     IF (      ZLON_MASK(JLON,JLAT) + 0.25 >= ZLONMIN &
00106           .AND. ZLON_MASK(JLON,JLAT) - 0.25 <= ZLONMAX &
00107           .AND. ZLAT_MASK(JLON,JLAT) + 0.25 >= ZLATMIN &
00108           .AND. ZLAT_MASK(JLON,JLAT) - 0.25 <= ZLATMAX ) OLATLONMASK(JLON,JLAT) = .TRUE.  
00109   END DO
00110 END DO
00111 IF (LHOOK) CALL DR_HOOK('LATLONMASK_LONLAT_REG',1,ZHOOK_HANDLE)
00112 !
00113 !-------------------------------------------------------------------------------
00114 !
00115 END SUBROUTINE LATLONMASK_LONLAT_REG