SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
read_nam_grid_lonlat_reg.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_reg(HPROGRAM,KGRID_PAR,KL,PGRID_PAR)
7 ! ################################################################
8 !
9 !!**** *READ_NAM_GRID_LONLAT_REG* - 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 !! V. Masson *Meteo France*
31 !!
32 !! MODIFICATIONS
33 !! -------------
34 !! Original 01/2004
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 :: xlonmin ! minimum longitude (degrees)
80 REAL :: xlonmax ! maximum longitude (degrees)
81 REAL :: xlatmin ! minimum latitude (degrees)
82 REAL :: xlatmax ! maximum latitude (degrees)
83 INTEGER :: nlon ! number of points in longitude
84 INTEGER :: nlat ! number of points in latitude
85 REAL(KIND=JPRB) :: zhook_handle
86 namelist/nam_lonlat_reg/xlonmin, xlonmax, xlatmin, xlatmax, nlon, nlat
87 !
88 !------------------------------------------------------------------------------
89 !
90 !* 1. opening of namelist
91 !
92 IF (lhook) CALL dr_hook('READ_NAM_GRID_LONLAT_REG',0,zhook_handle)
93  CALL get_luout(hprogram,iluout)
94 !
95  CALL open_namelist(hprogram,ilunam)
96 !
97 !---------------------------------------------------------------------------
98 !
99 !* 2. Reading of projection parameters
100 ! --------------------------------
101 !
102  CALL posnam(ilunam,'NAM_LONLAT_REG',gfound,iluout)
103 IF (gfound) READ(unit=ilunam,nml=nam_lonlat_reg)
104 !
105 !---------------------------------------------------------------------------
106 !
107 !* 3. Number of points
108 ! ----------------
109 !
110 kl = nlon * nlat
111 !
112 !---------------------------------------------------------------------------
113  CALL close_namelist(hprogram,ilunam)
114 !---------------------------------------------------------------------------
115 !
116 !* 4. All this information stored into pointer PGRID_PAR
117 ! --------------------------------------------------
118 !
119 ALLOCATE(zlat(kl))
120 ALLOCATE(zlon(kl))
121 !
122  CALL latlon_lonlat_reg(xlonmin,xlonmax,xlatmin,xlatmax,&
123  nlon,nlat,zlon,zlat )
124 !
125  CALL put_gridtype_lonlat_reg(zgrid_par,xlonmin,xlonmax,xlatmin,xlatmax, &
126  nlon,nlat,kl,zlon,zlat )
127 !
128 DEALLOCATE(zlat)
129 DEALLOCATE(zlon)
130 !
131 !---------------------------------------------------------------------------
132 !
133 !* 1st call : initializes dimension
134 !
135 IF (kgrid_par==0) THEN
136  kgrid_par = SIZE(zgrid_par)
137 !
138 ELSE
139 !
140 !* 2nd call : initializes grid array
141 !
142  pgrid_par(:) = 0.
143  pgrid_par(:) = zgrid_par
144 END IF
145 !
146 DEALLOCATE(zgrid_par)
147 IF (lhook) CALL dr_hook('READ_NAM_GRID_LONLAT_REG',1,zhook_handle)
148 !
149 !---------------------------------------------------------------------------
150 !
151 END SUBROUTINE read_nam_grid_lonlat_reg
subroutine latlon_lonlat_reg(PLONMIN, PLONMAX, PLATMIN, PLATMAX, KLON, KLAT, PLON, PLAT)
subroutine read_nam_grid_lonlat_reg(HPROGRAM, KGRID_PAR, KL, PGRID_PAR)
subroutine close_namelist(HPROGRAM, KLUNAM)
subroutine posnam(KULNAM, HDNAML, OFOUND, KLUOUT)
subroutine get_luout(HPROGRAM, KLUOUT)
Definition: get_luout.F90:6
subroutine open_namelist(HPROGRAM, KLUNAM, HFILE)
subroutine put_gridtype_lonlat_reg(PGRID_PAR, PLONMIN, PLONMAX, PLATMIN, PLATMAX, KLON, KLAT, KL, PLON, PLAT)