SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
read_teb_patch.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 read_teb_patch (&
7  hfilepgd,hfilepgdtype,kteb_patch)
8 ! #######################
9 !
10 !
11 !
12 !
14 USE modi_town_presence
15 !
16 USE modi_open_aux_io_surf
17 USE modi_close_aux_io_surf
18 !
19 USE yomhook ,ONLY : lhook, dr_hook
20 USE parkind1 ,ONLY : jprb
21 !
22 IMPLICIT NONE
23 !
24 !* dummy arguments
25 ! ---------------
26 !
27 !
28 !
29  CHARACTER(LEN=28), INTENT(IN) :: hfilepgd ! name of file
30  CHARACTER(LEN=6), INTENT(IN) :: hfilepgdtype ! type of file
31 INTEGER, INTENT(OUT) :: kteb_patch! number of TEB patches
32 !
33 !
34 !* local variables
35 ! ---------------
36 !
37  CHARACTER(LEN=12) :: yrecfm ! Name of the article to be read
38 INTEGER :: iresp ! reading return code
39 !
40 INTEGER :: iversion ! surface version
41 INTEGER :: ibugfix ! surface bugfix
42 LOGICAL :: gtown
43 REAL(KIND=JPRB) :: zhook_handle
44 !
45 !
46 !------------------------------------------------------------------------------
47 !
48 IF (lhook) CALL dr_hook('READ_TEB_PATCH',0,zhook_handle)
49 !
50  CALL open_aux_io_surf(&
51  hfilepgd,hfilepgdtype,'FULL ')
52 yrecfm='VERSION'
53  CALL read_surf(&
54  hfilepgdtype,yrecfm,iversion,iresp)
55 yrecfm='BUG'
56  CALL read_surf(&
57  hfilepgdtype,yrecfm,ibugfix,iresp)
58 !
59  CALL town_presence(&
60  hfilepgdtype,gtown)
61  CALL close_aux_io_surf(hfilepgd,hfilepgdtype)
62 !
63 IF (iversion<7 .OR. (iversion==7 .AND. ibugfix<=2).OR..NOT.gtown) THEN
64  kteb_patch = 1
65 ELSE
66  yrecfm='TEB_PATCH'
67  CALL open_aux_io_surf(&
68  hfilepgd,hfilepgdtype,'TOWN ')
69  CALL read_surf(&
70  hfilepgdtype,yrecfm,kteb_patch,iresp)
71  CALL close_aux_io_surf(hfilepgd,hfilepgdtype)
72 END IF
73 !
74 IF (lhook) CALL dr_hook('READ_TEB_PATCH',1,zhook_handle)
75 !
76 !------------------------------------------------------------------------------
77 !
78 END SUBROUTINE read_teb_patch
subroutine close_aux_io_surf(HFILE, HFILETYPE)
subroutine open_aux_io_surf(HFILE, HFILETYPE, HMASK)
subroutine read_teb_patch(HFILEPGD, HFILEPGDTYPE, KTEB_PATCH)
subroutine town_presence(HFILETYPE, OTEB)