Index: src/FLEXPART.f90
===================================================================
--- src/FLEXPART.f90	(revision 77778f8da97550749c019c9f1fc9634c072c42f4)
+++ src/FLEXPART.f90	(revision c0884a86ec69f31a8b28c5554286971ba48392be)
@@ -40,4 +40,7 @@
   !       detected metdata format                                              *
   !     - Passed metdata format down to timemanager                            *
+  !                                                                            *
+  !  Petra Seibert, 2018-06-26: simplified version met data format detection   *
+  !                                                                            *
   !*****************************************************************************
   !                                                                            *
@@ -54,5 +57,5 @@
 
   use random_mod, only: gasdev1
-  use class_gribfile
+  use check_gribfile_mod
 
 #ifdef USE_NCF
@@ -62,10 +65,7 @@
   implicit none
 
-  integer :: i,j,ix,jy,inest
+  integer :: i,j,ix,jy,inest,id_centre
   integer :: idummy = -320
   character(len=256) :: inline_options  !pathfile, flexversion, arg2
-  integer :: metdata_format = GRIBFILE_CENTRE_UNKNOWN
-  integer :: detectformat
-
 
 
@@ -190,13 +190,12 @@
   ! Detect metdata format
   !**********************
-
-  metdata_format = detectformat()
-
-  if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then
-    print *,'ECMWF metdata detected'
-  elseif (metdata_format.eq.GRIBFILE_CENTRE_NCEP) then
-    print *,'NCEP metdata detected'
+  
+  call cg_get_centre(path(3)(1:length(3)) // trim(wfname(1)), id_centre)
+  if (id_centre.eq.icg_id_ecmwf) then
+    print *,'ECMWF met data detected'
+  elseif (id_centre.eq.icg_id_ncep) then
+    print *,'NCEP met data detected'
   else
-    print *,'Unknown metdata format'
+    print *,'Unknown met data format'
     stop
   endif
@@ -220,5 +219,5 @@
   endif
 
-  if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then
+  if (id_centre.eq.icg_id_ecmwf) then
     call gridcheck_ecmwf
   else
@@ -449,5 +448,5 @@
   endif
 
-  call timemanager(metdata_format)
+  call timemanager(id_centre)
 
 ! NIK 16.02.2005 
Index: src/FLEXPART_MPI.f90
===================================================================
--- src/FLEXPART_MPI.f90	(revision 20963b15051b22eeb381dcf4e824a9104d92717b)
+++ src/FLEXPART_MPI.f90	(revision c0884a86ec69f31a8b28c5554286971ba48392be)
@@ -40,4 +40,7 @@
   !       detected metdata format                                              *
   !     - Passed metdata format down to timemanager                            *
+  !                                                                            *
+  !  Petra Seibert, 2018-06-26: simplified version met data format detection   *
+  !                                                                            *
   !*****************************************************************************
   !                                                                            *
@@ -54,5 +57,5 @@
   use mpi_mod
   use random_mod, only: gasdev1
-  use class_gribfile
+  use check_gribfile_mod
 
 #ifdef USE_NCF
@@ -62,9 +65,7 @@
   implicit none
 
-  integer :: i,j,ix,jy,inest
+  integer :: i,j,ix,jy,inest,id_centre
   integer :: idummy = -320
   character(len=256) :: inline_options  !pathfile, flexversion, arg2
-  integer :: metdata_format = GRIBFILE_CENTRE_UNKNOWN
-  integer :: detectformat
   integer(selected_int_kind(16)), dimension(maxspec) :: tot_b=0, &
        & tot_i=0
@@ -203,13 +204,11 @@
   ! Detect metdata format
   !**********************
-
-  metdata_format = detectformat()
-
-  if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then
+  call cg_get_centre(path(3)(1:length(3)) // trim(wfname(1)), id_centre)
+  if (id_centre.eq.icg_id_ecmwf) then
     if (lroot) print *,'ECMWF metdata detected'
-  elseif (metdata_format.eq.GRIBFILE_CENTRE_NCEP) then
-    if (lroot) print *,'NCEP metdata detected'
+  elseif (id_centre.eq.icg_id_ncep) then
+    if (lroot) print *,'NCEP met data detected'
   else
-    if (lroot) print *,'Unknown metdata format'
+    if (lroot) print *,'Unknown met data format'
     stop
   endif
@@ -233,5 +232,5 @@
   endif
 
-  if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then
+  if (id_centre.eq.icg_id_ecmwf) then
     call gridcheck_ecmwf
   else
@@ -480,5 +479,5 @@
 
 
-  call timemanager(metdata_format)
+  call timemanager(id_centre)
 
 
Index: src/calcmatrix.f90
===================================================================
--- src/calcmatrix.f90	(revision d8eed026ebec594e9a91de6c6fbc45b354a0e4b2)
+++ src/calcmatrix.f90	(revision c0884a86ec69f31a8b28c5554286971ba48392be)
@@ -20,5 +20,5 @@
 !**********************************************************************
 
-subroutine calcmatrix(lconv,delt,cbmf,metdata_format)
+subroutine calcmatrix(lconv,delt,cbmf,id_centre)
   !                        o    i    o
   !*****************************************************************************
@@ -40,4 +40,7 @@
   !     - Merged calcmatrix and calcmatrix_gfs into one routine using if-then  *
   !       for meteo-type dependent code                                        *
+  !                                                                            *
+  !  Petra Seibert, 2018-06-26: simplified version met data format detection   *
+  !                                                                            *
   !*****************************************************************************
   !                                                                            *
@@ -45,5 +48,5 @@
   !  delt         time step for convection [s]                                 *
   !  cbmf         cloud base mass flux                                         *
-  !  metdata_format format of metdata (ecmwf/gfs)                              *
+  !  id_centre    format of metdata (ecmwf/gfs)                                *
   !                                                                            *
   !*****************************************************************************
@@ -52,10 +55,10 @@
   use com_mod
   use conv_mod
-  use class_gribfile
+  use check_gribfile_mod
 
   implicit none
 
   real :: rlevmass,summe
-  integer :: metdata_format
+  integer :: id_centre
 
   integer :: iflag, k, kk, kuvz
@@ -88,5 +91,5 @@
   do kuvz = 2,nuvz
     k = kuvz-1
-    if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then
+    if (id_centre.eq.icg_id_ecmwf) then
     pconv(k) = (akz(kuvz) + bkz(kuvz)*psconv)
     phconv(kuvz) = (akm(kuvz) + bkm(kuvz)*psconv)
Index: src/calcpar.f90
===================================================================
--- src/calcpar.f90	(revision 027e844aa76ac151b33b946b4eb11e23321598af)
+++ src/calcpar.f90	(revision c0884a86ec69f31a8b28c5554286971ba48392be)
@@ -20,5 +20,5 @@
 !**********************************************************************
 
-subroutine calcpar(n,uuh,vvh,pvh,metdata_format)
+subroutine calcpar(n,uuh,vvh,pvh,id_centre)
   !                   i  i   i   o
   !*****************************************************************************
@@ -46,6 +46,7 @@
   !     - Merged calcpar and calcpar_gfs into one routine using if-then        *
   !       for meteo-type dependent code                                        *
-  !*****************************************************************************
-
+  !                                                                            *
+  !  Petra Seibert, 2018-06-26: simplified version met data format detection   *
+  !                                                                            *
   !*****************************************************************************
   !                                                                            *
@@ -55,5 +56,5 @@
   ! vvh                                                                        *
   ! pvh                                                                        *
-  ! metdata_format     format of metdata (ecmwf/gfs)                           * 
+  ! id_centre          format of metdata (ecmwf/gfs)                           *
   !                                                                            *
   ! Constants:                                                                 *
@@ -68,9 +69,9 @@
   use par_mod
   use com_mod
-  use class_gribfile
+  use check_gribfile_mod
 
   implicit none
 
-  integer :: metdata_format
+  integer :: id_centre
   integer :: n,ix,jy,i,kz,lz,kzmin,llev,loop_start
   real :: ttlev(nuvzmax),qvlev(nuvzmax),obukhov,scalev,ol,hmixplus
@@ -125,5 +126,5 @@
   !***********************************************
 
-      if (metdata_format.eq.GRIBFILE_CENTRE_NCEP) then
+      if (id_centre.eq.icg_id_ncep) then
         ! NCEP version: find first level above ground
         llev = 0
@@ -137,9 +138,11 @@
         ! calculate inverse Obukhov length scale with tth(llev)
         ol=obukhov(ps(ix,jy,1,n),tt2(ix,jy,1,n),td2(ix,jy,1,n), &
-             tth(ix,jy,llev,n),ustar(ix,jy,1,n),sshf(ix,jy,1,n),akm,bkm,akz(llev),metdata_format)
+             tth(ix,jy,llev,n),ustar(ix,jy,1,n),sshf(ix,jy,1,n), &
+             akm,bkm,akz(llev),id_centre)
       else
         llev=0
         ol=obukhov(ps(ix,jy,1,n),tt2(ix,jy,1,n),td2(ix,jy,1,n), &
-            tth(ix,jy,2,n),ustar(ix,jy,1,n),sshf(ix,jy,1,n),akm,bkm,akzdummy,metdata_format)
+            tth(ix,jy,2,n),ustar(ix,jy,1,n),sshf(ix,jy,1,n), &
+            akm,bkm,akzdummy,id_centre)
       end if
 
@@ -161,13 +164,13 @@
       end do
 
-      if (metdata_format.eq.GRIBFILE_CENTRE_NCEP) then
+      if (id_centre.eq.icg_id_ncep) then
         ! NCEP version hmix has been read in in readwind.f, is therefore not calculated here
       call richardson(ps(ix,jy,1,n),ustar(ix,jy,1,n),ttlev,qvlev, &
            ulev,vlev,nuvz,akz,bkz,sshf(ix,jy,1,n),tt2(ix,jy,1,n), &
-             td2(ix,jy,1,n),hmixdummy,wstar(ix,jy,1,n),hmixplus,metdata_format)
+             td2(ix,jy,1,n),hmixdummy,wstar(ix,jy,1,n),hmixplus,id_centre)
       else
         call richardson(ps(ix,jy,1,n),ustar(ix,jy,1,n),ttlev,qvlev, &
              ulev,vlev,nuvz,akz,bkz,sshf(ix,jy,1,n),tt2(ix,jy,1,n), &
-             td2(ix,jy,1,n),hmix(ix,jy,1,n),wstar(ix,jy,1,n),hmixplus,metdata_format)
+             td2(ix,jy,1,n),hmix(ix,jy,1,n),wstar(ix,jy,1,n),hmixplus,id_centre)
       end if
 
@@ -218,5 +221,5 @@
       pold=ps(ix,jy,1,n)
       zold=0.
-      if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then
+      if (id_centre.eq.icg_id_ecmwf) then
         loop_start=2
       else
@@ -242,5 +245,5 @@
   !************************************************************************
 
-      if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then
+      if (id_centre.eq.icg_id_ecmwf) then
         loop_start=1
       else
Index: src/calcpar_nests.f90
===================================================================
--- src/calcpar_nests.f90	(revision 6ecb30a41fb8a07e153abadc712699a09c15f90c)
+++ src/calcpar_nests.f90	(revision c0884a86ec69f31a8b28c5554286971ba48392be)
@@ -20,5 +20,5 @@
 !**********************************************************************
 
-subroutine calcpar_nests(n,uuhn,vvhn,pvhn,metdata_format)
+subroutine calcpar_nests(n,uuhn,vvhn,pvhn,id_centre)
   !                         i  i    i    o
   !*****************************************************************************
@@ -44,10 +44,13 @@
   !   Unified ECMWF and GFS builds                                             *
   !   Marian Harustak, 12.5.2017                                               *
-  !     - Added passing of metdata_format as it was needed by called routines  *
+  !     - Added passing of id_centre as it was needed by called routines       *
+  !                                                                            *
+  !  Petra Seibert, 2018-06-26: simplified version met data format detection   *
+  !                                                                            *
   !*****************************************************************************
   !                                                                            *
   ! Variables:                                                                 *
   ! n                  temporal index for meteorological fields (1 to 3)       *
-  ! metdata_format     format of metdata (ecmwf/gfs)                           *
+  ! id_centre          format of metdata (ecmwf/gfs)                           *
   !                                                                            *
   ! Constants:                                                                 *
@@ -65,5 +68,5 @@
   implicit none
 
-  integer :: metdata_format
+  integer :: id_centre
   integer :: n,ix,jy,i,l,kz,lz,kzmin
   real :: ttlev(nuvzmax),qvlev(nuvzmax),obukhov,scalev,ol,hmixplus,dummyakzllev
@@ -116,5 +119,5 @@
       ol=obukhov(psn(ix,jy,1,n,l),tt2n(ix,jy,1,n,l), &
            td2n(ix,jy,1,n,l),tthn(ix,jy,2,n,l),ustarn(ix,jy,1,n,l), &
-           sshfn(ix,jy,1,n,l),akm,bkm,dummyakzllev,metdata_format)
+           sshfn(ix,jy,1,n,l),akm,bkm,dummyakzllev,id_centre)
       if (ol.ne.0.) then
         olin(ix,jy,1,n,l)=1./ol
@@ -137,5 +140,5 @@
            qvlev,ulev,vlev,nuvz,akz,bkz,sshfn(ix,jy,1,n,l), &
            tt2n(ix,jy,1,n,l),td2n(ix,jy,1,n,l),hmixn(ix,jy,1,n,l), &
-           wstarn(ix,jy,1,n,l),hmixplus,metdata_format)
+           wstarn(ix,jy,1,n,l),hmixplus,id_centre)
 
       if(lsubgrid.eq.1) then
Index: src/changelog.txt
===================================================================
--- src/changelog.txt	(revision f251e576e36228966cea4e1a90c93e625f5cd2d9)
+++ src/changelog.txt	(revision c0884a86ec69f31a8b28c5554286971ba48392be)
@@ -73,2 +73,25 @@
    of height (array assignment where it was not intended)
 3) Add back the SAVE attribute to INIT, just to be sure
+
+
+
+* checking type (EC/GFS) of grib files PS 2018-06-26
+  ===================
+replaced the CTBTO code by shorter & simper code with proper license  
+
+Affected files:
+
+calcmatrix.f90
+calcpar.f90
+calcpar_nests.f90
+check_gribfile_mod.f90
+convmix.f90
+detectformat.f90
+FLEXPART.f90
+FLEXPART_MPI.f90
+getfields.f90
+getfields_mpi.f90
+obukhov.f90
+richardson.f90
+timemanager.f90
+timemanager_mpi.f90
Index: src/check_gribfile_mod.f90
===================================================================
--- src/check_gribfile_mod.f90	(revision c0884a86ec69f31a8b28c5554286971ba48392be)
+++ src/check_gribfile_mod.f90	(revision c0884a86ec69f31a8b28c5554286971ba48392be)
@@ -0,0 +1,69 @@
+module check_gribfile_mod
+
+!*
+! Valid-License-Identifier:    	GPL-3.0-or-later
+! Copyright (c) 2018 Petra Seibert (petra seibert at univie ac at)
+!
+! Prepared for use in FLEXPART (see flexpart.eu) version 10+
+! 1. provide centre ids for ECMWF and NCEP
+! 2. obtain centre id from a given grib file
+! intended to replace class_gribfile from ctbto project
+! requires grib_api_fortran90 and grib_api
+! either from eccodes or grib_api
+
+! I am using the convention to put an abbreviated module name (here: cg)
+! in front of public entities. If they are integer, then icg.
+! subroutines / functions from external libs with upper first letter
+
+  implicit none
+
+  integer, parameter :: icg_id_ncep = 7, icg_id_ecmwf = 98
+!!     official centre codes 
+  integer :: icentre ! centre ID found
+
+contains
+
+  subroutine cg_get_centre(pfname, icentre)
+  
+! this subroutine returns a code for the centre which produced the gribfile  
+
+  use grib_api
+
+  integer, intent(out) :: icentre
+  integer              :: ifile ! grib file handle
+  integer              :: iret  ! status code
+  integer              :: igrib ! message handle
+  character (len=*), intent(in)  :: pfname ! path+filenmae
+
+  call Grib_open_file(ifile,pfname,'r',iret)
+  if (iret == 0) then
+  
+    call Grib_new_from_file(ifile,igrib)    ! load first message
+    call Grib_get(igrib,'centre',icentre)  ! read centre ID
+    call Grib_close_file(ifile)              ! done
+
+    if (icentre .ne. icg_id_ecmwf .and. &
+        icentre .ne. icg_id_ncep) then
+!! centre not foreseen in Fp
+      write (*,*) ' #### FLEXPART MODEL ERROR! Met input file'
+      write (*,*) ' #### '//trim(pfname)
+      write (*,*) ' #### is neither ECMWF nor NCEP grib file'
+      stop 'error in check_gribfile'
+    endif
+
+  else
+
+!! reading gribfile failed
+    write (*,*) ' #### FLEXPART MODEL ERROR! Met input file'
+    write (*,*) ' #### '//trim(pfname)
+    write (*,*) ' #### cannot be opened with grib_api'
+    stop 'error in check_gribfile'
+
+  endif
+
+  end subroutine cg_get_centre
+  
+end module check_gribfile_mod
+
+! what needs to be done to replace the current code with this one:
+! see email
Index: src/convmix.f90
===================================================================
--- src/convmix.f90	(revision 6ecb30a41fb8a07e153abadc712699a09c15f90c)
+++ src/convmix.f90	(revision c0884a86ec69f31a8b28c5554286971ba48392be)
@@ -20,5 +20,5 @@
 !**********************************************************************
 
-subroutine convmix(itime,metdata_format)
+subroutine convmix(itime,id_centre)
   !                     i
   !**************************************************************
@@ -39,6 +39,9 @@
   !   Unified ECMWF and GFS builds                                             
   !   Marian Harustak, 12.5.2017                                              
-  !     - Merged convmix and convmix_gfs into one routine using if-then           
+  !     - Merged convmix and convmix_gfs into one routine using if-then      
   !       for meteo-type dependent code                                        
+  !                                                                          
+  !  Petra Seibert, 2018-06-26: simplified version met data format detection 
+  !                                                                          
   !**************************************************************
 
@@ -47,5 +50,5 @@
   use com_mod
   use conv_mod
-  use class_gribfile
+  use check_gribfile_mod
 
   implicit none
@@ -55,5 +58,5 @@
   integer :: jy, kpart, ktop, ngrid,kz
   integer :: igrid(maxpart), ipoint(maxpart), igridn(maxpart,maxnests)
-  integer :: metdata_format
+  integer :: id_centre
 
   ! itime [s]                 current time
@@ -116,5 +119,5 @@
 
     ngrid=0
-    if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then
+    if (id_centre.eq.icg_id_ecmwf) then
     do j=numbnests,1,-1
       if ( x.gt.xln(j)+eps .and. x.lt.xrn(j)-eps .and. &
@@ -189,5 +192,5 @@
       td2conv=(td2(ix,jy,1,mind1)*dt2+td2(ix,jy,1,mind2)*dt1)*dtt
 !!$      do kz=1,nconvlev+1      !old
-      if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then
+      if (id_centre.eq.icg_id_ecmwf) then
         do kz=1,nuvz-1           !bugfix
         tconv(kz)=(tth(ix,jy,kz+1,mind1)*dt2+ &
@@ -208,5 +211,5 @@
 
   ! Calculate translocation matrix
-      call calcmatrix(lconv,delt,cbaseflux(ix,jy),metdata_format)
+      call calcmatrix(lconv,delt,cbaseflux(ix,jy),id_centre)
       igrold = igr
       ktop = 0
@@ -285,5 +288,5 @@
   ! calculate translocation matrix
   !*******************************
-        call calcmatrix(lconv,delt,cbasefluxn(ix,jy,inest),metdata_format)
+        call calcmatrix(lconv,delt,cbasefluxn(ix,jy,inest),id_centre)
         igrold = igr
         ktop = 0
Index: c/detectformat.f90
===================================================================
--- src/detectformat.f90	(revision 61e07bac31955a83b2f343eb477aac0514ec1b8d)
+++ 	(revision )
@@ -1,67 +1,0 @@
-!**********************************************************************
-! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010         *
-! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa,             *
-! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann   *
-!                                                                     *
-! This file is part of FLEXPART.                                      *
-!                                                                     *
-! FLEXPART is free software: you can redistribute it and/or modify    *
-! it under the terms of the GNU General Public License as published by*
-! the Free Software Foundation, either version 3 of the License, or   *
-! (at your option) any later version.                                 *
-!                                                                     *
-! FLEXPART is distributed in the hope that it will be useful,         *
-! but WITHOUT ANY WARRANTY; without even the implied warranty of      *
-! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the       *
-! GNU General Public License for more details.                        *
-!                                                                     *
-! You should have received a copy of the GNU General Public License   *
-! along with FLEXPART.  If not, see <http://www.gnu.org/licenses/>.   *
-!**********************************************************************
-
-integer function detectformat()
-
-  !*****************************************************************************
-  !                                                                            *
-  !   This routine reads the 1st file with windfields to determine             *
-  !   the format.                                                              *
-  !                                                                            *
-  !     Authors: M. Harustak                                                   *
-  !                                                                            *
-  !     6 May 2015                                                             *
-  !                                                                            *
-  !   Unified ECMWF and GFS builds                                             *
-  !   Marian Harustak, 12.5.2017                                               *
-  !     - Added routine to FP10 Flexpart distribution                          *
-  !*****************************************************************************
-  !                                                                            *
-  ! Variables:                                                                 *
-  ! fname                file name of file to check                            *
-  !                                                                            *
-  !*****************************************************************************
-
-  use par_mod
-  use com_mod
-  use class_gribfile
-
-
-  implicit none
-
-  character(len=255) :: filename
-  character(len=255) :: wfname1(maxwf)
-  integer :: metdata_format
-
-  ! If no file is available
-  if ( maxwf.le.0 ) then
-    print*,'No wind file available'
-    detectformat = GRIBFILE_CENTRE_UNKNOWN
-    return
-  endif
-
-  ! construct filename
-  filename = path(3)(1:length(3)) // trim(wfname(1))
- 
-  ! get format
-  detectformat = gribfile_centre(TRIM(filename))
-
-end 
Index: src/getfields.f90
===================================================================
--- src/getfields.f90	(revision 6ecb30a41fb8a07e153abadc712699a09c15f90c)
+++ src/getfields.f90	(revision c0884a86ec69f31a8b28c5554286971ba48392be)
@@ -20,5 +20,5 @@
 !**********************************************************************
 
-subroutine getfields(itime,nstop,metdata_format)
+subroutine getfields(itime,nstop,id_centre)
 !                       i     o
 !*****************************************************************************
@@ -44,5 +44,8 @@
 !   Unified ECMWF and GFS builds                                             *
 !   Marian Harustak, 12.5.2017                                               *
-!     - Added passing of metdata_format as it was needed by called routines  *
+!     - Added passing of id_centre as it was needed by called routines       *
+!                                                                            *
+!  Petra Seibert, 2018-06-26: simplified version met data format detection   *
+!                                                                            *
 !*****************************************************************************
 !                                                                            *
@@ -62,5 +65,5 @@
 ! tt(0:nxmax,0:nymax,nuvzmax,2)   temperature [K]                            *
 ! ps(0:nxmax,0:nymax,2)           surface pressure [Pa]                      *
-! metdata_format     format of metdata (ecmwf/gfs)                           *
+! id_centre            format of metdata (ecmwf/gfs)                         *
 !                                                                            *
 ! Constants:                                                                 *
@@ -72,10 +75,10 @@
   use par_mod
   use com_mod
-  use class_gribfile
+  use check_gribfile_mod
 
   implicit none
 
   integer :: indj,itime,nstop,memaux
-  integer :: metdata_format
+  integer :: id_centre
 
   real :: uuh(0:nxmax-1,0:nymax-1,nuvzmax)
@@ -132,5 +135,5 @@
     do indj=indmin,numbwf-1
       if (ldirect*wftime(indj+1).gt.ldirect*itime) then
-        if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then
+        if (id_centre.eq.icg_id_ecmwf) then
           call readwind_ecmwf(indj+1,memind(2),uuh,vvh,wwh)
         else
@@ -138,7 +141,7 @@
         end if
         call readwind_nests(indj+1,memind(2),uuhn,vvhn,wwhn)
-        call calcpar(memind(2),uuh,vvh,pvh,metdata_format)
-        call calcpar_nests(memind(2),uuhn,vvhn,pvhn,metdata_format)
-        if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then
+        call calcpar(memind(2),uuh,vvh,pvh,id_centre)
+        call calcpar_nests(memind(2),uuhn,vvhn,pvhn,id_centre)
+        if (id_centre.eq.icg_id_ecmwf) then
           call verttransform_ecmwf(memind(2),uuh,vvh,wwh,pvh)
         else
@@ -167,5 +170,5 @@
            (ldirect*wftime(indj+1).gt.ldirect*itime)) then
         memind(1)=1
-        if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then
+        if (id_centre.eq.icg_id_ecmwf) then
           call readwind_ecmwf(indj,memind(1),uuh,vvh,wwh)
         else
@@ -173,7 +176,7 @@
         end if
         call readwind_nests(indj,memind(1),uuhn,vvhn,wwhn)
-        call calcpar(memind(1),uuh,vvh,pvh,metdata_format)
-        call calcpar_nests(memind(1),uuhn,vvhn,pvhn,metdata_format)
-        if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then
+        call calcpar(memind(1),uuh,vvh,pvh,id_centre)
+        call calcpar_nests(memind(1),uuhn,vvhn,pvhn,id_centre)
+        if (id_centre.eq.icg_id_ecmwf) then
           call verttransform_ecmwf(memind(1),uuh,vvh,wwh,pvh)
         else
@@ -183,5 +186,5 @@
         memtime(1)=wftime(indj)
         memind(2)=2
-        if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then
+        if (id_centre.eq.icg_id_ecmwf) then
           call readwind_ecmwf(indj+1,memind(2),uuh,vvh,wwh)
         else
@@ -189,7 +192,7 @@
         end if
         call readwind_nests(indj+1,memind(2),uuhn,vvhn,wwhn)
-        call calcpar(memind(2),uuh,vvh,pvh,metdata_format)
-        call calcpar_nests(memind(2),uuhn,vvhn,pvhn,metdata_format)
-        if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then
+        call calcpar(memind(2),uuh,vvh,pvh,id_centre)
+        call calcpar_nests(memind(2),uuhn,vvhn,pvhn,id_centre)
+        if (id_centre.eq.icg_id_ecmwf) then
           call verttransform_ecmwf(memind(2),uuh,vvh,wwh,pvh)
         else
Index: src/getfields_mpi.f90
===================================================================
--- src/getfields_mpi.f90	(revision 20963b15051b22eeb381dcf4e824a9104d92717b)
+++ src/getfields_mpi.f90	(revision c0884a86ec69f31a8b28c5554286971ba48392be)
@@ -20,5 +20,5 @@
 !**********************************************************************
 
-subroutine getfields(itime,nstop,memstat,metdata_format)
+subroutine getfields(itime,nstop,memstat,id_centre)
 !                       i     o       o
 !*****************************************************************************
@@ -60,7 +60,8 @@
 !   Unified ECMWF and GFS builds                                             
 !   Marian Harustak, 12.5.2017                                               
-!     - Added passing of metdata_format as it was needed by called routines  
-!          
-!*****************************************************************************
+!     - Added passing of id_centre as it was needed by called routines  
+!                                                                           
+!  Petra Seibert, 2018-06-26: simplified version met data format detection  
+!                                                                           !*****************************************************************************
 !                                                                            *
 ! Variables:                                                                 *
@@ -81,5 +82,5 @@
 ! tt(0:nxmax,0:nymax,nuvzmax,numwfmem)   temperature [K]                     *
 ! ps(0:nxmax,0:nymax,numwfmem)           surface pressure [Pa]               *
-! metdata_format     format of metdata (ecmwf/gfs)                           *
+! id_centre            format of metdata (ecmwf/gfs)                           *
 !                                                                            *
 ! Constants:                                                                 *
@@ -92,9 +93,9 @@
   use com_mod
   use mpi_mod, only: lmpreader,lmp_use_reader,lmp_sync
-  use class_gribfile
+  use check_gribfile_mod
 
   implicit none
 
-  integer :: metdata_format
+  integer :: id_centre
   integer :: indj,itime,nstop,memaux,mindread
 ! mindread: index of where to read 3rd field
@@ -211,5 +212,5 @@
       if (ldirect*wftime(indj+1).gt.ldirect*itime) then
         if (lmpreader.or..not. lmp_use_reader) then
-          if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then
+          if (id_centre.eq.icg_id_ecmwf) then
             call readwind_ecmwf(indj+1,mindread,uuh,vvh,wwh)
           else
@@ -217,7 +218,7 @@
           end if
           call readwind_nests(indj+1,mindread,uuhn,vvhn,wwhn)
-          call calcpar(mindread,uuh,vvh,pvh,metdata_format)
-          call calcpar_nests(mindread,uuhn,vvhn,pvhn,metdata_format)
-          if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then
+          call calcpar(mindread,uuh,vvh,pvh,id_centre)
+          call calcpar_nests(mindread,uuhn,vvhn,pvhn,id_centre)
+          if (id_centre.eq.icg_id_ecmwf) then
             call verttransform_ecmwf(mindread,uuh,vvh,wwh,pvh)
           else
@@ -249,5 +250,5 @@
         memind(1)=1
         if (lmpreader.or..not.lmp_use_reader) then
-          if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then
+          if (id_centre.eq.icg_id_ecmwf) then
             call readwind_ecmwf(indj,memind(1),uuh,vvh,wwh)
           else
@@ -255,7 +256,7 @@
           end if
           call readwind_nests(indj,memind(1),uuhn,vvhn,wwhn)
-          call calcpar(memind(1),uuh,vvh,pvh,metdata_format)
-          call calcpar_nests(memind(1),uuhn,vvhn,pvhn,metdata_format)
-          if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then
+          call calcpar(memind(1),uuh,vvh,pvh,id_centre)
+          call calcpar_nests(memind(1),uuhn,vvhn,pvhn,id_centre)
+          if (id_centre.eq.icg_id_ecmwf) then
             call verttransform_ecmwf(memind(1),uuh,vvh,wwh,pvh)
           else
@@ -267,5 +268,5 @@
         memind(2)=2
         if (lmpreader.or..not.lmp_use_reader) then
-          if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then
+          if (id_centre.eq.icg_id_ecmwf) then
             call readwind_ecmwf(indj+1,memind(2),uuh,vvh,wwh)
           else
@@ -273,7 +274,7 @@
           end if
           call readwind_nests(indj+1,memind(2),uuhn,vvhn,wwhn)
-          call calcpar(memind(2),uuh,vvh,pvh,metdata_format)
-          call calcpar_nests(memind(2),uuhn,vvhn,pvhn,metdata_format)
-          if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then
+          call calcpar(memind(2),uuh,vvh,pvh,id_centre)
+          call calcpar_nests(memind(2),uuhn,vvhn,pvhn,id_centre)
+          if (id_centre.eq.icg_id_ecmwf) then
             call verttransform_ecmwf(memind(2),uuh,vvh,wwh,pvh)
           else
Index: c/gributils/class_gribfile_mod.f90
===================================================================
--- src/gributils/class_gribfile_mod.f90	(revision 61e07bac31955a83b2f343eb477aac0514ec1b8d)
+++ 	(revision )
@@ -1,419 +1,0 @@
-MODULE class_gribfile
-
-    !*****************************************************************
-    !                                                                *
-    !  This is a class-like structure for providing access to the    *
-    !  metadata and data within a GRIB met file                      *
-    !                                                                *
-    !                                                                *
-    !*****************************************************************
-
-    IMPLICIT NONE
-    PRIVATE   ! The default is that everything is private, unless
-              ! specified otherwise
-
-    ! Note that all public interfaces and variables should have a
-    ! GRIBFILE_ prefix
-
-    PUBLIC :: gribfile_object,                &
-              gribfile_object_create,         &
-              gribfile_printobj,              &
-              gribfile_centre,                &
-              gribfile_num_xlon,              &
-              gribfile_num_ylat,              &
-              gribfile_num_zlevel
-
-
-    PUBLIC :: GRIBFILE_TYPE_ECMWF_GRIB1,      &
-              GRIBFILE_TYPE_ECMWF_GRIB2,      &
-              GRIBFILE_TYPE_ECMWF_GRIB1_2,    &
-              GRIBFILE_TYPE_NCEP_GRIB1,       &
-              GRIBFILE_TYPE_NCEP_GRIB2,       &
-              GRIBFILE_TYPE_UNKNOWN,          &
-              GRIBFILE_CENTRE_NCEP,           &
-              GRIBFILE_CENTRE_ECMWF,          &
-              GRIBFILE_CENTRE_UNKNOWN
-
-    ! These are codes for designating the type of GRIB file  
-    ! being looked at
-    INTEGER, PARAMETER :: GRIBFILE_TYPE_ECMWF_GRIB1 = 1,     &
-                          GRIBFILE_TYPE_ECMWF_GRIB2 = 2,     &
-                          GRIBFILE_TYPE_ECMWF_GRIB1_2 = 3,   &
-                          GRIBFILE_TYPE_NCEP_GRIB1 = 4,      &
-                          GRIBFILE_TYPE_NCEP_GRIB2 = 5,      &
-                          GRIBFILE_TYPE_UNKNOWN = -9999,     &
-                          GRIBFILE_CENTRE_NCEP = 1,          &
-                          GRIBFILE_CENTRE_ECMWF = 2,         &
-                          GRIBFILE_CENTRE_UNKNOWN = -9999
-
-    ! These are the official centre codes for NCEP and ECMWF in grib files.
-    INTEGER, PARAMETER :: CENTRE_NCEP = 7, CENTRE_ECMWF = 98
-
-    TYPE gribfile_object
-        PRIVATE    ! Make everything in here private so it's not directly manipulated outside
-        LOGICAL :: is_instantiated = .FALSE.
-        CHARACTER(LEN=256) :: file_path = ''
-        INTEGER :: grib_edition = 0  ! Not sure we want this, since it can vary on hybrid files
-        INTEGER :: grib_centre = GRIBFILE_CENTRE_UNKNOWN
-        INTEGER :: gribfile_type = GRIBFILE_TYPE_UNKNOWN
-        INTEGER :: num_xlon = -9999
-        INTEGER :: num_ylat = -9999
-        INTEGER :: num_zlevel = -9999
-    END TYPE gribfile_object
-
-
-
-CONTAINS
-
-    SUBROUTINE gribfile_testhello()
-        PRINT *, 'Hello gribfile'
-    END SUBROUTINE gribfile_testhello
-
-
-
-    TYPE(gribfile_object) FUNCTION gribfile_object_create(filepath)
-
-        ! This is the "constructor" for the pseudo gribfile object.  Given the path to a gribfile,
-        ! fills in attributes that can be accessed through methods in this
-        ! module
-
-        USE grib_api
-
-        IMPLICIT NONE
-
-        CHARACTER(LEN=*), INTENT(IN) :: filepath  ! full path to GRIB file
-
-        TYPE(gribfile_object) :: returned_object
-
-        INTEGER :: ifile, iret, igrib, grib_centre, gribfile_type
-        INTEGER :: xlon, ylat, zlev
-
-
-        CALL get_centre_and_type(filepath, grib_centre, gribfile_type)
-        returned_object%grib_centre = grib_centre
-        returned_object%gribfile_type = gribfile_type
-
-        ! Get dimensions of 3d u field
-        CALL get_3d_u_dims(filepath, gribfile_type, xlon, ylat, zlev)
-        returned_object%num_xlon = xlon
-        returned_object%num_ylat = ylat
-        returned_object%num_zlevel = zlev
-
-
-        returned_object%is_instantiated = .TRUE.
-        returned_object%file_path = TRIM(filepath)
-
-        gribfile_object_create = returned_object
-
-    END FUNCTION gribfile_object_create
-
-
-    SUBROUTINE gribfile_printobj(gribfile_obj)
-
-        ! Pretty prints the attributes of the gribfile pseudo-object
-        TYPE(gribfile_object), INTENT(IN) :: gribfile_obj
-
-        PRINT *, 'is_instantiated: ', gribfile_obj%is_instantiated
-        PRINT *, 'filepath: ', TRIM(gribfile_obj%file_path)
-        PRINT *, 'grib_centre: ', gribfile_obj%grib_centre
-        PRINT *, 'gribfile_type: ', gribfile_obj%gribfile_type
-        PRINT *, 'num_xlon: ', gribfile_obj%num_xlon
-        PRINT *, 'num_ylat: ', gribfile_obj%num_ylat
-        PRINT *, 'num_zlevel: ', gribfile_obj%num_zlevel
-
-    END SUBROUTINE gribfile_printobj
-
-    INTEGER FUNCTION gribfile_centre(filepath)
-
-        ! Returns an integer constant denoting the grib centre (currently either ECMWF, NCEP or UNKNOWN)
-        ! for the specified filepath.  Returns one of the GRIBFILE_CENTRE_ constants defined at top of this
-        ! module.
-
-
-        USE grib_api
-
-        IMPLICIT NONE
-
-        CHARACTER(LEN=*), INTENT(IN) :: filepath ! full path to GRIB file
-
-
-
-        INTEGER :: ifile, iret, igrib, grib_centre
-
-        CALL grib_open_file(ifile, filepath, 'r', iret)
-        IF (iret == 0) THEN
-            ! Use first record to detect centre, which is assumed constant
-            ! amongst all messages
-            CALL grib_new_from_file(ifile, igrib, iret)
-            CALL grib_get(igrib, 'centre', grib_centre)
-            CALL grib_close_file(ifile)
-        ELSE
-            PRINT *, "WARNING: problem opening GRIB file: ", filepath
-            grib_centre = -999
-        END IF
-
-
-
-
-
-        IF (grib_centre == CENTRE_NCEP) THEN
-            gribfile_centre = GRIBFILE_CENTRE_NCEP
-        ELSE IF (grib_centre == CENTRE_ECMWF) THEN
-            gribfile_centre = GRIBFILE_CENTRE_ECMWF
-        ELSE
-            gribfile_centre = GRIBFILE_CENTRE_UNKNOWN
-        END IF
-
-    END FUNCTION gribfile_centre
-
-
-    ! This is currently a PRIVATE subroutine
-    SUBROUTINE get_centre_and_type(filepath, grib_centre, gribfile_type)
-        ! Given specified grib file, passes back centre and gribfile
-        ! type to the calling program.  Numeric codes are defined as integer parameters
-        ! in this module
-
-        ! To get this information, we have to iterate through the entire file in order to
-        ! determine if it is hybrid or not
-        !
-
-        USE grib_api
-        IMPLICIT NONE
-        CHARACTER(LEN=*), INTENT(IN) :: filepath  ! full path to GRIB file
-        INTEGER, INTENT(OUT) :: grib_centre, gribfile_type
-
-        INTEGER :: fileptr, iret, igrib, centre, grib_edition
-        LOGICAL :: end_of_file
-        LOGICAL :: grib1_detected, grib2_detected
-
-
-        grib1_detected = .FALSE.
-        grib2_detected = .FALSE.
-
-        CALL grib_open_file(fileptr, filepath, 'r', iret)
-        IF (iret /= 0) THEN
-            PRINT *, 'class_gributils:get_centre_and_type()...'
-            PRINT *, '     unable to open filepath: ', filepath
-            STOP
-        END IF
-
-
-        ! Use first record to detect centre and and grib version of first messages.  We will
-        ! then assume that all following messages have same centre, but not necessarily same
-        ! GRIB version
-        CALL grib_new_from_file(fileptr, igrib, iret)
-        CALL grib_get(igrib, 'centre', grib_centre)
-        CALL grib_get(igrib, 'edition', grib_edition)
-
-        IF (grib_edition == 1) grib1_detected = .TRUE.
-        IF (grib_edition == 2) grib2_detected = .TRUE.
-
-        ! Now, iterate through the rest of records to determine if this is a mixed edition file
-        end_of_file = .FALSE.
-        DO WHILE (.NOT. end_of_file)
-            CALL grib_new_from_file(fileptr, igrib, iret)
-            IF (iret .eq. GRIB_END_OF_FILE) THEN
-                end_of_file = .TRUE.
-            ELSE
-
-                ! Get edition from file
-                CALL grib_get(igrib, 'edition', grib_edition)
-                IF (grib_edition .eq. 1) grib1_detected = .TRUE.
-                IF (grib_edition .eq. 2) grib2_detected = .TRUE.
-            END IF
-        END DO
-
-    CALL grib_close_file(fileptr)
-
-    ! Determine the gribfile type depending on centre and edition(s)
-    IF (grib_centre == CENTRE_ECMWF) THEN
-        IF (grib1_detected .AND. grib2_detected) THEN
-            gribfile_type = GRIBFILE_TYPE_ECMWF_GRIB1_2
-        ELSE IF (grib1_detected .AND. .NOT. grib2_detected) THEN
-            gribfile_type = GRIBFILE_TYPE_ECMWF_GRIB1
-        ELSE IF (.NOT. grib1_detected .AND. grib2_detected) THEN
-            gribfile_type = GRIBFILE_TYPE_ECMWF_GRIB2
-        ELSE
-            gribfile_type = GRIBFILE_TYPE_UNKNOWN
-        ENDIF
-    ELSE IF (grib_centre == CENTRE_NCEP) THEN
-        IF (grib1_detected .AND. .NOT. grib2_detected) THEN
-             gribfile_type = GRIBFILE_TYPE_NCEP_GRIB1
-        ELSE IF (.NOT. grib1_detected .AND. grib2_detected) THEN
-            gribfile_type = GRIBFILE_TYPE_NCEP_GRIB2
-        ELSE
-            gribfile_type = GRIBFILE_TYPE_UNKNOWN
-        ENDIF
-    ELSE
-        gribfile_type = GRIBFILE_TYPE_UNKNOWN
-    ENDIF
-
-    END SUBROUTINE get_centre_and_type
-
-
-    SUBROUTINE get_3d_u_dims(filepath, gribfile_type, xlon, ylat, zlev)
-
-        ! Looks at the 3d u fields in the GRIBFILE to get x and y dims, as well as number of levels
-        USE grib_api
-
-        IMPLICIT NONE
-
-        CHARACTER(LEN=*), INTENT(IN) :: filepath  ! full path to GRIB file
-        INTEGER, INTENT(IN) :: gribfile_type
-        INTEGER, INTENT(OUT) :: xlon, ylat, zlev
-
-        INTEGER :: ifile, iret, igrib, grib_centre
-        LOGICAL :: end_of_file
-
-        ! These will be assigned according to type of grib file, then used to filter
-        ! for the 3d messages
-        ! Name of the key being sought
-        CHARACTER(LEN=64) :: keyname_leveltype, keyname_shortname, keyname_level, &
-                             keyname_xlon, keyname_ylat
-
-        ! The key value being filtered for
-        CHARACTER(LEN=64) :: keyvalue_leveltype, keyvalue_shortname
-
-        ! Actual values read in from the grib file
-        CHARACTER(LEN=64) :: value_leveltype, value_shortname
-        INTEGER :: value_level
-
-        INTEGER :: num_levels
-
-        ! Get the field names to read, based on the type of grib file
-
-        !!! Note that ALL of these have the same key names, except that
-        !!! leveltype is 'hybrid' in ECMWF and 'isobaricInhPa' in NCEP.
-        !!! This could probably be consolidated, but because these are
-        !!! files that go through some preprocessing, and aren't 
-        !!! necessarily standard (at least for ECMWF), I'm going to be
-        !!! safe and leave it as is for now, so it would be easier to
-        !!! modify for one type, if necessary.
-        IF (gribfile_type == GRIBFILE_TYPE_ECMWF_GRIB1) THEN
-            keyname_leveltype = 'typeOfLevel'
-            keyname_shortname = 'shortName'
-            keyname_level = 'level'
-            keyvalue_leveltype = 'hybrid'
-            keyvalue_shortname = 'u'
-            keyname_xlon = 'Ni'
-            keyname_ylat = 'Nj'
-        ELSE IF (gribfile_type == GRIBFILE_TYPE_ECMWF_GRIB1_2) THEN
-            keyname_leveltype = 'typeOfLevel'
-            keyname_shortname = 'shortName'
-            keyname_level = 'level'
-            keyvalue_leveltype = 'hybrid'
-            keyvalue_shortname = 'u'
-            keyname_xlon = 'Ni'
-            keyname_ylat = 'Nj'
-        ELSE IF (gribfile_type == GRIBFILE_TYPE_ECMWF_GRIB2) THEN
-            keyname_leveltype = 'typeOfLevel'
-            keyname_shortname = 'shortName'
-            keyname_level = 'level'
-            keyvalue_leveltype = 'hybrid'
-            keyvalue_shortname = 'u'
-            keyname_xlon = 'Ni'
-            keyname_ylat = 'Nj'
-        ELSE IF (gribfile_type == GRIBFILE_TYPE_NCEP_GRIB1) THEN
-            keyname_leveltype = 'typeOfLevel'
-            keyname_shortname = 'shortName'
-            keyname_level = 'level'
-            keyvalue_leveltype = 'isobaricInhPa'
-            keyvalue_shortname = 'u'
-            keyname_xlon = 'Ni'
-            keyname_ylat = 'Nj'
-        ELSE IF (gribfile_type == GRIBFILE_TYPE_NCEP_GRIB2) THEN
-            keyname_leveltype = 'typeOfLevel'
-            keyname_shortname = 'shortName'
-            keyname_level = 'level'
-            keyvalue_leveltype = 'isobaricInhPa'
-            keyvalue_shortname = 'u'
-            keyname_xlon = 'Ni'
-            keyname_ylat = 'Nj'
-        ELSE
-            PRINT *, 'class_gribfile:get_3d_u_dims(): Unsupported gribfile type: ', gribfile_type
-            STOP
-        ENDIF
-
-        CALL grib_open_file(ifile, filepath, 'r', iret)
-        IF (iret == 0) THEN
-
-            ! Iterate through all messages to count 3d u messages (levels) and get x,y dimensions
-            end_of_file = .FALSE.
-            num_levels = 0
-            DO WHILE (.NOT. end_of_file)
-                CALL grib_new_from_file(ifile, igrib, iret)
-                IF (iret .eq. GRIB_END_OF_FILE) THEN
-                    end_of_file = .TRUE.
-                ELSE
-
-                    ! Get relevant keys and filter for the 3d U wind
-                    CALL grib_get(igrib, keyname_shortname, value_shortname)
-                    CALL grib_get(igrib, keyname_leveltype, value_leveltype)
-                    CALL grib_get(igrib, keyname_level, value_level)
-                    IF ( TRIM(value_leveltype) == TRIM(keyvalue_leveltype) .AND. &
-                         TRIM(value_shortname) == TRIM(keyvalue_shortname) ) THEN
-
-                        ! If this is first 3d U wind message, get dimensions
-                        IF (num_levels == 0) THEN
-                            CONTINUE
-                            CALL grib_get(igrib, keyname_xlon, xlon)
-                            CALL grib_get(igrib, keyname_ylat, ylat)
-                        ENDIF
-                        !PRINT *, TRIM(value_shortname), '  ', TRIM(value_leveltype), '  ', value_level
-                        num_levels = num_levels + 1
-                    END IF
-                END IF
-            END DO
-
-
-        ELSE
-            PRINT *, "ERROR: class_gribfile::get_3d_u_dims(): problem opening GRIB file: ", filepath
-            STOP
-        END IF
-
-        CALL grib_close_file(ifile)
-
-        zlev = num_levels
-
-    END SUBROUTINE get_3d_u_dims
-
-
-
-    !!! Getter methods
-    INTEGER FUNCTION gribfile_num_xlon(gribfile_obj)
-
-        ! Returns x (lon) dimension of met data
-        TYPE(gribfile_object), INTENT(IN) :: gribfile_obj
-
-        IF (.NOT. gribfile_obj%is_instantiated) THEN
-            PRINT *, 'ERROR: class_gribfile: gribfile_obj not instantiated'
-        ENDIF
-        gribfile_num_xlon = gribfile_obj%num_xlon
-
-    END FUNCTION gribfile_num_xlon
-
-    INTEGER FUNCTION gribfile_num_ylat(gribfile_obj)
-
-        ! Returns y (lat) dimension of met data
-        TYPE(gribfile_object), INTENT(IN) :: gribfile_obj
-
-        IF (.NOT. gribfile_obj%is_instantiated) THEN
-            PRINT *, 'ERROR: class_gribfile: gribfile_obj not instantiated'
-        ENDIF
-        gribfile_num_ylat = gribfile_obj%num_ylat
-
-    END FUNCTION gribfile_num_ylat
-
-    INTEGER FUNCTION gribfile_num_zlevel(gribfile_obj)
-
-        ! Returns z (level) dimension of met data
-        TYPE(gribfile_object), INTENT(IN) :: gribfile_obj
-
-        IF (.NOT. gribfile_obj%is_instantiated) THEN
-            PRINT *, 'ERROR: class_gribfile: gribfile_obj not instantiated'
-        ENDIF
-        gribfile_num_zlevel = gribfile_obj%num_zlevel
-
-    END FUNCTION gribfile_num_zlevel
-
-END MODULE class_gribfile
Index: src/makefile
===================================================================
--- src/makefile	(revision 77778f8da97550749c019c9f1fc9634c072c42f4)
+++ src/makefile	(revision c0884a86ec69f31a8b28c5554286971ba48392be)
@@ -22,5 +22,4 @@
 #
 #    Makefile was modified to produce unified executable for both ECMWF and GFS meteo data formats
-#    gributils were included to detect format of meteo data
 #
 #    Cpp directives USE_MPIINPLACE were added to three source files. The effect of these directives 
@@ -106,5 +105,6 @@
 
 #FFLAGS   = -I$(INCPATH1) -I$(INCPATH2) -O$(O_LEV) -cpp -m64 -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -fmessage-length=0 -flto=jobserver -O$(O_LEV) $(NCOPT) $(FUSER)  #-Warray-bounds -fcheck=all # -march=native
-FFLAGS   = -I$(INCPATH1) -I$(INCPATH2) -O$(O_LEV) -cpp -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -fmessage-length=0 -flto=jobserver -O$(O_LEV) $(NCOPT) $(FUSER)  # -fcheck=all -fbacktrace -march=native
+#FFLAGS   = -I$(INCPATH1) -I$(INCPATH2) -O$(O_LEV) -cpp -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -fmessage-length=0 -flto=jobserver -O$(O_LEV) $(NCOPT) $(FUSER)  # -fcheck=all -fbacktrace -march=native
+FFLAGS   = -I$(INCPATH1) -I$(INCPATH2) -O$(O_LEV) -cpp -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -fmessage-length=0 -flto=jobserver -O$(O_LEV) $(NCOPT) $(FUSER)  -fcheck=all -fbacktrace -march=native
 
 # Explanation of unusual gfortran options
@@ -125,5 +125,6 @@
 point_mod.o             outg_mod.o \
 mean_mod.o	 	random_mod.o \
-class_gribfile_mod.o
+check_gribfile_mod.o    
+
 
 MPI_MODOBJS = \
@@ -197,5 +198,5 @@
 interpol_wind_nests.o   interpol_misslev_nests.o \
 interpol_vdep_nests.o   interpol_rain_nests.o \
-readageclasses.o        detectformat.o  \
+readageclasses.o        \
 calcfluxes.o            fluxoutput.o \
 qvsat.o                 skplin.o \
@@ -272,6 +273,6 @@
 	random_mod.o
 calcfluxes.o: com_mod.o flux_mod.o outg_mod.o par_mod.o
-calcmatrix.o: com_mod.o conv_mod.o par_mod.o class_gribfile_mod.o
-calcpar.o: com_mod.o par_mod.o class_gribfile_mod.o
+calcmatrix.o: check_gribfile_mod.o conv_mod.o com_mod.o par_mod.o 
+calcpar.o: com_mod.o par_mod.o check_gribfile_mod.o
 calcpar_nests.o: com_mod.o par_mod.o
 calcpv.o: com_mod.o par_mod.o
@@ -299,7 +300,6 @@
 conv_mod.o: par_mod.o
 convect43c.o: conv_mod.o par_mod.o
-convmix.o: com_mod.o conv_mod.o flux_mod.o par_mod.o class_gribfile_mod.o
+convmix.o: com_mod.o conv_mod.o flux_mod.o par_mod.o check_gribfile_mod.o
 coordtrafo.o: com_mod.o par_mod.o point_mod.o
-detectformat.o: com_mod.o par_mod.o class_gribfile_mod.o
 distance.o: par_mod.o
 distance2.o: par_mod.o
@@ -307,11 +307,12 @@
 drydepokernel_nest.o: com_mod.o par_mod.o unc_mod.o
 erf.o: par_mod.o
-FLEXPART.o: com_mod.o conv_mod.o par_mod.o point_mod.o random_mod.o netcdf_output_mod.o class_gribfile_mod.o
+FLEXPART.o: com_mod.o conv_mod.o par_mod.o point_mod.o random_mod.o netcdf_output_mod.o check_gribfile_mod.o
+FLEXPART.o: check_gribfile_mod.o random_mod.o conv_mod.o com_mod.o par_mod.o point_mod.o 
 FLEXPART_MPI.o: com_mod.o conv_mod.o mpi_mod.o par_mod.o point_mod.o \
-	random_mod.o netcdf_output_mod.o class_gribfile_mod.o
+	random_mod.o netcdf_output_mod.o check_gribfile_mod.o
 fluxoutput.o: com_mod.o flux_mod.o outg_mod.o par_mod.o
 get_settling.o: com_mod.o par_mod.o
-getfields.o: com_mod.o par_mod.o class_gribfile_mod.o
-getfields_mpi.o: com_mod.o par_mod.o mpi_mod.o class_gribfile_mod.o
+getfields.o: com_mod.o par_mod.o check_gribfile_mod.o
+getfields_mpi.o: com_mod.o par_mod.o mpi_mod.o check_gribfile_mod.o
 gethourlyOH.o: com_mod.o oh_mod.o par_mod.o
 getrb.o: par_mod.o
@@ -354,5 +355,5 @@
 mpi_mod.o: com_mod.o par_mod.o unc_mod.o
 netcdf_output_mod.o: com_mod.o outg_mod.o par_mod.o point_mod.o unc_mod.o mean_mod.o
-obukhov.o: par_mod.o class_gribfile_mod.o
+obukhov.o: par_mod.o check_gribfile_mod.o
 ohreaction.o: com_mod.o oh_mod.o par_mod.o
 openouttraj.o: com_mod.o par_mod.o point_mod.o
@@ -401,5 +402,5 @@
 releaseparticles_mpi.o: com_mod.o mpi_mod.o par_mod.o point_mod.o \
 	random_mod.o xmass_mod.o
-richardson.o: par_mod.o class_gribfile_mod.o
+richardson.o: par_mod.o check_gribfile_mod.o
 scalev.o: par_mod.o
 shift_field.o: par_mod.o
Index: src/obukhov.f90
===================================================================
--- src/obukhov.f90	(revision 6ecb30a41fb8a07e153abadc712699a09c15f90c)
+++ src/obukhov.f90	(revision c0884a86ec69f31a8b28c5554286971ba48392be)
@@ -20,5 +20,5 @@
 !**********************************************************************
 
-real function obukhov(ps,tsurf,tdsurf,tlev,ustar,hf,akm,bkm,plev,metdata_format)
+real function obukhov(ps,tsurf,tdsurf,tlev,ustar,hf,akm,bkm,plev,id_centre)
 
   !********************************************************************
@@ -41,4 +41,8 @@
   !       if-then for meteo-type dependent code                       *
   !                                                                   *
+  !                                                                   *
+  !  Petra Seibert, 2018-06-26:                                       *
+  !    simplified version met data format detection                   *
+  !                                                                   *
   !********************************************************************
   !                                                                   *
@@ -54,14 +58,14 @@
   !     bkm     ECMWF vertical discretization parameter               *
   !     plev                                                          *
-  !     metdata_format format of metdata (ecmwf/gfs)                  *
+  !     id_centre format of metdata (ecmwf/gfs)                  *
   !                                                                   *
   !********************************************************************
 
   use par_mod
-  use class_gribfile
+  use check_gribfile_mod
 
   implicit none
 
-  integer :: metdata_format
+  integer :: id_centre
   real :: akm(nwzmax),bkm(nwzmax)
   real :: ps,tsurf,tdsurf,tlev,ustar,hf,e,ew,tv,rhoa,plev
@@ -72,5 +76,5 @@
   tv=tsurf*(1.+0.378*e/ps)               ! virtual temperature
   rhoa=ps/(r_air*tv)                      ! air density
-  if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then
+  if (id_centre.eq.icg_id_ecmwf) then
   ak1=(akm(1)+akm(2))/2.
   bk1=(bkm(1)+bkm(2))/2.
Index: src/par_mod.f90
===================================================================
--- src/par_mod.f90	(revision 3f149ccfb522ead3fdd1e69283deccd58b8740fc)
+++ src/par_mod.f90	(revision c0884a86ec69f31a8b28c5554286971ba48392be)
@@ -147,6 +147,6 @@
   
   ! ECMWF
-! integer,parameter :: nxmax=361,nymax=181,nuvzmax=92,nwzmax=92,nzmax=92,nxshift=359 ! 1.0 degree 92 level
-  integer,parameter :: nxmax=361,nymax=181,nuvzmax=138,nwzmax=138,nzmax=138,nxshift=359 ! 1.0 degree 138 level
+ integer,parameter :: nxmax=721,nymax=362,nuvzmax=36,nwzmax=36,nzmax=36,nxshift=0 ! 1.0 degree 92 level
+!  integer,parameter :: nxmax=361,nymax=181,nuvzmax=138,nwzmax=138,nzmax=138,nxshift=359 ! 1.0 degree 138 level
 ! integer,parameter :: nxmax=721,nymax=361,nuvzmax=138,nwzmax=138,nzmax=138,nxshift=359  ! 0.5 degree 138 level
 !  integer,parameter :: nxmax=181,nymax=91,nuvzmax=92,nwzmax=92,nzmax=92,nxshift=0  ! CERA 2.0 degree 92 level
Index: src/richardson.f90
===================================================================
--- src/richardson.f90	(revision 6ecb30a41fb8a07e153abadc712699a09c15f90c)
+++ src/richardson.f90	(revision c0884a86ec69f31a8b28c5554286971ba48392be)
@@ -21,5 +21,5 @@
 
 subroutine richardson(psurf,ust,ttlev,qvlev,ulev,vlev,nuvz, &
-       akz,bkz,hf,tt2,td2,h,wst,hmixplus,metdata_format)
+       akz,bkz,hf,tt2,td2,h,wst,hmixplus,id_centre)
   !                        i    i    i     i    i    i    i
   ! i   i  i   i   i  o  o     o
@@ -41,4 +41,7 @@
   !     Meteor. 81, 245-269.                                                  *
   !                                                                           *
+  !                                                                           *
+  !  Petra Seibert, 2018-06-26: simplified version met data format detection  *
+  !                                                                           *
   !****************************************************************************
   !                                                                           *
@@ -55,4 +58,7 @@
   !       - Merged richardson and richardson_gfs into one routine using       *
   !         if-then for meteo-type dependent code                             *
+  !                                                                           *
+  !                                                                           *
+  !  Petra Seibert, 2018-06-26: simplified version met data format detection  *
   !                                                                           *
   !****************************************************************************
@@ -64,5 +70,5 @@
   ! tv                         virtual temperature                            *
   ! wst                        convective velocity scale                      *
-  ! metdata_format             format of metdata (ecmwf/gfs)                  *
+  ! id_centre                  format of metdata (ecmwf/gfs)                  *
   !                                                                           *
   ! Constants:                                                                *
@@ -72,9 +78,9 @@
 
   use par_mod
-  use class_gribfile
+  use check_gribfile_mod
 
   implicit none
 
-  integer :: metdata_format
+  integer :: id_centre
   integer :: i,k,nuvz,iter,llev,loop_start
   real :: tv,tvold,zref,z,zold,pint,pold,theta,thetaref,ri
@@ -89,5 +95,5 @@
   iter=0
 
-  if (metdata_format.eq.GRIBFILE_CENTRE_NCEP) then
+  if (id_centre.eq.icg_id_ncep) then
     ! NCEP version: find first model level above ground
     !**************************************************
@@ -123,5 +129,5 @@
   ! Integrate z up to one level above zt
   !*************************************
-  if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then
+  if (id_centre.eq.icg_id_ecmwf) then
     loop_start=2
   else
Index: src/timemanager.f90
===================================================================
--- src/timemanager.f90	(revision a9cf4b1e763458eb1d7f20f9d55d1f5bd8a87da6)
+++ src/timemanager.f90	(revision c0884a86ec69f31a8b28c5554286971ba48392be)
@@ -20,5 +20,5 @@
 !**********************************************************************
 
-subroutine timemanager(metdata_format)
+subroutine timemanager(id_centre)
 
   !*****************************************************************************
@@ -52,5 +52,8 @@
   !  Unified ECMWF and GFS builds                                              *
   !   Marian Harustak, 12.5.2017                                               *
-  !   - Added passing of metdata_format as it was needed by called routines    *
+  !   - Added passing of id_centre as it was needed by called routines         *
+  !                                                                            *
+  !  Petra Seibert, 2018-06-26: simplified version met data format detection   *
+  !                                                                            *
   !*****************************************************************************
   !                                                                            *
@@ -86,5 +89,5 @@
   ! xtra1(maxpart), ytra1(maxpart), ztra1(maxpart) =                           *
   !                    spatial positions of trajectories                       *
-  ! metdata_format     format of metdata (ecmwf/gfs)                           *
+  ! id_centre          format of metdata (ecmwf/gfs)                           *
   !                                                                            *
   ! Constants:                                                                 *
@@ -108,5 +111,5 @@
   implicit none
 
-  integer :: metdata_format
+  integer :: id_centre
   integer :: j,ks,kp,l,n,itime=0,nstop,nstop1
 ! integer :: ksp
@@ -201,5 +204,5 @@
            write (*,*) 'timemanager> call convmix -- backward'
         endif         
-      call convmix(itime,metdata_format)
+      call convmix(itime,id_centre)
         if (verbosity.gt.1) then
           !CALL SYSTEM_CLOCK(count_clock, count_rate, count_max)
@@ -214,5 +217,5 @@
            write (*,*) 'timemanager> call getfields'
     endif 
-    call getfields(itime,nstop1,metdata_format)
+    call getfields(itime,nstop1,id_centre)
         if (verbosity.gt.1) then
           CALL SYSTEM_CLOCK(count_clock)
@@ -273,5 +276,5 @@
        write (*,*) 'timemanager> call convmix -- forward'
      endif    
-     call convmix(itime,metdata_format)
+     call convmix(itime,id_centre)
    endif
 
Index: src/timemanager_mpi.f90
===================================================================
--- src/timemanager_mpi.f90	(revision 20963b15051b22eeb381dcf4e824a9104d92717b)
+++ src/timemanager_mpi.f90	(revision c0884a86ec69f31a8b28c5554286971ba48392be)
@@ -20,5 +20,5 @@
 !**********************************************************************
 
-subroutine timemanager(metdata_format)
+subroutine timemanager(id_centre)
 
 !*****************************************************************************
@@ -52,5 +52,8 @@
 !  Unified ECMWF and GFS builds                                              *
 !   Marian Harustak, 12.5.2017                                               *
-!   - Added passing of metdata_format as it was needed by called routines    *
+!   - Added passing of id_centre as it was needed by called routines         *
+!                                                                            *
+!  Petra Seibert, 2018-06-26: simplified version met data format detection   *
+!                                                                            *
 !*****************************************************************************
 !                                                                            *
@@ -86,5 +89,5 @@
 ! xtra1(maxpart), ytra1(maxpart), ztra1(maxpart) =                           *
 !                    spatial positions of trajectories                       *
-! metdata_format     format of metdata (ecmwf/gfs)                           *
+! id_centre          format of metdata (ecmwf/gfs)                           *
 !                                                                            *
 ! Constants:                                                                 *
@@ -109,5 +112,5 @@
   implicit none
 
-  integer :: metdata_format
+  integer :: id_centre
   logical :: reqv_state=.false. ! .true. if waiting for a MPI_Irecv to complete
   integer :: j,ks,kp,l,n,itime=0,nstop,nstop1,memstat=0
@@ -214,5 +217,5 @@
       endif
 ! readwind process skips this step
-      if (.not.(lmpreader.and.lmp_use_reader)) call convmix(itime,metdata_format)
+      if (.not.(lmpreader.and.lmp_use_reader)) call convmix(itime,id_centre)
     endif
 
@@ -227,5 +230,5 @@
     if (mp_measure_time) call mpif_mtime('getfields',0)
 
-    call getfields(itime,nstop1,memstat,metdata_format)
+    call getfields(itime,nstop1,memstat,id_centre)
 
     if (mp_measure_time) call mpif_mtime('getfields',1)
@@ -355,5 +358,5 @@
         write (*,*) 'timemanager> call convmix -- forward'
       endif
-      call convmix(itime,metdata_format)
+      call convmix(itime,id_centre)
     endif
 
