SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
mode_read_surf_cov.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 
7 
8 !RJ: split cover from read_surf.F90 to avoid compiler bugs
9 !RJ: all safety compatibility checks should be done here
10 PUBLIC :: read_surf_cov
11 
12  CONTAINS
13 
14 ! #############################################################
15  SUBROUTINE read_surf_cov (&
16  hprogram,hrec,pfield,oflag,kresp,hcomment,hdir)
17 ! #############################################################
18 !
19 !
20 !
21 !
22 USE modd_surf_par, ONLY : xundef
23 !
25 #ifdef SFX_MNH
26 USE modi_read_surfx2cov_mnh
27 #endif
28 !
29 USE yomhook ,ONLY : lhook, dr_hook
30 USE parkind1 ,ONLY : jprb
31 !
32 IMPLICIT NONE
33 !
34 !* 0.1 Declarations of arguments
35 !
36 !
37 !
38  CHARACTER(LEN=6), INTENT(IN) :: hprogram ! calling program
39  CHARACTER(LEN=*), INTENT(IN) :: hrec ! name of the article to be read
40 REAL, DIMENSION(:,:), INTENT(OUT) :: pfield ! array containing the data field
41 LOGICAL,DIMENSION(:), INTENT(IN) :: oflag ! mask for array filling
42 INTEGER, INTENT(OUT) :: kresp ! KRESP : return-code if a problem appears
43  CHARACTER(LEN=*), OPTIONAL, INTENT(OUT) :: hcomment ! name of the article to be read
44  CHARACTER(LEN=1), OPTIONAL, INTENT(IN) :: hdir ! type of field :
45 ! ! 'H' : field with
46 ! ! horizontal spatial dim.
47 ! ! '-' : no horizontal dim.
48 !* 0.2 Declarations of local variables
49 !
50  CHARACTER(LEN=100) :: ycomment
51  CHARACTER(LEN=16) :: yrec
52  CHARACTER(LEN=1) :: ydir
53 INTEGER :: jj
54 INTEGER :: jcover
55 INTEGER :: il1, il2
56 REAL(KIND=JPRB) :: zhook_handle
57 !
58 IF (lhook) CALL dr_hook('READ_SURF_COV',0,zhook_handle)
59 !
60 yrec = hrec
61 ycomment="empty"
62 ydir = 'H'
63 IF (present(hdir)) ydir = hdir
64 !
65 il1 = SIZE(pfield,1)
66 il2 = SIZE(pfield,2)
67 !
68 pfield(:,:)=xundef
69 !
70 IF (hprogram=='MESONH') THEN
71 #ifdef SFX_MNH
72  CALL read_surfx2cov_mnh(yrec,il1,il2,pfield,oflag,kresp,ycomment,ydir)
73 #endif
74 ELSE
75  !
76  jcover = 0
77  DO jj=1,SIZE(oflag)
78  !
79  IF (.NOT. oflag(jj)) cycle
80  !
81  jcover = jcover + 1
82  !
83  WRITE(yrec,'(A5,I3.3)') 'COVER',jj
84  ycomment='X_Y_'//yrec
85 !RJ: xundef is done for whole array above, to ensure status INTENT(OUT)
86 !RJ PFIELD(:,JCOVER)=0.
87  !
88  CALL read_surf(hprogram,yrec,pfield(:,jcover),kresp,ycomment,ydir)
89  !
90  END DO
91  !
92 ENDIF
93 !
94 !RJ: what is a point of comment here? last field comment? Should be 'COVER_PACKED' status?
95 IF (present(hcomment)) hcomment = ycomment
96 !
97 IF (lhook) CALL dr_hook('READ_SURF_COV',1,zhook_handle)
98 !
99 END SUBROUTINE read_surf_cov
100 
101 END MODULE mode_read_surf_cov
subroutine, public read_surf_cov(HPROGRAM, HREC, PFIELD, OFLAG, KRESP, HCOMMENT, HDIR)