SURFEX v8.1
General documentation of Surfex
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 (HSELECT, CHN, HPROGRAM)
7 ! #######################################################################
8 !
9 !-----------------------------------------------------------------------------
10 !
11 !* 0. DECLARATIONS
12 !
13 !
15 !
16 USE modi_get_luout
18 USE modi_write_surf_field2d
19 !
20 USE yomhook ,ONLY : lhook, dr_hook
21 USE parkind1 ,ONLY : jprb
22 !
23 USE modi_abor1_sfx
24 !
25 IMPLICIT NONE
26 !
27  CHARACTER(LEN=*), DIMENSION(:), INTENT(IN) :: HSELECT
28 !
29 TYPE(ch_emis_snap_t), INTENT(INOUT) :: CHN
30 !
31  CHARACTER(LEN=6), INTENT(IN) :: HPROGRAM
32 !
33 !* 0.2 declarations of local variables
34 !
35  CHARACTER(LEN=16) :: YRECFM ! article name
36  CHARACTER(LEN=100) :: YCOMMENT ! comment
37  CHARACTER(LEN=100) :: YCOMMENTUNIT ! Comment string : unit of the datas in the field to write
38 !
39 INTEGER :: IRESP ! I/O error code
40 INTEGER :: ILUOUT ! Unit number for prints
41 INTEGER :: JSPEC ! Loop index for emission species
42 INTEGER :: JSNAP ! Loop index for SNAP categories
43 REAL(KIND=JPRB) :: ZHOOK_HANDLE
44 !-------------------------------------------------------------------------------
45 IF (lhook) CALL dr_hook('WRITESURF_SNAP_n',0,zhook_handle)
46  CALL get_luout(hprogram,iluout)
47 !
48 !-------------------------------------------------------------------------------
49 !
50 ycomment = ""
51 !
52 yrecfm='EMISPEC_NBR'
53  CALL write_surf(hselect, &
54  hprogram,yrecfm,chn%NEMIS_NBR,iresp,ycomment)
55 yrecfm='SNAP_NBR'
56  CALL write_surf(hselect, &
57  hprogram,yrecfm,chn%NEMIS_SNAP,iresp,ycomment)
58 yrecfm='SNAP_TIME'
59  CALL write_surf(hselect, &
60  hprogram,yrecfm,chn%CSNAP_TIME_REF,iresp,ycomment)
61 !
62 IF (chn%CSNAP_TIME_REF=='LEGAL') THEN
63  yrecfm='LEGALTIME'
64  CALL write_surf(hselect, &
65  hprogram,yrecfm,chn%XDELTA_LEGAL_TIME(:),iresp,ycomment)
66 END IF
67 !-------------------------------------------------------------------------------
68 !
69 DO jspec=1,chn%NEMIS_NBR
70 ! Writes the name of species
71  WRITE(yrecfm,'("EMISNAME",I3.3)') jspec
72  ycomment = chn%CEMIS_COMMENT(jspec)
73  CALL write_surf(hselect, &
74  hprogram,yrecfm,chn%CEMIS_NAME(jspec),iresp,ycomment)
75 !
76 ! Writes the temporal profiles of all snaps
77  ycommentunit='-'
78  yrecfm = "E_"//trim(chn%CEMIS_NAME(jspec))//"_M"
79  CALL write_surf_field2d(hselect, hprogram,chn%XSNAP_MONTHLY(:,:,jspec),yrecfm,&
80  ycomment,ycommentunit,hdir='-',hnam_dim="Nemis_snap ")
81  yrecfm = "E_"//trim(chn%CEMIS_NAME(jspec))//"_D"
82  CALL write_surf_field2d(hselect, hprogram,chn%XSNAP_DAILY(:,:,jspec),yrecfm,&
83  ycomment,ycommentunit,hdir='-',hnam_dim="Nemis_snap ")
84  yrecfm = "E_"//trim(chn%CEMIS_NAME(jspec))//"_H"
85  CALL write_surf_field2d(hselect, hprogram,chn%XSNAP_HOURLY(:,:,jspec),yrecfm,&
86  ycomment,ycommentunit,hdir='-',hnam_dim="Nemis_snap ")
87 ! Writes the potential emission of species for each snap
88  DO jsnap=1,chn%NEMIS_SNAP
89  WRITE(yrecfm,'("SN",I2.2,"_",A7)') jsnap,chn%CEMIS_NAME(jspec)
90  CALL write_surf(hselect, &
91  hprogram,yrecfm,chn%XEMIS_FIELDS_SNAP(:,jsnap,jspec),iresp,ycomment)
92  END DO
93 !
94 END DO
95 !
96 !-------------------------------------------------------------------------------
97 IF (lhook) CALL dr_hook('WRITESURF_SNAP_n',1,zhook_handle)
98 !-------------------------------------------------------------------------------
99 !
100 END SUBROUTINE writesurf_snap_n
static const char * trim(const char *name, int *n)
Definition: drhook.c:2383
subroutine writesurf_snap_n(HSELECT, CHN, HPROGRAM)
integer, parameter jprb
Definition: parkind1.F90:32
subroutine get_luout(HPROGRAM, KLUOUT)
Definition: get_luout.F90:7
logical lhook
Definition: yomhook.F90:15
subroutine write_surf_field2d(HSELECT, HPROGRAM, PFIELD2D, HFIELDNAME