SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
latlonmask_cartesian.F90
Go to the documentation of this file.
1 !SFX_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier
2 !SFX_LIC This is part of the SURFEX software governed by the CeCILL-C licence
3 !SFX_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
4 !SFX_LIC for details. version 1.
5 ! ##################################
6  SUBROUTINE latlonmask_cartesian(KGRID_PAR,PGRID_PAR,OLATLONMASK)
7 ! ##################################
8 !
9 !!**** *LATLONMASK* builds the latiude and longitude mask including the grid
10 !!
11 !! PURPOSE
12 !! -------
13 !!
14 !! METHOD
15 !! ------
16 !!
17 !! Two tests are performed:
18 !!
19 !! 1) test if the points of the mask are in the domain
20 !!
21 !! 2) fills the mask points corresponding to points scanning
22 !!
23 !! EXTERNAL
24 !! --------
25 !!
26 !!
27 !! IMPLICIT ARGUMENTS
28 !! ------------------
29 !!
30 !!
31 !! REFERENCE
32 !! ---------
33 !!
34 !! AUTHOR
35 !! ------
36 !!
37 !! V. Masson Meteo-France
38 !!
39 !! MODIFICATION
40 !! ------------
41 !!
42 !! Original 19/07/95
43 !----------------------------------------------------------------------------
44 !
45 !* 0. DECLARATION
46 ! -----------
47 !
49 !
50 !
51 USE yomhook ,ONLY : lhook, dr_hook
52 USE parkind1 ,ONLY : jprb
53 !
54 IMPLICIT NONE
55 !
56 !* 0.1 Declaration of arguments
57 ! ------------------------
58 !
59 INTEGER, INTENT(IN) :: kgrid_par ! size of PGRID_PAR
60 REAL, DIMENSION(KGRID_PAR), INTENT(IN) :: pgrid_par ! parameters defining this grid
61 LOGICAL, DIMENSION(720,360), INTENT(OUT) :: olatlonmask ! mask where data are to be read
62 !
63 !* 0.2 Declaration of local variables
64 ! ------------------------------
65 !
66 INTEGER :: jlon,jlat! loop counters
67 REAL, DIMENSION(720,360) :: zlon_mask! mask points longitudes
68 REAL, DIMENSION(720,360) :: zlat_mask! mask points latitudes
69 REAL :: zlat0 ! reference latitude
70 REAL :: zlon0 ! reference longitude
71 REAL(KIND=JPRB) :: zhook_handle
72 !----------------------------------------------------------------------------
73 !
74 IF (lhook) CALL dr_hook('LATLONMASK_CARTESIAN',0,zhook_handle)
75  CALL get_gridtype_cartesian(pgrid_par,zlat0,zlon0)
76 !
77 !-------------------------------------------------------------------------------
78 !
79 olatlonmask(:,:) = .false.
80 !
81 !-------------------------------------------------------------------------------
82 !
83 !* 2. Definition of the coordinates at center of the mask meshes
84 ! ----------------------------------------------------------
85 !
86 !
87 zlon_mask(:,:)= spread( (/ ( jlon /2. - 0.25 , jlon=1,720 ) /) , dim=2, ncopies=360 )
88 zlat_mask(:,:)= spread( (/ ( (jlat-180)/2. - 0.25 , jlat=1,360 ) /) , dim=1, ncopies=720 )
89 !
90 !* 3. Longitude correction / LON0
91 ! ---------------------------
92 !
93 zlon_mask(:,:)=zlon_mask(:,:)+nint((zlon0-zlon_mask(:,:))/360.)*360.
94 !
95 !
96 WHERE ( zlon_mask(:,:) -0.25 <= zlon0 .AND. zlon0 <= zlon_mask(:,:) +0.25 &
97  .AND. zlat_mask(:,:) -0.25 <= zlon0 .AND. zlat0 <= zlat_mask(:,:) +0.25 )
98  olatlonmask(:,:) = .true.
99 END WHERE
100 IF (lhook) CALL dr_hook('LATLONMASK_CARTESIAN',1,zhook_handle)
101 !
102 !-------------------------------------------------------------------------------
103 !
104 END SUBROUTINE latlonmask_cartesian
subroutine latlonmask_cartesian(KGRID_PAR, PGRID_PAR, OLATLONMASK)
subroutine get_gridtype_cartesian(PGRID_PAR, PLAT0, PLON0, KIMAX, KJMAX, PX, PY, PDX, PDY, KL)