SURFEX v8.1
General documentation of Surfex
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 !
38 !
39 USE modd_prep_teb_greenroof, ONLY : xgrid_soil, xwr_def
40 USE modd_data_cover_par, ONLY : nvegtype
41 USE modd_surf_par, ONLY : xundef
43 !
44 !
45 USE yomhook ,ONLY : lhook, dr_hook
46 USE parkind1 ,ONLY : jprb
47 !
48 USE modi_abor1_sfx
49 !
50 IMPLICIT NONE
51 !
52 !* 0.1 declarations of arguments
53 !
54  CHARACTER(LEN=6), INTENT(IN) :: HPROGRAM ! program calling surf. schemes
55  CHARACTER(LEN=7), INTENT(IN) :: HSURF ! type of field
56  CHARACTER(LEN=28), INTENT(IN) :: HFILE ! name of file
57 INTEGER, INTENT(IN) :: KLUOUT ! logical unit of output listing
58 REAL,DIMENSION(:,:,:), POINTER :: PFIELD ! field to interpolate horizontally
59 !
60 !* 0.2 declarations of local variables
61 !
62 REAL, DIMENSION(:) , POINTER :: ZMASK => null() ! Land mask
63 REAL, DIMENSION(:,:), POINTER :: ZFIELD => null() ! field read
64 REAL, DIMENSION(:), POINTER :: ZFIELD1D => null() ! field read
65 REAL, DIMENSION(:,:), POINTER :: ZD => null() ! depth of field in the soil
66 INTEGER :: JVEGTYPE ! loop counter on vegtypes
67 REAL(KIND=JPRB) :: ZHOOK_HANDLE
68 !
69 !-------------------------------------------------------------------------------------
70 !
71 !* 1. Reading of grid
72 ! ---------------
73 !
74 IF (lhook) CALL dr_hook('PREP_TEB_GREENROOF_GRIB',0,zhook_handle)
75 !
76 IF (trim(hfile).NE.cgrib_file) cgrib_file=""
77 !
78  CALL read_grib_land_mask(hfile,kluout,cinmodel,zmask)
79 !
80 !* 2. Reading of field
81 ! ----------------
82 !
83 !* 3. Transformation into physical quantity to be interpolated
84 ! --------------------------------------------------------
85 !
86 SELECT CASE(hsurf)
87 !
88 !* 3.1 Profile of temperature in the soil
89 !
90  CASE('TG ')
91  !* reading of the profile and its depth definition
92  SELECT CASE(cinmodel)
93  CASE('ECMWF ')
94  CALL read_grib_tg_ecmwf(hfile,kluout,cinmodel,zmask,zfield,zd)
95  CASE('ARPEGE','ALADIN','MOCAGE')
96  CALL read_grib_tg_meteo_france(hfile,kluout,cinmodel,zmask,zfield,zd)
97  CASE('HIRLAM')
98  CALL read_grib_tg_hirlam(hfile,kluout,cinmodel,zmask,zfield,zd)
99  END SELECT
100  CALL soil_profile_grib
101 
102  CASE('WG ')
103  !* reading of the profile and its depth definition
104  SELECT CASE(cinmodel)
105  CASE('ECMWF ')
106  CALL read_grib_wg_ecmwf(hfile,kluout,cinmodel,zmask,zfield,zd)
107  CASE('ARPEGE','ALADIN','MOCAGE')
108  CALL read_grib_wg_meteo_france(hfile,kluout,cinmodel,zmask,zfield,zd)
109  CASE('HIRLAM')
110  CALL read_grib_wg_hirlam(hfile,kluout,cinmodel,zmask,zfield,zd)
111  END SELECT
112  CALL soil_profile_grib
113 
114 
115 !* 3.3 Profile of soil ice content
116 
117  CASE('WGI ')
118  !* reading of the profile and its depth definition
119  SELECT CASE(cinmodel)
120  CASE('ECMWF ')
121  CALL read_grib_wgi_ecmwf(hfile,kluout,cinmodel,zmask,zfield,zd)
122  CASE('ARPEGE','ALADIN','MOCAGE')
123  CALL read_grib_wgi_meteo_france(hfile,kluout,cinmodel,zmask,zfield,zd)
124  CASE('HIRLAM')
125  CALL read_grib_wgi_hirlam(hfile,kluout,zfield,zd)
126  END SELECT
127  CALL soil_profile_grib
128 !
129 !* 3.4 Water content intercepted on leaves, LAI
130 !
131  CASE('WR ')
132  ALLOCATE(pfield(nni,1,1))
133  pfield(:,:,:) = xwr_def
134 !
135  CASE('LAI ')
136  ALLOCATE(pfield(nni,1,1))
137  pfield(:,:,:) = xundef
138 !
139 !
140 !* 3.5 Other fields
141 !
142  CASE('ZS ')
143  CALL read_grib_zs_land(hfile,kluout,cinmodel,zmask,zfield1d)
144  ALLOCATE(pfield(SIZE(zfield1d,1),1,1))
145  pfield(:,1,1)=zfield1d(:)
146  DEALLOCATE(zfield1d)
147 
148  CASE DEFAULT
149  CALL abor1_sfx('PREP_TEB_GREENROOF_GRIB: OPTION NOT SUPPORTED - '//hsurf)
150 
151 END SELECT
152 !
153 DEALLOCATE(zmask)
154 !
155 !* 4. Interpolation method
156 ! --------------------
157 !
158 !-------------------------------------------------------------------------------------
159 !-------------------------------------------------------------------------------------
160 !
161 IF (lhook) CALL dr_hook('PREP_TEB_GREENROOF_GRIB',1,zhook_handle)
162 CONTAINS
163 !
164 !-------------------------------------------------------------------------------------
165 !-------------------------------------------------------------------------------------
166 SUBROUTINE soil_profile_grib
167 !-------------------------------------------------------------------------------------
168 !
169 REAL, DIMENSION(:,:), ALLOCATABLE :: ZOUT ! work array
170 REAL(KIND=JPRB) :: ZHOOK_HANDLE
171 !
172 !-------------------------------------------------------------------------------------
173 !
174  !
175  !* interpolation on fine vertical grid
176  IF (lhook) CALL dr_hook('SOIL_PROFILE_GRIB',0,zhook_handle)
177  ALLOCATE(zout(SIZE(zfield,1),SIZE(xgrid_soil)))
178  CALL interp_grid_nat(zd,zfield,xgrid_soil,zout)
179  !
180  !* extends definition to all vegtypes.
181  ALLOCATE(pfield(SIZE(zfield,1),SIZE(xgrid_soil),1))
182  pfield(:,:,1)=zout(:,:)
183  !* end
184  DEALLOCATE(zout)
185  DEALLOCATE(zfield)
186  DEALLOCATE(zd)
187 IF (lhook) CALL dr_hook('SOIL_PROFILE_GRIB',1,zhook_handle)
188 
189 END SUBROUTINE soil_profile_grib
190 !
191 !-------------------------------------------------------------------------------------
192 END SUBROUTINE prep_teb_greenroof_grib
static const char * trim(const char *name, int *n)
Definition: drhook.c:2383
character(len=28) cgrib_file
subroutine read_grib_tg_meteo_france(HGRIB, KLUOUT, HINMODEL, PMASK, PTG, PDT)
subroutine read_grib_zs_land(HGRIB, KLUOUT, HINMODEL, PMASK, PZSL)
subroutine soil_profile_grib
subroutine read_grib_wgi_ecmwf(HGRIB, KLUOUT, HINMODEL, PMASK, PFIELD, PD)
subroutine abor1_sfx(YTEXT)
Definition: abor1_sfx.F90:7
real, parameter xundef
character(len=6) cinmodel
subroutine read_grib_tg_hirlam(HGRIB, KLUOUT, HINMODEL, PMASK, PTG, PDT)
integer, parameter jprb
Definition: parkind1.F90:32
subroutine prep_teb_greenroof_grib(HPROGRAM, HSURF, HFILE, KLUOUT, PFIELD)
logical lhook
Definition: yomhook.F90:15
subroutine read_grib_land_mask(HGRIB, KLUOUT, HINMODEL, PMASK)
subroutine read_grib_wg_meteo_france(HGRIB, KLUOUT, HINMODEL, PMASK, PFIELD, PD)
subroutine read_grib_tg_ecmwf(HGRIB, KLUOUT, HINMODEL, PMASK, PTG, PD)
subroutine read_grib_wg_hirlam(HGRIB, KLUOUT, HINMODEL, PMASK, PFIELD, PD)
subroutine read_grib_wgi_hirlam(HGRIB, KLUOUT, PFIELD, PD)
subroutine read_grib_wgi_meteo_france(HGRIB, KLUOUT, HINMODEL, PMASK, PFIELD, PD)
subroutine read_grib_wg_ecmwf(HGRIB, KLUOUT, HINMODEL, PMASK, PFIELD, PD)