SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
write_gridtype_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 write_gridtype_lonlat_reg (DGU, U, &
7  hprogram,klu,kgrid_par,pgrid_par,kresp)
8 ! #################################################################
9 !
10 !!**** *WRITE_GRIDTYPE_LONLAT_REG* - 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 REAL :: zlonmin ! minimum longitude (degrees)
73 REAL :: zlonmax ! maximum longitude (degrees)
74 REAL :: zlatmin ! minimum latitude (degrees)
75 REAL :: zlatmax ! maximum latitude (degrees)
76 INTEGER :: ilon ! number of points in longitude
77 INTEGER :: ilat ! number of points in latitude
78 INTEGER :: il ! number of points
79 REAL, DIMENSION(:), ALLOCATABLE :: zlon ! longitude of points
80 REAL, DIMENSION(:), ALLOCATABLE :: zlat ! latitude of points
81 !
82  CHARACTER(LEN=100) :: ycomment ! comment written in the file
83 REAL(KIND=JPRB) :: zhook_handle
84 !---------------------------------------------------------------------------
85 !
86 !* 1. Grid parameters
87 ! ---------------
88 !
89 IF (lhook) CALL dr_hook('WRITE_GRIDTYPE_LONLAT_REG',0,zhook_handle)
90  CALL get_gridtype_lonlat_reg(pgrid_par,zlonmin,zlonmax, &
91  zlatmin,zlatmax,ilon,ilat,il )
92 !
93 ALLOCATE(zlon(il))
94 ALLOCATE(zlat(il))
95  CALL get_gridtype_lonlat_reg(pgrid_par,plon=zlon,plat=zlat)
96 !
97 !---------------------------------------------------------------------------
98 !
99 !* 2. Writing of the grid definition parameters
100 ! -----------------------------------------
101 !
102 ycomment=' '
103  CALL write_surf(dgu, u, &
104  hprogram,'LONMIN',zlonmin,kresp,ycomment)
105  CALL write_surf(dgu, u, &
106  hprogram,'LONMAX',zlonmax,kresp,ycomment)
107  CALL write_surf(dgu, u, &
108  hprogram,'LATMIN',zlatmin,kresp,ycomment)
109  CALL write_surf(dgu, u, &
110  hprogram,'LATMAX',zlatmax,kresp,ycomment)
111  CALL write_surf(dgu, u, &
112  hprogram,'NLON',ilon,kresp,ycomment)
113  CALL write_surf(dgu, u, &
114  hprogram,'NLAT',ilat,kresp,ycomment)
115  CALL write_surf(dgu, u, &
116  hprogram,'REG_LON',zlon,kresp,ycomment)
117  CALL write_surf(dgu, u, &
118  hprogram,'REG_LAT',zlat,kresp,ycomment)
119 !---------------------------------------------------------------------------
120 DEALLOCATE(zlon)
121 DEALLOCATE(zlat)
122 IF (lhook) CALL dr_hook('WRITE_GRIDTYPE_LONLAT_REG',1,zhook_handle)
123 !---------------------------------------------------------------------------
124 !
125 END SUBROUTINE write_gridtype_lonlat_reg
subroutine write_gridtype_lonlat_reg(DGU, U, HPROGRAM, KLU, KGRID_PAR, PGRID_PAR, KRESP)
subroutine get_gridtype_lonlat_reg(PGRID_PAR, PLONMIN, PLONMAX, PLATMIN, PLATMAX, KLON, KLAT, KL, PLON, PLAT)