SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
read_gridtype_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 ! ################################################################
7  hprogram,kgrid_par,klu,oread,ksize,pgrid_par,kresp,hdir)
8 ! ################################################################
9 !
10 !!**** *READ_GRIDTYPE_LONLAT_ROT* - 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 !! P. Samuelsson SMHI
32 !!
33 !! MODIFICATIONS
34 !! -------------
35 !! Original 12/2012
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 REAL :: zwest ! West longitude in rotated grid (degrees)
78 REAL :: zsouth ! South latitude in rotated grid (degrees)
79 REAL :: zdlon ! Longitudal grid spacing (degrees)
80 REAL :: zdlat ! Latitudal grid spacing (degrees)
81 REAL :: zpolon ! Longitude of rotated pole (degrees)
82 REAL :: zpolat ! Latitude of rotated pole (degrees)
83 INTEGER :: ilon ! number of points in longitude
84 INTEGER :: ilat ! number of points in latitude
85 REAL, DIMENSION(KLU) :: zlon ! longitudes
86 REAL, DIMENSION(KLU) :: zlat ! latitudes
87 !
88 INTEGER :: iluout
89 !---------------------------------------------------------------------------
90 REAL, DIMENSION(:), POINTER :: zgrid_par=>null()
91 !$OMP THREADPRIVATE(ZGRID_PAR)
92 REAL(KIND=JPRB) :: zhook_handle
93 !---------------------------------------------------------------------------
94 !
95 !* 1. Reading of the grid
96 ! -------------------
97 !
98 IF (lhook) CALL dr_hook('READ_GRIDTYPE_LONLAT_ROT',0,zhook_handle)
99 
100  CALL read_surf(&
101  hprogram,'WEST',zwest,kresp,hdir=hdir)
102  CALL read_surf(&
103  hprogram,'SOUTH',zsouth,kresp,hdir=hdir)
104  CALL read_surf(&
105  hprogram,'DLON',zdlon,kresp,hdir=hdir)
106  CALL read_surf(&
107  hprogram,'DLAT',zdlat,kresp,hdir=hdir)
108  CALL read_surf(&
109  hprogram,'POLON',zpolon,kresp,hdir=hdir)
110  CALL read_surf(&
111  hprogram,'POLAT',zpolat,kresp,hdir=hdir)
112  CALL read_surf(&
113  hprogram,'NLON',ilon,kresp,hdir=hdir)
114  CALL read_surf(&
115  hprogram,'NLAT',ilat,kresp,hdir=hdir)
116  CALL read_surf(&
117  hprogram,'REG_LON',zlon,kresp,hdir=hdir)
118  CALL read_surf(&
119  hprogram,'REG_LAT',zlat,kresp,hdir=hdir)
120 !
121 !---------------------------------------------------------------------------
122 !
123 !* 2. All this information stored into pointer PGRID_PAR
124 ! --------------------------------------------------
125 !
126  CALL put_gridtype_lonlat_rot(zgrid_par, &
127  zwest,zsouth,zdlon,zdlat,zpolon,zpolat, &
128  ilon,ilat,klu,zlon,zlat )
129 !
130 !---------------------------------------------------------------------------
131 IF (oread) THEN
132  IF (SIZE(pgrid_par) /= SIZE(zgrid_par)) THEN
133  CALL get_luout(hprogram,iluout)
134  WRITE(iluout,*)'size of PGRID_PAR =', SIZE(pgrid_par)
135  WRITE(iluout,*)'size of ZGRID_PAR =', SIZE(zgrid_par)
136  CALL abor1_sfx('READ_GRIDTYPE_LONLAT_ROT: SIZE OF PGRID_PAR IS NOT CORRECT')
137  END IF
138  !
139  pgrid_par = zgrid_par
140 ELSE
141  kgrid_par = SIZE(zgrid_par)
142 END IF
143 !
144 DEALLOCATE(zgrid_par)
145 IF (lhook) CALL dr_hook('READ_GRIDTYPE_LONLAT_ROT',1,zhook_handle)
146 !---------------------------------------------------------------------------
147 !
148 END SUBROUTINE read_gridtype_lonlat_rot
subroutine read_gridtype_lonlat_rot(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
subroutine put_gridtype_lonlat_rot(PGRID_PAR, PWEST, PSOUTH, PDLON, PDLAT, PPOLON, PPOLAT, KLON, KLAT, KL, PLON, PLAT)