SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
write_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 ! #################################################################
6  SUBROUTINE write_gridtype_lonlat_rot (DGU, U, &
7  hprogram,klu,kgrid_par,pgrid_par,kresp)
8 ! #################################################################
9 !
10 !!**** *WRITE_GRIDTYPE_LONLAT_ROT* - 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 !! P. Samuelsson SMHI
32 !!
33 !! MODIFICATIONS
34 !! -------------
35 !! Original 12/2012
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 :: zwest ! West longitude in rotated grid (degrees)
73 REAL :: zsouth ! South latitude in rotated grid (degrees)
74 REAL :: zdlon ! Longitudal grid spacing (degrees)
75 REAL :: zdlat ! Latitudal grid spacing (degrees)
76 REAL :: zpolon ! Longitude of rotated pole (degrees)
77 REAL :: zpolat ! Latitude of rotated pole (degrees)
78 INTEGER :: ilon ! number of points in longitude
79 INTEGER :: ilat ! number of points in latitude
80 INTEGER :: il ! number of points
81 REAL, DIMENSION(:), ALLOCATABLE :: zlon ! longitude of points
82 REAL, DIMENSION(:), ALLOCATABLE :: zlat ! latitude of points
83 !
84  CHARACTER(LEN=100) :: ycomment ! comment written in the file
85 REAL(KIND=JPRB) :: zhook_handle
86 !---------------------------------------------------------------------------
87 !
88 !* 1. Grid parameters
89 ! ---------------
90 !
91 IF (lhook) CALL dr_hook('WRITE_GRIDTYPE_LONLAT_ROT',0,zhook_handle)
92  CALL get_gridtype_lonlat_rot(pgrid_par, &
93  zwest,zsouth,zdlon,zdlat,zpolon,zpolat, &
94  ilon,ilat,il )
95 !
96 ALLOCATE(zlon(il))
97 ALLOCATE(zlat(il))
98  CALL get_gridtype_lonlat_rot(pgrid_par,plon=zlon,plat=zlat)
99 !
100 !---------------------------------------------------------------------------
101 !
102 !* 2. Writing of the grid definition parameters
103 ! -----------------------------------------
104 !
105 ycomment=' '
106  CALL write_surf(dgu, u, &
107  hprogram,'WEST',zwest,kresp,ycomment)
108  CALL write_surf(dgu, u, &
109  hprogram,'SOUTH',zsouth,kresp,ycomment)
110  CALL write_surf(dgu, u, &
111  hprogram,'DLON',zdlon,kresp,ycomment)
112  CALL write_surf(dgu, u, &
113  hprogram,'DLAT',zdlat,kresp,ycomment)
114  CALL write_surf(dgu, u, &
115  hprogram,'POLON',zpolon,kresp,ycomment)
116  CALL write_surf(dgu, u, &
117  hprogram,'POLAT',zpolat,kresp,ycomment)
118  CALL write_surf(dgu, u, &
119  hprogram,'NLON',ilon,kresp,ycomment)
120  CALL write_surf(dgu, u, &
121  hprogram,'NLAT',ilat,kresp,ycomment)
122  CALL write_surf(dgu, u, &
123  hprogram,'REG_LON',zlon,kresp,ycomment)
124  CALL write_surf(dgu, u, &
125  hprogram,'REG_LAT',zlat,kresp,ycomment)
126 !---------------------------------------------------------------------------
127 DEALLOCATE(zlon)
128 DEALLOCATE(zlat)
129 IF (lhook) CALL dr_hook('WRITE_GRIDTYPE_LONLAT_ROT',1,zhook_handle)
130 !---------------------------------------------------------------------------
131 !
132 END SUBROUTINE write_gridtype_lonlat_rot
subroutine get_gridtype_lonlat_rot(PGRID_PAR, PWEST, PSOUTH, PDLON, PDLAT, PPOLON, PPOLAT, KLON, KLAT, KL, PLON, PLAT)
subroutine write_gridtype_lonlat_rot(DGU, U, HPROGRAM, KLU, KGRID_PAR, PGRID_PAR, KRESP)