SURFEX v8.1
General documentation of Surfex
prep_grid_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 prep_grid_lonlat_reg (HFILETYPE,HINTERP_TYPE,KNI)
7 ! ##########################################################################
8 !
9 !!**** *PREP_GRID_LATLON* - reads EXTERNALIZED Surface grid.
10 !!
11 !! PURPOSE
12 !! -------
13 !!
14 !!** METHOD
15 !! ------
16 !!
17 !! EXTERNAL
18 !! --------
19 !!
20 !! IMPLICIT ARGUMENTS
21 !! ------------------
22 !!
23 !!
24 !! REFERENCE
25 !! ---------
26 !!
27 !!
28 !! AUTHOR
29 !! ------
30 !!
31 !! V. Masson
32 !!
33 !! MODIFICATIONS
34 !! -------------
35 !! Original 06/2003
36 !-------------------------------------------------------------------------------
37 !
38 !* 0. DECLARATIONS
39 ! ------------
40 !
41 !
42 !
43 !
45 !
47 !
48 USE yomhook ,ONLY : lhook, dr_hook
49 USE parkind1 ,ONLY : jprb
50 !
51 IMPLICIT NONE
52 !
53 !* 0.1. Declaration of arguments
54 ! ------------------------
55 !
56 !
57 !
58  CHARACTER(LEN=6), INTENT(IN) :: HFILETYPE ! file type
59  CHARACTER(LEN=6), INTENT(OUT) :: HINTERP_TYPE ! Grid type
60 INTEGER, INTENT(OUT) :: KNI ! number of points
61 !
62 !* 0.2 Declaration of local variables
63 ! ------------------------------
64 !
65  CHARACTER(LEN=12) :: YRECFM ! Name of the article to be read
66 INTEGER :: IRESP
67 !
68 INTEGER :: JL ! loop counter
69 INTEGER :: ILON
70 REAL :: ZDLAT, ZDLON
71 REAL(KIND=JPRB) :: ZHOOK_HANDLE
72 !-----------------------------------------------------------------------
73 !
74 !* 1 Projection
75 ! ----------
76 !
77 IF (lhook) CALL dr_hook('PREP_GRID_LONLAT_REG',0,zhook_handle)
78 yrecfm = 'LONMIN'
79  CALL read_surf(hfiletype,yrecfm,xilon1,iresp)
80 yrecfm = 'LONMAX'
81  CALL read_surf(hfiletype,yrecfm,xilon2,iresp)
82 yrecfm = 'LATMIN'
83  CALL read_surf(hfiletype,yrecfm,xilat1,iresp)
84 yrecfm = 'LATMAX'
85  CALL read_surf(hfiletype,yrecfm,xilat2,iresp)
86 yrecfm = 'NLAT'
87  CALL read_surf(hfiletype,yrecfm,ninlat,iresp)
88 !
89 IF (ALLOCATED(ninlon)) DEALLOCATE(ninlon)
90 ALLOCATE(ninlon(ninlat))
91 yrecfm = 'NLON'
92  CALL read_surf(hfiletype,yrecfm,ninlon(1),iresp)
93 IF (ninlat.GT.1) ninlon(2:ninlat) = ninlon(1)
94 !
95 !-----------------------------------------------------------------------
96 !
97 !* 3 Computes additional quantities used in interpolation
98 ! ----------------------------------------------------
99 !
101 kni = nilength
102 !
103 zdlat = (xilat2-xilat1)/ninlat
104 zdlon = (xilon2-xilon1)/ninlon(1)
105 !
106 xilon1 = xilon1 + zdlon/2.
107 xilon2 = xilon2 - zdlon/2.
108 xilat1 = xilat1 + zdlat/2.
109 xilat2 = xilat2 - zdlat/2.
110 !
111 IF (ALLOCATED(xilatarray)) DEALLOCATE(xilatarray)
112 ALLOCATE(xilatarray(ninlat))
113 !
115 DO jl = 2,ninlat
116  xilatarray(jl) = xilatarray(jl-1) + zdlat
117 ENDDO
118 !
119 !-----------------------------------------------------------------------
120 IF(kni==1)THEN
121  hinterp_type = 'UNIF'
122 ELSE
123  hinterp_type = 'HORIBL'
124 ENDIF
125 !
126 IF (lhook) CALL dr_hook('PREP_GRID_LONLAT_REG',1,zhook_handle)
127 !-----------------------------------------------------------------------
128 !
129 END SUBROUTINE prep_grid_lonlat_reg
real, dimension(:), allocatable xilatarray
subroutine prep_grid_lonlat_reg(HFILETYPE, HINTERP_TYPE, KNI)
integer, parameter jprb
Definition: parkind1.F90:32
logical lhook
Definition: yomhook.F90:15
integer, dimension(:), allocatable ninlon