99e93a2c45364a5a9df786d5e9b71494dc7a1475
[MNH-git_open_source-lfs.git] / src / SURFEX / writesurf_pgd_teb_parn.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 WRITESURF_PGD_TEB_PAR_n(HPROGRAM)
7 !     ################################################
8 !
9 !!****  *WRITESURF_PGD_TEB_PAR_n* - reads ISBA physiographic fields
10 !!                        
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    05/2005
36 !-------------------------------------------------------------------------------
37 !
38 !*       0.    DECLARATIONS
39 !              ------------
40 !
41 USE MODD_TEB_n,               ONLY : LGARDEN, LGREENROOF, CBEM
42 USE MODD_DATA_TEB_n,          ONLY : NPAR_ROAD_LAYER, NPAR_WALL_LAYER,               &
43                                      NPAR_ROOF_LAYER,                                &
44                                      NPAR_BLDTYPE, NPAR_BLD_AGE, NPAR_USETYPE,       &
45                                      XPAR_Z0_TOWN, XPAR_BLD,                         &
46                                      XPAR_GARDEN, XPAR_ROAD_DIR, XPAR_GREENROOF,     &
47                                      XPAR_ALB_ROOF,                                  &
48                                      XPAR_EMIS_ROOF, XPAR_HC_ROOF, XPAR_TC_ROOF,     &
49                                      XPAR_D_ROOF, XPAR_ALB_ROAD, XPAR_EMIS_ROAD,     &
50                                      XPAR_HC_ROAD, XPAR_TC_ROAD, XPAR_D_ROAD,        &
51                                      XPAR_ALB_WALL, XPAR_EMIS_WALL, XPAR_HC_WALL,    &
52                                      XPAR_TC_WALL, XPAR_D_WALL, XPAR_BLD_HEIGHT,     &
53                                      XPAR_WALL_O_HOR,                                &
54                                      XPAR_H_TRAFFIC, XPAR_LE_TRAFFIC,                &
55                                      XPAR_H_INDUSTRY, XPAR_LE_INDUSTRY,              &
56                                      LDATA_Z0_TOWN, LDATA_BLD, LDATA_ALB_ROOF,       &
57                                      LDATA_EMIS_ROOF, LDATA_HC_ROOF, LDATA_TC_ROOF,  &
58                                      LDATA_D_ROOF, LDATA_ALB_ROAD, LDATA_EMIS_ROAD,  &
59                                      LDATA_HC_ROAD, LDATA_TC_ROAD, LDATA_D_ROAD,     &
60                                      LDATA_ALB_WALL, LDATA_EMIS_WALL, LDATA_HC_WALL, &
61                                      LDATA_TC_WALL, LDATA_D_WALL, LDATA_BLD_HEIGHT,  &
62                                      LDATA_WALL_O_HOR,                               &
63                                      LDATA_H_TRAFFIC, LDATA_LE_TRAFFIC,              &
64                                      LDATA_H_INDUSTRY, LDATA_LE_INDUSTRY ,           &
65                                      LDATA_GARDEN, LDATA_BLDTYPE, LDATA_GREENROOF,   &
66                                      LDATA_ROAD_DIR, LDATA_USETYPE, LDATA_BLD_AGE,   &
67                                      LDATA_ROUGH_ROOF, LDATA_ROUGH_WALL,             &
68                                      XPAR_ROUGH_ROOF, XPAR_ROUGH_WALL
69 USE MODD_DATA_BEM_n,          ONLY : NPAR_FLOOR_LAYER,                               &
70                                      XPAR_HC_FLOOR, XPAR_TC_FLOOR, XPAR_D_FLOOR,     &
71                                      XPAR_TCOOL_TARGET, XPAR_THEAT_TARGET,           &
72                                      XPAR_F_WASTE_CAN,                               &
73                                      XPAR_EFF_HEAT, XPAR_QIN, XPAR_QIN_FRAD,         &
74                                      XPAR_SHGC, XPAR_U_WIN, XPAR_GR, XPAR_SHGC_SH,   &
75                                      XPAR_FLOOR_HEIGHT, XPAR_INF, XPAR_QIN_FLAT,     &
76                                      XPAR_HR_TARGET, XPAR_V_VENT, XPAR_CAP_SYS_HEAT, &
77                                      XPAR_CAP_SYS_RAT, XPAR_T_ADP, XPAR_M_SYS_RAT,   &
78                                      XPAR_COP_RAT, XPAR_T_SIZE_MAX, XPAR_T_SIZE_MIN, &
79                                      XPAR_F_WATER_COND, XPAR_NATVENT, XPAR_SHADE,    &
80                                      LDATA_TCOOL_TARGET, LDATA_THEAT_TARGET,         &
81                                      LDATA_F_WASTE_CAN, LDATA_EFF_HEAT, LDATA_QIN,   &
82                                      LDATA_QIN_FRAD, LDATA_SHGC, LDATA_U_WIN,        &
83                                      LDATA_GR, LDATA_FLOOR_HEIGHT, LDATA_INF,        &
84                                      LDATA_QIN_FLAT, LDATA_HR_TARGET, LDATA_V_VENT,  &
85                                      LDATA_CAP_SYS_HEAT, LDATA_CAP_SYS_RAT,          &
86                                      LDATA_T_ADP, LDATA_M_SYS_RAT, LDATA_COP_RAT,    &
87                                      LDATA_T_SIZE_MAX, LDATA_T_SIZE_MIN,             &
88                                      LDATA_NATVENT, LDATA_SHGC_SH,                   &
89                                      LDATA_F_WATER_COND, LDATA_SHADE, LDATA_HC_FLOOR,&
90                                      LDATA_TC_FLOOR, LDATA_D_FLOOR
91
92 USE MODD_TEB_GARDEN_n,        ONLY : CTYPE_HVEG, CTYPE_LVEG, CTYPE_NVEG, LPAR_GARDEN
93 USE MODD_DATA_TEB_GARDEN_n,   ONLY : NTIME,                                          &
94                                      XDATA_FRAC_HVEG, XDATA_FRAC_LVEG,               &
95                                      XDATA_FRAC_NVEG,                                &
96                                      XDATA_LAI_HVEG , XDATA_LAI_LVEG ,               &
97                                      XDATA_H_HVEG  
98 USE MODD_TEB_GREENROOF_n,     ONLY : NTIME_GR,NLAYER_GR,CTYP_GR, LPAR_GREENROOF
99 USE MODD_DATA_TEB_GREENROOF_n,ONLY : XPAR_OM_GR, XPAR_CLAY_GR,                       &
100                                      XPAR_SAND_GR, XPAR_LAI_GR
101 !
102 USE MODI_WRITE_SURF
103 USE MODI_WRITE_BLD_DESCRIPTION
104 !
105 !
106 USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK
107 USE PARKIND1  ,ONLY : JPRB
108 !
109 IMPLICIT NONE
110 !
111 !*       0.1   Declarations of arguments
112 !              -------------------------
113 !
114  CHARACTER(LEN=6),  INTENT(IN)  :: HPROGRAM ! program calling
115 !
116 !*       0.2   Declarations of local variables
117 !              -------------------------------
118 !
119 INTEGER           :: IRESP          ! IRESP  : return-code if a problem appears
120  CHARACTER(LEN=12) :: YRECFM         ! Name of the article to be read
121  CHARACTER(LEN=100):: YCOMMENT       ! Comment string
122 INTEGER           :: JLAYER         ! loop index
123 INTEGER           :: JTIME          ! loop index
124 REAL, DIMENSION(:), ALLOCATABLE :: ZWORK
125 REAL(KIND=JPRB) :: ZHOOK_HANDLE
126 !
127 !-------------------------------------------------------------------------------
128 !
129 IF (LHOOK) CALL DR_HOOK('WRITESURF_PGD_TEB_PAR_N',0,ZHOOK_HANDLE)
130 YRECFM='L_BLDTYPE'
131 YCOMMENT=YRECFM
132  CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_BLDTYPE,IRESP,HCOMMENT=YCOMMENT)
133 IF (LDATA_BLDTYPE) THEN
134   YRECFM='D_BLDTYPE'
135   YCOMMENT='X_Y_'//YRECFM//' (m)'
136   ALLOCATE(ZWORK(SIZE(NPAR_BLDTYPE)))
137   ZWORK=FLOAT(NPAR_BLDTYPE(:))
138   CALL WRITE_SURF(HPROGRAM,YRECFM,ZWORK,IRESP,YCOMMENT)
139   DEALLOCATE(ZWORK)
140 ENDIF
141 !
142 YRECFM='L_BLD_AGE'
143 YCOMMENT=YRECFM
144  CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_BLD_AGE,IRESP,HCOMMENT=YCOMMENT)
145 IF (LDATA_BLD_AGE) THEN
146   YRECFM='D_BLD_AGE'
147   YCOMMENT='X_Y_'//YRECFM//' (m)'
148   ALLOCATE(ZWORK(SIZE(NPAR_BLD_AGE)))
149   ZWORK=FLOAT(NPAR_BLD_AGE(:))
150   CALL WRITE_SURF(HPROGRAM,YRECFM,ZWORK,IRESP,YCOMMENT)
151   DEALLOCATE(ZWORK)
152 ENDIF
153 !
154 YRECFM='L_USETYPE'
155 YCOMMENT=YRECFM
156  CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_USETYPE,IRESP,HCOMMENT=YCOMMENT)
157 IF (LDATA_USETYPE) THEN
158   YRECFM='D_USETYPE'
159   YCOMMENT='X_Y_'//YRECFM//' (m)'
160   ALLOCATE(ZWORK(SIZE(NPAR_USETYPE)))
161   ZWORK=FLOAT(NPAR_USETYPE(:))
162   CALL WRITE_SURF(HPROGRAM,YRECFM,ZWORK,IRESP,YCOMMENT)
163   DEALLOCATE(ZWORK)
164 ENDIF
165 !
166 IF (LDATA_BLDTYPE .OR. LDATA_BLD_AGE .OR. LDATA_USETYPE) CALL WRITE_BLD_DESCRIPTION(HPROGRAM)
167 !
168 YRECFM='L_Z0_TOWN'
169 YCOMMENT=YRECFM
170  CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_Z0_TOWN,IRESP,HCOMMENT=YCOMMENT)
171 IF (LDATA_Z0_TOWN) THEN
172   YRECFM='D_Z0_TOWN'
173   YCOMMENT='X_Y_'//YRECFM//' (m)'
174   CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_Z0_TOWN,IRESP,YCOMMENT)
175 ENDIF
176 !
177 YRECFM='L_BLD'
178 YCOMMENT=YRECFM
179  CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_BLD,IRESP,HCOMMENT=YCOMMENT)
180 IF (LDATA_BLD) THEN
181   YRECFM='D_BLD'
182   YCOMMENT='X_Y_'//YRECFM//' (-)'
183   CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_BLD,IRESP,YCOMMENT)
184 ENDIF
185 !
186 YRECFM='L_GARDEN'
187 YCOMMENT=YRECFM
188  CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_GARDEN,IRESP,HCOMMENT=YCOMMENT)
189 IF (LDATA_GARDEN) THEN
190   YRECFM='D_GARDEN'
191   YCOMMENT='X_Y_'//YRECFM//' (-)'
192   CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_GARDEN,IRESP,YCOMMENT)
193 ENDIF
194 !
195 YRECFM='L_GREENROOF'
196 YCOMMENT=YRECFM
197  CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_GREENROOF,IRESP,HCOMMENT=YCOMMENT)
198 IF (LDATA_GREENROOF) THEN
199   YRECFM='D_GREENROOF'
200   YCOMMENT='X_Y_'//YRECFM//' (-)'
201   CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_GREENROOF,IRESP,YCOMMENT)
202 ENDIF
203 !
204 YRECFM='L_ROAD_DIR'
205 YCOMMENT=YRECFM
206  CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_ROAD_DIR,IRESP,HCOMMENT=YCOMMENT)
207 IF (LDATA_ROAD_DIR) THEN
208   YRECFM='D_ROAD_DIR'
209   YCOMMENT='X_Y_'//YRECFM//' (-)'
210   CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_ROAD_DIR,IRESP,YCOMMENT)
211 ENDIF
212 !
213 YRECFM='L_ALB_ROOF'
214 YCOMMENT=YRECFM
215  CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_ALB_ROOF,IRESP,HCOMMENT=YCOMMENT)
216 IF (LDATA_ALB_ROOF) THEN
217   YRECFM='D_ALB_ROOF'
218   YCOMMENT='X_Y_'//YRECFM//' (-)'
219   CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_ALB_ROOF,IRESP,YCOMMENT)
220 ENDIF
221 !
222 YRECFM='L_EMIS_ROOF'
223 YCOMMENT=YRECFM
224  CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_EMIS_ROOF,IRESP,HCOMMENT=YCOMMENT)
225 IF (LDATA_EMIS_ROOF) THEN
226   YRECFM='D_EMI_ROOF'
227   YCOMMENT='X_Y_'//YRECFM//' (-)'
228   CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_EMIS_ROOF,IRESP,YCOMMENT)
229 ENDIF
230 !
231 IF (LDATA_HC_ROOF) THEN
232   YCOMMENT='Number of specified Roof thermal layers'
233   CALL WRITE_SURF(HPROGRAM,'PAR_RF_LAYER',NPAR_ROOF_LAYER,IRESP,YCOMMENT)
234 END IF
235 !
236 YRECFM='L_HC_ROOF'
237 YCOMMENT=YRECFM
238  CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_HC_ROOF,IRESP,HCOMMENT=YCOMMENT)
239 IF (LDATA_HC_ROOF) THEN
240   DO JLAYER=1,NPAR_ROOF_LAYER
241     WRITE(YRECFM,FMT='(A9,I1.1)') 'D_HC_ROOF',JLAYER
242     YCOMMENT='X_Y_'//YRECFM//' (J/K/m3)'
243     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_HC_ROOF(:,JLAYER),IRESP,YCOMMENT)
244   END DO
245 ENDIF
246 !
247 YRECFM='L_TC_ROOF'
248 YCOMMENT=YRECFM
249  CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_TC_ROOF,IRESP,HCOMMENT=YCOMMENT)
250 IF (LDATA_TC_ROOF) THEN
251   DO JLAYER=1,NPAR_ROOF_LAYER
252     WRITE(YRECFM,FMT='(A9,I1.1)') 'D_TC_ROOF',JLAYER
253     YCOMMENT='X_Y_'//YRECFM//' (W/K/m)'
254     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_TC_ROOF(:,JLAYER),IRESP,YCOMMENT)
255   END DO
256 ENDIF
257 !
258 YRECFM='L_D_ROOF'
259 YCOMMENT=YRECFM
260  CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_D_ROOF,IRESP,HCOMMENT=YCOMMENT)
261 IF (LDATA_D_ROOF) THEN
262   DO JLAYER=1,NPAR_ROOF_LAYER
263     WRITE(YRECFM,FMT='(A8,I1.1)') 'D_D_ROOF',JLAYER
264     YCOMMENT='X_Y_'//YRECFM//' (m)'
265     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_D_ROOF(:,JLAYER),IRESP,YCOMMENT)
266   END DO
267 ENDIF
268 !
269 YRECFM='L_ALB_ROAD'
270 YCOMMENT=YRECFM
271  CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_ALB_ROAD,IRESP,HCOMMENT=YCOMMENT)
272 IF (LDATA_ALB_ROAD) THEN
273   YRECFM='D_ALB_ROAD'
274   YCOMMENT='X_Y_'//YRECFM//' (-)'
275   CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_ALB_ROAD,IRESP,YCOMMENT)
276 ENDIF
277 !
278 YRECFM='L_EMIS_ROAD'
279 YCOMMENT=YRECFM
280  CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_EMIS_ROAD,IRESP,HCOMMENT=YCOMMENT)
281 IF (LDATA_EMIS_ROAD) THEN
282   YRECFM='D_EMI_ROAD'
283   YCOMMENT='X_Y_'//YRECFM//' (-)'
284   CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_EMIS_ROAD,IRESP,YCOMMENT)
285 ENDIF
286 !
287 IF (LDATA_HC_ROAD) THEN
288   YCOMMENT='Number of specified Road thermal layers'
289   CALL WRITE_SURF(HPROGRAM,'PAR_RD_LAYER',NPAR_ROAD_LAYER,IRESP,YCOMMENT)
290 END IF
291 !
292 YRECFM='L_HC_ROAD'
293 YCOMMENT=YRECFM
294  CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_HC_ROAD,IRESP,HCOMMENT=YCOMMENT)
295 IF (LDATA_HC_ROAD) THEN
296   DO JLAYER=1,NPAR_ROAD_LAYER
297     WRITE(YRECFM,FMT='(A9,I1.1)') 'D_HC_ROAD',JLAYER
298     YCOMMENT='X_Y_'//YRECFM//' (J/K/m3)'
299     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_HC_ROAD(:,JLAYER),IRESP,YCOMMENT)
300   END DO
301 ENDIF
302 !
303 YRECFM='L_TC_ROAD'
304 YCOMMENT=YRECFM
305  CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_TC_ROAD,IRESP,HCOMMENT=YCOMMENT)
306 IF (LDATA_TC_ROAD) THEN
307   DO JLAYER=1,NPAR_ROAD_LAYER
308     WRITE(YRECFM,FMT='(A9,I1.1)') 'D_TC_ROAD',JLAYER
309     YCOMMENT='X_Y_'//YRECFM//' (W/K/m)'
310     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_TC_ROAD(:,JLAYER),IRESP,YCOMMENT)
311   END DO
312 ENDIF
313 !
314 YRECFM='L_D_ROAD'
315 YCOMMENT=YRECFM
316  CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_D_ROAD,IRESP,HCOMMENT=YCOMMENT)
317 IF (LDATA_D_ROAD) THEN
318   DO JLAYER=1,NPAR_ROAD_LAYER
319     WRITE(YRECFM,FMT='(A8,I1.1)') 'D_D_ROAD',JLAYER
320     YCOMMENT='X_Y_'//YRECFM//' (m)'
321     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_D_ROAD(:,JLAYER),IRESP,YCOMMENT)
322   END DO
323 ENDIF
324 !
325 YRECFM='L_ALB_WALL'
326 YCOMMENT=YRECFM
327  CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_ALB_WALL,IRESP,HCOMMENT=YCOMMENT)
328 IF (LDATA_ALB_WALL) THEN
329   YRECFM='D_ALB_WALL'
330   YCOMMENT='X_Y_'//YRECFM//' (-)'
331   CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_ALB_WALL,IRESP,YCOMMENT)
332 ENDIF
333 !
334 YRECFM='L_EMIS_WALL'
335 YCOMMENT=YRECFM
336  CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_EMIS_WALL,IRESP,HCOMMENT=YCOMMENT)
337 IF (LDATA_EMIS_WALL) THEN
338   YRECFM='D_EMI_WALL'
339   YCOMMENT='X_Y_'//YRECFM//' (-)'
340   CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_EMIS_WALL,IRESP,YCOMMENT)
341 ENDIF
342 !
343 !
344 IF (LDATA_HC_WALL) THEN
345   YCOMMENT='Number of specified Wall thermal layers'
346   CALL WRITE_SURF(HPROGRAM,'PAR_WL_LAYER',NPAR_WALL_LAYER,IRESP,YCOMMENT)
347 END IF
348 !
349 YRECFM='L_HC_WALL'
350 YCOMMENT=YRECFM
351  CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_HC_WALL,IRESP,HCOMMENT=YCOMMENT)
352 IF (LDATA_HC_WALL) THEN
353   DO JLAYER=1,NPAR_WALL_LAYER
354     WRITE(YRECFM,FMT='(A9,I1.1)') 'D_HC_WALL',JLAYER
355     YCOMMENT='X_Y_'//YRECFM//' (J/K/m3)'
356     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_HC_WALL(:,JLAYER),IRESP,YCOMMENT)
357   END DO
358 ENDIF
359 !
360 YRECFM='L_TC_WALL'
361 YCOMMENT=YRECFM
362  CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_TC_WALL,IRESP,HCOMMENT=YCOMMENT)
363 IF (LDATA_TC_WALL) THEN
364   DO JLAYER=1,NPAR_WALL_LAYER
365     WRITE(YRECFM,FMT='(A9,I1.1)') 'D_TC_WALL',JLAYER
366     YCOMMENT='X_Y_'//YRECFM//' (W/K/m)'
367     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_TC_WALL(:,JLAYER),IRESP,YCOMMENT)
368   END DO
369 ENDIF
370 !
371 YRECFM='L_D_WALL'
372 YCOMMENT=YRECFM
373  CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_D_WALL,IRESP,HCOMMENT=YCOMMENT)
374 IF (LDATA_D_WALL) THEN
375   DO JLAYER=1,NPAR_WALL_LAYER
376     WRITE(YRECFM,FMT='(A8,I1.1)') 'D_D_WALL',JLAYER
377     YCOMMENT='X_Y_'//YRECFM//' (m)'
378     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_D_WALL(:,JLAYER),IRESP,YCOMMENT)
379   END DO
380 ENDIF
381 !
382 YRECFM='L_BLD_HEIGHT'
383 YCOMMENT=YRECFM
384  CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_BLD_HEIGHT,IRESP,HCOMMENT=YCOMMENT)
385 IF (LDATA_BLD_HEIGHT) THEN
386   YRECFM='D_BLD_HEIG'
387   YCOMMENT='X_Y_'//YRECFM//' (m)'
388   CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_BLD_HEIGHT,IRESP,YCOMMENT)
389 ENDIF
390 !
391 YRECFM='L_WALL_O_HOR'
392 YCOMMENT=YRECFM
393  CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_WALL_O_HOR,IRESP,HCOMMENT=YCOMMENT)
394 IF (LDATA_WALL_O_HOR) THEN
395   YRECFM='D_WALL_O_H'
396   YCOMMENT='X_Y_'//YRECFM//' (-)'
397   CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_WALL_O_HOR,IRESP,YCOMMENT)
398 ENDIF
399 !
400 YRECFM='L_H_TRAF'
401 YCOMMENT=YRECFM
402  CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_H_TRAFFIC,IRESP,HCOMMENT=YCOMMENT)
403 IF (LDATA_H_TRAFFIC) THEN
404   YRECFM='D_H_TRAF'
405   YCOMMENT='X_Y_'//YRECFM//' (W/m2)'
406   CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_H_TRAFFIC,IRESP,YCOMMENT)
407 ENDIF
408 !
409 YRECFM='L_LE_TRAF'
410 YCOMMENT=YRECFM
411  CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_LE_TRAFFIC,IRESP,HCOMMENT=YCOMMENT)
412 IF (LDATA_LE_TRAFFIC) THEN
413   YRECFM='D_LE_TRAF'
414   YCOMMENT='X_Y_'//YRECFM//' (W/m2)'
415   CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_LE_TRAFFIC,IRESP,YCOMMENT)
416 ENDIF
417 !
418 YRECFM='L_H_IND'
419 YCOMMENT=YRECFM
420  CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_H_INDUSTRY,IRESP,HCOMMENT=YCOMMENT)
421 IF (LDATA_H_INDUSTRY) THEN
422   YRECFM='D_H_IND'
423   YCOMMENT='X_Y_'//YRECFM//' (W/m2)'
424   CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_H_INDUSTRY,IRESP,YCOMMENT)
425 ENDIF
426 !
427 YRECFM='L_LE_IND'
428 YCOMMENT=YRECFM
429  CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_LE_INDUSTRY,IRESP,HCOMMENT=YCOMMENT)
430 IF (LDATA_LE_INDUSTRY) THEN
431   YRECFM='D_LE_IND'
432   YCOMMENT='X_Y_'//YRECFM//' (W/m2)'
433   CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_LE_INDUSTRY,IRESP,YCOMMENT)
434 ENDIF
435 !
436 YRECFM='L_ROUGH_ROOF'
437 YCOMMENT=YRECFM
438  CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_ROUGH_ROOF,IRESP,HCOMMENT=YCOMMENT)
439 IF (LDATA_ROUGH_ROOF) THEN
440   YRECFM='D_ROUGH_ROOF'
441   YCOMMENT='X_Y_'//YRECFM//' (-)'
442   CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_ROUGH_ROOF,IRESP,YCOMMENT)
443 ENDIF
444 !
445 YRECFM='L_ROUGH_WALL'
446 YCOMMENT=YRECFM
447  CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_ROUGH_WALL,IRESP,HCOMMENT=YCOMMENT)
448 IF (LDATA_ROUGH_WALL) THEN
449   YRECFM='D_ROUGH_WALL'
450   YCOMMENT='X_Y_'//YRECFM//' (-)'
451   CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_ROUGH_WALL,IRESP,YCOMMENT)
452 ENDIF
453 IF (CBEM .EQ. 'BEM') THEN
454   !
455   IF (LDATA_HC_FLOOR) THEN
456     YCOMMENT='Number of specified Floor thermal layers'
457     CALL WRITE_SURF(HPROGRAM,'PAR_FL_LAYER',NPAR_FLOOR_LAYER,IRESP,YCOMMENT)
458   END IF
459   !
460   YRECFM='L_HC_FLOOR'
461   YCOMMENT=YRECFM
462   CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_HC_FLOOR,IRESP,HCOMMENT=YCOMMENT)
463   IF (LDATA_HC_FLOOR) THEN
464     DO JLAYER=1,NPAR_FLOOR_LAYER
465       WRITE(YRECFM,FMT='(A10,I1.1)') 'D_HC_FLOOR',JLAYER
466       YCOMMENT='X_Y_'//YRECFM//' (J/K/m3)'
467       CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_HC_FLOOR(:,JLAYER),IRESP,YCOMMENT)
468     END DO
469   ENDIF
470   !
471   YRECFM='L_TC_FLOOR'
472   YCOMMENT=YRECFM
473   CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_TC_FLOOR,IRESP,HCOMMENT=YCOMMENT)
474   IF (LDATA_TC_FLOOR) THEN
475     DO JLAYER=1,NPAR_FLOOR_LAYER
476       WRITE(YRECFM,FMT='(A10,I1.1)') 'D_TC_FLOOR',JLAYER
477       YCOMMENT='X_Y_'//YRECFM//' (W/K/m)'
478       CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_TC_FLOOR(:,JLAYER),IRESP,YCOMMENT)
479     END DO
480   ENDIF
481   !
482   YRECFM='L_D_FLOOR'
483   YCOMMENT=YRECFM
484   CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_D_FLOOR,IRESP,HCOMMENT=YCOMMENT)
485   IF (LDATA_D_FLOOR) THEN
486     DO JLAYER=1,NPAR_FLOOR_LAYER
487       WRITE(YRECFM,FMT='(A9,I1.1)') 'D_D_FLOOR',JLAYER
488       YCOMMENT='X_Y_'//YRECFM//' (m)'
489       CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_D_FLOOR(:,JLAYER),IRESP,YCOMMENT)
490     END DO
491   ENDIF
492   !
493   YRECFM='L_TCOOL_TARG'
494   YCOMMENT=YRECFM
495   CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_TCOOL_TARGET,IRESP,HCOMMENT=YCOMMENT)
496   IF (LDATA_TCOOL_TARGET) THEN
497     YRECFM='D_TCOOL_TARG'
498     YCOMMENT='X_Y_'//YRECFM//' (K)'
499     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_TCOOL_TARGET,IRESP,YCOMMENT)
500   ENDIF
501   !
502   YRECFM='L_THEAT_TARG'
503   YCOMMENT=YRECFM
504   CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_THEAT_TARGET,IRESP,HCOMMENT=YCOMMENT)
505   IF (LDATA_THEAT_TARGET) THEN
506     YRECFM='D_THEAT_TARG'
507     YCOMMENT='X_Y_'//YRECFM//' (K)'
508     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_THEAT_TARGET,IRESP,YCOMMENT)
509   ENDIF
510   !
511   YRECFM='L_F_WAST_CAN'
512   YCOMMENT=YRECFM
513   CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_F_WASTE_CAN,IRESP,HCOMMENT=YCOMMENT)
514   IF (LDATA_F_WASTE_CAN) THEN
515     YRECFM='D_F_WAST_CAN'
516     YCOMMENT='X_Y_'//YRECFM//' (-)'
517     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_F_WASTE_CAN,IRESP,YCOMMENT)
518   ENDIF
519   !
520   YRECFM='L_EFF_HEAT'
521   YCOMMENT=YRECFM
522   CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_EFF_HEAT,IRESP,HCOMMENT=YCOMMENT)
523   IF (LDATA_EFF_HEAT) THEN
524     YRECFM='D_EFF_HEAT'
525     YCOMMENT='X_Y_'//YRECFM//' (-)'
526     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_EFF_HEAT,IRESP,YCOMMENT)
527   ENDIF
528   !
529   YRECFM='L_QIN'
530   YCOMMENT=YRECFM
531   CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_QIN,IRESP,HCOMMENT=YCOMMENT)
532   IF (LDATA_QIN) THEN
533     YRECFM='D_QIN'
534     YCOMMENT='X_Y_'//YRECFM//' (K)'
535     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_QIN,IRESP,YCOMMENT)
536   ENDIF
537   !
538   YRECFM='L_QIN_FRAD'
539   YCOMMENT=YRECFM
540   CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_QIN_FRAD,IRESP,HCOMMENT=YCOMMENT)
541   IF (LDATA_QIN_FRAD) THEN
542     YRECFM='D_QIN_FRAD'
543     YCOMMENT='X_Y_'//YRECFM//' (K)'
544     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_QIN_FRAD,IRESP,YCOMMENT)
545   ENDIF
546   !
547   YRECFM='L_SHGC'
548   YCOMMENT=YRECFM
549   CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_SHGC,IRESP,HCOMMENT=YCOMMENT)
550   IF (LDATA_SHGC) THEN
551     YRECFM='D_SHGC'
552     YCOMMENT='X_Y_'//YRECFM//' (-)'
553     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_SHGC,IRESP,YCOMMENT)
554   ENDIF
555   !
556   YRECFM='L_U_WIN'
557   YCOMMENT=YRECFM
558   CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_U_WIN,IRESP,HCOMMENT=YCOMMENT)
559   IF (LDATA_U_WIN) THEN
560     YRECFM='D_U_WIN'
561     YCOMMENT='X_Y_'//YRECFM//' (W m-2 K-1)'
562     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_U_WIN,IRESP,YCOMMENT)
563   ENDIF
564   !
565   YRECFM='L_GR'
566   YCOMMENT=YRECFM
567   CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_GR,IRESP,HCOMMENT=YCOMMENT)
568   IF (LDATA_GR) THEN
569     YRECFM='D_GR'
570     YCOMMENT='X_Y_'//YRECFM//' (-)'
571     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_GR,IRESP,YCOMMENT)
572   ENDIF
573   !
574   YRECFM='L_SHGC_SH'
575   YCOMMENT=YRECFM
576   CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_SHGC_SH,IRESP,HCOMMENT=YCOMMENT)
577   IF (LDATA_SHGC_SH) THEN
578     YRECFM='D_SHGC_SH'
579     YCOMMENT='X_Y_'//YRECFM//' (-)'
580     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_SHGC_SH,IRESP,YCOMMENT)
581   ENDIF  
582   !
583   YRECFM='L_FLOOR_HEIG'
584   YCOMMENT=YRECFM
585   CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_FLOOR_HEIGHT,IRESP,HCOMMENT=YCOMMENT)
586   IF (LDATA_FLOOR_HEIGHT) THEN
587     YRECFM='D_FLOOR_HEIG'
588     YCOMMENT='X_Y_'//YRECFM//' (m)'
589     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_FLOOR_HEIGHT,IRESP,YCOMMENT)
590   ENDIF
591   !
592   YRECFM='L_INF'
593   YCOMMENT=YRECFM
594   CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_INF,IRESP,HCOMMENT=YCOMMENT)
595   IF (LDATA_INF) THEN
596     YRECFM='D_INF'
597     YCOMMENT='X_Y_'//YRECFM//' (ACH)'
598     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_INF,IRESP,YCOMMENT)
599   ENDIF
600   !
601   YRECFM='L_QIN_FLAT'
602   YCOMMENT=YRECFM
603   CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_QIN_FLAT,IRESP,HCOMMENT=YCOMMENT)
604   IF (LDATA_QIN_FLAT) THEN
605     YRECFM='D_QIN_FLAT'
606     YCOMMENT='X_Y_'//YRECFM//' (-)'
607     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_QIN_FLAT,IRESP,YCOMMENT)
608   ENDIF
609   !
610   YRECFM='L_HR_TARGET'
611   YCOMMENT=YRECFM
612   CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_HR_TARGET,IRESP,HCOMMENT=YCOMMENT)
613   IF (LDATA_HR_TARGET) THEN
614     YRECFM='D_HR_TARGET'
615     YCOMMENT='X_Y_'//YRECFM//' (-)'
616     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_HR_TARGET,IRESP,YCOMMENT)
617   ENDIF
618   !
619   YRECFM='L_V_VENT'
620   YCOMMENT=YRECFM
621   CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_V_VENT,IRESP,HCOMMENT=YCOMMENT)
622   IF (LDATA_V_VENT) THEN
623     YRECFM='D_V_VENT'
624     YCOMMENT='X_Y_'//YRECFM//' (ACH)'
625     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_V_VENT,IRESP,YCOMMENT)
626   ENDIF
627   !
628   YRECFM='L_CAP_SYS_HE'
629   YCOMMENT=YRECFM
630   CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_CAP_SYS_HEAT,IRESP,HCOMMENT=YCOMMENT)
631   IF (LDATA_CAP_SYS_HEAT) THEN
632     YRECFM='D_CAP_SYS_HE'
633     YCOMMENT='X_Y_'//YRECFM//' (W m-2)'
634     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_CAP_SYS_HEAT,IRESP,YCOMMENT)
635   ENDIF
636   !
637   YRECFM='L_CAP_SYS_RA'
638   YCOMMENT=YRECFM
639   CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_CAP_SYS_RAT,IRESP,HCOMMENT=YCOMMENT)
640   IF (LDATA_CAP_SYS_RAT) THEN
641     YRECFM='D_CAP_SYS_RA'
642     YCOMMENT='X_Y_'//YRECFM//' (W m-2)'
643     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_CAP_SYS_RAT,IRESP,YCOMMENT)
644   ENDIF
645   !
646   YRECFM='L_T_ADP'
647   YCOMMENT=YRECFM
648   CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_T_ADP,IRESP,HCOMMENT=YCOMMENT)
649   IF (LDATA_T_ADP) THEN
650     YRECFM='D_T_ADP'
651     YCOMMENT='X_Y_'//YRECFM//' (K)'
652     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_T_ADP,IRESP,YCOMMENT)
653   ENDIF
654   !
655   YRECFM='L_M_SYS_RAT'
656   YCOMMENT=YRECFM
657   CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_M_SYS_RAT,IRESP,HCOMMENT=YCOMMENT)
658   IF (LDATA_M_SYS_RAT) THEN
659     YRECFM='D_M_SYS_RAT'
660     YCOMMENT='X_Y_'//YRECFM//' (kg s-1 m-)'
661     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_M_SYS_RAT,IRESP,YCOMMENT)
662   ENDIF
663   !
664   YRECFM='L_COP_RAT'
665   YCOMMENT=YRECFM
666   CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_COP_RAT,IRESP,HCOMMENT=YCOMMENT)
667   IF (LDATA_COP_RAT) THEN
668     YRECFM='D_COP_RAT'
669     YCOMMENT='X_Y_'//YRECFM//' (-)'
670     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_COP_RAT,IRESP,YCOMMENT)
671   ENDIF
672   !
673   YRECFM='L_T_SIZE_MAX'
674   YCOMMENT=YRECFM
675   CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_T_SIZE_MAX,IRESP,HCOMMENT=YCOMMENT)
676   IF (LDATA_T_SIZE_MAX) THEN
677     YRECFM='D_T_SIZE_MAX'
678     YCOMMENT='X_Y_'//YRECFM//' (K)'
679     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_T_SIZE_MAX,IRESP,YCOMMENT)
680   ENDIF
681   !
682   YRECFM='L_T_SIZE_MIN'
683   YCOMMENT=YRECFM
684   CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_T_SIZE_MIN,IRESP,HCOMMENT=YCOMMENT)
685   IF (LDATA_T_SIZE_MIN) THEN
686     YRECFM='D_T_SIZE_MIN'
687     YCOMMENT='X_Y_'//YRECFM//' (K)'
688     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_T_SIZE_MIN,IRESP,YCOMMENT)
689   ENDIF
690   !
691   YRECFM='L_FWAT_COND'
692   YCOMMENT=YRECFM
693   CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_F_WATER_COND,IRESP,HCOMMENT=YCOMMENT)
694   IF (LDATA_F_WATER_COND) THEN
695     YRECFM='D_FWAT_COND'
696     YCOMMENT='X_Y_'//YRECFM//' (-)'
697     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_F_WATER_COND,IRESP,YCOMMENT)
698   ENDIF
699   !
700   YRECFM='L_SHADE'
701   YCOMMENT=YRECFM
702   CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_SHADE,IRESP,HCOMMENT=YCOMMENT)
703   IF (LDATA_SHADE) THEN
704     YRECFM='D_SHADE'
705     YCOMMENT='X_Y_'//YRECFM//' (-)'
706     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_SHADE,IRESP,YCOMMENT)
707   ENDIF
708   !
709   YRECFM='L_NATVENT'
710   YCOMMENT=YRECFM
711   CALL WRITE_SURF(HPROGRAM,YRECFM,LDATA_NATVENT,IRESP,HCOMMENT=YCOMMENT)
712   IF (LDATA_NATVENT) THEN
713     YRECFM='D_NATVENT'
714     YCOMMENT='X_Y_'//YRECFM//' (-)'
715     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_NATVENT,IRESP,YCOMMENT)
716   ENDIF
717   !  
718 ENDIF
719 !
720 ! Flag for data for gardens
721 YRECFM='PAR_GARDEN'
722 YCOMMENT='FLAG FOR SPECIFIED GARDEN PARAMETERS'
723  CALL WRITE_SURF(HPROGRAM,YRECFM,LPAR_GARDEN,IRESP,HCOMMENT=YCOMMENT)
724 !
725 IF (LGARDEN .AND. LPAR_GARDEN) THEN
726 !
727 ! Type of high vegetation
728   YRECFM='D_TYPE_HVEG'
729   YCOMMENT='X_Y_TYPE_HVEG'
730   CALL WRITE_SURF(HPROGRAM,YRECFM,CTYPE_HVEG,IRESP,HCOMMENT=YCOMMENT)
731 !
732 ! Type of low vegetation
733   YRECFM='D_TYPE_LVEG'
734   YCOMMENT='X_Y_TYPE_LVEG'
735   CALL WRITE_SURF(HPROGRAM,YRECFM,CTYPE_LVEG,IRESP,HCOMMENT=YCOMMENT)
736 !
737 ! Type of bare soil (no vegetation)
738   YRECFM='D_TYPE_NVEG'
739   YCOMMENT='X_Y_TYPE_NVEG'
740   CALL WRITE_SURF(HPROGRAM,YRECFM,CTYPE_NVEG,IRESP,HCOMMENT=YCOMMENT)
741 !
742 ! Fraction of high vegetation
743   YRECFM='D_FRAC_HVEG'
744   YCOMMENT='X_Y_D_FRAC_HVEG'
745   CALL WRITE_SURF(HPROGRAM,YRECFM,XDATA_FRAC_HVEG(:),IRESP,HCOMMENT=YCOMMENT)
746 !
747 ! Fraction of low vegetation
748   YRECFM='D_FRAC_LVEG'
749   YCOMMENT='X_Y_D_FRAC_LVEG'
750   CALL WRITE_SURF(HPROGRAM,YRECFM,XDATA_FRAC_LVEG(:),IRESP,HCOMMENT=YCOMMENT)
751 !
752 ! Fraction of bare soil
753   YRECFM='D_FRAC_NVEG'
754   YCOMMENT='X_Y_D_FRAC_NVEG'
755   CALL WRITE_SURF(HPROGRAM,YRECFM,XDATA_FRAC_NVEG(:),IRESP,HCOMMENT=YCOMMENT)
756 !
757 ! LAI of high vegetation
758   DO JTIME=1,NTIME
759     WRITE(YRECFM,FMT='(A10,I2.2)') 'D_LAI_HVEG',JTIME
760     YCOMMENT='X_Y_D_LAI_HVEG'
761     CALL WRITE_SURF(HPROGRAM,YRECFM,XDATA_LAI_HVEG(:,JTIME),IRESP,HCOMMENT=YCOMMENT)
762   END DO
763 !
764 ! LAI of low vegetation
765   DO JTIME=1,NTIME
766     WRITE(YRECFM,FMT='(A10,I2.2)') 'D_LAI_LVEG',JTIME
767     YCOMMENT='X_Y_D_LAI_LVEG'
768     CALL WRITE_SURF(HPROGRAM,YRECFM,XDATA_LAI_LVEG(:,JTIME),IRESP,HCOMMENT=YCOMMENT)
769   END DO
770 !
771 ! Height of trees
772   YRECFM='D_H_HVEG'
773   YCOMMENT='X_Y_DATA_H_HVEG'
774   CALL WRITE_SURF(HPROGRAM,YRECFM,XDATA_H_HVEG(:),IRESP,HCOMMENT=YCOMMENT)
775 !
776 ENDIF
777 !
778 IF (LGREENROOF .AND. LPAR_GREENROOF) THEN
779 !
780 ! Type of green roof
781   YRECFM='D_TYPE_GR'
782   YCOMMENT='X_Y_TYPE_GR'
783   CALL WRITE_SURF(HPROGRAM,YRECFM,CTYP_GR,IRESP,HCOMMENT=YCOMMENT)
784 !
785 ! Fraction of OM in green roof layer
786   DO JLAYER=1,NLAYER_GR
787     WRITE(YRECFM,FMT='(A7,I2.2)') 'D_OM_GR',JLAYER
788     YCOMMENT='X_Y_D_OM_GR'
789     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_OM_GR(:,JLAYER),IRESP,HCOMMENT=YCOMMENT)
790   END DO
791 !
792 ! Fraction of CLAY in the non-OM part of the green roof layer
793   DO JLAYER=1,NLAYER_GR
794     WRITE(YRECFM,FMT='(A9,I2.2)') 'D_CLAY_GR',JLAYER
795     YCOMMENT='X_Y_D_CLAY_GR'
796     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_CLAY_GR(:,JLAYER),IRESP,HCOMMENT=YCOMMENT)
797   END DO
798 !
799 ! Fraction of SAND in the non-OM part of the green roof layer
800   DO JLAYER=1,NLAYER_GR
801     WRITE(YRECFM,FMT='(A9,I2.2)') 'D_SAND_GR',JLAYER
802     YCOMMENT='X_Y_D_SAND_GR'
803     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_SAND_GR(:,JLAYER),IRESP,HCOMMENT=YCOMMENT)
804   END DO
805 !
806 ! LAI of green roof vegetation
807   DO JTIME=1,NTIME_GR
808     WRITE(YRECFM,FMT='(A8,I2.2)') 'D_LAI_GR',JTIME
809     YCOMMENT='X_Y_D_LAI_GR'
810     CALL WRITE_SURF(HPROGRAM,YRECFM,XPAR_LAI_GR(:,JTIME),IRESP,HCOMMENT=YCOMMENT)
811   END DO
812
813 ENDIF
814 !
815 IF (LHOOK) CALL DR_HOOK('WRITESURF_PGD_TEB_PAR_N',1,ZHOOK_HANDLE)
816 !
817 !
818 !-------------------------------------------------------------------------------
819 !
820 END SUBROUTINE WRITESURF_PGD_TEB_PAR_n