Philippe 07/03/2019: IO bugfix: io_set_mnhversion must be called by all the processes
[MNH-git_open_source-lfs.git] / src / SURFEX / writesurf_pgd_teb_parn.F90
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 WRITESURF_PGD_TEB_PAR_n (BDD, DTB, DTGD, DTGR, DTT, HSELECT, &
7                                           GDO, GRO, GRS, GRK, TIR, TOP, HPROGRAM)
8 !     ################################################
9 !
10 !!****  *WRITESURF_PGD_TEB_PAR_n* - reads ISBA physiographic fields
11 !!                        
12 !!
13 !!    PURPOSE
14 !!    -------
15 !!
16 !!**  METHOD
17 !!    ------
18 !!
19 !!    EXTERNAL
20 !!    --------
21 !!
22 !!
23 !!    IMPLICIT ARGUMENTS
24 !!    ------------------
25 !!
26 !!    REFERENCE
27 !!    ---------
28 !!
29 !!
30 !!    AUTHOR
31 !!    ------
32 !!      V. Masson   *Meteo France*
33 !!
34 !!    MODIFICATIONS
35 !!    -------------
36 !!      Original    05/2005
37 !!       V. Masson  08/2013 add solar panels
38 !-------------------------------------------------------------------------------
39 !
40 !*       0.    DECLARATIONS
41 !              ------------
42 !
43 USE MODD_BLD_DESCRIPTION_n, ONLY : BLD_DESC_t
44 USE MODD_DATA_BEM_n, ONLY : DATA_BEM_t
45 USE MODD_DATA_ISBA_n, ONLY : DATA_ISBA_t
46 USE MODD_DATA_TEB_n, ONLY : DATA_TEB_t
47 USE MODD_ISBA_OPTIONS_n, ONLY : ISBA_OPTIONS_t
48 USE MODD_ISBA_n, ONLY : ISBA_S_t, ISBA_K_t
49 USE MODD_TEB_IRRIG_n, ONLY : TEB_IRRIG_t
50 USE MODD_TEB_OPTION_n, ONLY : TEB_OPTIONS_t
51 !
52 USE MODI_WRITE_SURF
53 USE MODI_WRITE_BLD_DESCRIPTION_n
54 USE MODI_WRITESURF_PGD_TEB_IRRIG_n
55 !
56 !
57 USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK
58 USE PARKIND1  ,ONLY : JPRB
59 !
60 IMPLICIT NONE
61 !
62 !*       0.1   Declarations of arguments
63 !              -------------------------
64 !
65 !
66 TYPE(BLD_DESC_t), INTENT(INOUT) :: BDD
67 TYPE(DATA_BEM_t), INTENT(INOUT) :: DTB
68 TYPE(DATA_ISBA_t), INTENT(INOUT) :: DTGD
69 TYPE(DATA_ISBA_t), INTENT(INOUT) :: DTGR
70 TYPE(DATA_TEB_t), INTENT(INOUT) :: DTT
71  CHARACTER(LEN=*), DIMENSION(:), INTENT(IN) :: HSELECT
72 TYPE(ISBA_OPTIONS_t), INTENT(INOUT) :: GDO
73 TYPE(ISBA_OPTIONS_t), INTENT(INOUT) :: GRO
74 TYPE(ISBA_S_t), INTENT(INOUT) :: GRS
75 TYPE(ISBA_K_t), INTENT(INOUT) :: GRK
76 TYPE(TEB_IRRIG_t), INTENT(INOUT) :: TIR
77 TYPE(TEB_OPTIONS_t), INTENT(INOUT) :: TOP
78 !
79  CHARACTER(LEN=6),  INTENT(IN)  :: HPROGRAM ! program calling
80 !
81 !*       0.2   Declarations of local variables
82 !              -------------------------------
83 !
84 INTEGER           :: IRESP          ! IRESP  : return-code if a problem appears
85  CHARACTER(LEN=LEN_HREC) :: YRECFM         ! Name of the article to be read
86  CHARACTER(LEN=100):: YCOMMENT       ! Comment string
87 INTEGER           :: JL         ! loop index
88 INTEGER           :: JTIME          ! loop index
89 REAL, DIMENSION(:), ALLOCATABLE :: ZWORK
90 REAL(KIND=JPRB) :: ZHOOK_HANDLE
91 !
92 !-------------------------------------------------------------------------------
93 !
94 IF (LHOOK) CALL DR_HOOK('WRITESURF_PGD_TEB_PAR_N',0,ZHOOK_HANDLE)
95 YRECFM='L_BLDTYPE'
96 YCOMMENT=YRECFM
97  CALL WRITE_SURF(HSELECT, &
98                  HPROGRAM,YRECFM,DTT%LDATA_BLDTYPE,IRESP,HCOMMENT=YCOMMENT)
99 IF (DTT%LDATA_BLDTYPE) THEN
100   YRECFM='D_BLDTYPE'
101   YCOMMENT='X_Y_'//YRECFM//' (m)'
102   ALLOCATE(ZWORK(SIZE(DTT%NPAR_BLDTYPE)))
103   ZWORK=FLOAT(DTT%NPAR_BLDTYPE(:))
104   CALL WRITE_SURF(HSELECT, &
105                  HPROGRAM,YRECFM,ZWORK,IRESP,YCOMMENT)
106   DEALLOCATE(ZWORK)
107 ENDIF
108 !
109 YRECFM='L_BLD_AGE'
110 YCOMMENT=YRECFM
111  CALL WRITE_SURF(HSELECT, &
112                  HPROGRAM,YRECFM,DTT%LDATA_BLD_AGE,IRESP,HCOMMENT=YCOMMENT)
113 IF (DTT%LDATA_BLD_AGE) THEN
114   YRECFM='D_BLD_AGE'
115   YCOMMENT='X_Y_'//YRECFM//' (m)'
116   ALLOCATE(ZWORK(SIZE(DTT%NPAR_BLD_AGE)))
117   ZWORK=FLOAT(DTT%NPAR_BLD_AGE(:))
118   CALL WRITE_SURF(HSELECT, &
119                  HPROGRAM,YRECFM,ZWORK,IRESP,YCOMMENT)
120   DEALLOCATE(ZWORK)
121 ENDIF
122 !
123 YRECFM='L_USETYPE'
124 YCOMMENT=YRECFM
125  CALL WRITE_SURF(HSELECT, &
126                  HPROGRAM,YRECFM,DTT%LDATA_USETYPE,IRESP,HCOMMENT=YCOMMENT)
127 IF (DTT%LDATA_USETYPE) THEN
128   YRECFM='D_USETYPE'
129   YCOMMENT='X_Y_'//YRECFM//' (m)'
130   ALLOCATE(ZWORK(SIZE(DTT%NPAR_USETYPE)))
131   ZWORK=FLOAT(DTT%NPAR_USETYPE(:))
132   CALL WRITE_SURF(HSELECT, &
133                  HPROGRAM,YRECFM,ZWORK,IRESP,YCOMMENT)
134   DEALLOCATE(ZWORK)
135 ENDIF
136 !
137 IF (DTT%LDATA_BLDTYPE .OR. DTT%LDATA_BLD_AGE .OR. DTT%LDATA_USETYPE) &
138         CALL WRITE_BLD_DESCRIPTION_n(HSELECT, BDD, HPROGRAM)
139 !
140 YRECFM='L_Z0_TOWN'
141 YCOMMENT=YRECFM
142  CALL WRITE_SURF(HSELECT, &
143                  HPROGRAM,YRECFM,DTT%LDATA_Z0_TOWN,IRESP,HCOMMENT=YCOMMENT)
144 IF (DTT%LDATA_Z0_TOWN) THEN
145   YRECFM='D_Z0_TOWN'
146   YCOMMENT='X_Y_'//YRECFM//' (m)'
147   CALL WRITE_SURF(HSELECT, &
148                  HPROGRAM,YRECFM,DTT%XPAR_Z0_TOWN,IRESP,YCOMMENT)
149 ENDIF
150 !
151 YRECFM='L_BLD'
152 YCOMMENT=YRECFM
153  CALL WRITE_SURF(HSELECT, &
154                  HPROGRAM,YRECFM,DTT%LDATA_BLD,IRESP,HCOMMENT=YCOMMENT)
155 IF (DTT%LDATA_BLD) THEN
156   YRECFM='D_BLD'
157   YCOMMENT='X_Y_'//YRECFM//' (-)'
158   CALL WRITE_SURF(HSELECT, &
159                  HPROGRAM,YRECFM,DTT%XPAR_BLD,IRESP,YCOMMENT)
160 ENDIF
161 !
162 YRECFM='L_GARDEN'
163 YCOMMENT=YRECFM
164  CALL WRITE_SURF(HSELECT, &
165                  HPROGRAM,YRECFM,DTT%LDATA_GARDEN,IRESP,HCOMMENT=YCOMMENT)
166 IF (DTT%LDATA_GARDEN) THEN
167   YRECFM='D_GARDEN'
168   YCOMMENT='X_Y_'//YRECFM//' (-)'
169   CALL WRITE_SURF(HSELECT, &
170                  HPROGRAM,YRECFM,DTT%XPAR_GARDEN,IRESP,YCOMMENT)
171 ENDIF
172 !
173 YRECFM='L_GREENROOF'
174 YCOMMENT=YRECFM
175  CALL WRITE_SURF(HSELECT, &
176                  HPROGRAM,YRECFM,DTT%LDATA_GREENROOF,IRESP,HCOMMENT=YCOMMENT)
177 IF (DTT%LDATA_GREENROOF) THEN
178   YRECFM='D_GREENROOF'
179   YCOMMENT='X_Y_'//YRECFM//' (-)'
180   CALL WRITE_SURF(HSELECT, &
181                  HPROGRAM,YRECFM,DTT%XPAR_GREENROOF,IRESP,YCOMMENT)
182 ENDIF
183 !
184 YRECFM='L_ROAD_DIR'
185 YCOMMENT=YRECFM
186  CALL WRITE_SURF(HSELECT, &
187                  HPROGRAM,YRECFM,DTT%LDATA_ROAD_DIR,IRESP,HCOMMENT=YCOMMENT)
188 IF (DTT%LDATA_ROAD_DIR) THEN
189   YRECFM='D_ROAD_DIR'
190   YCOMMENT='X_Y_'//YRECFM//' (-)'
191   CALL WRITE_SURF(HSELECT, &
192                  HPROGRAM,YRECFM,DTT%XPAR_ROAD_DIR,IRESP,YCOMMENT)
193 ENDIF
194 !
195 YRECFM='L_ALB_ROOF'
196 YCOMMENT=YRECFM
197  CALL WRITE_SURF(HSELECT, &
198                  HPROGRAM,YRECFM,DTT%LDATA_ALB_ROOF,IRESP,HCOMMENT=YCOMMENT)
199 IF (DTT%LDATA_ALB_ROOF) THEN
200   YRECFM='D_ALB_ROOF'
201   YCOMMENT='X_Y_'//YRECFM//' (-)'
202   CALL WRITE_SURF(HSELECT, &
203                  HPROGRAM,YRECFM,DTT%XPAR_ALB_ROOF,IRESP,YCOMMENT)
204 ENDIF
205 !
206 YRECFM='L_EMIS_ROOF'
207 YCOMMENT=YRECFM
208  CALL WRITE_SURF(HSELECT, &
209                  HPROGRAM,YRECFM,DTT%LDATA_EMIS_ROOF,IRESP,HCOMMENT=YCOMMENT)
210 IF (DTT%LDATA_EMIS_ROOF) THEN
211   YRECFM='D_EMI_ROOF'
212   YCOMMENT='X_Y_'//YRECFM//' (-)'
213   CALL WRITE_SURF(HSELECT, &
214                  HPROGRAM,YRECFM,DTT%XPAR_EMIS_ROOF,IRESP,YCOMMENT)
215 ENDIF
216 !
217 IF (DTT%LDATA_HC_ROOF) THEN
218   YCOMMENT='Number of specified Roof thermal layers'
219   CALL WRITE_SURF(HSELECT, &
220                  HPROGRAM,'PAR_RF_LAYER',DTT%NPAR_ROOF_LAYER,IRESP,YCOMMENT)
221 END IF
222 !
223 YRECFM='L_HC_ROOF'
224 YCOMMENT=YRECFM
225  CALL WRITE_SURF(HSELECT, &
226                  HPROGRAM,YRECFM,DTT%LDATA_HC_ROOF,IRESP,HCOMMENT=YCOMMENT)
227 IF (DTT%LDATA_HC_ROOF) THEN
228   DO JL=1,DTT%NPAR_ROOF_LAYER
229     WRITE(YRECFM,FMT='(A9,I1.1)') 'D_HC_ROOF',JL
230     YCOMMENT='X_Y_'//YRECFM//' (J/K/m3)'
231     CALL WRITE_SURF(HSELECT, &
232                  HPROGRAM,YRECFM,DTT%XPAR_HC_ROOF(:,JL),IRESP,YCOMMENT)
233   END DO
234 ENDIF
235 !
236 YRECFM='L_TC_ROOF'
237 YCOMMENT=YRECFM
238  CALL WRITE_SURF(HSELECT, &
239                  HPROGRAM,YRECFM,DTT%LDATA_TC_ROOF,IRESP,HCOMMENT=YCOMMENT)
240 IF (DTT%LDATA_TC_ROOF) THEN
241   DO JL=1,DTT%NPAR_ROOF_LAYER
242     WRITE(YRECFM,FMT='(A9,I1.1)') 'D_TC_ROOF',JL
243     YCOMMENT='X_Y_'//YRECFM//' (W/K/m)'
244     CALL WRITE_SURF(HSELECT, &
245                  HPROGRAM,YRECFM,DTT%XPAR_TC_ROOF(:,JL),IRESP,YCOMMENT)
246   END DO
247 ENDIF
248 !
249 YRECFM='L_D_ROOF'
250 YCOMMENT=YRECFM
251  CALL WRITE_SURF(HSELECT, &
252                  HPROGRAM,YRECFM,DTT%LDATA_D_ROOF,IRESP,HCOMMENT=YCOMMENT)
253 IF (DTT%LDATA_D_ROOF) THEN
254   DO JL=1,DTT%NPAR_ROOF_LAYER
255     WRITE(YRECFM,FMT='(A8,I1.1)') 'D_D_ROOF',JL
256     YCOMMENT='X_Y_'//YRECFM//' (m)'
257     CALL WRITE_SURF(HSELECT, &
258                  HPROGRAM,YRECFM,DTT%XPAR_D_ROOF(:,JL),IRESP,YCOMMENT)
259   END DO
260 ENDIF
261 !
262 YRECFM='L_ALB_ROAD'
263 YCOMMENT=YRECFM
264  CALL WRITE_SURF(HSELECT, &
265                  HPROGRAM,YRECFM,DTT%LDATA_ALB_ROAD,IRESP,HCOMMENT=YCOMMENT)
266 IF (DTT%LDATA_ALB_ROAD) THEN
267   YRECFM='D_ALB_ROAD'
268   YCOMMENT='X_Y_'//YRECFM//' (-)'
269   CALL WRITE_SURF(HSELECT, &
270                  HPROGRAM,YRECFM,DTT%XPAR_ALB_ROAD,IRESP,YCOMMENT)
271 ENDIF
272 !
273 YRECFM='L_EMIS_ROAD'
274 YCOMMENT=YRECFM
275  CALL WRITE_SURF(HSELECT, &
276                  HPROGRAM,YRECFM,DTT%LDATA_EMIS_ROAD,IRESP,HCOMMENT=YCOMMENT)
277 IF (DTT%LDATA_EMIS_ROAD) THEN
278   YRECFM='D_EMI_ROAD'
279   YCOMMENT='X_Y_'//YRECFM//' (-)'
280   CALL WRITE_SURF(HSELECT, &
281                  HPROGRAM,YRECFM,DTT%XPAR_EMIS_ROAD,IRESP,YCOMMENT)
282 ENDIF
283 !
284 IF (DTT%LDATA_HC_ROAD) THEN
285   YCOMMENT='Number of specified Road thermal layers'
286   CALL WRITE_SURF(HSELECT, &
287                  HPROGRAM,'PAR_RD_LAYER',DTT%NPAR_ROAD_LAYER,IRESP,YCOMMENT)
288 END IF
289 !
290 YRECFM='L_HC_ROAD'
291 YCOMMENT=YRECFM
292  CALL WRITE_SURF(HSELECT, &
293                  HPROGRAM,YRECFM,DTT%LDATA_HC_ROAD,IRESP,HCOMMENT=YCOMMENT)
294 IF (DTT%LDATA_HC_ROAD) THEN
295   DO JL=1,DTT%NPAR_ROAD_LAYER
296     WRITE(YRECFM,FMT='(A9,I1.1)') 'D_HC_ROAD',JL
297     YCOMMENT='X_Y_'//YRECFM//' (J/K/m3)'
298     CALL WRITE_SURF(HSELECT, &
299                  HPROGRAM,YRECFM,DTT%XPAR_HC_ROAD(:,JL),IRESP,YCOMMENT)
300   END DO
301 ENDIF
302 !
303 YRECFM='L_TC_ROAD'
304 YCOMMENT=YRECFM
305  CALL WRITE_SURF(HSELECT, &
306                  HPROGRAM,YRECFM,DTT%LDATA_TC_ROAD,IRESP,HCOMMENT=YCOMMENT)
307 IF (DTT%LDATA_TC_ROAD) THEN
308   DO JL=1,DTT%NPAR_ROAD_LAYER
309     WRITE(YRECFM,FMT='(A9,I1.1)') 'D_TC_ROAD',JL
310     YCOMMENT='X_Y_'//YRECFM//' (W/K/m)'
311     CALL WRITE_SURF(HSELECT, &
312                  HPROGRAM,YRECFM,DTT%XPAR_TC_ROAD(:,JL),IRESP,YCOMMENT)
313   END DO
314 ENDIF
315 !
316 YRECFM='L_D_ROAD'
317 YCOMMENT=YRECFM
318  CALL WRITE_SURF(HSELECT, &
319                  HPROGRAM,YRECFM,DTT%LDATA_D_ROAD,IRESP,HCOMMENT=YCOMMENT)
320 IF (DTT%LDATA_D_ROAD) THEN
321   DO JL=1,DTT%NPAR_ROAD_LAYER
322     WRITE(YRECFM,FMT='(A8,I1.1)') 'D_D_ROAD',JL
323     YCOMMENT='X_Y_'//YRECFM//' (m)'
324     CALL WRITE_SURF(HSELECT, &
325                  HPROGRAM,YRECFM,DTT%XPAR_D_ROAD(:,JL),IRESP,YCOMMENT)
326   END DO
327 ENDIF
328 !
329 YRECFM='L_ALB_WALL'
330 YCOMMENT=YRECFM
331  CALL WRITE_SURF(HSELECT, &
332                  HPROGRAM,YRECFM,DTT%LDATA_ALB_WALL,IRESP,HCOMMENT=YCOMMENT)
333 IF (DTT%LDATA_ALB_WALL) THEN
334   YRECFM='D_ALB_WALL'
335   YCOMMENT='X_Y_'//YRECFM//' (-)'
336   CALL WRITE_SURF(HSELECT, &
337                  HPROGRAM,YRECFM,DTT%XPAR_ALB_WALL,IRESP,YCOMMENT)
338 ENDIF
339 !
340 YRECFM='L_EMIS_WALL'
341 YCOMMENT=YRECFM
342  CALL WRITE_SURF(HSELECT, &
343                  HPROGRAM,YRECFM,DTT%LDATA_EMIS_WALL,IRESP,HCOMMENT=YCOMMENT)
344 IF (DTT%LDATA_EMIS_WALL) THEN
345   YRECFM='D_EMI_WALL'
346   YCOMMENT='X_Y_'//YRECFM//' (-)'
347   CALL WRITE_SURF(HSELECT, &
348                  HPROGRAM,YRECFM,DTT%XPAR_EMIS_WALL,IRESP,YCOMMENT)
349 ENDIF
350 !
351 !
352 IF (DTT%LDATA_HC_WALL) THEN
353   YCOMMENT='Number of specified Wall thermal layers'
354   CALL WRITE_SURF(HSELECT, &
355                  HPROGRAM,'PAR_WL_LAYER',DTT%NPAR_WALL_LAYER,IRESP,YCOMMENT)
356 END IF
357 !
358 YRECFM='L_HC_WALL'
359 YCOMMENT=YRECFM
360  CALL WRITE_SURF(HSELECT, &
361                  HPROGRAM,YRECFM,DTT%LDATA_HC_WALL,IRESP,HCOMMENT=YCOMMENT)
362 IF (DTT%LDATA_HC_WALL) THEN
363   DO JL=1,DTT%NPAR_WALL_LAYER
364     WRITE(YRECFM,FMT='(A9,I1.1)') 'D_HC_WALL',JL
365     YCOMMENT='X_Y_'//YRECFM//' (J/K/m3)'
366     CALL WRITE_SURF(HSELECT, &
367                  HPROGRAM,YRECFM,DTT%XPAR_HC_WALL(:,JL),IRESP,YCOMMENT)
368   END DO
369 ENDIF
370 !
371 YRECFM='L_TC_WALL'
372 YCOMMENT=YRECFM
373  CALL WRITE_SURF(HSELECT, &
374                  HPROGRAM,YRECFM,DTT%LDATA_TC_WALL,IRESP,HCOMMENT=YCOMMENT)
375 IF (DTT%LDATA_TC_WALL) THEN
376   DO JL=1,DTT%NPAR_WALL_LAYER
377     WRITE(YRECFM,FMT='(A9,I1.1)') 'D_TC_WALL',JL
378     YCOMMENT='X_Y_'//YRECFM//' (W/K/m)'
379     CALL WRITE_SURF(HSELECT, &
380                  HPROGRAM,YRECFM,DTT%XPAR_TC_WALL(:,JL),IRESP,YCOMMENT)
381   END DO
382 ENDIF
383 !
384 YRECFM='L_D_WALL'
385 YCOMMENT=YRECFM
386  CALL WRITE_SURF(HSELECT, &
387                  HPROGRAM,YRECFM,DTT%LDATA_D_WALL,IRESP,HCOMMENT=YCOMMENT)
388 IF (DTT%LDATA_D_WALL) THEN
389   DO JL=1,DTT%NPAR_WALL_LAYER
390     WRITE(YRECFM,FMT='(A8,I1.1)') 'D_D_WALL',JL
391     YCOMMENT='X_Y_'//YRECFM//' (m)'
392     CALL WRITE_SURF(HSELECT, &
393                  HPROGRAM,YRECFM,DTT%XPAR_D_WALL(:,JL),IRESP,YCOMMENT)
394   END DO
395 ENDIF
396 !
397 YRECFM='L_BLD_HEIGHT'
398 YCOMMENT=YRECFM
399  CALL WRITE_SURF(HSELECT, &
400                  HPROGRAM,YRECFM,DTT%LDATA_BLD_HEIGHT,IRESP,HCOMMENT=YCOMMENT)
401 IF (DTT%LDATA_BLD_HEIGHT) THEN
402   YRECFM='D_BLD_HEIG'
403   YCOMMENT='X_Y_'//YRECFM//' (m)'
404   CALL WRITE_SURF(HSELECT, &
405                  HPROGRAM,YRECFM,DTT%XPAR_BLD_HEIGHT,IRESP,YCOMMENT)
406 ENDIF
407 !
408 YRECFM='L_WALL_O_HOR'
409 YCOMMENT=YRECFM
410  CALL WRITE_SURF(HSELECT, &
411                  HPROGRAM,YRECFM,DTT%LDATA_WALL_O_HOR,IRESP,HCOMMENT=YCOMMENT)
412 IF (DTT%LDATA_WALL_O_HOR) THEN
413   YRECFM='D_WALL_O_H'
414   YCOMMENT='X_Y_'//YRECFM//' (-)'
415   CALL WRITE_SURF(HSELECT, &
416                  HPROGRAM,YRECFM,DTT%XPAR_WALL_O_HOR,IRESP,YCOMMENT)
417 ENDIF
418 !
419 YRECFM='L_H_TRAF'
420 YCOMMENT=YRECFM
421  CALL WRITE_SURF(HSELECT, &
422                  HPROGRAM,YRECFM,DTT%LDATA_H_TRAFFIC,IRESP,HCOMMENT=YCOMMENT)
423 IF (DTT%LDATA_H_TRAFFIC) THEN
424   YRECFM='D_H_TRAF'
425   YCOMMENT='X_Y_'//YRECFM//' (W/m2)'
426   CALL WRITE_SURF(HSELECT, &
427                  HPROGRAM,YRECFM,DTT%XPAR_H_TRAFFIC,IRESP,YCOMMENT)
428 ENDIF
429 !
430 YRECFM='L_LE_TRAF'
431 YCOMMENT=YRECFM
432  CALL WRITE_SURF(HSELECT, &
433                  HPROGRAM,YRECFM,DTT%LDATA_LE_TRAFFIC,IRESP,HCOMMENT=YCOMMENT)
434 IF (DTT%LDATA_LE_TRAFFIC) THEN
435   YRECFM='D_LE_TRAF'
436   YCOMMENT='X_Y_'//YRECFM//' (W/m2)'
437   CALL WRITE_SURF(HSELECT, &
438                  HPROGRAM,YRECFM,DTT%XPAR_LE_TRAFFIC,IRESP,YCOMMENT)
439 ENDIF
440 !
441 YRECFM='L_H_IND'
442 YCOMMENT=YRECFM
443  CALL WRITE_SURF(HSELECT, &
444                  HPROGRAM,YRECFM,DTT%LDATA_H_INDUSTRY,IRESP,HCOMMENT=YCOMMENT)
445 IF (DTT%LDATA_H_INDUSTRY) THEN
446   YRECFM='D_H_IND'
447   YCOMMENT='X_Y_'//YRECFM//' (W/m2)'
448   CALL WRITE_SURF(HSELECT, &
449                  HPROGRAM,YRECFM,DTT%XPAR_H_INDUSTRY,IRESP,YCOMMENT)
450 ENDIF
451 !
452 YRECFM='L_LE_IND'
453 YCOMMENT=YRECFM
454  CALL WRITE_SURF(HSELECT, &
455                  HPROGRAM,YRECFM,DTT%LDATA_LE_INDUSTRY,IRESP,HCOMMENT=YCOMMENT)
456 IF (DTT%LDATA_LE_INDUSTRY) THEN
457   YRECFM='D_LE_IND'
458   YCOMMENT='X_Y_'//YRECFM//' (W/m2)'
459   CALL WRITE_SURF(HSELECT, &
460                  HPROGRAM,YRECFM,DTT%XPAR_LE_INDUSTRY,IRESP,YCOMMENT)
461 ENDIF
462 !
463 YRECFM='L_ROUGH_ROOF'
464 YCOMMENT=YRECFM
465  CALL WRITE_SURF(HSELECT, &
466                  HPROGRAM,YRECFM,DTT%LDATA_ROUGH_ROOF,IRESP,HCOMMENT=YCOMMENT)
467 IF (DTT%LDATA_ROUGH_ROOF) THEN
468   YRECFM='D_ROUGH_ROOF'
469   YCOMMENT='X_Y_'//YRECFM//' (-)'
470   CALL WRITE_SURF(HSELECT, &
471                  HPROGRAM,YRECFM,DTT%XPAR_ROUGH_ROOF,IRESP,YCOMMENT)
472 ENDIF
473 !
474 YRECFM='L_ROUGH_WALL'
475 YCOMMENT=YRECFM
476  CALL WRITE_SURF(HSELECT, &
477                  HPROGRAM,YRECFM,DTT%LDATA_ROUGH_WALL,IRESP,HCOMMENT=YCOMMENT)
478 IF (DTT%LDATA_ROUGH_WALL) THEN
479   YRECFM='D_ROUGH_WALL'
480   YCOMMENT='X_Y_'//YRECFM//' (-)'
481   CALL WRITE_SURF(HSELECT, &
482                  HPROGRAM,YRECFM,DTT%XPAR_ROUGH_WALL,IRESP,YCOMMENT)
483 ENDIF!
484 !
485 YRECFM='L_F_RESIDENT'
486 YCOMMENT=YRECFM
487  CALL WRITE_SURF(HSELECT, &
488                  HPROGRAM,YRECFM,DTT%LDATA_RESIDENTIAL,IRESP,HCOMMENT=YCOMMENT)
489 IF (DTT%LDATA_RESIDENTIAL) THEN
490   YRECFM='D_F_RESIDENT'
491   YCOMMENT='X_Y_'//YRECFM//' (-)'
492   CALL WRITE_SURF(HSELECT, &
493                  HPROGRAM,YRECFM,DTT%XPAR_RESIDENTIAL,IRESP,YCOMMENT)
494 ENDIF
495 !
496 !* solar panels
497 !
498 YRECFM='L_EMIS_PANEL'
499 YCOMMENT=YRECFM
500  CALL WRITE_SURF(HSELECT, &
501                  HPROGRAM,YRECFM,DTT%LDATA_EMIS_PANEL,IRESP,HCOMMENT=YCOMMENT)
502 IF (DTT%LDATA_EMIS_PANEL) THEN
503   YRECFM='D_EMIS_PANEL'
504   YCOMMENT='X_Y_'//YRECFM//' (-)'
505   CALL WRITE_SURF(HSELECT, &
506                  HPROGRAM,YRECFM,DTT%XPAR_EMIS_PANEL,IRESP,YCOMMENT)
507 ENDIF
508 !
509 YRECFM='L_ALB_PANEL'
510 YCOMMENT=YRECFM
511  CALL WRITE_SURF(HSELECT, &
512                  HPROGRAM,YRECFM,DTT%LDATA_ALB_PANEL,IRESP,HCOMMENT=YCOMMENT)
513 IF (DTT%LDATA_ALB_PANEL) THEN
514   YRECFM='D_ALB_PANEL'
515   YCOMMENT='X_Y_'//YRECFM//' (-)'
516   CALL WRITE_SURF(HSELECT, &
517                  HPROGRAM,YRECFM,DTT%XPAR_ALB_PANEL,IRESP,YCOMMENT)
518 ENDIF
519 !
520 YRECFM='L_EFF_PANEL'
521 YCOMMENT=YRECFM
522  CALL WRITE_SURF(HSELECT, &
523                  HPROGRAM,YRECFM,DTT%LDATA_EFF_PANEL,IRESP,HCOMMENT=YCOMMENT)
524 IF (DTT%LDATA_EFF_PANEL) THEN
525   YRECFM='D_EFF_PANEL'
526   YCOMMENT='X_Y_'//YRECFM//' (-)'
527   CALL WRITE_SURF(HSELECT, &
528                  HPROGRAM,YRECFM,DTT%XPAR_EFF_PANEL,IRESP,YCOMMENT)
529 ENDIF
530 !
531 YRECFM='L_FRAC_PANEL'
532 YCOMMENT=YRECFM
533  CALL WRITE_SURF(HSELECT, &
534                  HPROGRAM,YRECFM,DTT%LDATA_FRAC_PANEL,IRESP,HCOMMENT=YCOMMENT)
535 IF (DTT%LDATA_FRAC_PANEL) THEN
536   YRECFM='D_FRAC_PANEL'
537   YCOMMENT='X_Y_'//YRECFM//' (-)'
538   CALL WRITE_SURF(HSELECT, &
539                  HPROGRAM,YRECFM,DTT%XPAR_FRAC_PANEL,IRESP,YCOMMENT)
540 ENDIF
541 !
542 !* Building Energy Model
543 !
544 IF (TOP%CBEM .EQ. 'BEM') THEN
545   !
546   IF (DTB%LDATA_HC_FLOOR) THEN
547     YCOMMENT='Number of specified Floor thermal layers'
548     CALL WRITE_SURF(HSELECT, &
549                  HPROGRAM,'PAR_FL_LAYER',DTB%NPAR_FLOOR_LAYER,IRESP,YCOMMENT)
550   END IF
551   !
552   YRECFM='L_HC_FLOOR'
553   YCOMMENT=YRECFM
554   CALL WRITE_SURF(HSELECT, &
555                  HPROGRAM,YRECFM,DTB%LDATA_HC_FLOOR,IRESP,HCOMMENT=YCOMMENT)
556   IF (DTB%LDATA_HC_FLOOR) THEN
557     DO JL=1,DTB%NPAR_FLOOR_LAYER
558       WRITE(YRECFM,FMT='(A10,I1.1)') 'D_HC_FLOOR',JL
559       YCOMMENT='X_Y_'//YRECFM//' (J/K/m3)'
560       CALL WRITE_SURF(HSELECT, &
561                  HPROGRAM,YRECFM,DTB%XPAR_HC_FLOOR(:,JL),IRESP,YCOMMENT)
562     END DO
563   ENDIF
564   !
565   YRECFM='L_TC_FLOOR'
566   YCOMMENT=YRECFM
567   CALL WRITE_SURF(HSELECT, &
568                  HPROGRAM,YRECFM,DTB%LDATA_TC_FLOOR,IRESP,HCOMMENT=YCOMMENT)
569   IF (DTB%LDATA_TC_FLOOR) THEN
570     DO JL=1,DTB%NPAR_FLOOR_LAYER
571       WRITE(YRECFM,FMT='(A10,I1.1)') 'D_TC_FLOOR',JL
572       YCOMMENT='X_Y_'//YRECFM//' (W/K/m)'
573       CALL WRITE_SURF(HSELECT, &
574                  HPROGRAM,YRECFM,DTB%XPAR_TC_FLOOR(:,JL),IRESP,YCOMMENT)
575     END DO
576   ENDIF
577   !
578   YRECFM='L_D_FLOOR'
579   YCOMMENT=YRECFM
580   CALL WRITE_SURF(HSELECT, &
581                  HPROGRAM,YRECFM,DTB%LDATA_D_FLOOR,IRESP,HCOMMENT=YCOMMENT)
582   IF (DTB%LDATA_D_FLOOR) THEN
583     DO JL=1,DTB%NPAR_FLOOR_LAYER
584       WRITE(YRECFM,FMT='(A9,I1.1)') 'D_D_FLOOR',JL
585       YCOMMENT='X_Y_'//YRECFM//' (m)'
586       CALL WRITE_SURF(HSELECT, &
587                  HPROGRAM,YRECFM,DTB%XPAR_D_FLOOR(:,JL),IRESP,YCOMMENT)
588     END DO
589   ENDIF
590   !
591   YRECFM='L_TCOOL_TARG'
592   YCOMMENT=YRECFM
593   CALL WRITE_SURF(HSELECT, &
594                  HPROGRAM,YRECFM,DTB%LDATA_TCOOL_TARGET,IRESP,HCOMMENT=YCOMMENT)
595   IF (DTB%LDATA_TCOOL_TARGET) THEN
596     YRECFM='D_TCOOL_TARG'
597     YCOMMENT='X_Y_'//YRECFM//' (K)'
598     CALL WRITE_SURF(HSELECT, &
599                  HPROGRAM,YRECFM,DTB%XPAR_TCOOL_TARGET,IRESP,YCOMMENT)
600   ENDIF
601   !
602   YRECFM='L_THEAT_TARG'
603   YCOMMENT=YRECFM
604   CALL WRITE_SURF(HSELECT, &
605                  HPROGRAM,YRECFM,DTB%LDATA_THEAT_TARGET,IRESP,HCOMMENT=YCOMMENT)
606   IF (DTB%LDATA_THEAT_TARGET) THEN
607     YRECFM='D_THEAT_TARG'
608     YCOMMENT='X_Y_'//YRECFM//' (K)'
609     CALL WRITE_SURF(HSELECT, &
610                  HPROGRAM,YRECFM,DTB%XPAR_THEAT_TARGET,IRESP,YCOMMENT)
611   ENDIF
612   !
613   YRECFM='L_F_WAST_CAN'
614   YCOMMENT=YRECFM
615   CALL WRITE_SURF(HSELECT, &
616                  HPROGRAM,YRECFM,DTB%LDATA_F_WASTE_CAN,IRESP,HCOMMENT=YCOMMENT)
617   IF (DTB%LDATA_F_WASTE_CAN) THEN
618     YRECFM='D_F_WAST_CAN'
619     YCOMMENT='X_Y_'//YRECFM//' (-)'
620     CALL WRITE_SURF(HSELECT, &
621                  HPROGRAM,YRECFM,DTB%XPAR_F_WASTE_CAN,IRESP,YCOMMENT)
622   ENDIF
623   !
624   YRECFM='L_EFF_HEAT'
625   YCOMMENT=YRECFM
626   CALL WRITE_SURF(HSELECT, &
627                  HPROGRAM,YRECFM,DTB%LDATA_EFF_HEAT,IRESP,HCOMMENT=YCOMMENT)
628   IF (DTB%LDATA_EFF_HEAT) THEN
629     YRECFM='D_EFF_HEAT'
630     YCOMMENT='X_Y_'//YRECFM//' (-)'
631     CALL WRITE_SURF(HSELECT, &
632                  HPROGRAM,YRECFM,DTB%XPAR_EFF_HEAT,IRESP,YCOMMENT)
633   ENDIF
634   !
635   YRECFM='L_QIN'
636   YCOMMENT=YRECFM
637   CALL WRITE_SURF(HSELECT, &
638                  HPROGRAM,YRECFM,DTB%LDATA_QIN,IRESP,HCOMMENT=YCOMMENT)
639   IF (DTB%LDATA_QIN) THEN
640     YRECFM='D_QIN'
641     YCOMMENT='X_Y_'//YRECFM//' (K)'
642     CALL WRITE_SURF(HSELECT, &
643                  HPROGRAM,YRECFM,DTB%XPAR_QIN,IRESP,YCOMMENT)
644   ENDIF
645   !
646   YRECFM='L_QIN_FRAD'
647   YCOMMENT=YRECFM
648   CALL WRITE_SURF(HSELECT, &
649                  HPROGRAM,YRECFM,DTB%LDATA_QIN_FRAD,IRESP,HCOMMENT=YCOMMENT)
650   IF (DTB%LDATA_QIN_FRAD) THEN
651     YRECFM='D_QIN_FRAD'
652     YCOMMENT='X_Y_'//YRECFM//' (K)'
653     CALL WRITE_SURF(HSELECT, &
654                  HPROGRAM,YRECFM,DTB%XPAR_QIN_FRAD,IRESP,YCOMMENT)
655   ENDIF
656   !
657   YRECFM='L_SHGC'
658   YCOMMENT=YRECFM
659   CALL WRITE_SURF(HSELECT, &
660                  HPROGRAM,YRECFM,DTB%LDATA_SHGC,IRESP,HCOMMENT=YCOMMENT)
661   IF (DTB%LDATA_SHGC) THEN
662     YRECFM='D_SHGC'
663     YCOMMENT='X_Y_'//YRECFM//' (-)'
664     CALL WRITE_SURF(HSELECT, &
665                  HPROGRAM,YRECFM,DTB%XPAR_SHGC,IRESP,YCOMMENT)
666   ENDIF
667   !
668   YRECFM='L_U_WIN'
669   YCOMMENT=YRECFM
670   CALL WRITE_SURF(HSELECT, &
671                  HPROGRAM,YRECFM,DTB%LDATA_U_WIN,IRESP,HCOMMENT=YCOMMENT)
672   IF (DTB%LDATA_U_WIN) THEN
673     YRECFM='D_U_WIN'
674     YCOMMENT='X_Y_'//YRECFM//' (W m-2 K-1)'
675     CALL WRITE_SURF(HSELECT, &
676                  HPROGRAM,YRECFM,DTB%XPAR_U_WIN,IRESP,YCOMMENT)
677   ENDIF
678   !
679   YRECFM='L_GR'
680   YCOMMENT=YRECFM
681   CALL WRITE_SURF(HSELECT, &
682                  HPROGRAM,YRECFM,DTB%LDATA_GR,IRESP,HCOMMENT=YCOMMENT)
683   IF (DTB%LDATA_GR) THEN
684     YRECFM='D_GR'
685     YCOMMENT='X_Y_'//YRECFM//' (-)'
686     CALL WRITE_SURF(HSELECT, &
687                  HPROGRAM,YRECFM,DTB%XPAR_GR,IRESP,YCOMMENT)
688   ENDIF
689   !
690   YRECFM='L_SHGC_SH'
691   YCOMMENT=YRECFM
692   CALL WRITE_SURF(HSELECT, &
693                  HPROGRAM,YRECFM,DTB%LDATA_SHGC_SH,IRESP,HCOMMENT=YCOMMENT)
694   IF (DTB%LDATA_SHGC_SH) THEN
695     YRECFM='D_SHGC_SH'
696     YCOMMENT='X_Y_'//YRECFM//' (-)'
697     CALL WRITE_SURF(HSELECT, &
698                  HPROGRAM,YRECFM,DTB%XPAR_SHGC_SH,IRESP,YCOMMENT)
699   ENDIF  
700   !
701   YRECFM='L_FLOOR_HEIG'
702   YCOMMENT=YRECFM
703   CALL WRITE_SURF(HSELECT, &
704                  HPROGRAM,YRECFM,DTB%LDATA_FLOOR_HEIGHT,IRESP,HCOMMENT=YCOMMENT)
705   IF (DTB%LDATA_FLOOR_HEIGHT) THEN
706     YRECFM='D_FLOOR_HEIG'
707     YCOMMENT='X_Y_'//YRECFM//' (m)'
708     CALL WRITE_SURF(HSELECT, &
709                  HPROGRAM,YRECFM,DTB%XPAR_FLOOR_HEIGHT,IRESP,YCOMMENT)
710   ENDIF
711   !
712   YRECFM='L_INF'
713   YCOMMENT=YRECFM
714   CALL WRITE_SURF(HSELECT, &
715                  HPROGRAM,YRECFM,DTB%LDATA_INF,IRESP,HCOMMENT=YCOMMENT)
716   IF (DTB%LDATA_INF) THEN
717     YRECFM='D_INF'
718     YCOMMENT='X_Y_'//YRECFM//' (ACH)'
719     CALL WRITE_SURF(HSELECT, &
720                  HPROGRAM,YRECFM,DTB%XPAR_INF,IRESP,YCOMMENT)
721   ENDIF
722   !
723   YRECFM='L_QIN_FLAT'
724   YCOMMENT=YRECFM
725   CALL WRITE_SURF(HSELECT, &
726                  HPROGRAM,YRECFM,DTB%LDATA_QIN_FLAT,IRESP,HCOMMENT=YCOMMENT)
727   IF (DTB%LDATA_QIN_FLAT) THEN
728     YRECFM='D_QIN_FLAT'
729     YCOMMENT='X_Y_'//YRECFM//' (-)'
730     CALL WRITE_SURF(HSELECT, &
731                  HPROGRAM,YRECFM,DTB%XPAR_QIN_FLAT,IRESP,YCOMMENT)
732   ENDIF
733   !
734   YRECFM='L_HR_TARGET'
735   YCOMMENT=YRECFM
736   CALL WRITE_SURF(HSELECT, &
737                  HPROGRAM,YRECFM,DTB%LDATA_HR_TARGET,IRESP,HCOMMENT=YCOMMENT)
738   IF (DTB%LDATA_HR_TARGET) THEN
739     YRECFM='D_HR_TARGET'
740     YCOMMENT='X_Y_'//YRECFM//' (-)'
741     CALL WRITE_SURF(HSELECT, &
742                  HPROGRAM,YRECFM,DTB%XPAR_HR_TARGET,IRESP,YCOMMENT)
743   ENDIF
744   !
745   YRECFM='L_V_VENT'
746   YCOMMENT=YRECFM
747   CALL WRITE_SURF(HSELECT, &
748                  HPROGRAM,YRECFM,DTB%LDATA_V_VENT,IRESP,HCOMMENT=YCOMMENT)
749   IF (DTB%LDATA_V_VENT) THEN
750     YRECFM='D_V_VENT'
751     YCOMMENT='X_Y_'//YRECFM//' (ACH)'
752     CALL WRITE_SURF(HSELECT, &
753                  HPROGRAM,YRECFM,DTB%XPAR_V_VENT,IRESP,YCOMMENT)
754   ENDIF
755   !
756   YRECFM='L_CAP_SYS_HE'
757   YCOMMENT=YRECFM
758   CALL WRITE_SURF(HSELECT, &
759                  HPROGRAM,YRECFM,DTB%LDATA_CAP_SYS_HEAT,IRESP,HCOMMENT=YCOMMENT)
760   IF (DTB%LDATA_CAP_SYS_HEAT) THEN
761     YRECFM='D_CAP_SYS_HE'
762     YCOMMENT='X_Y_'//YRECFM//' (W m-2)'
763     CALL WRITE_SURF(HSELECT, &
764                  HPROGRAM,YRECFM,DTB%XPAR_CAP_SYS_HEAT,IRESP,YCOMMENT)
765   ENDIF
766   !
767   YRECFM='L_CAP_SYS_RA'
768   YCOMMENT=YRECFM
769   CALL WRITE_SURF(HSELECT, &
770                  HPROGRAM,YRECFM,DTB%LDATA_CAP_SYS_RAT,IRESP,HCOMMENT=YCOMMENT)
771   IF (DTB%LDATA_CAP_SYS_RAT) THEN
772     YRECFM='D_CAP_SYS_RA'
773     YCOMMENT='X_Y_'//YRECFM//' (W m-2)'
774     CALL WRITE_SURF(HSELECT, &
775                  HPROGRAM,YRECFM,DTB%XPAR_CAP_SYS_RAT,IRESP,YCOMMENT)
776   ENDIF
777   !
778   YRECFM='L_T_ADP'
779   YCOMMENT=YRECFM
780   CALL WRITE_SURF(HSELECT, &
781                  HPROGRAM,YRECFM,DTB%LDATA_T_ADP,IRESP,HCOMMENT=YCOMMENT)
782   IF (DTB%LDATA_T_ADP) THEN
783     YRECFM='D_T_ADP'
784     YCOMMENT='X_Y_'//YRECFM//' (K)'
785     CALL WRITE_SURF(HSELECT, &
786                  HPROGRAM,YRECFM,DTB%XPAR_T_ADP,IRESP,YCOMMENT)
787   ENDIF
788   !
789   YRECFM='L_M_SYS_RAT'
790   YCOMMENT=YRECFM
791   CALL WRITE_SURF(HSELECT, &
792                  HPROGRAM,YRECFM,DTB%LDATA_M_SYS_RAT,IRESP,HCOMMENT=YCOMMENT)
793   IF (DTB%LDATA_M_SYS_RAT) THEN
794     YRECFM='D_M_SYS_RAT'
795     YCOMMENT='X_Y_'//YRECFM//' (kg s-1 m-)'
796     CALL WRITE_SURF(HSELECT, &
797                  HPROGRAM,YRECFM,DTB%XPAR_M_SYS_RAT,IRESP,YCOMMENT)
798   ENDIF
799   !
800   YRECFM='L_COP_RAT'
801   YCOMMENT=YRECFM
802   CALL WRITE_SURF(HSELECT, &
803                  HPROGRAM,YRECFM,DTB%LDATA_COP_RAT,IRESP,HCOMMENT=YCOMMENT)
804   IF (DTB%LDATA_COP_RAT) THEN
805     YRECFM='D_COP_RAT'
806     YCOMMENT='X_Y_'//YRECFM//' (-)'
807     CALL WRITE_SURF(HSELECT, &
808                  HPROGRAM,YRECFM,DTB%XPAR_COP_RAT,IRESP,YCOMMENT)
809   ENDIF
810   !
811   YRECFM='L_T_SIZE_MAX'
812   YCOMMENT=YRECFM
813   CALL WRITE_SURF(HSELECT, &
814                  HPROGRAM,YRECFM,DTB%LDATA_T_SIZE_MAX,IRESP,HCOMMENT=YCOMMENT)
815   IF (DTB%LDATA_T_SIZE_MAX) THEN
816     YRECFM='D_T_SIZE_MAX'
817     YCOMMENT='X_Y_'//YRECFM//' (K)'
818     CALL WRITE_SURF(HSELECT, &
819                  HPROGRAM,YRECFM,DTB%XPAR_T_SIZE_MAX,IRESP,YCOMMENT)
820   ENDIF
821   !
822   YRECFM='L_T_SIZE_MIN'
823   YCOMMENT=YRECFM
824   CALL WRITE_SURF(HSELECT, &
825                  HPROGRAM,YRECFM,DTB%LDATA_T_SIZE_MIN,IRESP,HCOMMENT=YCOMMENT)
826   IF (DTB%LDATA_T_SIZE_MIN) THEN
827     YRECFM='D_T_SIZE_MIN'
828     YCOMMENT='X_Y_'//YRECFM//' (K)'
829     CALL WRITE_SURF(HSELECT, &
830                  HPROGRAM,YRECFM,DTB%XPAR_T_SIZE_MIN,IRESP,YCOMMENT)
831   ENDIF
832   !
833   YRECFM='L_FWAT_COND'
834   YCOMMENT=YRECFM
835   CALL WRITE_SURF(HSELECT, &
836                  HPROGRAM,YRECFM,DTB%LDATA_F_WATER_COND,IRESP,HCOMMENT=YCOMMENT)
837   IF (DTB%LDATA_F_WATER_COND) THEN
838     YRECFM='D_FWAT_COND'
839     YCOMMENT='X_Y_'//YRECFM//' (-)'
840     CALL WRITE_SURF(HSELECT, &
841                  HPROGRAM,YRECFM,DTB%XPAR_F_WATER_COND,IRESP,YCOMMENT)
842   ENDIF
843   !
844   YRECFM='L_SHADE'
845   YCOMMENT=YRECFM
846   CALL WRITE_SURF(HSELECT, &
847                  HPROGRAM,YRECFM,DTB%LDATA_SHADE,IRESP,HCOMMENT=YCOMMENT)
848   IF (DTB%LDATA_SHADE) THEN
849     YRECFM='D_SHADE'
850     YCOMMENT='X_Y_'//YRECFM//' (-)'
851     CALL WRITE_SURF(HSELECT, &
852                  HPROGRAM,YRECFM,DTB%XPAR_SHADE,IRESP,YCOMMENT)
853   ENDIF
854   !
855   YRECFM='L_NATVENT'
856   YCOMMENT=YRECFM
857   CALL WRITE_SURF(HSELECT, &
858                  HPROGRAM,YRECFM,DTB%LDATA_NATVENT,IRESP,HCOMMENT=YCOMMENT)
859   IF (DTB%LDATA_NATVENT) THEN
860     YRECFM='D_NATVENT'
861     YCOMMENT='X_Y_'//YRECFM//' (-)'
862     CALL WRITE_SURF(HSELECT, &
863                  HPROGRAM,YRECFM,DTB%XPAR_NATVENT,IRESP,YCOMMENT)
864   ENDIF
865   !  
866 ENDIF
867 !
868 ! Flag for data for gardens
869 YRECFM='PAR_GARDEN'
870 YCOMMENT='FLAG FOR SPECIFIED GARDEN PARAMETERS'
871  CALL WRITE_SURF(HSELECT, &
872                  HPROGRAM,YRECFM,GDO%LPAR,IRESP,HCOMMENT=YCOMMENT)
873 !
874 IF (TOP%LGARDEN .AND. GDO%LPAR) THEN
875 !
876   YRECFM='GD_NTIME'
877   YCOMMENT=YRECFM
878   CALL WRITE_SURF(HSELECT, &
879                  HPROGRAM,YRECFM,DTGD%NTIME,IRESP,HCOMMENT=YCOMMENT)
880 !
881 ! Type of high vegetation
882   YRECFM='D_TYPE_HVEG'
883   YCOMMENT='X_Y_TYPE_HVEG'
884   CALL WRITE_SURF(HSELECT, &
885                  HPROGRAM,YRECFM,GDO%CTYPE_HVEG,IRESP,HCOMMENT=YCOMMENT)
886 !
887 ! Type of low vegetation
888   YRECFM='D_TYPE_LVEG'
889   YCOMMENT='X_Y_TYPE_LVEG'
890   CALL WRITE_SURF(HSELECT, &
891                  HPROGRAM,YRECFM,GDO%CTYPE_LVEG,IRESP,HCOMMENT=YCOMMENT)
892 !
893 ! Type of bare soil (no vegetation)
894   YRECFM='D_TYPE_NVEG'
895   YCOMMENT='X_Y_TYPE_NVEG'
896   CALL WRITE_SURF(HSELECT, &
897                  HPROGRAM,YRECFM,GDO%CTYPE_NVEG,IRESP,HCOMMENT=YCOMMENT)
898 !
899 ! Fraction of high vegetation
900   YRECFM='D_FRAC_HVEG'
901   YCOMMENT='X_Y_D_FRAC_HVEG'
902   CALL WRITE_SURF(HSELECT, &
903                  HPROGRAM,YRECFM,DTGD%XPAR_FRAC_HVEG(:),IRESP,HCOMMENT=YCOMMENT)
904 !
905 ! Fraction of low vegetation
906   YRECFM='D_FRAC_LVEG'
907   YCOMMENT='X_Y_D_FRAC_LVEG'
908   CALL WRITE_SURF(HSELECT, &
909                  HPROGRAM,YRECFM,DTGD%XPAR_FRAC_LVEG(:),IRESP,HCOMMENT=YCOMMENT)
910 !
911 ! Fraction of bare soil
912   YRECFM='D_FRAC_NVEG'
913   YCOMMENT='X_Y_D_FRAC_NVEG'
914   CALL WRITE_SURF(HSELECT, &
915                  HPROGRAM,YRECFM,DTGD%XPAR_FRAC_NVEG(:),IRESP,HCOMMENT=YCOMMENT)
916 !
917 ! LAI of high vegetation
918   DO JTIME=1,DTGD%NTIME
919     WRITE(YRECFM,FMT='(A10,I2.2)') 'D_LAI_HVEG',JTIME
920     YCOMMENT='X_Y_D_LAI_HVEG'
921     CALL WRITE_SURF(HSELECT, &
922                  HPROGRAM,YRECFM,DTGD%XPAR_LAI_HVEG(:,JTIME),IRESP,HCOMMENT=YCOMMENT)
923   END DO
924 !
925 ! LAI of low vegetation
926   DO JTIME=1,DTGD%NTIME
927     WRITE(YRECFM,FMT='(A10,I2.2)') 'D_LAI_LVEG',JTIME
928     YCOMMENT='X_Y_D_LAI_LVEG'
929     CALL WRITE_SURF(HSELECT, &
930                  HPROGRAM,YRECFM,DTGD%XPAR_LAI_LVEG(:,JTIME),IRESP,HCOMMENT=YCOMMENT)
931   END DO
932 !
933 ! Height of trees
934   YRECFM='D_H_HVEG'
935   YCOMMENT='X_Y_DATA_H_HVEG'
936   CALL WRITE_SURF(HSELECT, &
937                  HPROGRAM,YRECFM,DTGD%XPAR_H_HVEG(:),IRESP,HCOMMENT=YCOMMENT)
938 !
939 ENDIF
940 !
941 IF (TOP%LGREENROOF .AND. GRO%LPAR) THEN
942 !
943 ! Type of green roof
944   YRECFM='D_TYPE_GR'
945   YCOMMENT='X_Y_TYPE_GR'
946   CALL WRITE_SURF(HSELECT, &
947                  HPROGRAM,YRECFM,GRO%CTYP_COV,IRESP,HCOMMENT=YCOMMENT)
948 !
949 ! Fraction of OM in green roof layer
950   DO JL=1,GRO%NGROUND_LAYER
951     WRITE(YRECFM,FMT='(A7,I2.2)') 'D_OM_GR',JL
952     YCOMMENT='X_Y_D_OM_GR'
953     CALL WRITE_SURF(HSELECT, &
954                  HPROGRAM,YRECFM,GRS%XSOC(:,JL),IRESP,HCOMMENT=YCOMMENT)
955   END DO
956 !
957 ! Fraction of CLAY in the non-OM part of the green roof layer
958   DO JL=1,GRO%NGROUND_LAYER
959     WRITE(YRECFM,FMT='(A9,I2.2)') 'D_CLAY_GR',JL
960     YCOMMENT='X_Y_D_CLAY_GR'
961     CALL WRITE_SURF(HSELECT, &
962                  HPROGRAM,YRECFM,GRK%XCLAY(:,JL),IRESP,HCOMMENT=YCOMMENT)
963   END DO
964 !
965 ! Fraction of SAND in the non-OM part of the green roof layer
966   DO JL=1,GRO%NGROUND_LAYER
967     WRITE(YRECFM,FMT='(A9,I2.2)') 'D_SAND_GR',JL
968     YCOMMENT='X_Y_D_SAND_GR'
969     CALL WRITE_SURF(HSELECT, &
970                  HPROGRAM,YRECFM,GRK%XSAND(:,JL),IRESP,HCOMMENT=YCOMMENT)
971   END DO
972 !
973 ! LAI of green roof vegetation
974   DO JTIME=1,DTGR%NTIME
975     WRITE(YRECFM,FMT='(A8,I2.2)') 'D_LAI_GR',JTIME
976     YCOMMENT='X_Y_D_LAI_GR'
977     CALL WRITE_SURF(HSELECT, &
978                  HPROGRAM,YRECFM,DTGR%XPAR_LAI(:,JTIME,1),IRESP,HCOMMENT=YCOMMENT)
979   END DO
980
981 ENDIF
982 !-------------------------------------------------------------------------------
983 !
984 !*      Irrigation of gardens or greenroofs
985 !       -----------------------------------
986 !
987 CALL WRITESURF_PGD_TEB_IRRIG_n(HSELECT, TIR, HPROGRAM)
988 !
989 IF (LHOOK) CALL DR_HOOK('WRITESURF_PGD_TEB_PAR_N',1,ZHOOK_HANDLE)
990 !
991 !
992 !-------------------------------------------------------------------------------
993 !
994 END SUBROUTINE WRITESURF_PGD_TEB_PAR_n