SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
read_nam_grid_lonlat_rot.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 read_nam_grid_lonlat_rot(HPROGRAM,KGRID_PAR,KL,PGRID_PAR)
7 ! ################################################################
8 !
9 !!**** *READ_NAM_GRID_LONLAT_ROT* - routine to read in namelist the horizontal grid
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 !! P. Samuelsson SMHI
31 !!
32 !! MODIFICATIONS
33 !! -------------
34 !! Original 12/2012
35 !-------------------------------------------------------------------------------
36 !
37 !* 0. DECLARATIONS
38 ! ------------
39 !
40 USE mode_pos_surf
41 !
42 USE modi_open_namelist
43 USE modi_close_namelist
44 USE modi_get_luout
45 !
47 !
48 !
49 USE yomhook ,ONLY : lhook, dr_hook
50 USE parkind1 ,ONLY : jprb
51 !
52 IMPLICIT NONE
53 !
54 !* 0.1 Declarations of arguments
55 ! -------------------------
56 !
57  CHARACTER(LEN=6), INTENT(IN) :: hprogram ! calling program
58 INTEGER, INTENT(INOUT) :: kgrid_par ! size of PGRID_PAR
59 INTEGER, INTENT(OUT) :: kl ! number of points
60 REAL, DIMENSION(KGRID_PAR), INTENT(OUT) :: pgrid_par ! parameters defining this grid
61 !
62 !* 0.2 Declarations of local variables
63 ! -------------------------------
64 !
65 INTEGER :: iluout ! output listing logical unit
66 INTEGER :: ilunam ! namelist file logical unit
67 !
68 REAL, DIMENSION(:), ALLOCATABLE :: zlat ! latitude of all points
69 REAL, DIMENSION(:), ALLOCATABLE :: zlon ! longitude of all points
70 !
71 REAL, DIMENSION(:), POINTER :: zgrid_par
72 !
73 LOGICAL :: gfound
74 !
75 !
76 !* 0.3 Declarations of namelist
77 ! ------------------------
78 !
79 REAL :: xwest ! West longitude in rotated grid (degrees)
80 REAL :: xsouth ! South latitude in rotated grid (degrees)
81 REAL :: xdlon ! Longitudal grid spacing (degrees)
82 REAL :: xdlat ! Latitudal grid spacing (degrees)
83 REAL :: xpolon ! Longitude of rotated pole (degrees)
84 REAL :: xpolat ! Latitude of rotated pole (degrees)
85 INTEGER :: nlon ! number of points in longitude
86 INTEGER :: nlat ! number of points in latitude
87 REAL(KIND=JPRB) :: zhook_handle
88 namelist/nam_lonlat_rot/xwest,xsouth,xdlon,xdlat,xpolon,xpolat,nlon,nlat
89 !
90 !------------------------------------------------------------------------------
91 !
92 !* 1. opening of namelist
93 !
94 IF (lhook) CALL dr_hook('READ_NAM_GRID_LONLAT_ROT',0,zhook_handle)
95  CALL get_luout(hprogram,iluout)
96 !
97  CALL open_namelist(hprogram,ilunam)
98 !
99 !---------------------------------------------------------------------------
100 !
101 !* 2. Reading of projection parameters
102 ! --------------------------------
103 !
104  CALL posnam(ilunam,'NAM_LONLAT_ROT',gfound,iluout)
105 IF (gfound) READ(unit=ilunam,nml=nam_lonlat_rot)
106 !
107 !---------------------------------------------------------------------------
108 !
109 !* 3. Number of points
110 ! ----------------
111 !
112 kl = nlon * nlat
113 !
114 !---------------------------------------------------------------------------
115  CALL close_namelist(hprogram,ilunam)
116 !---------------------------------------------------------------------------
117 !
118 !* 4. All this information stored into pointer PGRID_PAR
119 ! --------------------------------------------------
120 !
121 ALLOCATE(zlat(kl))
122 ALLOCATE(zlon(kl))
123 !
124  CALL latlon_lonlat_rot(xwest,xsouth,xdlon,xdlat,xpolon,xpolat, &
125  nlon,nlat,zlon,zlat )
126 !
127  CALL put_gridtype_lonlat_rot(zgrid_par, &
128  xwest,xsouth,xdlon,xdlat,xpolon,xpolat, &
129  nlon,nlat,kl,zlon,zlat )
130 !
131 DEALLOCATE(zlat)
132 DEALLOCATE(zlon)
133 !
134 !---------------------------------------------------------------------------
135 !
136 !* 1st call : initializes dimension
137 !
138 IF (kgrid_par==0) THEN
139  kgrid_par = SIZE(zgrid_par)
140 !
141 ELSE
142 !
143 !* 2nd call : initializes grid array
144 !
145  pgrid_par(:) = 0.
146  pgrid_par(:) = zgrid_par
147 END IF
148 !
149 DEALLOCATE(zgrid_par)
150 IF (lhook) CALL dr_hook('READ_NAM_GRID_LONLAT_ROT',1,zhook_handle)
151 !
152 !---------------------------------------------------------------------------
153 !
154 END SUBROUTINE read_nam_grid_lonlat_rot
subroutine latlon_lonlat_rot(PWEST, PSOUTH, PDLON, PDLAT, PPOLON, PPOLAT, KLON, KLAT, PLON, PLAT)
subroutine close_namelist(HPROGRAM, KLUNAM)
subroutine posnam(KULNAM, HDNAML, OFOUND, KLUOUT)
subroutine read_nam_grid_lonlat_rot(HPROGRAM, KGRID_PAR, KL, PGRID_PAR)
subroutine get_luout(HPROGRAM, KLUOUT)
Definition: get_luout.F90:6
subroutine open_namelist(HPROGRAM, KLUNAM, HFILE)
subroutine put_gridtype_lonlat_rot(PGRID_PAR, PWEST, PSOUTH, PDLON, PDLAT, PPOLON, PPOLAT, KLON, KLAT, KL, PLON, PLAT)