SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
writesurf_snapn.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 writesurf_snap_n (DGU, U, &
7  chn, &
8  hprogram)
9 ! #######################################################################
10 !
11 !-----------------------------------------------------------------------------
12 !
13 !* 0. DECLARATIONS
14 !
15 !
16 !
17 !
18 !
20 USE modd_surf_atm_n, ONLY : surf_atm_t
21 !
23 !
24 USE modi_get_luout
26 !
27 USE yomhook ,ONLY : lhook, dr_hook
28 USE parkind1 ,ONLY : jprb
29 !
30 USE modi_abor1_sfx
31 !
32 IMPLICIT NONE
33 !
34 !
35 !
36 TYPE(diag_surf_atm_t), INTENT(INOUT) :: dgu
37 TYPE(surf_atm_t), INTENT(INOUT) :: u
38 !
39 TYPE(ch_emis_snap_t), INTENT(INOUT) :: chn
40 !
41  CHARACTER(LEN=6) :: hprogram
42 !
43 !* 0.2 declarations of local variables
44 !
45 INTEGER :: iresp ! I/O error code
46  CHARACTER (LEN=16) :: yrecfm ! article name
47  CHARACTER (LEN=100) :: ycomment ! comment
48 INTEGER :: iluout ! Unit number for prints
49 INTEGER :: jspec ! Loop index for emission species
50 INTEGER :: jsnap ! Loop index for SNAP categories
51 REAL(KIND=JPRB) :: zhook_handle
52 !-------------------------------------------------------------------------------
53 IF (lhook) CALL dr_hook('WRITESURF_SNAP_n',0,zhook_handle)
54  CALL get_luout(hprogram,iluout)
55 !
56 !-------------------------------------------------------------------------------
57 !
58 ycomment = ""
59 !
60 yrecfm='EMISPEC_NBR'
61  CALL write_surf(dgu, u, &
62  hprogram,yrecfm,chn%NEMIS_NBR,iresp,ycomment)
63 yrecfm='SNAP_NBR'
64  CALL write_surf(dgu, u, &
65  hprogram,yrecfm,chn%NEMIS_SNAP,iresp,ycomment)
66 yrecfm='SNAP_TIME'
67  CALL write_surf(dgu, u, &
68  hprogram,yrecfm,chn%CSNAP_TIME_REF,iresp,ycomment)
69 !
70 IF (chn%CSNAP_TIME_REF=='LEGAL') THEN
71  yrecfm='LEGALTIME'
72  CALL write_surf(dgu, u, &
73  hprogram,yrecfm,chn%XDELTA_LEGAL_TIME(:),iresp,ycomment)
74 END IF
75 !-------------------------------------------------------------------------------
76 !
77 DO jspec=1,chn%NEMIS_NBR
78 ! Writes the name of species
79  WRITE(yrecfm,'("EMISNAME",I3.3)') jspec
80  ycomment = chn%CEMIS_COMMENT(jspec)
81  CALL write_surf(dgu, u, &
82  hprogram,yrecfm,chn%CEMIS_NAME(jspec),iresp,ycomment)
83 !
84 ! Writes the temporal profiles of all snaps
85  yrecfm = "E_"//trim(chn%CEMIS_NAME(jspec))//"_M"
86  CALL write_surf(dgu, u, &
87  hprogram,yrecfm,chn%XSNAP_MONTHLY(:,:,jspec),iresp,ycomment,&
88  hdir='-',hnam_dim="Nemis_snap ")
89  yrecfm = "E_"//trim(chn%CEMIS_NAME(jspec))//"_D"
90  CALL write_surf(dgu, u, &
91  hprogram,yrecfm,chn%XSNAP_DAILY(:,:,jspec),iresp,ycomment,&
92  hdir='-',hnam_dim="Nemis_snap ")
93  yrecfm = "E_"//trim(chn%CEMIS_NAME(jspec))//"_H"
94  CALL write_surf(dgu, u, &
95  hprogram,yrecfm,chn%XSNAP_HOURLY(:,:,jspec),iresp,ycomment,&
96  hdir='-',hnam_dim="Nemis_snap ")
97 ! Writes the potential emission of species for each snap
98  DO jsnap=1,chn%NEMIS_SNAP
99  WRITE(yrecfm,'("SNAP",I2.2,"_",A3)') jsnap,chn%CEMIS_NAME(jspec)
100  CALL write_surf(dgu, u, &
101  hprogram,yrecfm,chn%XEMIS_FIELDS_SNAP(:,jsnap,jspec),iresp,ycomment)
102  END DO
103 !
104 END DO
105 !
106 !-------------------------------------------------------------------------------
107 IF (lhook) CALL dr_hook('WRITESURF_SNAP_n',1,zhook_handle)
108 !-------------------------------------------------------------------------------
109 !
110 END SUBROUTINE writesurf_snap_n
subroutine writesurf_snap_n(DGU, U, CHN, HPROGRAM)
subroutine get_luout(HPROGRAM, KLUOUT)
Definition: get_luout.F90:6