c62b461b944e89ebde083b3235c33cb61e96319e
[MNH-git_open_source-lfs.git] / src / SURFEX / read_sson.F90
1 !SURFEX_LIC Copyright 1994-2014 Meteo-France 
2 !SURFEX_LIC This is part of the SURFEX software governed by the CeCILL-C  licence
3 !SURFEX_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
4 !SURFEX_LIC for details. version 1.
5 !     #########
6       SUBROUTINE READ_SSO_n(HPROGRAM)
7 !     ################################
8 !
9 !!****  *READ_SSO_n* - routine to read a file for
10 !!                         physiographic data file of model _n 
11 !!
12 !!    PURPOSE
13 !!    -------
14 !!       The purpose of this routine is to initialise the 
15 !!       physiographic data file.
16 !!
17 !!
18 !!**  METHOD
19 !!    ------
20 !!      The data are read in the initial surface file :
21 !!        - 2D physiographic data fields
22 !!          
23 !!      It does not read the grid definition. This should have been
24 !!      read already.
25 !!
26 !!    EXTERNAL
27 !!    --------
28 !!      
29 !!
30 !!
31 !!    IMPLICIT ARGUMENTS
32 !!    ------------------
33 !!
34 !!    REFERENCE
35 !!    ---------
36 !!
37 !!
38 !!    AUTHOR
39 !!    ------
40 !!      V. Masson   *Meteo France*      
41 !!
42 !!    MODIFICATIONS
43 !!    -------------
44 !!      Original    01/2003
45 !-------------------------------------------------------------------------------
46 !
47 !*       0.    DECLARATIONS
48 !              ------------
49 !
50 USE MODD_SURF_ATM_SSO_n,     ONLY : XAVG_ZS, XSIL_ZS, XSSO_STDEV,    &
51                                       XSSO_ANIS, XSSO_DIR, XSSO_SLOPE, &
52                                       XMIN_ZS, XMAX_ZS,                &
53                                       XAOSIP, XAOSIM, XAOSJP, XAOSJM,  &
54                                       XHO2IP, XHO2IM, XHO2JP, XHO2JM  
55 USE MODD_SURF_ATM_n    ,     ONLY : NSIZE_FULL, XSEA
56 !
57 !
58 USE MODI_READ_SURF
59 !
60 USE MODD_SURF_PAR, ONLY : XUNDEF
61 !
62 USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK
63 USE PARKIND1  ,ONLY : JPRB
64 !
65 IMPLICIT NONE
66 !
67 !*       0.1   Declarations of arguments
68 !              -------------------------
69 !
70  CHARACTER(LEN=6),  INTENT(IN)  :: HPROGRAM ! calling program
71 !
72 !*       0.2   Declarations of local variables
73 !              -------------------------------
74 !
75
76 !
77 INTEGER           :: IRESP          ! Error code after redding
78
79  CHARACTER(LEN=12) :: YRECFM         ! Name of the article to be read
80 REAL(KIND=JPRB) :: ZHOOK_HANDLE
81 !
82 !-------------------------------------------------------------------------------
83 !
84 !*       2.     Orography :
85 !               ---------
86 !
87 !
88 IF (LHOOK) CALL DR_HOOK('READ_SSO_N',0,ZHOOK_HANDLE)
89 IF(.NOT.ASSOCIATED(XAVG_ZS)) ALLOCATE(XAVG_ZS(NSIZE_FULL))
90 YRECFM='AVG_ZS'
91  CALL READ_SURF(HPROGRAM,YRECFM,XAVG_ZS(:),IRESP)
92 !
93 IF(.NOT.ASSOCIATED(XSIL_ZS)) ALLOCATE(XSIL_ZS(NSIZE_FULL))
94 YRECFM='SIL_ZS'
95  CALL READ_SURF(HPROGRAM,YRECFM,XSIL_ZS(:),IRESP)
96 !
97 !
98 !*       3.     Subgrid Orography :
99 !               -----------------
100 !
101 !
102 IF(.NOT.ASSOCIATED(XSSO_STDEV)) ALLOCATE(XSSO_STDEV(NSIZE_FULL))
103 YRECFM='SSO_STDEV'
104  CALL READ_SURF(HPROGRAM,YRECFM,XSSO_STDEV(:),IRESP)
105 WHERE (XSEA(:) == 1.) XSSO_STDEV(:) = XUNDEF
106 !
107 IF(.NOT.ASSOCIATED(XMIN_ZS)) ALLOCATE(XMIN_ZS(NSIZE_FULL))
108 YRECFM='MIN_ZS'
109  CALL READ_SURF(HPROGRAM,YRECFM,XMIN_ZS(:),IRESP)
110 !
111 IF(.NOT.ASSOCIATED(XMAX_ZS)) ALLOCATE(XMAX_ZS(NSIZE_FULL))
112 YRECFM='MAX_ZS'
113  CALL READ_SURF(HPROGRAM,YRECFM,XMAX_ZS(:),IRESP)
114 !
115 IF(.NOT.ASSOCIATED(XSSO_ANIS)) ALLOCATE(XSSO_ANIS(NSIZE_FULL))
116 YRECFM='SSO_ANIS'
117  CALL READ_SURF(HPROGRAM,YRECFM,XSSO_ANIS(:),IRESP)
118 WHERE (XSEA(:) == 1.) XSSO_ANIS(:) = XUNDEF
119 !
120 IF(.NOT.ASSOCIATED(XSSO_DIR)) ALLOCATE(XSSO_DIR(NSIZE_FULL))
121 YRECFM='SSO_DIR'
122  CALL READ_SURF(HPROGRAM,YRECFM,XSSO_DIR(:),IRESP)
123 WHERE (XSEA(:) == 1.) XSSO_DIR(:) = XUNDEF
124 !
125 IF(.NOT.ASSOCIATED(XSSO_SLOPE)) ALLOCATE(XSSO_SLOPE(NSIZE_FULL))
126 YRECFM='SSO_SLOPE'
127  CALL READ_SURF(HPROGRAM,YRECFM,XSSO_SLOPE(:),IRESP)
128 WHERE (XSEA(:) == 1.) XSSO_SLOPE(:) = XUNDEF
129 !
130 !-------------------------------------------------------------------------------
131 !
132 !*       3.     Subgrid Orography roughness:
133 !               ---------------------------
134 !
135 !
136 IF(.NOT.ASSOCIATED(XHO2IP)) ALLOCATE(XHO2IP(NSIZE_FULL))
137 YRECFM='HO2IP'
138  CALL READ_SURF(HPROGRAM,YRECFM,XHO2IP(:),IRESP)
139 WHERE (XSEA(:) == 1.) XHO2IP(:) = XUNDEF
140 !
141 IF(.NOT.ASSOCIATED(XHO2JP)) ALLOCATE(XHO2JP(NSIZE_FULL))
142 YRECFM='HO2JP'
143  CALL READ_SURF(HPROGRAM,YRECFM,XHO2JP(:),IRESP)
144 WHERE (XSEA(:) == 1.) XHO2JP(:) = XUNDEF
145 !
146 IF(.NOT.ASSOCIATED(XHO2IM)) ALLOCATE(XHO2IM(NSIZE_FULL))
147 YRECFM='HO2IM'
148  CALL READ_SURF(HPROGRAM,YRECFM,XHO2IM(:),IRESP)
149 WHERE (XSEA(:) == 1.) XHO2IM(:) = XUNDEF
150 !
151 IF(.NOT.ASSOCIATED(XHO2JM)) ALLOCATE(XHO2JM(NSIZE_FULL))
152 YRECFM='HO2JM'
153  CALL READ_SURF(HPROGRAM,YRECFM,XHO2JM(:),IRESP)
154 WHERE (XSEA(:) == 1.) XHO2JM(:) = XUNDEF
155 !
156 IF(.NOT.ASSOCIATED(XAOSIP)) ALLOCATE(XAOSIP(NSIZE_FULL))
157 YRECFM='AOSIP'
158  CALL READ_SURF(HPROGRAM,YRECFM,XAOSIP(:),IRESP)
159 WHERE (XSEA(:) == 1.) XAOSIP(:) = XUNDEF
160 !
161 IF(.NOT.ASSOCIATED(XAOSJP)) ALLOCATE(XAOSJP(NSIZE_FULL))
162 YRECFM='AOSJP'
163  CALL READ_SURF(HPROGRAM,YRECFM,XAOSJP(:),IRESP)
164 WHERE (XSEA(:) == 1.) XAOSJP(:) = XUNDEF
165 !
166 IF(.NOT.ASSOCIATED(XAOSIM)) ALLOCATE(XAOSIM(NSIZE_FULL))
167 YRECFM='AOSIM'
168  CALL READ_SURF(HPROGRAM,YRECFM,XAOSIM(:),IRESP)
169 WHERE (XSEA(:) == 1.) XAOSIM(:) = XUNDEF
170 !
171 IF(.NOT.ASSOCIATED(XAOSJM)) ALLOCATE(XAOSJM(NSIZE_FULL))
172 YRECFM='AOSJM'
173  CALL READ_SURF(HPROGRAM,YRECFM,XAOSJM(:),IRESP)
174 WHERE (XSEA(:) == 1.) XAOSJM(:) = XUNDEF
175 IF (LHOOK) CALL DR_HOOK('READ_SSO_N',1,ZHOOK_HANDLE)
176 !
177 !
178 !-------------------------------------------------------------------------------
179 !
180 END SUBROUTINE READ_SSO_n