69 USE modd_assim, ONLY : lassim, cassim, cassim_isba, nie, nens, &
70 xaddtimecorr, lens_gen, nvar
75 USE modi_writesurf_gr_snow
78 USE yomhook
,ONLY : lhook, dr_hook
79 USE parkind1
,ONLY : jprb
92 TYPE(dst_t),
INTENT(INOUT) :: dst
93 TYPE(isba_t
),
INTENT(INOUT) :: i
95 CHARACTER(LEN=6),
INTENT(IN) :: hprogram
96 LOGICAL,
INTENT(IN) :: oland_use
102 CHARACTER(LEN=12) :: yrecfm
103 CHARACTER(LEN=4 ) :: ylvl
104 CHARACTER(LEN=3 ) :: yvar
105 CHARACTER(LEN=100):: ycomment
106 CHARACTER(LEN=25) :: yform
108 INTEGER :: jj, jlayer, jp, jnbiomass, jnlitter, jnsoilcarb, jnlittlevs
111 INTEGER :: isize_lmeb_patch
114 REAL(KIND=JPRB) :: zhook_handle
121 IF (lhook) CALL dr_hook(
'WRITESURF_ISBA_N',0,zhook_handle)
125 iwork=i%NTEMPLAYER_ARP
126 ELSEIF(i%CISBA==
'DIF')
THEN
127 iwork=i%NGROUND_LAYER
133 WRITE(ylvl,
'(I4)') jlayer
134 yrecfm=
'TG'//adjustl(ylvl(:len_trim(ylvl)))
136 IF (jlayer >= 10) yform=
'(A6,I2.2,A4)'
137 WRITE(ycomment,fmt=yform)
'X_Y_TG',jlayer,
' (K)'
139 hprogram,yrecfm,i%XTG(:,jlayer,:),iresp,hcomment=ycomment)
144 DO jlayer=1,i%NGROUND_LAYER
145 WRITE(ylvl,
'(I4)') jlayer
146 yrecfm=
'WG'//adjustl(ylvl(:len_trim(ylvl)))
148 IF (jlayer >= 10) yform=
'(A6,I2.2,A8)'
149 WRITE(ycomment,fmt=yform)
'X_Y_WG',jlayer,
' (m3/m3)'
151 hprogram,yrecfm,i%XWG(:,jlayer,:),iresp,hcomment=ycomment)
156 IF(i%CISBA==
'DIF')
THEN
157 iwork=i%NGROUND_LAYER
163 WRITE(ylvl,
'(I4)') jlayer
164 yrecfm=
'WGI'//adjustl(ylvl(:len_trim(ylvl)))
166 IF (jlayer >= 10) yform=
'(A7,I2.2,A8)'
167 WRITE(ycomment,yform)
'X_Y_WGI',jlayer,
' (m3/m3)'
169 hprogram,yrecfm,i%XWGI(:,jlayer,:),iresp,hcomment=ycomment)
175 ycomment=
'X_Y_WR (kg/m2)'
177 hprogram,yrecfm,i%XWR(:,:),iresp,hcomment=ycomment)
182 ycomment=
'LGLACIER key for external prep'
184 hprogram,yrecfm,i%LGLACIER,iresp,hcomment=ycomment)
188 ycomment=
'X_Y_ICE_STO (kg/m2)'
190 hprogram,yrecfm,i%XICE_STO(:,:),iresp,hcomment=ycomment)
195 IF (i%CPHOTO/=
'NON' .AND. i%CPHOTO/=
'AGS' .AND. i%CPHOTO/=
'AST')
THEN
199 ycomment=
'X_Y_LAI (m2/m2)'
201 hprogram,yrecfm,i%XLAI(:,:),iresp,hcomment=ycomment)
205 IF ( trim(cassim_isba)==
"ENKF" .AND. (lassim .OR. nie/=0) )
THEN
207 IF ( xaddtimecorr(jvar)>0. )
THEN
208 WRITE(yvar,
'(I3)') jvar
209 ycomment =
'Red_Noise_Enkf'
210 yrecfm=
'RED_NOISE'//adjustl(yvar(:len_trim(yvar)))
212 hprogram,yrecfm,i%XRED_NOISE(:,:,jvar),iresp,hcomment=ycomment)
220 hprogram,
'VEG',
' ',i%TSNOW)
225 IF(i%CISBA==
'DIF')
THEN
228 ycomment=
'SOC key for external prep'
230 hprogram,yrecfm,i%LSOC,iresp,hcomment=ycomment)
235 ycomment=
'LTEMP_ARP key for external prep'
237 hprogram,yrecfm,i%LTEMP_ARP,iresp,hcomment=ycomment)
241 ycomment=
'NTEMPLAYER_ARP for external prep'
243 hprogram,yrecfm,i%NTEMPLAYER_ARP,iresp,hcomment=ycomment)
254 isize_lmeb_patch=count(i%LMEB_PATCH(:))
256 IF (isize_lmeb_patch>0)
THEN
261 ycomment=
'X_Y_WRL (kg/m2)'
263 hprogram,yrecfm,i%XWRL(:,:),iresp,hcomment=ycomment)
268 ycomment=
'X_Y_WRLI (kg/m2)'
270 hprogram,yrecfm,i%XWRLI(:,:),iresp,hcomment=ycomment)
275 ycomment=
'X_Y_WRVN (kg/m2)'
277 hprogram,yrecfm,i%XWRVN(:,:),iresp,hcomment=ycomment)
282 ycomment=
'X_Y_TV (K)'
284 hprogram,yrecfm,i%XTV(:,:),iresp,hcomment=ycomment)
289 ycomment=
'X_Y_TL (K)'
291 hprogram,yrecfm,i%XTL(:,:),iresp,hcomment=ycomment)
296 ycomment=
'X_Y_TC (K)'
298 hprogram,yrecfm,i%XTC(:,:),iresp,hcomment=ycomment)
303 ycomment=
'X_Y_QC (kg/kg)'
305 hprogram,yrecfm,i%XQC(:,:),iresp,hcomment=ycomment)
318 ycomment=
'fraction for each patch (-)'
320 hprogram,yrecfm,i%XPATCH(:,:),iresp,hcomment=ycomment)
325 ycomment=
'X_TSRAD_NAT (K)'
327 hprogram,yrecfm,i%XTSRAD_NAT(:),iresp,hcomment=ycomment)
332 ycomment=
'X_Y_RESA (s/m)'
334 hprogram,yrecfm,i%XRESA(:,:),iresp,hcomment=ycomment)
340 DO jlayer=1,i%NGROUND_LAYER
341 WRITE(ylvl,
'(I4)') jlayer
342 yrecfm=
'OLD_DG'//adjustl(ylvl(:len_trim(ylvl)))
344 IF (jlayer >= 10) yform=
'(A6,I2.2,A8)'
345 WRITE(ycomment,fmt=yform)
'X_Y_OLD_DG',jlayer,
' (m)'
347 hprogram,yrecfm,i%XDG(:,jlayer,:),iresp,hcomment=ycomment)
354 IF (i%CPHOTO/=
'NON')
THEN
356 ycomment=
'X_Y_AN (kgCO2/kgair m/s)'
358 hprogram,yrecfm,i%XAN(:,:),iresp,hcomment=ycomment)
361 ycomment=
'X_Y_ANDAY (kgCO2/m2/day)'
363 hprogram,yrecfm,i%XANDAY(:,:),iresp,hcomment=ycomment)
366 ycomment=
'X_Y_ANFM (kgCO2/kgair m/s)'
368 hprogram,yrecfm,i%XANFM(:,:),iresp,hcomment=ycomment)
371 ycomment=
'X_Y_LE_AGS (W/m2)'
373 hprogram,yrecfm,i%XLE(:,:),iresp,hcomment=ycomment)
377 IF (i%CPHOTO==
'NIT' .OR. i%CPHOTO==
'NCB')
THEN
379 DO jnbiomass=1,i%NNBIOMASS
380 WRITE(ylvl,
'(I1)') jnbiomass
381 yrecfm=
'BIOMA'//adjustl(ylvl(:len_trim(ylvl)))
382 yform=
'(A11,I1.1,A10)'
383 WRITE(ycomment,fmt=yform)
'X_Y_BIOMASS',jnbiomass,
' (kgDM/m2)'
385 hprogram,yrecfm,i%XBIOMASS(:,jnbiomass,:),iresp,hcomment=ycomment)
389 DO jnbiomass=2,i%NNBIOMASS
390 WRITE(ylvl,
'(I1)') jnbiomass
391 yrecfm=
'RESPI'//adjustl(ylvl(:len_trim(ylvl)))
392 yform=
'(A16,I1.1,A10)'
393 WRITE(ycomment,fmt=yform)
'X_Y_RESP_BIOMASS',jnbiomass,
' (kg/m2/s)'
395 hprogram,yrecfm,i%XRESP_BIOMASS(:,jnbiomass,:),iresp,hcomment=ycomment)
405 hprogram,yrecfm,i%CRESPSL,iresp,hcomment=ycomment)
410 hprogram,yrecfm,i%NNLITTER,iresp,hcomment=ycomment)
415 hprogram,yrecfm,i%NNLITTLEVS,iresp,hcomment=ycomment)
420 hprogram,yrecfm,i%NNSOILCARB,iresp,hcomment=ycomment)
422 IF(i%LSPINUPCARBS.OR.i%LSPINUPCARBW)
THEN
426 hprogram,yrecfm,i%NNBYEARSOLD,iresp,hcomment=ycomment)
429 IF (i%CRESPSL==
'CNT')
THEN
431 DO jnlitter=1,i%NNLITTER
432 DO jnlittlevs=1,i%NNLITTLEVS
433 WRITE(ylvl,
'(I1,A1,I1)') jnlitter,
'_',jnlittlevs
434 yrecfm=
'LITTER'//adjustl(ylvl(:len_trim(ylvl)))
435 yform=
'(A10,I1.1,A1,I1.1,A8)'
436 WRITE(ycomment,fmt=yform)
'X_Y_LITTER',jnlitter,
' ',jnlittlevs,
' (gC/m2)'
438 hprogram,yrecfm,i%XLITTER(:,jnlitter,jnlittlevs,:),iresp,hcomment=ycomment)
442 DO jnsoilcarb=1,i%NNSOILCARB
443 WRITE(ylvl,
'(I4)') jnsoilcarb
444 yrecfm=
'SOILCARB'//adjustl(ylvl(:len_trim(ylvl)))
446 WRITE(ycomment,fmt=yform)
'X_Y_SOILCARB',jnsoilcarb,
' (gC/m2)'
448 hprogram,yrecfm,i%XSOILCARB(:,jnsoilcarb,:),iresp,hcomment=ycomment)
451 DO jnlittlevs=1,i%NNLITTLEVS
452 WRITE(ylvl,
'(I4)') jnlittlevs
453 yrecfm=
'LIGNIN_STR'//adjustl(ylvl(:len_trim(ylvl)))
454 yform=
'(A12,I1.1,A8)'
455 WRITE(ycomment,fmt=yform)
'X_Y_LIGNIN_STRUC',jnlittlevs,
' (-)'
457 hprogram,yrecfm,i%XLIGNIN_STRUC(:,jnlittlevs,:),iresp,hcomment=ycomment)
463 IF (chi%SVI%NDSTEQ > 0)
THEN
465 WRITE(yrecfm,
'(A8,I3.3)')
'FLX_DSTM',jsv
466 ycomment=
'X_Y_'//yrecfm//
' (kg/m2)'
468 hprogram,yrecfm,dst%XSFDSTM(:,jsv,:),iresp,hcomment=ycomment)
480 hprogram,yrecfm,i%TTIME,iresp,hcomment=ycomment)
481 IF (lhook) CALL dr_hook(
'WRITESURF_ISBA_N',1,zhook_handle)
subroutine writesurf_isba_n(DGU, U, CHI, DST, I, HPROGRAM, OLAND_USE)
subroutine writesurf_gr_snow(DGU, U, HPROGRAM, HSURFTYPE, HPREFIX, TPSNOW)