SURFEX v8.1
General documentation of Surfex
prep_isba_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_isba_grib(HPROGRAM,HSURF,HFILE,KLUOUT,PFIELD,OKEY)
7 ! #################################################################################
8 !
9 !!**** *PREP_ISBA_GRIB* - initializes ISBA fields from operational GRIB
10 !!
11 !! PURPOSE
12 !! -------
13 !
14 !!** METHOD
15 !! ------
16 !!
17 !! REFERENCE
18 !! ---------
19 !!
20 !!
21 !! AUTHOR
22 !! ------
23 !! V. Masson
24 !!
25 !! MODIFICATIONS
26 !! -------------
27 !! Original 01/2004
28 !! S. Riette 04/2010 READ_GRIB_WGI_ECMWF interface changed
29 !!------------------------------------------------------------------
30 !
32 !
34 !
36 !
37 USE modd_prep_isba, ONLY : xgrid_soil, xwr_def, xwrv_def, &
38  xwrvn_def, xqc_def
39 USE modd_surf_par, ONLY : xundef
41 !
42 !
43 USE yomhook ,ONLY : lhook, dr_hook
44 USE parkind1 ,ONLY : jprb
45 !
46 USE modi_abor1_sfx
47 !
48 IMPLICIT NONE
49 !
50 !* 0.1 declarations of arguments
51 !
52  CHARACTER(LEN=6), INTENT(IN) :: HPROGRAM ! program calling surf. schemes
53  CHARACTER(LEN=7), INTENT(IN) :: HSURF ! type of field
54  CHARACTER(LEN=28), INTENT(IN) :: HFILE ! name of file
55 INTEGER, INTENT(IN) :: KLUOUT ! logical unit of output listing
56 REAL,DIMENSION(:,:,:), POINTER :: PFIELD ! field to interpolate horizontally
57 LOGICAL, OPTIONAL, INTENT(INOUT) :: OKEY
58 !
59 !* 0.2 declarations of local variables
60 !
61 REAL, DIMENSION(:) , POINTER :: ZMASK => null() ! Land mask
62 REAL, DIMENSION(:,:), POINTER :: ZFIELD => null() ! field read
63 REAL, DIMENSION(:), POINTER :: ZFIELD1D => null() ! field read
64 REAL, DIMENSION(:,:), POINTER :: ZD => null() ! layer thicknesses
65 INTEGER :: JVEGTYPE ! loop counter on vegtypes
66 REAL(KIND=JPRB) :: ZHOOK_HANDLE
67 !
68 !-------------------------------------------------------------------------------------
69 !
70 !* 1. Reading of grid
71 ! ---------------
72 !
73 IF (lhook) CALL dr_hook('PREP_ISBA_GRIB',0,zhook_handle)
74 !
75 IF (trim(hfile).NE.cgrib_file) cgrib_file=""
76 !
77  CALL read_grib_land_mask(hfile,kluout,cinmodel,zmask)
78 !
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  IF(PRESENT(okey))okey=.false.
95  CALL read_grib_tg_ecmwf(hfile,kluout,cinmodel,zmask,zfield,zd)
96  CASE('ARPEGE','ALADIN','MOCAGE')
97  CALL read_grib_tg_meteo_france(hfile,kluout,cinmodel,zmask,zfield,zd)
98  CASE('HIRLAM')
99  CALL read_grib_tg_hirlam(hfile,kluout,cinmodel,zmask,zfield,zd)
100  END SELECT
101  CALL soil_profile_grib
102 
103  CASE('WG ')
104  !* reading of the profile and its depth definition
105  SELECT CASE(cinmodel)
106  CASE('ECMWF ')
107  IF(PRESENT(okey))okey=.false.
108  CALL read_grib_wg_ecmwf(hfile,kluout,cinmodel,zmask,zfield,zd)
109  CASE('ARPEGE','ALADIN','MOCAGE')
110  CALL read_grib_wg_meteo_france(hfile,kluout,cinmodel,zmask,zfield,zd)
111  CASE('HIRLAM')
112  CALL read_grib_wg_hirlam(hfile,kluout,cinmodel,zmask,zfield,zd)
113  END SELECT
114  CALL soil_profile_grib
115 
116 !* 3.3 Profile of soil ice content
117 
118  CASE('WGI ')
119  !* reading of the profile and its depth definition
120  SELECT CASE(cinmodel)
121  CASE('ECMWF ')
122  IF(PRESENT(okey))okey=.false.
123  CALL read_grib_wgi_ecmwf(hfile,kluout,cinmodel,zmask,zfield,zd)
124  CASE('ARPEGE','ALADIN','MOCAGE')
125  CALL read_grib_wgi_meteo_france(hfile,kluout,cinmodel,zmask,zfield,zd)
126  CASE('HIRLAM')
127  CALL read_grib_wgi_hirlam(hfile,kluout,zfield,zd)
128  END SELECT
129  CALL soil_profile_grib
130 !
131 !* 3.4 Water content intercepted on leaves, LAI
132 !
133  CASE('WR ')
134  ALLOCATE(pfield(nni,1,1))
135  pfield(:,:,:) = xwr_def
136 !
137  CASE('LAI ')
138  ALLOCATE(pfield(nni,1,1))
139  pfield(:,:,:) = xundef
140 !
141 !
142 !* 3.5 Other fields
143 !
144  CASE('ZS ')
145  CALL read_grib_zs_land(hfile,kluout,cinmodel,zmask,zfield1d)
146  ALLOCATE(pfield(SIZE(zfield1d,1),1,1))
147  pfield(:,1,1)=zfield1d(:)
148  DEALLOCATE(zfield1d)
149 !
150  CASE('ICE_STO')
151  ALLOCATE(pfield(nni,1,1))
152  pfield(:,:,:) = 0.0
153 !
154 !* 3.6 MEB fields
155 !
156  CASE('WRV ')
157  ALLOCATE(pfield(nni,1,1))
158  pfield(:,:,:) = xwrv_def
159 !
160  CASE('WRVN ')
161  ALLOCATE(pfield(nni,1,1))
162  pfield(:,:,:) = xwrvn_def
163 !
164  CASE('QC ')
165  ALLOCATE(pfield(nni,1,1))
166  pfield(:,:,:) = xqc_def
167 !
168  CASE('TV ','TC ')
169  !* reading of the profile and its depth definition
170  SELECT CASE(cinmodel)
171  CASE('ECMWF ')
172  IF(PRESENT(okey))okey=.false.
173  CALL read_grib_tg_ecmwf(hfile,kluout,cinmodel,zmask,zfield,zd)
174  CASE('ARPEGE','ALADIN','MOCAGE')
175  CALL read_grib_tg_meteo_france(hfile,kluout,cinmodel,zmask,zfield,zd)
176  CASE('HIRLAM')
177  CALL read_grib_tg_hirlam(hfile,kluout,cinmodel,zmask,zfield,zd)
178  END SELECT
179  ALLOCATE(pfield(nni,1,1))
180  pfield(:,1,1) =zfield(:,1)
181  DEALLOCATE(zfield)
182  DEALLOCATE(zd)
183 !
184  CASE DEFAULT
185  CALL abor1_sfx('PREP_ISBA_GRIB: '//trim(hsurf)//" initialization not implemented !")
186 !
187 END SELECT
188 !
189 DEALLOCATE(zmask)
190 !
191 !* 4. Interpolation method
192 ! --------------------
193 !
194 !-------------------------------------------------------------------------------------
195 !-------------------------------------------------------------------------------------
196 !
197 IF (lhook) CALL dr_hook('PREP_ISBA_GRIB',1,zhook_handle)
198 CONTAINS
199 !
200 !-------------------------------------------------------------------------------------
201 !-------------------------------------------------------------------------------------
202 SUBROUTINE soil_profile_grib
203 !-------------------------------------------------------------------------------------
204 !
205 REAL, DIMENSION(:,:), ALLOCATABLE :: ZOUT ! work array
206 REAL(KIND=JPRB) :: ZHOOK_HANDLE
207 !
208 !-------------------------------------------------------------------------------------
209 !
210  !
211  !* interpolation on fine vertical grid
212  IF (lhook) CALL dr_hook('SOIL_PROFILE_GRIB',0,zhook_handle)
213  ALLOCATE(zout(SIZE(zfield,1),SIZE(xgrid_soil)))
214  CALL interp_grid_nat(zd,zfield,xgrid_soil,zout)
215  !
216  !* extends definition to all vegtypes.
217  ALLOCATE(pfield(SIZE(zfield,1),SIZE(xgrid_soil),1))
218  pfield(:,:,1)=zout(:,:)
219  !* end
220  DEALLOCATE(zout)
221  DEALLOCATE(zfield)
222  DEALLOCATE(zd)
223 IF (lhook) CALL dr_hook('SOIL_PROFILE_GRIB',1,zhook_handle)
224 
225 END SUBROUTINE soil_profile_grib
226 !
227 !-------------------------------------------------------------------------------------
228 END SUBROUTINE prep_isba_grib
static const char * trim(const char *name, int *n)
Definition: drhook.c:2383
character(len=28) cgrib_file
subroutine prep_isba_grib(HPROGRAM, HSURF, HFILE, KLUOUT, PFIELD, OKEY)
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
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)