SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
write_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 write_gridtype_gauss (DGU, U, &
7  hprogram,klu,kgrid_par,pgrid_par,kresp)
8 !#################################################################
9 !
10 !!**** *WRITE_GRIDTYPE_GAUSS* - routine to write 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 !
44 USE modd_surf_atm_n, ONLY : surf_atm_t
45 !
47 !
49 !
50 !
51 USE yomhook ,ONLY : lhook, dr_hook
52 USE parkind1 ,ONLY : jprb
53 !
54 IMPLICIT NONE
55 !
56 !* 0.1 Declarations of arguments
57 ! -------------------------
58 !
59 !
60 TYPE(diag_surf_atm_t), INTENT(INOUT) :: dgu
61 TYPE(surf_atm_t), INTENT(INOUT) :: u
62 !
63  CHARACTER(LEN=6), INTENT(IN) :: hprogram ! calling program
64 INTEGER, INTENT(IN) :: klu ! number of points
65 INTEGER, INTENT(IN) :: kgrid_par ! size of PGRID_PAR
66 REAL, DIMENSION(KGRID_PAR), INTENT(IN) :: pgrid_par ! parameters defining this grid
67 INTEGER, INTENT(OUT) :: kresp ! error return code
68 !
69 !* 0.2 Declarations of local variables
70 ! -------------------------------
71 !
72 INTEGER :: inlati ! number of pseudo-latitudes
73 REAL :: zlapo ! latitude of the rotated pole (deg)
74 REAL :: zlopo ! longitude of the rotated pole (deg)
75 REAL :: zcodil ! stretching factor (must be greater than or equal to 1)
76 INTEGER, DIMENSION(:), ALLOCATABLE :: inlopa ! number of pseudo-longitudes on each
77  ! pseudo-latitude circle
78 REAL, DIMENSION(KLU) :: zlat ! latitudes
79 REAL, DIMENSION(KLU) :: zlon ! longitudes
80 REAL, DIMENSION(KLU) :: zlat_xy
81 REAL, DIMENSION(KLU) :: zlon_xy
82 REAL, DIMENSION(KLU) :: zmesh_size
83 ! _____ Sup
84 REAL, DIMENSION(KLU) :: zlatsup ! Grid corner Latitude | |
85 REAL, DIMENSION(KLU) :: zlonsup ! Grid corner Longitude | |
86 REAL, DIMENSION(KLU) :: zlatinf ! Grid corner Latitude |_____|
87 REAL, DIMENSION(KLU) :: zloninf ! Grid corner Longitude Inf
88 !
89 INTEGER :: il ! total number of points
90 !
91  CHARACTER(LEN=100) :: ycomment ! comment written in the file
92 REAL(KIND=JPRB) :: zhook_handle
93 !---------------------------------------------------------------------------
94 !
95 IF (lhook) CALL dr_hook('WRITE_GRIDTYPE_GAUSS',0,zhook_handle)
96 !
97 !* 1. Projection and 2D grid parameters
98 ! ---------------------------------
99 !
100  CALL get_gridtype_gauss(pgrid_par,inlati)
101 !
102 ALLOCATE(inlopa(inlati))
103 !
104  CALL get_gridtype_gauss(pgrid_par,inlati,zlapo,zlopo,zcodil,inlopa(:),il,&
105  zlat,zlon,zlat_xy,zlon_xy,zmesh_size, &
106  zloninf,zlatinf,zlonsup,zlatsup )
107 !
108 !---------------------------------------------------------------------------
109 !
110 !* 2. Writing of the grid definition parameters
111 ! -----------------------------------------
112 !
113 ycomment=' '
114  CALL write_surf(dgu, u, &
115  hprogram,'NLATI',inlati,kresp,ycomment)
116  CALL write_surf(dgu, u, &
117  hprogram,'LAPO',zlapo, kresp,ycomment)
118  CALL write_surf(dgu, u, &
119  hprogram,'LOPO',zlopo,kresp,ycomment)
120  CALL write_surf(dgu, u, &
121  hprogram,'CODIL',zcodil,kresp,ycomment)
122  CALL write_surf(dgu, u, &
123  hprogram,'NLOPA',inlopa(:),kresp,ycomment,hdir='-',hnam_dim='Nlati ')
124  CALL write_surf(dgu, u, &
125  hprogram,'LATGAUSS',zlat(:),kresp,ycomment)
126  CALL write_surf(dgu, u, &
127  hprogram,'LONGAUSS',zlon(:),kresp,ycomment)
128  CALL write_surf(dgu, u, &
129  hprogram,'LAT_G_XY',zlat_xy(:),kresp,ycomment)
130  CALL write_surf(dgu, u, &
131  hprogram,'LON_G_XY',zlon_xy(:),kresp,ycomment)
132  CALL write_surf(dgu, u, &
133  hprogram,'MESHGAUSS',zmesh_size(:),kresp,ycomment)
134  CALL write_surf(dgu, u, &
135  hprogram,'LONINF',zloninf(:),kresp,ycomment)
136  CALL write_surf(dgu, u, &
137  hprogram,'LATINF',zlatinf(:),kresp,ycomment)
138  CALL write_surf(dgu, u, &
139  hprogram,'LONSUP',zlonsup(:),kresp,ycomment)
140  CALL write_surf(dgu, u, &
141  hprogram,'LATSUP',zlatsup(:),kresp,ycomment)
142 !
143 DEALLOCATE(inlopa)
144 !
145 !---------------------------------------------------------------------------
146 IF (lhook) CALL dr_hook('WRITE_GRIDTYPE_GAUSS',1,zhook_handle)
147 !---------------------------------------------------------------------------
148 !
149 END SUBROUTINE write_gridtype_gauss
subroutine get_gridtype_gauss(PGRID_PAR, KNLATI, PLAPO, PLOPO, PCODIL, KNLOPA, KL, PLAT, PLON, PLAT_XY, PLON_XY, PMESH_SIZE, PLONINF, PLATINF, PLONSUP, PLATSUP)
subroutine write_gridtype_gauss(DGU, U, HPROGRAM, KLU, KGRID_PAR, PGRID_PAR, KRESP)