Index: src/makefile
===================================================================
--- src/makefile	(revision c56da455adc4af0f5c28c039f48f7b6b73595ced)
+++ src/makefile	(revision fe118c0f73cfce2b8e612d1d42e2e4bbc072975a)
@@ -1,27 +1,36 @@
+# SPDX-FileCopyrightText: FLEXPART 1998-2019, see flexpart_license.txt
+# SPDX-License-Identifier: GPL-3.0-or-later
+
 SHELL = /bin/bash
-################################################################################
+
+##############################################################
 #  DESCRIPTION
-#    Makefile for FLEXPART. Standard (serial) and parallel (MPI) version
-#
-#    Dependencies are resolved in this makefile, so parallel make is
-#    possible ("make -j")
-#
-#    At NILU we have installed gcc-4.9.1 and libraries under user /homevip/flexpart
-#    ("ROOT_DIR")
-#    To use gfortran version 4.9, add "gcc=4.9" to the make command, e.g.
-#       'make -j ecmwf gcc=4.9',
-#    also set environment variable LD_LIBRARY_PATH to point to compiler libraries
-#
-#    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 
-#    are to enable the MPI_IN_PLACE option only if compiled with a -DUSE_MPIINPLACE directive. 
-#    Otherwise, a safer option (which requires the allocation of another array) is used by default. 
-#    In makefile added the -x f95-cpp-input flag for compiling of cpp directives.
+#    Makefile for FLEXPART. 
+#    Standard (serial) and parallel (MPI) version
+#
+#    Dependencies are resolved in this makefile, 
+#    so parallel make is possible ("make -j")
+#
+#    At NILU we have installed gcc-4.9.1 and libraries under 
+#    user /homevip/flexpart ("ROOT_DIR"). You may adapt that
+#    for your needs; also set environment variable 
+#    LD_LIBRARY_PATH to point to compiler libraries if not in
+#    the standard location 
+#    There are different definitions of paths included below
+#    You have to comment them in or out according to your
+#    environment, or adapt them!
+#
+#    cpp directives USE_MPIINPLACE were added to three  
+#    source files. The effect of these directives is to enable 
+#    the MPI_IN_PLACE option only if compiled with a 
+#    -DUSE_MPIINPLACE directive. Otherwise, a safer option 
+#    (which requires the allocation of another array) is used by default. 
+#    -x f95-cpp-input added  for compiling of cpp directives.
 # 
 #  USAGE
 #    Compile serial FLEXPART 
 #      make [-j] serial
+#    or simply
+#      make [-j] 
 #
 #    Compile parallel FLEXPART 
@@ -50,27 +59,44 @@
 FLEXPART-SERIAL = FLEXPART
 
-
-ifeq ($(gcc), 4.9)
-# Compiled libraries under user ~flexpart, gfortran v4.9
-	ROOT_DIR = /homevip/flexpart/
-
-	F90	  = ${ROOT_DIR}/gcc-4.9.1/bin/gfortran
-	MPIF90    = ${ROOT_DIR}/bin/mpifort
-
-	INCPATH1  = ${ROOT_DIR}/gcc-4.9.1/include	
-	INCPATH2  = ${ROOT_DIR}/include
-	LIBPATH1 = ${ROOT_DIR}/lib
-else 
-# Compiled libraries under user ~flexpart, gfortran v5.4
-	ROOT_DIR = /homevip/flexpart/
-
-	F90	  = /usr/bin/gfortran
-	MPIF90    = /usr/bin/mpifort
-
-	INCPATH1  = ${ROOT_DIR}/gcc-5.4.0/include	
-	INCPATH2  = /usr/include
-	LIBPATH1 = ${ROOT_DIR}/gcc-5.4.0/lib
-endif
-
+# the following is for NILU only
+
+#ifeq ($(gcc), 4.9)
+## Compiled libraries under user ~flexpart, gfortran v4.9
+#	ROOT_DIR = /homevip/flexpart/
+#
+#	F90	  = ${ROOT_DIR}/gcc-4.9.1/bin/gfortran
+#	MPIF90    = ${ROOT_DIR}/bin/mpifort
+#
+#	INCPATH1  = ${ROOT_DIR}/gcc-4.9.1/include	
+#	INCPATH2  = ${ROOT_DIR}/include
+#	LIBPATH1  = ${ROOT_DIR}/lib
+#else 
+## Compiled libraries under user ~flexpart, gfortran v5.4
+#	ROOT_DIR = /homevip/flexpart/
+#
+#	F90	  = /usr/bin/gfortran
+#	MPIF90    = /usr/bin/mpifort
+#
+#	INCPATH1  = ${ROOT_DIR}/gcc-5.4.0/include	
+#	INCPATH2  = /usr/include
+#	LIBPATH1  = ${ROOT_DIR}/gcc-5.4.0/lib
+#endif
+
+# the following works on a Debian stretch machine
+
+	F90	  = gfortran
+	MPIF90    = mpifort
+
+	INCPATH1  = /usr/include/
+	INCPATH2  = ./
+	LIBPATH1  = /usr/lib/
+
+# the following works on a Debian buster (and probably newer) machine
+#	F90	  = gfortran
+#	MPIF90    = mpifort
+#
+#	INCPATH1  = /usr/lib/x86_64-linux-gnu/fortran/gfortran-mod-15
+#	INCPATH2  = /usr/include
+#	LIBPATH1  = /usr/lib/x86_64-linux-gnu/
 
 ### Enable netCDF output?
@@ -88,17 +114,22 @@
 
 ## OPTIMIZATION LEVEL
-O_LEV = 0 # [0,1,2,3,g,s,fast]
-O_LEV_DBG = g # [0,g]
+O_LEV = 2 # [0,1,2,3,g,s,fast] # 0 may give trouble; then use -mcmdoel=large
+O_LEV_DBG = 0 # [0,g] # use g only for debugging
 
 ## LIBRARIES
-#LIBS = -lgrib_api_f90 -lgrib_api -lm -ljasper -lnetcdff
 LIBS = -lgrib_api_f90 -lgrib_api -lm -ljasper $(NCOPT)
 
-FFLAGS   = -I$(INCPATH1) -I$(INCPATH2) -O$(O_LEV) -g -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
-
-DBGFLAGS = -I$(INCPATH1) -I$(INCPATH2) -O$(O_LEV_DBG) -g3 -ggdb3 -cpp -m64 -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -fmessage-length=0 -flto=jobserver -O$(O_LEV_DBG) $(NCOPT) -fbacktrace   -Wall  -fdump-core $(FUSER)  #  -ffpe-trap=invalid,overflow,denormal,underflow,zero  -Warray-bounds -fcheck=all
-
-LDFLAGS  = $(FFLAGS) -L$(LIBPATH1) -Wl,-rpath,$(LIBPATH1) $(LIBS) #-L$(LIBPATH2)
-LDDEBUG  = $(DBGFLAGS) -L$(LIBPATH1) $(LIBS) #-L$(LIBPATH2)
+FFLAGS   = -I$(INCPATH1) -I$(INCPATH2) -O$(O_LEV) -g -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
+
+DBGFLAGS = -I$(INCPATH1) -I$(INCPATH2) -O$(O_LEV_DBG) -g3 -ggdb3 -cpp \
+           -m64 -mcmodel=medium -fconvert=little-endian -frecord-marker=4  \
+           -fmessage-length=0 -flto=jobserver -O$(O_LEV_DBG) $(NCOPT) \
+           -fbacktrace   -Wall  -fdump-core $(FUSER) -fcheck=all #\
+            #  -ffpe-trap=invalid,overflow,denormal,underflow,zero 
+
+LDFLAGS  = $(FFLAGS) -L$(LIBPATH1) -Wl,-rpath,$(LIBPATH1) $(LIBS)
+LDDEBUG  = $(DBGFLAGS) -L$(LIBPATH1) $(LIBS)
 
 MODOBJS = \
@@ -147,5 +178,7 @@
         readwind_ecmwf_mpi.o 
 
-OBJECTS_NCF = netcdf_output_mod.o
+ifeq ($(ncf), yes)
+        OBJECTS_NCF = netcdf_output_mod.o
+endif
 
 OBJECTS = \
@@ -258,6 +291,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
-calcpar.o: com_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
 calcpar_nests.o: com_mod.o par_mod.o
 calcpv.o: com_mod.o par_mod.o
@@ -292,7 +325,7 @@
 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
+convmix.o: com_mod.o conv_mod.o flux_mod.o par_mod.o class_gribfile_mod.o
 coordtrafo.o: com_mod.o par_mod.o point_mod.o
-detectformat.o: com_mod.o par_mod.o
+detectformat.o: com_mod.o par_mod.o class_gribfile_mod.o
 distance.o: par_mod.o
 distance2.o: par_mod.o
@@ -300,14 +333,28 @@
 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 netcdf_output_mod.o par_mod.o point_mod.o \
+ifeq ($(ncf), yes)
+        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 \
 	random_mod.o
-FLEXPART_MPI.o: com_mod.o conv_mod.o mpi_mod.o netcdf_output_mod.o par_mod.o \
-	point_mod.o random_mod.o
+        FLEXPART_MPI.o: com_mod.o conv_mod.o mpi_mod.o netcdf_output_mod.o par_mod.o \
+	point_mod.o random_mod.o class_gribfile_mod.o
+        netcdf_output_mod.o: com_mod.o mean_mod.o outg_mod.o par_mod.o point_mod.o unc_mod.o
+        timemanager.o: com_mod.o flux_mod.o netcdf_output_mod.o oh_mod.o outg_mod.o \
+	par_mod.o point_mod.o unc_mod.o xmass_mod.o
+        timemanager_mpi.o: com_mod.o flux_mod.o mpi_mod.o netcdf_output_mod.o \
+	oh_mod.o outg_mod.o par_mod.o point_mod.o unc_mod.o xmass_mod.o
+else        
+        FLEXPART.o: com_mod.o conv_mod.o par_mod.o point_mod.o random_mod.o  class_gribfile_mod.o random_mod.o
+        FLEXPART_MPI.o: com_mod.o conv_mod.o mpi_mod.o par_mod.o point_mod.o random_mod.o class_gribfile_mod.o
+        timemanager.o: com_mod.o flux_mod.o oh_mod.o outg_mod.o \
+	par_mod.o point_mod.o unc_mod.o xmass_mod.o
+        timemanager_mpi.o: com_mod.o flux_mod.o mpi_mod.o \
+	oh_mod.o outg_mod.o par_mod.o point_mod.o unc_mod.o xmass_mod.o
+endif
 fluxoutput.o: com_mod.o flux_mod.o outg_mod.o par_mod.o
 get_settling.o: com_mod.o par_mod.o
 get_vdep_prob.o: com_mod.o interpol_mod.o par_mod.o point_mod.o
 get_wetscav.o: com_mod.o par_mod.o point_mod.o
-getfields.o: com_mod.o par_mod.o
-getfields_mpi.o: com_mod.o mpi_mod.o par_mod.o
+getfields.o: com_mod.o par_mod.o class_gribfile_mod.o
+getfields_mpi.o: com_mod.o mpi_mod.o par_mod.o class_gribfile_mod.o
 gethourlyOH.o: com_mod.o oh_mod.o par_mod.o
 getrb.o: par_mod.o
@@ -346,7 +393,5 @@
 mean_mod.o: par_mod.o
 mpi_mod.o: com_mod.o par_mod.o unc_mod.o
-netcdf_output_mod.o: com_mod.o mean_mod.o outg_mod.o par_mod.o point_mod.o \
-	unc_mod.o
-obukhov.o: par_mod.o
+obukhov.o: par_mod.o class_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
@@ -394,12 +439,8 @@
 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
+richardson.o: par_mod.o class_gribfile_mod.o
 scalev.o: par_mod.o
 shift_field.o: par_mod.o
 shift_field_0.o: par_mod.o
-timemanager.o: com_mod.o flux_mod.o netcdf_output_mod.o oh_mod.o outg_mod.o \
-	par_mod.o point_mod.o unc_mod.o xmass_mod.o
-timemanager_mpi.o: com_mod.o flux_mod.o mpi_mod.o netcdf_output_mod.o \
-	oh_mod.o outg_mod.o par_mod.o point_mod.o unc_mod.o xmass_mod.o
 unc_mod.o: par_mod.o
 verttransform_ecmwf.o: cmapf_mod.o com_mod.o par_mod.o
Index: src/verttransform_ecmwf.f90
===================================================================
--- src/verttransform_ecmwf.f90	(revision 92fab6545ef2a8e57cadc977df94b6b510318a1d)
+++ src/verttransform_ecmwf.f90	(revision fe118c0f73cfce2b8e612d1d42e2e4bbc072975a)
@@ -37,4 +37,7 @@
 !*****************************************************************************
 ! Date: 2017-05-30 modification of a bug in ew. Don Morton (CTBTO project)   *
+!*****************************************************************************
+! PS 2020-07-05: 
+! remove superfluous comma in write, write and open to lowercase
 !*****************************************************************************
 !                                                                            *
@@ -727,5 +730,5 @@
 !teller(:)=0
 virr=virr+1
-WRITE(aspec, '(i3.3)'), virr
+write(aspec, '(i3.3)') virr
 
 !if (readclouds) then
@@ -775,7 +778,7 @@
 !OPEN(UNIT=114, FILE=fnameD,FORM='FORMATTED',STATUS = 'UNKNOWN')
 !else
-OPEN(UNIT=115, FILE=fnameH,FORM='FORMATTED',STATUS = 'UNKNOWN')
-OPEN(UNIT=116, FILE=fnameI,FORM='FORMATTED',STATUS = 'UNKNOWN')
-OPEN(UNIT=117, FILE=fnameJ,FORM='FORMATTED',STATUS = 'UNKNOWN')
+open(unit=115, file=fnameh,form='formatted',status = 'unknown')
+open(unit=116, file=fnamei,form='formatted',status = 'unknown')
+open(unit=117, file=fnamej,form='formatted',status = 'unknown')
 !endif
 !
@@ -799,7 +802,7 @@
 !CLOSE(114)
 !else
-CLOSE(115)
-CLOSE(116)
-CLOSE(117)
+close(115)
+close(116)
+close(117)
 endif
 !endif
