SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
read_connex_file.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 ! #######################
7  SUBROUTINE read_connex_file(HPROGRAM,HFILE,HFORM,KNMC,PCONN,KLINE)
8 ! #######################
9 !
10 !!**** *READ_CONNEX_FILE*
11 !!
12 !! PURPOSE
13 !! -------
14 ! This routine aims at reading connexion file
15 !!** METHOD
16 !! ------
17 !
18 !! EXTERNAL
19 !! --------
20 !!
21 !! none
22 !!
23 !! IMPLICIT ARGUMENTS
24 !! ------------------
25 !!
26 !!
27 !!
28 !!
29 !!
30 !! REFERENCE
31 !! ---------
32 !!
33 !!
34 !!
35 !! AUTHOR
36 !! ------
37 !!
38 !! B. Vincendon * Meteo-France *
39 !!
40 !! MODIFICATIONS
41 !! -------------
42 !!
43 !! Original 11/2006
44 !! 03/2014 (B. Vincendon) format correction
45 !-------------------------------------------------------------------------------
46 !
47 !* 0. DECLARATIONS
48 ! ------------
49 !
50 USE modd_topd_par, ONLY : nunit
51 USE modd_topodyn, ONLY : npmax
52 USE modd_surf_par, ONLY : xundef
53 !
54 USE modi_get_luout
55 USE modi_open_file
56 USE modi_close_file
57 !
58 USE yomhook ,ONLY : lhook, dr_hook
59 USE parkind1 ,ONLY : jprb
60 !
61 IMPLICIT NONE
62 !
63 !* 0.1 declarations of arguments
64 !
65  CHARACTER(LEN=*), INTENT(IN) :: hprogram !
66  CHARACTER(LEN=*), INTENT(IN) :: hfile ! File to be read
67  CHARACTER(LEN=*), INTENT(IN) :: hform ! Format of the file to be read
68 INTEGER, INTENT(IN) :: knmc ! Number of pixels in the catchment
69 REAL, DIMENSION(:,:),INTENT(OUT) :: pconn ! pixels topographic slope/length flow
70 INTEGER, DIMENSION(:),INTENT(OUT) :: kline ! second index of the pixel in the array PCONN
71 !
72 !* 0.2 declarations of local variables
73 !
74 !
75 INTEGER :: jj ! loop control
76 INTEGER :: iluout ! Unit of the files
77 INTEGER :: iindex ! index of the pixel in the topo domain
78 REAL(KIND=JPRB) :: zhook_handle
79 !-------------------------------------------------------------------------------
80 IF (lhook) CALL dr_hook('READ_CONNEX_FILE',0,zhook_handle)
81 !
82 !* 0.2 preparing file openning
83 ! ----------------------
84  CALL get_luout(hprogram,iluout)
85 !
86  CALL open_file(hprogram,nunit,hfile,hform,haction='READ')
87 !
88 WRITE(iluout,*) 'Open ',hfile,'debut'
89 !
90 DO jj=1,7
91  READ(nunit,*)
92 ENDDO
93 !
94 DO jj=1,knmc
95  !
96  READ(nunit,*,end=120) pconn(jj,:)
97  iindex = int(pconn(jj,1))
98  kline(iindex) = jj
99  !
100 ENDDO
101 !
102 120 CALL close_file(hprogram,nunit)
103 !
104 IF (lhook) CALL dr_hook('READ_CONNEX_FILE',1,zhook_handle)
105 !
106 END SUBROUTINE read_connex_file
107 
108 
109 
110 
111 
112 
113 
subroutine close_file(HPROGRAM, KUNIT)
Definition: close_file.F90:6
subroutine get_luout(HPROGRAM, KLUOUT)
Definition: get_luout.F90:6
subroutine read_connex_file(HPROGRAM, HFILE, HFORM, KNMC, PCONN, KLINE)
subroutine open_file(HPROGRAM, KUNIT, HFILE, HFORM, HACTION, HACCESS, KRECL)
Definition: open_file.F90:6