SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
latlon_gridtype_conf_proj.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 latlon_gridtype_conf_proj(KGRID_PAR,KL,PGRID_PAR,PLAT,PLON,PMESH_SIZE,PDIR)
7 ! #########################################################################
8 !
9 !!**** *LATLON_GRIDTYPE_CONF_PROJ* - routine to compute the horizontal geographic fields
10 !!
11 !! PURPOSE
12 !! -------
13 !!
14 !!** METHOD
15 !! ------
16 !!
17 !! EXTERNAL
18 !! --------
19 !!
20 !!
21 !! IMPLICIT ARGUMENTS
22 !! ------------------
23 !!
24 !! REFERENCE
25 !! ---------
26 !!
27 !!
28 !! AUTHOR
29 !! ------
30 !! V. Masson *Meteo France*
31 !!
32 !! MODIFICATIONS
33 !! -------------
34 !! Original 01/2004
35 !-------------------------------------------------------------------------------
36 !
37 !* 0. DECLARATIONS
38 ! ------------
39 !
40 USE modd_csts, ONLY : xpi
41 !
43 !
44 !
45 !
46 USE yomhook ,ONLY : lhook, dr_hook
47 USE parkind1 ,ONLY : jprb
48 !
49 IMPLICIT NONE
50 !
51 !* 0.1 Declarations of arguments
52 ! -------------------------
53 !
54 INTEGER, INTENT(IN) :: kgrid_par ! size of PGRID_PAR
55 INTEGER, INTENT(IN) :: kl ! number of points
56 REAL, DIMENSION(KGRID_PAR), INTENT(IN) :: pgrid_par ! parameters defining this grid
57 REAL, DIMENSION(KL), INTENT(OUT) :: plat ! latitude (degrees)
58 REAL, DIMENSION(KL), INTENT(OUT) :: plon ! longitude (degrees)
59 REAL, DIMENSION(KL), INTENT(OUT) :: pmesh_size ! mesh size (m2)
60 REAL, DIMENSION(KL), INTENT(OUT) :: pdir ! direction of main grid Y axis (deg. from N, clockwise)
61 !
62 !* 0.2 Declarations of local variables
63 ! -------------------------------
64 !
65 REAL :: zlat0 ! reference latitude
66 REAL :: zlon0 ! reference longitude
67 REAL :: zrpk ! projection parameter
68 ! ! K=1 : stereographic north pole
69 ! ! 0<K<1 : Lambert, north hemisphere
70 ! ! K=0 : Mercator
71 ! !-1<K<0 : Lambert, south hemisphere
72 ! ! K=-1: stereographic south pole
73 REAL :: zbeta ! angle between grid and reference longitude
74 REAL :: zlator ! latitude of point of coordinates X=0, Y=0
75 REAL :: zlonor ! longitude of point of coordinates X=0, Y=0
76 REAL, DIMENSION(:), ALLOCATABLE :: zx ! X conformal coordinate
77 REAL, DIMENSION(:), ALLOCATABLE :: zy ! Y conformal coordinate
78 REAL, DIMENSION(:), ALLOCATABLE :: zmap ! map factor
79 REAL, DIMENSION(:), ALLOCATABLE :: zdx ! size in X conformal coordinate
80 REAL, DIMENSION(:), ALLOCATABLE :: zdy ! size in Y conformal coordinate
81 REAL(KIND=JPRB) :: zhook_handle
82 !
83 !---------------------------------------------------------------------------
84 !
85 !* 1. Projection and 2D grid parameters
86 ! ---------------------------------
87 !
88 IF (lhook) CALL dr_hook('LATLON_GRIDTYPE_CONF_PROJ',0,zhook_handle)
89 ALLOCATE(zx(SIZE(plat)))
90 ALLOCATE(zy(SIZE(plat)))
91 ALLOCATE(zdx(SIZE(plat)))
92 ALLOCATE(zdy(SIZE(plat)))
93 !
94  CALL get_gridtype_conf_proj(pgrid_par,zlat0,zlon0,zrpk,zbeta,&
95  zlator,zlonor, &
96  px=zx,py=zy,pdx=zdx,pdy=zdy )
97 !
98 !---------------------------------------------------------------------------
99 !
100 !* 2. Computation of latitude and longitude
101 ! -------------------------------------
102 !
103  CALL latlon_conf_proj(zlat0,zlon0,zrpk,zbeta,zlator,zlonor,zx,zy,plat,plon)
104 !
105 !-----------------------------------------------------------------------------
106 !
107 !* 3. Compute grid size (2D array)
108 ! -----------------
109 !
110 ! 3.1 Map factor
111 ! ----------
112 !
113 ALLOCATE(zmap(SIZE(plat)))
114 !
115  CALL map_factor_conf_proj(zlat0,zrpk,plat,zmap)
116 !
117 ! 3.2 Grid size
118 ! ---------
119 !
120 pmesh_size(:) = zdx(:) * zdy(:) / zmap(:)**2
121 !
122 !-----------------------------------------------------------------------------
123 !
124 !* 4. Direction of Y axis (from North) for each grid point
125 ! ----------------------------------------------------
126 !
127 !* the following formulae is given for clockwise angles.
128 pdir(:) = zrpk * (plon(:) - zlon0) - zbeta
129 !
130 WHERE (pdir(:) <0.) pdir = pdir + 360.
131 WHERE (pdir(:) >=360.) pdir = pdir - 360.
132 !
133 !---------------------------------------------------------------------------
134 DEALLOCATE(zx)
135 DEALLOCATE(zy)
136 DEALLOCATE(zmap)
137 DEALLOCATE(zdx)
138 DEALLOCATE(zdy)
139 IF (lhook) CALL dr_hook('LATLON_GRIDTYPE_CONF_PROJ',1,zhook_handle)
140 !---------------------------------------------------------------------------
141 !
142 END SUBROUTINE latlon_gridtype_conf_proj
143 
subroutine map_factor_conf_proj(PLAT0, PRPK, PLAT, PMAP)
subroutine latlon_gridtype_conf_proj(KGRID_PAR, KL, PGRID_PAR, PLAT, PLON, PMESH_SIZE, PDIR)
subroutine latlon_conf_proj(PLAT0, PLON0, PRPK, PBETA, PLATOR, PLONOR, PX, PY, PLAT, PLON)
subroutine get_gridtype_conf_proj(PGRID_PAR, PLAT0, PLON0, PRPK, PBETA, PLATOR, PLONOR, KIMAX, KJMAX, PX, PY, PDX, PDY, KL)