SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
prep_teb_greenroof_grib.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 prep_teb_greenroof_grib(HPROGRAM,HSURF,HFILE,KLUOUT,PFIELD)
7 ! #################################################################################
8 !
9 !!**** *PREP_TEB_GREENROOF_GRIB* - initializes ISBA fields from operational GRIB
10 !!
11 !! PURPOSE
12 !! -------
13 !
14 !!** METHOD
15 !! ------
16 !! Based on "prep_teb_garden_grib"
17 !!
18 !! REFERENCE
19 !! ---------
20 !!
21 !!
22 !! AUTHOR
23 !! ------
24 !! A. Lemonsu & C. de Munck
25 !!
26 !! MODIFICATIONS
27 !! -------------
28 !! Original 07/2011
29 !!------------------------------------------------------------------
30 !
31 
32 !
34 !
36 !
37 USE modi_prep_grib_grid
39 !
40 USE modd_prep, ONLY : cingrid_type, cinterp_type
41 USE modd_prep_teb_greenroof, ONLY : xgrid_soil, xwr_def
42 USE modd_data_cover_par, ONLY : nvegtype
43 USE modd_surf_par, ONLY : xundef
44 USE modd_grid_grib, ONLY : cgrib_file, nni
45 !
46 !
47 USE yomhook ,ONLY : lhook, dr_hook
48 USE parkind1 ,ONLY : jprb
49 !
50 USE modi_abor1_sfx
51 !
52 IMPLICIT NONE
53 !
54 !* 0.1 declarations of arguments
55 !
56  CHARACTER(LEN=6), INTENT(IN) :: hprogram ! program calling surf. schemes
57  CHARACTER(LEN=7), INTENT(IN) :: hsurf ! type of field
58  CHARACTER(LEN=28), INTENT(IN) :: hfile ! name of file
59 INTEGER, INTENT(IN) :: kluout ! logical unit of output listing
60 REAL,DIMENSION(:,:,:), POINTER :: pfield ! field to interpolate horizontally
61 !
62 !* 0.2 declarations of local variables
63 !
64 TYPE (date_time) :: tztime_grib ! current date and time
65  CHARACTER(LEN=6) :: yinmodel ! model from which GRIB file originates
66 REAL, DIMENSION(:) , POINTER :: zmask => null() ! Land mask
67 REAL, DIMENSION(:,:), POINTER :: zfield => null() ! field read
68 REAL, DIMENSION(:), POINTER :: zfield1d => null() ! field read
69 REAL, DIMENSION(:,:), POINTER :: zd => null() ! depth of field in the soil
70 INTEGER :: jvegtype ! loop counter on vegtypes
71 REAL(KIND=JPRB) :: zhook_handle
72 !
73 !-------------------------------------------------------------------------------------
74 !
75 !* 1. Reading of grid
76 ! ---------------
77 !
78 IF (lhook) CALL dr_hook('PREP_TEB_GREENROOF_GRIB',0,zhook_handle)
79 !
80 IF (trim(hfile).NE.cgrib_file) cgrib_file=""
81 !
82  CALL prep_grib_grid(hfile,kluout,yinmodel,cingrid_type,tztime_grib)
83 !
84  CALL read_grib_land_mask(hfile,kluout,yinmodel,zmask)
85 !
86 !* 2. Reading of field
87 ! ----------------
88 !
89 !* 3. Transformation into physical quantity to be interpolated
90 ! --------------------------------------------------------
91 !
92 SELECT CASE(hsurf)
93 !
94 !* 3.1 Profile of temperature in the soil
95 !
96  CASE('TG ')
97  !* reading of the profile and its depth definition
98  SELECT CASE(yinmodel)
99  CASE('ECMWF ')
100  CALL read_grib_tg_ecmwf(hfile,kluout,yinmodel,zmask,zfield,zd)
101  CASE('ARPEGE','ALADIN','MOCAGE')
102  CALL read_grib_tg_meteo_france(hfile,kluout,yinmodel,zmask,zfield,zd)
103  CASE('HIRLAM')
104  CALL read_grib_tg_hirlam(hfile,kluout,yinmodel,zmask,zfield,zd)
105  END SELECT
106  CALL soil_profile_grib
107 
108  CASE('WG ')
109  !* reading of the profile and its depth definition
110  SELECT CASE(yinmodel)
111  CASE('ECMWF ')
112  CALL read_grib_wg_ecmwf(hfile,kluout,yinmodel,zmask,zfield,zd)
113  CASE('ARPEGE','ALADIN','MOCAGE')
114  CALL read_grib_wg_meteo_france(hfile,kluout,yinmodel,zmask,zfield,zd)
115  CASE('HIRLAM')
116  CALL read_grib_wg_hirlam(hfile,kluout,yinmodel,zmask,zfield,zd)
117  END SELECT
118  CALL soil_profile_grib
119 
120 
121 !* 3.3 Profile of soil ice content
122 
123  CASE('WGI ')
124  !* reading of the profile and its depth definition
125  SELECT CASE(yinmodel)
126  CASE('ECMWF ')
127  CALL read_grib_wgi_ecmwf(hfile,kluout,yinmodel,zmask,zfield,zd)
128  CASE('ARPEGE','ALADIN','MOCAGE')
129  CALL read_grib_wgi_meteo_france(hfile,kluout,yinmodel,zmask,zfield,zd)
130  CASE('HIRLAM')
131  CALL read_grib_wgi_hirlam(hfile,kluout,zfield,zd)
132  END SELECT
133  CALL soil_profile_grib
134 !
135 !* 3.4 Water content intercepted on leaves, LAI
136 !
137  CASE('WR ')
138  ALLOCATE(pfield(nni,1,nvegtype))
139  pfield(:,:,:) = xwr_def
140 !
141  CASE('LAI ')
142  ALLOCATE(pfield(nni,1,nvegtype))
143  pfield(:,:,:) = xundef
144 !
145 !
146 !* 3.5 Other fields
147 !
148  CASE('ZS ')
149  CALL read_grib_zs_land(hfile,kluout,yinmodel,zmask,zfield1d)
150  ALLOCATE(pfield(SIZE(zfield1d,1),1,1))
151  pfield(:,1,1)=zfield1d(:)
152  DEALLOCATE(zfield1d)
153 
154  CASE default
155  CALL abor1_sfx('PREP_TEB_GREENROOF_GRIB: OPTION NOT SUPPORTED - '//hsurf)
156 
157 END SELECT
158 !
159 DEALLOCATE(zmask)
160 !
161 !* 4. Interpolation method
162 ! --------------------
163 !
164  cinterp_type='HORIBL'
165 !
166 !-------------------------------------------------------------------------------------
167 !-------------------------------------------------------------------------------------
168 !
169 IF (lhook) CALL dr_hook('PREP_TEB_GREENROOF_GRIB',1,zhook_handle)
170  CONTAINS
171 !
172 !-------------------------------------------------------------------------------------
173 !-------------------------------------------------------------------------------------
175 !-------------------------------------------------------------------------------------
176 !
177 REAL, DIMENSION(:,:), ALLOCATABLE :: zout ! work array
178 REAL(KIND=JPRB) :: zhook_handle
179 !
180 !-------------------------------------------------------------------------------------
181 !
182  !
183  !* interpolation on fine vertical grid
184  IF (lhook) CALL dr_hook('SOIL_PROFILE_GRIB',0,zhook_handle)
185  ALLOCATE(zout(SIZE(zfield,1),SIZE(xgrid_soil)))
186  CALL interp_grid_nat(zd,zfield,xgrid_soil,zout)
187  !
188  !* extends definition to all vegtypes.
189  ALLOCATE(pfield(SIZE(zfield,1),SIZE(xgrid_soil),nvegtype))
190  DO jvegtype=1,nvegtype
191  pfield(:,:,jvegtype)=zout(:,:)
192  END DO
193  !* end
194  DEALLOCATE(zout)
195  DEALLOCATE(zfield)
196  DEALLOCATE(zd)
197 IF (lhook) CALL dr_hook('SOIL_PROFILE_GRIB',1,zhook_handle)
198 
199 END SUBROUTINE soil_profile_grib
200 !
201 !-------------------------------------------------------------------------------------
202 END SUBROUTINE prep_teb_greenroof_grib
subroutine read_grib_zs_land(HGRIB, KLUOUT, HINMODEL, PMASK, PZSL)
subroutine read_grib_wg_hirlam(HGRIB, KLUOUT, HINMODEL, PMASK, PFIELD, PD)
subroutine read_grib_tg_meteo_france(HGRIB, KLUOUT, HINMODEL, PMASK, PTG, PDT)
subroutine soil_profile_grib
subroutine read_grib_wgi_meteo_france(HGRIB, KLUOUT, HINMODEL, PMASK, PFIELD, PD)
subroutine read_grib_land_mask(HGRIB, KLUOUT, HINMODEL, PMASK)
subroutine abor1_sfx(YTEXT)
Definition: abor1_sfx.F90:6
subroutine read_grib_wgi_hirlam(HGRIB, KLUOUT, PFIELD, PD)
subroutine read_grib_wg_meteo_france(HGRIB, KLUOUT, HINMODEL, PMASK, PFIELD, PD)
subroutine prep_teb_greenroof_grib(HPROGRAM, HSURF, HFILE, KLUOUT, PFIELD)
subroutine read_grib_tg_ecmwf(HGRIB, KLUOUT, HINMODEL, PMASK, PTG, PD)
subroutine read_grib_wgi_ecmwf(HGRIB, KLUOUT, HINMODEL, PMASK, PFIELD, PD)
subroutine read_grib_wg_ecmwf(HGRIB, KLUOUT, HINMODEL, PMASK, PFIELD, PD)
subroutine read_grib_tg_hirlam(HGRIB, KLUOUT, HINMODEL, PMASK, PTG, PDT)
subroutine prep_grib_grid(HGRIB, KLUOUT, HINMODEL, HGRIDTYPE, TPTIME_GRIB)