SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
read_ascllv.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_ascllv (USS, &
7  hprogram,hsubroutine,hfilename)
8 ! ##############################################################
9 !
10 !!**** *READ_ASCLLV* reads a binary latlonvalue file and call treatment
11 !! subroutine
12 !!
13 !! PURPOSE
14 !! -------
15 !!
16 !! AUTHOR
17 !! ------
18 !!
19 !! V. Masson Meteo-France
20 !!
21 !! MODIFICATION
22 !! ------------
23 !!
24 !! Original 12/09/95
25 !! 03/2004 externalization (V. Masson)
26 !!
27 !----------------------------------------------------------------------------
28 !
29 !* 0. DECLARATION
30 ! -----------
31 !
32 !
33 !
35 !
36 USE modd_pgd_grid, ONLY : llatlonmask
37 !
38 USE modi_open_file
39 USE modi_close_file
40 USE modi_pt_by_pt_treatment
41 USE modi_get_luout
42 !
43 !
44 USE yomhook ,ONLY : lhook, dr_hook
45 USE parkind1 ,ONLY : jprb
46 !
47 IMPLICIT NONE
48 !
49 !* 0.1 Declaration of arguments
50 ! ------------------------
51 !
52 !
53 TYPE(surf_atm_sso_t), INTENT(INOUT) :: uss
54 !
55  CHARACTER(LEN=6), INTENT(IN) :: hprogram ! Type of program
56  CHARACTER(LEN=6), INTENT(IN) :: hsubroutine ! Name of the subroutine to call
57  CHARACTER(LEN=28), INTENT(IN) :: hfilename ! Name of the field file.
58 !
59 !
60 !* 0.2 Declaration of local variables
61 ! ------------------------------
62 !
63 INTEGER :: iglb ! logical unit
64 !
65 INTEGER :: jlat, jlon ! indexes of OLATLONMASK array
66 REAL :: zvalue ! values of a data point
67 REAL :: zlat ! latitude of data point
68 REAL :: zlon ! longitude of data point
69 !
70 INTEGER :: iluout ! output listing
71 REAL(KIND=JPRB) :: zhook_handle
72 !----------------------------------------------------------------------------
73 !
74 !* 1. Open the file
75 ! -------------
76 !
77 IF (lhook) CALL dr_hook('READ_ASCLLV',0,zhook_handle)
78  CALL open_file('ASCII ',iglb,hfilename,'FORMATTED',haction='READ')
79 !
80  CALL get_luout(hprogram,iluout)
81 !
82 !----------------------------------------------------------------------------
83 DO
84 !----------------------------------------------------------------------------
85 !
86 !* 3. Reading of a data point
87 ! -----------------------
88 !
89  READ(iglb,*,end=99) zlat,zlon,zvalue
90 !
91 !----------------------------------------------------------------------------
92 !
93 !* 4. Test if point is in MESO-NH domain
94 ! ----------------------------------
95 !
96  zlon=zlon+nint((180.-zlon)/360.)*360.
97  !
98  jlat = 1 + int( ( zlat + 90. ) * 2. )
99  jlat = min(jlat,360)
100  jlon = 1 + int( ( zlon ) * 2. )
101  jlon = min(jlon,720)
102  !
103  IF (.NOT. llatlonmask(jlon,jlat)) cycle
104 !
105 !-------------------------------------------------------------------------------
106 !
107 !* 5. Call to the adequate subroutine (point by point treatment)
108 ! ----------------------------------------------------------
109 !
110  CALL pt_by_pt_treatment(uss, &
111  iluout, (/ zlat /) , (/ zlon /) , (/ zvalue /) , &
112  hsubroutine )
113 !
114 !-------------------------------------------------------------------------------
115 ENDDO
116 !
117 !----------------------------------------------------------------------------
118 !
119 !* 8. Closing of the data file
120 ! ------------------------
121 !
122 99 CONTINUE
123  CALL close_file('ASCII ',iglb)
124 IF (lhook) CALL dr_hook('READ_ASCLLV',1,zhook_handle)
125 !
126 !-------------------------------------------------------------------------------
127 !
128 END SUBROUTINE read_ascllv
subroutine read_ascllv(USS, HPROGRAM, HSUBROUTINE, HFILENAME)
Definition: read_ascllv.F90:6
subroutine pt_by_pt_treatment(USS, KLUOUT, PLAT, PLON, PVALUE, HSUBROUTINE, KNBLINES, PNODATA)
subroutine close_file(HPROGRAM, KUNIT)
Definition: close_file.F90:6
subroutine get_luout(HPROGRAM, KLUOUT)
Definition: get_luout.F90:6
subroutine open_file(HPROGRAM, KUNIT, HFILE, HFORM, HACTION, HACCESS, KRECL)
Definition: open_file.F90:6