SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
read_gridtype_gauss.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_gridtype_gauss (&
7  hprogram,kgrid_par,klu,oread,ksize,pgrid_par,kresp,hdir)
8 !################################################################
9 !
10 !!**** *READ_GRIDTYPE_GAUSS* - routine to initialise the horizontal grid
11 !!
12 !! PURPOSE
13 !! -------
14 !!
15 !!** METHOD
16 !! ------
17 !!
18 !! EXTERNAL
19 !! --------
20 !!
21 !!
22 !! IMPLICIT ARGUMENTS
23 !! ------------------
24 !!
25 !! REFERENCE
26 !! ---------
27 !!
28 !!
29 !! AUTHOR
30 !! ------
31 !! V. Masson *Meteo France*
32 !!
33 !! MODIFICATIONS
34 !! -------------
35 !! Original 01/2004
36 !-------------------------------------------------------------------------------
37 !
38 !* 0. DECLARATIONS
39 ! ------------
40 !
41 !
42 !
43 !
45 USE modi_get_luout
46 !
48 !
49 !
50 USE yomhook ,ONLY : lhook, dr_hook
51 USE parkind1 ,ONLY : jprb
52 !
53 USE modi_abor1_sfx
54 !
55 IMPLICIT NONE
56 !
57 !* 0.1 Declarations of arguments
58 ! -------------------------
59 !
60 !
61 !
62  CHARACTER(LEN=6), INTENT(IN) :: hprogram ! calling program
63 INTEGER, INTENT(INOUT) :: kgrid_par ! real size of PGRID_PAR
64 INTEGER, INTENT(IN) :: klu ! number of points
65 LOGICAL, INTENT(IN) :: oread ! flag to read the grid
66 INTEGER, INTENT(IN) :: ksize ! estimated size of PGRID_PAR
67 REAL, DIMENSION(KSIZE), INTENT(OUT) :: pgrid_par ! parameters defining this grid
68 INTEGER, INTENT(OUT) :: kresp ! error return code
69  CHARACTER(LEN=1), INTENT(IN) :: hdir ! reading directive
70 ! ! 'A' : all field
71 ! ! 'H' : field on this processor only
72 !
73 !
74 !* 0.2 Declarations of local variables
75 ! -------------------------------
76 !
77 INTEGER :: inlati ! number of pseudo-latitudes
78 REAL :: zlapo ! latitude of the rotated pole (deg)
79 REAL :: zlopo ! longitude of the rotated pole (deg)
80 REAL :: zcodil ! stretching factor (must be greater than or equal to 1)
81 INTEGER, DIMENSION(:), ALLOCATABLE :: inlopa ! number of pseudo-longitudes on each
82  ! pseudo-latitude circle
83 REAL, DIMENSION(KLU) :: zlat ! latitudes
84 REAL, DIMENSION(KLU) :: zlon ! longitudes
85 REAL, DIMENSION(KLU) :: zlat_xy ! pseudo-latitudes
86 REAL, DIMENSION(KLU) :: zlon_xy ! pseudo-longitudes
87 REAL, DIMENSION(KLU) :: zmesh_size ! Mesh size
88 ! _____ Sup
89 REAL, DIMENSION(KLU) :: zlatsup ! Grid corner Latitude | |
90 REAL, DIMENSION(KLU) :: zlonsup ! Grid corner Longitude | |
91 REAL, DIMENSION(KLU) :: zlatinf ! Grid corner Latitude |_____|
92 REAL, DIMENSION(KLU) :: zloninf ! Grid corner Longitude Inf
93 !
94 INTEGER :: iluout
95 !---------------------------------------------------------------------------
96 REAL, DIMENSION(:), POINTER :: zgrid_par=>null()
97 !$OMP THREADPRIVATE(ZGRID_PAR)
98 REAL(KIND=JPRB) :: zhook_handle
99 !---------------------------------------------------------------------------
100 !
101 !* 1. Reading of projection parameters
102 ! --------------------------------
103 !
104 IF (lhook) CALL dr_hook('READ_GRIDTYPE_GAUSS',0,zhook_handle)
105  CALL read_surf(&
106  hprogram,'LAPO',zlapo, kresp,hdir=hdir)
107  CALL read_surf(&
108  hprogram,'LOPO',zlopo,kresp,hdir=hdir)
109  CALL read_surf(&
110  hprogram,'CODIL',zcodil,kresp,hdir=hdir)
111 !
112 !---------------------------------------------------------------------------
113 !
114 !* 2. Reading parameters of the grid
115 ! ------------------------------
116 !
117  CALL read_surf(&
118  hprogram,'NLATI',inlati,kresp,hdir=hdir)
119 ALLOCATE(inlopa(inlati))
120 IF (hdir=='A') THEN
121  CALL read_surf(&
122  hprogram,'NLOPA',inlopa(:),kresp,hdir=hdir)
123 ELSE
124  CALL read_surf(&
125  hprogram,'NLOPA',inlopa(:),kresp,hdir='-')
126 ENDIF
127  CALL read_surf(&
128  hprogram,'LATGAUSS',zlat(:),kresp,hdir=hdir)
129  CALL read_surf(&
130  hprogram,'LONGAUSS',zlon(:),kresp,hdir=hdir)
131  CALL read_surf(&
132  hprogram,'LAT_G_XY',zlat_xy(:),kresp,hdir=hdir)
133  CALL read_surf(&
134  hprogram,'LON_G_XY',zlon_xy(:),kresp,hdir=hdir)
135  CALL read_surf(&
136  hprogram,'MESHGAUSS',zmesh_size(:),kresp,hdir=hdir)
137  CALL read_surf(&
138  hprogram,'LONINF',zloninf(:),kresp,hdir=hdir)
139  CALL read_surf(&
140  hprogram,'LATINF',zlatinf(:),kresp,hdir=hdir)
141  CALL read_surf(&
142  hprogram,'LONSUP',zlonsup(:),kresp,hdir=hdir)
143  CALL read_surf(&
144  hprogram,'LATSUP',zlatsup(:),kresp,hdir=hdir)
145 
146 !---------------------------------------------------------------------------
147 !
148 !* 4. All this information stored into pointer PGRID_PAR
149 ! --------------------------------------------------
150 !
151  CALL put_gridtype_gauss(zgrid_par,inlati,zlapo,zlopo,zcodil,inlopa, &
152  klu,zlat,zlon,zlat_xy,zlon_xy,zmesh_size, &
153  zloninf,zlatinf,zlonsup,zlatsup )
154 !
155 DEALLOCATE(inlopa)
156 !---------------------------------------------------------------------------
157 IF (oread) THEN
158  IF (SIZE(pgrid_par) /= SIZE(zgrid_par)) THEN
159  CALL get_luout(hprogram,iluout)
160  WRITE(iluout,*)'size of PGRID_PAR =', SIZE(pgrid_par)
161  WRITE(iluout,*)'size of ZGRID_PAR =', SIZE(zgrid_par)
162  CALL abor1_sfx('READ_GRIDTYPE_GAUSS: SIZE OF PGRID_PAR IS NOT CORRECT')
163  END IF
164  !
165  pgrid_par = zgrid_par
166 ELSE
167  kgrid_par = SIZE(zgrid_par)
168 END IF
169 !
170 DEALLOCATE(zgrid_par)
171 IF (lhook) CALL dr_hook('READ_GRIDTYPE_GAUSS',1,zhook_handle)
172 !---------------------------------------------------------------------------
173 !
174 END SUBROUTINE read_gridtype_gauss
subroutine put_gridtype_gauss(PGRID_PAR, KNLATI, PLAPO, PLOPO, PCODIL, KNLOPA, KL, PLAT, PLON, PLAT_XY, PLON_XY, PMESH_SIZE, PLONINF, PLATINF, PLONSUP, PLATSUP)
subroutine read_gridtype_gauss(HPROGRAM, KGRID_PAR, KLU, OREAD, KSIZE, PGRID_PAR, KRESP, HDIR)
subroutine abor1_sfx(YTEXT)
Definition: abor1_sfx.F90:6
subroutine get_luout(HPROGRAM, KLUOUT)
Definition: get_luout.F90:6