Index: src/getfields.f90
===================================================================
--- src/getfields.f90	(revision d1a8707797c5c3fabdbd530210b84b85fb18b258)
+++ src/getfields.f90	(revision 6ecb30a41fb8a07e153abadc712699a09c15f90c)
@@ -20,5 +20,5 @@
 !**********************************************************************
 
-subroutine getfields(itime,nstop)
+subroutine getfields(itime,nstop,metdata_format)
 !                       i     o
 !*****************************************************************************
@@ -38,7 +38,11 @@
 !                                                                            *
 !*****************************************************************************
-!  Changes, Bernd C. Krueger, Feb. 2001:
-!   Variables tth,qvh,tthn,qvhn (on eta coordinates) in common block.
-!   Function of nstop extended.
+!  Changes, Bernd C. Krueger, Feb. 2001:                                     *
+!   Variables tth,qvh,tthn,qvhn (on eta coordinates) in common block.        *
+!   Function of nstop extended.                                              *
+!                                                                            *
+!   Unified ECMWF and GFS builds                                             *
+!   Marian Harustak, 12.5.2017                                               *
+!     - Added passing of metdata_format as it was needed by called routines  *
 !*****************************************************************************
 !                                                                            *
@@ -58,4 +62,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)                           *
 !                                                                            *
 ! Constants:                                                                 *
@@ -67,8 +72,10 @@
   use par_mod
   use com_mod
+  use class_gribfile
 
   implicit none
 
   integer :: indj,itime,nstop,memaux
+  integer :: metdata_format
 
   real :: uuh(0:nxmax-1,0:nymax-1,nuvzmax)
@@ -125,9 +132,17 @@
     do indj=indmin,numbwf-1
       if (ldirect*wftime(indj+1).gt.ldirect*itime) then
-        call readwind(indj+1,memind(2),uuh,vvh,wwh)
+        if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then
+          call readwind_ecmwf(indj+1,memind(2),uuh,vvh,wwh)
+        else
+          call readwind_gfs(indj+1,memind(2),uuh,vvh,wwh)
+        end if
         call readwind_nests(indj+1,memind(2),uuhn,vvhn,wwhn)
-        call calcpar(memind(2),uuh,vvh,pvh)
-        call calcpar_nests(memind(2),uuhn,vvhn,pvhn)
-        call verttransform(memind(2),uuh,vvh,wwh,pvh)
+        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 verttransform_ecmwf(memind(2),uuh,vvh,wwh,pvh)
+        else
+          call verttransform_gfs(memind(2),uuh,vvh,wwh,pvh)
+        end if
         call verttransform_nests(memind(2),uuhn,vvhn,wwhn,pvhn)
         memtime(2)=wftime(indj+1)
@@ -152,17 +167,33 @@
            (ldirect*wftime(indj+1).gt.ldirect*itime)) then
         memind(1)=1
-        call readwind(indj,memind(1),uuh,vvh,wwh)
+        if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then
+          call readwind_ecmwf(indj,memind(1),uuh,vvh,wwh)
+        else
+          call readwind_gfs(indj,memind(1),uuh,vvh,wwh)
+        end if
         call readwind_nests(indj,memind(1),uuhn,vvhn,wwhn)
-        call calcpar(memind(1),uuh,vvh,pvh)
-        call calcpar_nests(memind(1),uuhn,vvhn,pvhn)
-        call verttransform(memind(1),uuh,vvh,wwh,pvh)
+        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 verttransform_ecmwf(memind(1),uuh,vvh,wwh,pvh)
+        else
+          call verttransform_gfs(memind(1),uuh,vvh,wwh,pvh)
+        end if
         call verttransform_nests(memind(1),uuhn,vvhn,wwhn,pvhn)
         memtime(1)=wftime(indj)
         memind(2)=2
-        call readwind(indj+1,memind(2),uuh,vvh,wwh)
+        if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then
+          call readwind_ecmwf(indj+1,memind(2),uuh,vvh,wwh)
+        else
+          call readwind_gfs(indj+1,memind(2),uuh,vvh,wwh)
+        end if
         call readwind_nests(indj+1,memind(2),uuhn,vvhn,wwhn)
-        call calcpar(memind(2),uuh,vvh,pvh)
-        call calcpar_nests(memind(2),uuhn,vvhn,pvhn)
-        call verttransform(memind(2),uuh,vvh,wwh,pvh)
+        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 verttransform_ecmwf(memind(2),uuh,vvh,wwh,pvh)
+        else
+          call verttransform_gfs(memind(2),uuh,vvh,wwh,pvh)
+        end if
         call verttransform_nests(memind(2),uuhn,vvhn,wwhn,pvhn)
         memtime(2)=wftime(indj+1)
