SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
test_record_len.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 test_record_len (DGU, &
7  hprogram,hrec,onowrite)
8 !#################################################
9 !
10 !!
11 !! MODIFICATIONS
12 !! -------------
13 !! B. Decharme 07/2013 write 'time' in netcdf output files
14 !-------------------------------------------------------------------------------
15 !
16 !
18 !
19 USE modi_get_luout
20 !
21 !
22 USE yomhook ,ONLY : lhook, dr_hook
23 USE parkind1 ,ONLY : jprb
24 !
25 USE modi_abor1_sfx
26 !
27 IMPLICIT NONE
28 !
29 !
30 TYPE(diag_surf_atm_t), INTENT(INOUT) :: dgu
31 !
32  CHARACTER(LEN=6), INTENT(IN) :: hprogram ! calling program
33  CHARACTER(LEN=12), INTENT(IN) :: hrec ! name of the article to be written
34 LOGICAL, INTENT(OUT) :: onowrite ! flag for article to be written
35 !
36  CHARACTER(LEN=12) :: yrec
37 INTEGER :: ifield,jfield
38 INTEGER :: iluout ! listing logical unit
39 REAL(KIND=JPRB) :: zhook_handle
40 !-------------------------------------------------------------------------------
41 IF (lhook) CALL dr_hook('MODI_WRITE_SURF:TEST_RECORD_LEN',0,zhook_handle)
42 IF (len_trim(hrec)>12) THEN
43  CALL get_luout(hprogram,iluout)
44  WRITE(iluout,*) '----------------------------------------------'
45  WRITE(iluout,*) 'Error occured when writing a field '
46  WRITE(iluout,*) 'The name of the field is too long '
47  WRITE(iluout,*) 'The name must not be longer than 12 characters'
48  WRITE(iluout,*) 'Please shorten the name of your field '
49  WRITE(iluout,fmt='(A32,A12,A1)') ' The field name currently is : "',hrec,'"'
50  WRITE(iluout,*) '----------------------------------------------'
51  CALL abor1_sfx('TEST_RECORD_LEN: FIELD NAME TOO LONG --> '//hrec)
52 END IF
53 !
54 yrec = hrec
55 SELECT CASE(hrec(1:4))
56  CASE("TEB1","TEB2","TEB3","TEB4","TEB5","TEB6","TEB7","TEB8","TEB9")
57  yrec=hrec(6:len(hrec))
58 END SELECT
59 ! if output fields selection is active, test if this field is to be written
60 IF (dgu%LSELECT) THEN
61  ifield=count(dgu%CSELECT /= ' ')
62  onowrite=.true.
63  DO jfield=1,ifield
64  IF ( trim(dgu%CSELECT(jfield))==trim(yrec) ) THEN
65  onowrite=.false.
66  ENDIF
67  ENDDO
68  !special case for netcdf output
69  IF(trim(yrec)=='time')onowrite=.false.
70 ELSE
71  onowrite=.false.
72 ENDIF
73 IF (lhook) CALL dr_hook('MODI_WRITE_SURF:TEST_RECORD_LEN',1,zhook_handle)
74 !
75 !-------------------------------------------------------------------------------
76 END SUBROUTINE test_record_len
subroutine abor1_sfx(YTEXT)
Definition: abor1_sfx.F90:6
subroutine test_record_len(DGU, HPROGRAM, HREC, ONOWRITE)
subroutine get_luout(HPROGRAM, KLUOUT)
Definition: get_luout.F90:6