CTBTO FLEXPART WO4 (2015-10-15)
 All Classes Files Functions Variables
grib2check.F90
Go to the documentation of this file.
1 subroutine grib2check(igrib,isec1,conversion_factor)
2 #if defined WITH_CTBTO_PATCHES
3  use grib_api
4  use par_mod
5  use com_mod
6 
7  implicit none
8  integer :: gribver,parcat,parnum,typsurf,valsurf,discipl,parid
9  integer :: iret,igrib
10  integer :: isec1(*)
11  real :: conversion_factor
12 
13  !HSO grib api error messages
14  character(len=24) :: griberrormsg = 'Error reading grib file'
15  character(len=20) :: gribfunction = 'readwind'
16 
17  !print*,'GRiB Edition 2'
18  !read the grib2 identifiers
19  call grib_get_int(igrib,'discipline',discipl,iret)
20  call grib_check(iret,gribfunction,griberrormsg)
21  call grib_get_int(igrib,'parameterCategory',parcat,iret)
22  call grib_check(iret,gribfunction,griberrormsg)
23  call grib_get_int(igrib,'parameterNumber',parnum,iret)
24  call grib_check(iret,gribfunction,griberrormsg)
25  call grib_get_int(igrib,'typeOfFirstFixedSurface',typsurf,iret)
26  call grib_check(iret,gribfunction,griberrormsg)
27  call grib_get_int(igrib,'level',valsurf,iret)
28  call grib_check(iret,gribfunction,griberrormsg)
29  call grib_get_int(igrib,'paramId',parid,iret)
30  call grib_check(iret,gribfunction,griberrormsg)
31 
32  !print*,discipl,parId,parCat,parNum,typSurf,valSurf
33 
34  !convert to grib1 identifiers
35  isec1(6)=-1
36  isec1(7)=-1
37  isec1(8)=-1
38  isec1(8)=valsurf ! level
39 
40 
41  conversion_factor=1.
42  isec1(6)=parid
43 
44  if(parid .eq. 3063 ) then ! acpcp [kg/m2] convert into m
45  conversion_factor=1000.
46  endif
47  if(parid .eq. 0 ) then ! snow depth [kg/m2] convert into m
48  if ((parcat.eq.1).and.(parnum.eq.11).and.(typsurf.eq.1)) then ! SD
49  isec1(6)=141 ! indicatorOfParameter
50  conversion_factor=1000.
51  else
52  print*,'***ERROR: undefined GRiB2 message found!',discipl, &
53  parcat,parnum,typsurf
54 
55  endif
56  endif
57 
58 
59 
60 #endif
61 return
62 end subroutine grib2check
subroutine grib2check(igrib, isec1, conversion_factor)
Definition: grib2check.F90:1