SURFEX v7.3
General documentation of Surfex
 All Classes Files Functions Variables Typedefs
/home/dasprezs/EXPORT_v7_3/src/SURFEX/latlonmask_cartesian.F90
Go to the documentation of this file.
00001 !     ##################################
00002       SUBROUTINE LATLONMASK_CARTESIAN(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_CARTESIAN
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 INTEGER                           :: JLON,JLAT! loop counters
00063 REAL, DIMENSION(720,360)          :: ZLON_MASK! mask points longitudes
00064 REAL, DIMENSION(720,360)          :: ZLAT_MASK! mask points latitudes
00065 REAL                              :: ZLAT0    ! reference latitude
00066 REAL                              :: ZLON0    ! reference longitude
00067 REAL(KIND=JPRB) :: ZHOOK_HANDLE
00068 !----------------------------------------------------------------------------
00069 !
00070 IF (LHOOK) CALL DR_HOOK('LATLONMASK_CARTESIAN',0,ZHOOK_HANDLE)
00071  CALL GET_GRIDTYPE_CARTESIAN(PGRID_PAR,ZLAT0,ZLON0)
00072 !
00073 !-------------------------------------------------------------------------------
00074 !
00075 OLATLONMASK(:,:) = .FALSE.
00076 !
00077 !-------------------------------------------------------------------------------
00078 !
00079 !*      2.   Definition of the coordinates at center of the mask meshes
00080 !            ----------------------------------------------------------
00081 !
00082 !
00083 ZLON_MASK(:,:)= SPREAD( (/ (  JLON     /2. - 0.25 , JLON=1,720 ) /) , DIM=2, NCOPIES=360 )
00084 ZLAT_MASK(:,:)= SPREAD( (/ ( (JLAT-180)/2. - 0.25 , JLAT=1,360 ) /) , DIM=1, NCOPIES=720 )
00085 !
00086 !*      3.   Longitude correction / LON0
00087 !            ---------------------------
00088 !
00089 ZLON_MASK(:,:)=ZLON_MASK(:,:)+NINT((ZLON0-ZLON_MASK(:,:))/360.)*360.
00090 !
00091 !
00092 WHERE (        ZLON_MASK(:,:) -0.25 <= ZLON0 .AND. ZLON0 <= ZLON_MASK(:,:) +0.25 &
00093            .AND. ZLAT_MASK(:,:) -0.25 <= ZLON0 .AND. ZLAT0 <= ZLAT_MASK(:,:) +0.25 )  
00094   OLATLONMASK(:,:) = .TRUE.
00095 END WHERE
00096 IF (LHOOK) CALL DR_HOOK('LATLONMASK_CARTESIAN',1,ZHOOK_HANDLE)
00097 !
00098 !-------------------------------------------------------------------------------
00099 !
00100 END SUBROUTINE LATLONMASK_CARTESIAN