Index: palm/trunk/UTIL/inifor/Makefile
===================================================================
--- palm/trunk/UTIL/inifor/Makefile	(revision 3779)
+++ palm/trunk/UTIL/inifor/Makefile	(revision 3785)
@@ -14,6 +14,6 @@
 # PALM. If not, see <http://www.gnu.org/licenses/>.
 #
-# Copyright 2017-2018 Leibniz Universitaet Hannover
-# Copyright 2017-2018 Deutscher Wetterdienst Offenbach
+# Copyright 2017-2019 Leibniz Universitaet Hannover
+# Copyright 2017-2019 Deutscher Wetterdienst Offenbach
 #------------------------------------------------------------------------------#
 #
@@ -25,4 +25,8 @@
 # -----------------
 # $Id$
+# Updated copyright note
+# 
+# 
+# 3716 2019-02-05 17:02:38Z eckhard
 # Added __netcdf preprocessor flag
 # 
Index: palm/trunk/UTIL/inifor/Makefile.gnu
===================================================================
--- palm/trunk/UTIL/inifor/Makefile.gnu	(revision 3779)
+++ palm/trunk/UTIL/inifor/Makefile.gnu	(revision 3785)
@@ -14,6 +14,6 @@
 # PALM. If not, see <http://www.gnu.org/licenses/>.
 #
-# Copyright 2017-2018 Leibniz Universitaet Hannover
-# Copyright 2017-2018 Deutscher Wetterdienst Offenbach
+# Copyright 2017-2019 Leibniz Universitaet Hannover
+# Copyright 2017-2019 Deutscher Wetterdienst Offenbach
 #------------------------------------------------------------------------------#
 #
@@ -25,4 +25,8 @@
 # -----------------
 # $Id$
+# Updated copyright note
+# 
+# 
+# 3716 2019-02-05 17:02:38Z eckhard
 # Added __netcdf preprocessor flag
 # 
Index: palm/trunk/UTIL/inifor/Makefile.ifort
===================================================================
--- palm/trunk/UTIL/inifor/Makefile.ifort	(revision 3779)
+++ palm/trunk/UTIL/inifor/Makefile.ifort	(revision 3785)
@@ -14,6 +14,6 @@
 # PALM. If not, see <http://www.gnu.org/licenses/>.
 #
-# Copyright 2017-2018 Leibniz Universitaet Hannover
-# Copyright 2017-2018 Deutscher Wetterdienst Offenbach
+# Copyright 2017-2019 Leibniz Universitaet Hannover
+# Copyright 2017-2019 Deutscher Wetterdienst Offenbach
 #------------------------------------------------------------------------------#
 #
@@ -25,4 +25,8 @@
 # -----------------
 # $Id$
+# Updated copyright note
+# 
+# 
+# 3716 2019-02-05 17:02:38Z eckhard
 # Added __netcdf preprocessor flag
 # 
Index: palm/trunk/UTIL/inifor/src/inifor.f90
===================================================================
--- palm/trunk/UTIL/inifor/src/inifor.f90	(revision 3779)
+++ palm/trunk/UTIL/inifor/src/inifor.f90	(revision 3785)
@@ -130,5 +130,5 @@
 
     LOGICAL, SAVE ::  ug_vg_have_been_computed = .FALSE. !< flag for managing geostrophic wind allocation and computation
-    LOGICAL, SAVE ::  debugging_output = .TRUE.          !< flag controllging output of internal variables
+    !LOGICAL, SAVE ::  debugging_output = .TRUE.          !< flag controllging output of internal variables
     
 !> \mainpage About INIFOR
@@ -163,6 +163,5 @@
 !
 !-- Add the output variables to the netCDF output file
-    CALL setup_netcdf_variables(output_file % name, output_var_table,          &
-                                cfg % debug)
+    CALL setup_netcdf_variables(output_file % name, output_var_table)
 
     CALL setup_io_groups()
@@ -193,5 +192,5 @@
                    "' could not be preprocessed sucessfully."
                 CALL inifor_abort('main loop', message)
-             END IF
+             ENDIF
 
 !------------------------------------------------------------------------------
@@ -276,7 +275,7 @@
                                output_arr(0,0,:), rho_centre,                  &
                                output_var % averaging_grid)
-                         END IF
-
-                      END IF
+                         ENDIF
+
+                      ENDIF
  CALL run_control('time', 'comp')
 
@@ -349,5 +348,5 @@
                             input_buffer(output_var % input_id) % array(:,:,:),&
                             internal_arr(:),                                   &
-                            cosmo_grid, output_var % averaging_grid            &
+                            output_var % averaging_grid                        &
                          )
 
@@ -363,5 +362,5 @@
                       !   ALLOCATE( output_arr(1,1,1:output_var % grid % nz) )
                       !   output_arr(1,1,:) = internal_arr(:)
-                      !END IF
+                      !ENDIF
  CALL run_control('time', 'comp')
 
@@ -395,9 +394,9 @@
                             CALL interpolate_1d( vg_cosmo, vg_palm,             &
                                                  output_var % grid )
-                         END IF
+                         ENDIF
 
                          ug_vg_have_been_computed = .TRUE.
 
-                      END IF
+                      ENDIF
 
 !
@@ -467,14 +466,14 @@
                                          output_file, cfg)
  CALL run_control('time', 'write')
-                   END IF
+                   ENDIF
 
                    IF (ALLOCATED(output_arr))  DEALLOCATE(output_arr)
  CALL run_control('time', 'alloc')
 
-                END IF
+                ENDIF
 
 !
 !--          output variable loop
-             END DO
+             ENDDO
 
              ug_vg_have_been_computed = .FALSE.
@@ -494,6 +493,6 @@
                    DEALLOCATE( p_east )
                    DEALLOCATE( p_west )
-                END IF
-             END IF
+                ENDIF
+             ENDIF
 
 !
@@ -505,15 +504,15 @@
                 CALL report('main loop', 'Deallocating input buffer', cfg % debug)
                 DEALLOCATE(input_buffer)
-             END IF
+             ENDIF
  CALL run_control('time', 'alloc')
 
 !
 !--       time steps / input files loop
-          END DO
+          ENDDO
 
           IF (ALLOCATED(input_buffer))  THEN
              CALL report('main loop', 'Deallocating input buffer', cfg % debug)
              DEALLOCATE(input_buffer)
-          END IF
+          ENDIF
  CALL run_control('time', 'alloc')
 
@@ -524,5 +523,5 @@
               message = TRIM(message) // " with input variable '" //           &
               TRIM(group % in_var_list(1) % name) // "'."
-          END IF
+          ENDIF
 
           CALL report('main loop', message, cfg % debug)
@@ -530,9 +529,9 @@
 !
 !--    IO group % to_be_processed conditional
-       END IF
+       ENDIF
 
 !
 !-- IO groups loop
-    END DO
+    ENDDO
 
 !------------------------------------------------------------------------------
Index: palm/trunk/UTIL/inifor/src/inifor_control.f90
===================================================================
--- palm/trunk/UTIL/inifor/src/inifor_control.f90	(revision 3779)
+++ palm/trunk/UTIL/inifor/src/inifor_control.f90	(revision 3785)
@@ -110,5 +110,5 @@
        ELSE
           OPEN( NEWUNIT=u, FILE='inifor.log', POSITION='append', STATUS='old' )
-       END IF
+       ENDIF
           
 
@@ -116,10 +116,10 @@
        IF ( PRESENT(debug) )  THEN
           IF ( .NOT. debug )  suppress_message = .TRUE.
-       END IF
+       ENDIF
 
        IF ( .NOT. suppress_message )  THEN
           PRINT *, "inifor: " // TRIM(message) // "  [ " // TRIM(routine) // " ]"
           WRITE(u, *)  TRIM(message) // "  [ " // TRIM(routine) // " ]"
-       END IF
+       ENDIF
 
        CLOSE(u)
Index: palm/trunk/UTIL/inifor/src/inifor_grid.f90
===================================================================
--- palm/trunk/UTIL/inifor/src/inifor_grid.f90	(revision 3779)
+++ palm/trunk/UTIL/inifor/src/inifor_grid.f90	(revision 3785)
@@ -440,5 +440,5 @@
                     "has not been implemented, yet."
           CALL inifor_abort('setup_parameters', message)
-       END IF
+       ENDIF
 
 !
@@ -525,5 +525,5 @@
                                   // TRIM(cfg % namelist_file) // "'"
 
-       END IF
+       ENDIF
        origin_lon = origin_lon * TO_RADIANS
        origin_lat = origin_lat * TO_RADIANS
@@ -566,5 +566,5 @@
           hfl(:,:,k) = 0.5_dp * ( hhl(:,:,k) +                                 &
                                   hhl(:,:,k+1) )
-       END DO
+       ENDDO
  CALL run_control('time', 'comp')
 
@@ -1041,5 +1041,5 @@
                   x0=x0, y0=y0, z0 = z0,                                          &
                   nx = nx, ny = ny, nz = nlev - 1)
-       END IF
+       ENDIF
 
 !                                                                              
@@ -1117,5 +1117,5 @@
           CALL setup_interpolation(cosmo_grid, scalars_south_grid, scalars_south_intermediate, interp_mode)
           CALL setup_interpolation(cosmo_grid, scalars_top_grid, scalars_top_intermediate, interp_mode)
-       END IF
+       ENDIF
 
        interp_mode = 'u'
@@ -1127,5 +1127,5 @@
           CALL setup_interpolation(cosmo_grid, u_south_grid, u_south_intermediate, interp_mode)
           CALL setup_interpolation(cosmo_grid, u_top_grid, u_top_intermediate, interp_mode)
-       END IF
+       ENDIF
 
        interp_mode = 'v'
@@ -1137,5 +1137,5 @@
           CALL setup_interpolation(cosmo_grid, v_south_grid, v_south_intermediate, interp_mode)
           CALL setup_interpolation(cosmo_grid, v_top_grid, v_top_intermediate, interp_mode)
-       END IF
+       ENDIF
 
        interp_mode = 'w'
@@ -1147,9 +1147,9 @@
           CALL setup_interpolation(cosmo_grid, w_south_grid, w_south_intermediate, interp_mode)
           CALL setup_interpolation(cosmo_grid, w_top_grid, w_top_intermediate, interp_mode)
-       END IF
+       ENDIF
 
        IF (TRIM(cfg % ic_mode) == 'profile')  THEN
            !TODO: remove this conditional if not needed. 
-       END IF
+       ENDIF
         
 
@@ -1241,5 +1241,5 @@
        IF (PRESENT(ic_mode))  THEN
           IF (TRIM(ic_mode) == 'profile')  setup_volumetric = .FALSE.
-       END IF
+       ENDIF
 
        IF (setup_volumetric)  THEN
@@ -1254,5 +1254,5 @@
           CALL interpolate_2d(cosmo_h, intermediate_grid % h, intermediate_grid)
           CALL find_vertical_neighbours_and_weights_interp(grid, intermediate_grid)
-       END IF
+       ENDIF
        
     END SUBROUTINE setup_interpolation
@@ -1317,5 +1317,5 @@
               message = "z has not been passed but is required for 'boundary' grids"
               CALL inifor_abort('init_grid_definition', message)
-           END IF
+           ENDIF
 
            ALLOCATE( grid % x(0:nx) )
@@ -1335,5 +1335,5 @@
               ALLOCATE( grid % w_verti(0:nx, 0:ny, 1:nz, 2) )
               grid % w_verti(:,:,:,:) = 0.0_dp
-           END IF
+           ENDIF
         
         CASE('boundary intermediate')
@@ -1374,10 +1374,10 @@
               message = "z has not been passed but is required for 'palm' grids"
               CALL inifor_abort('init_grid_definition', message)
-           END IF
+           ENDIF
 
            IF (.NOT.PRESENT(zw))  THEN
               message = "zw has not been passed but is required for 'palm' grids"
               CALL inifor_abort('init_grid_definition', message)
-           END IF
+           ENDIF
 
            grid % name(1) = 'x and lon'
@@ -1407,5 +1407,5 @@
               ALLOCATE( grid % w_verti(0:nx, 0:ny, 1:nz, 2) )
               grid % w_verti(:,:,:,:) = 0.0_dp
-           END IF
+           ENDIF
 
         CASE('palm intermediate')
@@ -1602,5 +1602,5 @@
                           avg_grid % iii, avg_grid % jjj)
 
-       END IF
+       ENDIF
 
 !
@@ -1674,6 +1674,6 @@
           avg_grid % iii(l) = i
           avg_grid % jjj(l) = j
-       END DO
-       END DO
+       ENDDO
+       ENDDO
 
     END SUBROUTINE get_cosmo_averaging_region
@@ -2083,5 +2083,5 @@
         DO k = 1, UBOUND(zw, 1)
            zw(k) = 0.5_dp * (z(k-1) + z(k))
-        END DO
+        ENDDO
 
     END SUBROUTINE midpoints
@@ -2291,5 +2291,5 @@
        ELSE
           group % n_output_quantities = group % n_inputs
-       END IF
+       ENDIF
 
        ALLOCATE(group % in_var_list(group % n_inputs))
@@ -2347,5 +2347,5 @@
           message = 'Simulation start date has not been set.'
           CALL inifor_abort('setup_variable_tables', message)
-       END IF
+       ENDIF
 
        nc_source_text = 'COSMO-DE analysis from ' // TRIM(cfg % start_date)
@@ -2491,5 +2491,5 @@
        IF (TRIM(ic_mode) == 'profile')  THEN
           output_var_table(3) % averaging_grid => averaged_initial_scalar_profile
-       END IF
+       ENDIF
 
        output_var_table(4) = init_nc_var(                                      &
@@ -2567,5 +2567,5 @@
        IF (TRIM(ic_mode) == 'profile')  THEN
           output_var_table(9) % averaging_grid => averaged_initial_scalar_profile
-       END IF
+       ENDIF
 
        output_var_table(10) = init_nc_var(                                     &
@@ -2643,5 +2643,5 @@
        IF (TRIM(ic_mode) == 'profile')  THEN
           output_var_table(15) % averaging_grid => averaged_initial_scalar_profile
-       END IF 
+       ENDIF 
 
        output_var_table(16) = init_nc_var(                                     &
@@ -2719,5 +2719,5 @@
        IF (TRIM(ic_mode) == 'profile')  THEN
           output_var_table(21) % averaging_grid => averaged_initial_scalar_profile
-       END IF
+       ENDIF
 
        output_var_table(22) = init_nc_var(                                     &
@@ -2795,5 +2795,5 @@
        IF (TRIM(ic_mode) == 'profile')  THEN
           output_var_table(27) % averaging_grid => averaged_initial_w_profile
-       END IF
+       ENDIF
 
        output_var_table(28) = init_nc_var(                                     &
@@ -3315,5 +3315,5 @@
        IF (PRESENT(is_profile))  THEN
           IF (is_profile)  out_var_kind = TRIM(kind) // ' profile'
-       END IF
+       ENDIF
 
        var % name              = name
@@ -3734,7 +3734,7 @@
                                u = input_buffer(1) % array(i,j,k),             &
                                v = input_buffer(2) % array(i,j,k) )
-             END DO
-             END DO
-             END DO
+             ENDDO
+             ENDDO
+             ENDDO
 
           CASE DEFAULT
@@ -3788,6 +3788,6 @@
                    basic_state_pressure(:)
 
-             END DO
-             END DO
+             ENDDO
+             ENDDO
  CALL run_control('time', 'comp')
 
@@ -3797,5 +3797,5 @@
              group % in_var_list(2) % name = 'P'
 
-          END IF
+          ENDIF
 !
 !--       mark pressure as preprocessed
@@ -3875,7 +3875,7 @@
              input_buffer(1) % array(i,j,k) =                                  &
                  input_buffer(1) % array(i,j,k) * d_depth_rho_inv(k)
-          END DO
-          END DO
-          END DO
+          ENDDO
+          ENDDO
+          ENDDO
 
           message = "Converted soil water from [kg/m^2] to [m^3/m^3]"
@@ -4054,7 +4054,7 @@
                       n_cells = n_cells + 1
                       column(:) = column(:) + array(ii,jj,:)
-                   END IF
-
-                END DO
+                   ENDIF
+
+                ENDDO
 
 !
@@ -4063,14 +4063,14 @@
                    array(i,j,:) = column(:) / n_cells
                    new_soiltyp(i,j) = 0
-                END IF
-
-             END IF
-
-          END DO
-          END DO
+                ENDIF
+
+             ENDIF
+
+          ENDDO
+          ENDDO
 
           old_soiltyp(:,:) = new_soiltyp(:,:)
 
-       END DO
+       ENDDO
 
        DEALLOCATE(old_soiltyp, new_soiltyp)
Index: palm/trunk/UTIL/inifor/src/inifor_io.f90
===================================================================
--- palm/trunk/UTIL/inifor/src/inifor_io.f90	(revision 3779)
+++ palm/trunk/UTIL/inifor/src/inifor_io.f90	(revision 3785)
@@ -177,5 +177,5 @@
           CALL inifor_abort('get_netcdf_variable', message)
 
-       END IF
+       ENDIF
 
        CALL check(nf90_close(ncid))
@@ -221,5 +221,5 @@
           CALL inifor_abort('get_netcdf_variable', message)
 
-       END IF
+       ENDIF
 
        CALL check(nf90_close(ncid))
@@ -259,5 +259,5 @@
           CALL inifor_abort('get_netcdf_dim_vector', message)
 
-       END IF
+       ENDIF
 
     END SUBROUTINE get_netcdf_dim_vector
@@ -291,5 +291,5 @@
                                              name = in_var % dimname(i),       &
                                              len  = in_var % dimlen(i) ))
-       END DO
+       ENDDO
 
     END SUBROUTINE get_input_dimensions
@@ -318,5 +318,5 @@
           CALL inifor_abort('get_netcdf_start_and_count', message)
 
-       END IF
+       ENDIF
 
        start = (/ 1, 1, 1 /)
@@ -329,5 +329,5 @@
 !--       Start reading from second level, e.g. depth = 0.005 instead of 0.0
           start(3) = 2
-       END IF
+       ENDIF
 
        IF (in_var % ndim .EQ. 2)  THEN
@@ -358,5 +358,5 @@
         IF ( var % lod .GE. 0 )  THEN
            CALL check(nf90_put_att(ncid, var % varid, "lod",           var % lod))
-        END IF 
+        ENDIF 
         CALL check(nf90_put_att(ncid, var % varid, "source",        var % source))
         CALL check(nf90_put_att(ncid, var % varid, "_FillValue",    NF90_FILL_REAL))
@@ -383,5 +383,5 @@
                                              name = null, &
                                              len  = var % dimlen(i)  ) )
-        END DO
+        ENDDO
 
     END SUBROUTINE netcdf_get_dimensions
@@ -538,5 +538,5 @@
              i = i + 1
 
-          END DO
+          ENDDO
 
        ELSE
@@ -545,5 +545,5 @@
           CALL report('parse_command_line_arguments', message)
 
-       END IF
+       ENDIF
 
    END SUBROUTINE parse_command_line_arguments
@@ -574,5 +574,5 @@
                           TRIM(date_string) // TRIM(suffix) // '.nc'
 
-      END DO
+      ENDDO
 
    END SUBROUTINE get_datetime_file_list
@@ -594,8 +594,6 @@
       LOGICAL, OPTIONAL, INTENT(IN)    ::  nocheck
 
-      INTEGER             ::  number_of_intervals, hour, i
-      CHARACTER(LEN=DATE) ::  date_string
-      CHARACTER(LEN=PATH) ::  file_name
-      LOGICAL             ::  check_files
+      INTEGER ::  i
+      LOGICAL ::  check_files
 
       CALL get_datetime_file_list( start_date_string, start_hour, end_hour,    &
@@ -606,5 +604,5 @@
       IF ( PRESENT ( nocheck ) )  THEN
          IF ( nocheck )  check_files = .FALSE.
-      END IF
+      ENDIF
 
       IF ( check_files )  THEN
@@ -615,7 +613,7 @@
          DO i = 1, SIZE(file_list)
              CALL verify_file(file_list(i), 'input', tip)
-         END DO
-
-      END IF
+         ENDDO
+
+      ENDIF
 
    END SUBROUTINE get_input_file_list
@@ -645,11 +643,11 @@
             IF (PRESENT(tip))  THEN
                message = TRIM(message) // " " // TRIM(tip)
-            END IF
-
-         END IF
+            ENDIF
+
+         ENDIF
 
          CALL inifor_abort('verify_file', message)
 
-      END IF
+      ENDIF
 
       message = "Set up input file name '" // TRIM(file_name) // "'"
@@ -691,5 +689,5 @@
       IF (TRIM(cfg % static_driver_file) .NE. '')  THEN
          CALL verify_file(cfg % static_driver_file, 'static driver')
-      END IF
+      ENDIF
 
       SELECT CASE( TRIM(cfg % ic_mode) )
@@ -739,5 +737,5 @@
                    "wind. Please specify either both or none."
          CALL inifor_abort( 'validate_config', message )
-      END IF
+      ENDIF
 
    END SUBROUTINE validate_config
@@ -958,9 +956,8 @@
 !> Defines the netCDF variables to be written to the dynamic driver file
 !------------------------------------------------------------------------------!
-    SUBROUTINE setup_netcdf_variables(filename, output_variable_table, debug)
+    SUBROUTINE setup_netcdf_variables(filename, output_variable_table)
 
        CHARACTER (LEN=*), INTENT(IN)        ::  filename
        TYPE(nc_var), INTENT(INOUT), TARGET  ::  output_variable_table(:)
-       LOGICAL, INTENT(IN)                  ::  debug
 
        TYPE(nc_var), POINTER                ::  var
@@ -988,7 +985,7 @@
              CALL netcdf_define_variable(var, ncid)
              CALL netcdf_get_dimensions(var, ncid)
-          END IF
+          ENDIF
            
-       END DO
+       ENDDO
 
        CALL check(nf90_enddef(ncid))
@@ -1043,5 +1040,5 @@
                        TRIM( str(SIZE(group % in_var_list)) ) // "."
              CALL inifor_abort('read_input_variables | accumulation', message)
-          END IF
+          ENDIF
 
 !
@@ -1095,5 +1092,5 @@
                 input_var % name = TRIM( get_pressure_varname(input_file) )
  CALL run_control('time', 'read')
-             END IF
+             ENDIF
 
              CALL get_netcdf_variable(input_file, input_var, buffer(ivar) % array)
@@ -1102,6 +1099,6 @@
  CALL run_control('time', 'comp')
 
-          END DO
-       END IF
+          ENDDO
+       ENDIF
 
     END SUBROUTINE read_input_variables
@@ -1159,5 +1156,5 @@
           CALL inifor_abort('get_pressure_var', message)
 
-       END IF
+       ENDIF
 
        CALL check(nf90_close(ncid))
@@ -1189,5 +1186,5 @@
           CALL inifor_abort('get_netcdf_attribute', message)
 
-       END IF
+       ENDIF
 
     END FUNCTION get_netcdf_attribute
@@ -1252,5 +1249,5 @@
                  SIZE(array, 2), ")."
              STOP
-          END IF
+          ENDIF
           
 
@@ -1303,5 +1300,5 @@
                                       start=start(1:ndim+1),                   &
                                       count=count(1:ndim) ) )
-          END IF
+          ENDIF
 
        CASE ( 'large-scale scalar forcing', 'large-scale w forcing' )
@@ -1336,5 +1333,5 @@
                     TRIM( nf90_strerror(status) )
           CALL inifor_abort('io.check', message)
-       END IF
+       ENDIF
 
     END SUBROUTINE check
Index: palm/trunk/UTIL/inifor/src/inifor_transform.f90
===================================================================
--- palm/trunk/UTIL/inifor/src/inifor_transform.f90	(revision 3779)
+++ palm/trunk/UTIL/inifor/src/inifor_transform.f90	(revision 3785)
@@ -121,5 +121,5 @@
        REAL(dp), INTENT(OUT)             ::  out_arr(:)
 
-       INTEGER :: i, j, k, l, nz
+       INTEGER :: k, l, nz
 
        nz = UBOUND(out_arr, 1)
@@ -139,7 +139,7 @@
                 out_arr(k) = out_arr(k) +                                      &
                     outgrid % w(1,k,l) * in_arr(outgrid % kkk(1,k,l) )
-             END DO
-          END IF
-       END DO
+             ENDDO
+          ENDIF
+       ENDDO
 
     END SUBROUTINE interpolate_1d
@@ -195,9 +195,9 @@
                     outgrid % w_verti(i,j,k,l) *                               &
                     in_arr(i,j,outgrid % kk(i,j,k, l) )
-             END DO
-          END IF
-       END DO
-       END DO
-       END DO
+             ENDDO
+          ENDIF
+       ENDDO
+       ENDDO
+       ENDDO
     END SUBROUTINE interpolate_1d_arr
 
@@ -245,5 +245,5 @@
               TRIM(str(UBOUND(invar, 3))) // ")."
            CALL inifor_abort('interpolate_2d', message)
-       END IF
+       ENDIF
 
        DO k = 0, UBOUND(outvar, 3)
@@ -257,8 +257,8 @@
                                                   outgrid % jj(i,j,l),         &
                                                   k )
-          END DO
-       END DO
-       END DO
-       END DO
+          ENDDO
+       ENDDO
+       ENDDO
+       ENDDO
         
     END SUBROUTINE interpolate_2d
@@ -284,5 +284,5 @@
              NEW_LINE(' ') // "jj has " // str(SIZE(jj)) // "."
           CALL inifor_abort('average_2d', message)
-       END IF
+       ENDIF
 
        IF (SIZE(ii) == 0)  THEN
@@ -290,5 +290,5 @@
                     "size of index lists 'ii' and 'jj' is zero."
           CALL inifor_abort('average_2d', message)
-       END IF
+       ENDIF
 
        DO k = 0, UBOUND(out_arr, 1)
@@ -299,7 +299,7 @@
              j = jj(l)
              out_arr(k) = out_arr(k) + in_arr(i, j, k)
-          END DO
-
-       END DO
+          ENDDO
+
+       ENDDO
 
        ni = 1.0_dp / SIZE(ii)
@@ -385,13 +385,13 @@
 !
 !--          Loop over vertical interpolation neighbours m
-             END DO
+             ENDDO
 
 !
 !--       Loop over PALM levels k_profile
-          END DO
+          ENDDO
 
 !
 !--    Loop over horizontal neighbours l
-       END DO
+       ENDDO
 
        ni_columns = 1.0_dp / avg_grid % n_columns
@@ -411,14 +411,13 @@
 !> averaging grid 'avg_grid' and store the result in 'profile_array'.
 !------------------------------------------------------------------------------!
-    SUBROUTINE average_profile( source_array, profile_array,                   &
-                                source_grid, avg_grid )
-
-       TYPE(grid_definition), INTENT(IN)          ::  source_grid, avg_grid
+    SUBROUTINE average_profile( source_array, profile_array, avg_grid )
+
+       TYPE(grid_definition), INTENT(IN)          ::  avg_grid
        REAL(dp), DIMENSION(:,:,:), INTENT(IN)     ::  source_array 
        REAL(dp), DIMENSION(:), INTENT(OUT)        ::  profile_array
 
-       INTEGER ::  i_source, j_source, k_profile, k_source, l, m, nz, nlev
-
-       REAL                            ::  ni_columns
+       INTEGER ::  i_source, j_source, l, nz, nlev
+
+       REAL(dp) ::  ni_columns
 
        nlev = SIZE( source_array, 3 )
@@ -442,5 +441,5 @@
                            + source_array(i_source, j_source, :)
 
-       END DO
+       ENDDO
 
        ni_columns = 1.0_dp / avg_grid % n_columns
@@ -464,5 +463,5 @@
        REAL(dp), DIMENSION(:), INTENT(OUT)        ::  profile_array
 
-       INTEGER ::  i_source, j_source, k_profile, k_source, l, m, nz, nlev
+       INTEGER ::  i_source, j_source, l, nz, nlev
 
        REAL(dp)                            ::  ni_columns
@@ -497,5 +496,5 @@
 !
 !--    Loop over horizontal neighbours l
-       END DO
+       ENDDO
 
        DEALLOCATE( basic_state_pressure )
@@ -554,5 +553,5 @@
           p(k) = constant_density_pressure(p(k_min), zk, rhok, drhodz,         &
                                            avg_grid % z(k), G)
-       END DO
+       ENDDO
 
     END SUBROUTINE extrapolate_pressure
@@ -706,5 +705,5 @@
        IF (phi_c > 0.0_dp)  THEN
           lamc_to_lamn = lam_c - SIGN(PI, lam_c)
-       END IF
+       ENDIF
 
     END FUNCTION lamc_to_lamn
@@ -731,5 +730,5 @@
        ELSE
            gamma_from_hemisphere = 0.0_dp
-       END IF
+       ENDIF
     END FUNCTION gamma_from_hemisphere
 
@@ -773,5 +772,5 @@
           PRINT *, "inifor: rotate_to_cosmo: lam: ", SIZE(lam, 1), SIZE(lam, 2)
           STOP
-       END IF
+       ENDIF
 
        IF ( SIZE(phir) .NE. SIZE(phi, 2) .OR. &
@@ -781,5 +780,5 @@
           PRINT *, "inifor: rotate_to_cosmo: lamr: ", SIZE(lamr), SIZE(phi, 1)
           STOP
-       END IF
+       ENDIF
        
        DO j = 0, UBOUND(phir, 1)
@@ -797,6 +796,6 @@
                                    gam  * TO_DEGREES) * TO_RADIANS
 
-          END DO
-       END DO
+          ENDDO
+       ENDDO
 
     END SUBROUTINE rotate_to_cosmo
@@ -831,5 +830,5 @@
           y(i) = v_rot(2)
 
-       END DO
+       ENDDO
 
     END SUBROUTINE rotate_vector_field
@@ -941,5 +940,5 @@
                 ", PALM lat " // TRIM(real_to_str(palm_clat(i,j)*TO_DEGREES))
              CALL inifor_abort('find_horizontal_neighbours', message)
-          END IF
+          ENDIF
 
           palm_ii(i,j,1) = FLOOR(lonpos)
@@ -952,6 +951,6 @@
           palm_jj(i,j,3) = CEILING(latpos)
           palm_jj(i,j,4) = FLOOR(latpos)
-       END DO
-       END DO
+       ENDDO
+       ENDDO
 
     END SUBROUTINE find_horizontal_neighbours
@@ -1042,5 +1041,5 @@
                       current_height <  h_top                                  &
                    )
-                END DO
+                ENDDO
 
                 IF (k_intermediate > nlev-1)  THEN
@@ -1048,5 +1047,5 @@
                              " is above intermediate grid range."
                    CALL inifor_abort('find_vertical_neighbours', message)
-                END IF
+                ENDIF
    
                 palm_grid % kk(i,j,k,1) = k_intermediate
@@ -1058,10 +1057,10 @@
                 palm_grid % w_verti(i,j,k,1) = weight
                 palm_grid % w_verti(i,j,k,2) = 1.0_dp - weight
-             END IF
-
-          END DO
-
-       END DO
-       END DO
+             ENDIF
+
+          ENDDO
+
+       ENDDO
+       ENDDO
 
     END SUBROUTINE find_vertical_neighbours_and_weights_interp
@@ -1103,5 +1102,5 @@
        ELSE
           cosmo_h => avg_grid % cosmo_h
-       END IF
+       ENDIF
 
 !
@@ -1115,5 +1114,5 @@
              i = avg_grid % iii(l)
              j = avg_grid % jjj(l)
-          END IF
+          ENDIF
 
           column_base = cosmo_h(i,j,1)
@@ -1176,5 +1175,5 @@
                       current_height <  h_top                                  &
                    )
-                END DO
+                ENDDO
 
 !
@@ -1185,5 +1184,5 @@
                              " is above intermediate grid range."
                    CALL inifor_abort('find_vertical_neighbours', message)
-                END IF
+                ENDIF
    
                 avg_grid % kkk(l,k_palm,1) = k_intermediate
@@ -1195,13 +1194,13 @@
                 avg_grid % w(l,k_palm,1) = weight
                 avg_grid % w(l,k_palm,2) = 1.0_dp - weight
-             END IF
+             ENDIF
 
 !
 !--       Loop over PALM levels k
-          END DO
+          ENDDO
 
 !
 !--       Loop over averaging columns l
-       END DO
+       ENDDO
  
     END SUBROUTINE find_vertical_neighbours_and_weights_average
@@ -1283,10 +1282,10 @@
                         " is out bounds."
               CALL inifor_abort('compute_horizontal_interp_weights', message)
-          END IF
+          ENDIF
           IF (wp > 1.0_dp .OR. wp < 0.0_dp)  THEN
               message = "Horizontal weight wp = " // TRIM(real_to_str(wp)) //   &
                         " is out bounds."
               CALL inifor_abort('compute_horizontal_interp_weights', message)
-          END IF
+          ENDIF
 
           palm_w_horiz(i,j,1) = wl * wp
@@ -1295,6 +1294,6 @@
           palm_w_horiz(i,j,4) = 1.0_dp - SUM( palm_w_horiz(i,j,1:3) )
 
-       END DO
-       END DO
+       ENDDO
+       ENDDO
        
     END SUBROUTINE compute_horizontal_interp_weights
@@ -1352,5 +1351,5 @@
        ELSE
           zrlas = rlarot
-       END IF
+       ENDIF
        zrlas = zrlas * TO_RADIANS
      
@@ -1362,5 +1361,5 @@
        ELSE
           zarg = zcospol * COS (zphis) * COS (zrlas) + zsinpol * SIN (zphis)
-       END IF
+       ENDIF
       
        phirot2phi = ASIN (zarg) * TO_DEGREES
@@ -1394,5 +1393,5 @@
        ELSE
           zrla1 = rla
-       END IF
+       ENDIF
        zrla = zrla1 * TO_RADIANS
        
@@ -1431,5 +1430,5 @@
        ELSE
           zrlas = rlarot
-       END IF
+       ENDIF
        zrlas   = TO_RADIANS * zrlas
       
@@ -1452,5 +1451,5 @@
                                       zcospol *              SIN(zphis)) +     &
                     SIN (zlampol) *             SIN(zrlas) * COS(zphis)
-       END IF
+       ENDIF
       
        IF (zarg2 == 0.0_dp)  zarg2 = 1.0E-20_dp
@@ -1487,5 +1486,5 @@
        ELSE
           zrla1 = rla
-       END IF
+       ENDIF
        zrla = zrla1 * TO_RADIANS
        
@@ -1500,5 +1499,5 @@
           rla2rlarot = polgam + rla2rlarot
           IF (rla2rlarot > 180._dp)  rla2rlarot = rla2rlarot - 360.0_dp
-       END IF
+       ENDIF
        
     END FUNCTION rla2rlarot
Index: palm/trunk/UTIL/inifor/src/inifor_util.f90
===================================================================
--- palm/trunk/UTIL/inifor/src/inifor_util.f90	(revision 3779)
+++ palm/trunk/UTIL/inifor/src/inifor_util.f90	(revision 3785)
@@ -250,7 +250,7 @@
           DO i = 0, n
              array(i) = start + REAL(i, dp) / n * (stop - start)
-          END DO
-
-       END IF
+          ENDDO
+
+       ENDIF
        
     END SUBROUTINE linspace
@@ -366,5 +366,5 @@
         ELSE
            WRITE(real_to_str, '(E11.4)') val
-        END IF
+        ENDIF
         real_to_str = ADJUSTL(real_to_str)
 
@@ -416,5 +416,5 @@
         IF (path(n:n) .NE. '/')  THEN
            path = TRIM(path) // '/'
-        END IF
+        ENDIF
 
     END SUBROUTINE
Index: palm/trunk/UTIL/inifor/tests/Makefile
===================================================================
--- palm/trunk/UTIL/inifor/tests/Makefile	(revision 3779)
+++ palm/trunk/UTIL/inifor/tests/Makefile	(revision 3785)
@@ -14,6 +14,6 @@
 # PALM. If not, see <http://www.gnu.org/licenses/>.
 #
-# Copyright 2017-2018 Leibniz Universitaet Hannover
-# Copyright 2017-2018 Deutscher Wetterdienst Offenbach
+# Copyright 2017-2019 Leibniz Universitaet Hannover
+# Copyright 2017-2019 Deutscher Wetterdienst Offenbach
 #------------------------------------------------------------------------------#
 #
@@ -25,4 +25,8 @@
 # -----------------
 # $Id$
+# Updated copyright note
+# 
+# 
+# 3618 2018-12-10 13:25:22Z eckhard
 # Prefixed INIFOR modules with inifor_
 # 
Index: palm/trunk/UTIL/inifor/tests/Makefile.gnu
===================================================================
--- palm/trunk/UTIL/inifor/tests/Makefile.gnu	(revision 3779)
+++ palm/trunk/UTIL/inifor/tests/Makefile.gnu	(revision 3785)
@@ -14,6 +14,6 @@
 # PALM. If not, see <http://www.gnu.org/licenses/>.
 #
-# Copyright 2017-2018 Leibniz Universitaet Hannover
-# Copyright 2017-2018 Deutscher Wetterdienst Offenbach
+# Copyright 2017-2019 Leibniz Universitaet Hannover
+# Copyright 2017-2019 Deutscher Wetterdienst Offenbach
 #------------------------------------------------------------------------------#
 #
@@ -25,4 +25,8 @@
 # -----------------
 # $Id$
+# Updated copyright note
+# 
+# 
+# 3618 2018-12-10 13:25:22Z eckhard
 # Prefixed INIFOR modules with inifor_
 # 
Index: palm/trunk/UTIL/inifor/tests/Makefile.ifort
===================================================================
--- palm/trunk/UTIL/inifor/tests/Makefile.ifort	(revision 3779)
+++ palm/trunk/UTIL/inifor/tests/Makefile.ifort	(revision 3785)
@@ -14,6 +14,6 @@
 # PALM. If not, see <http://www.gnu.org/licenses/>.
 #
-# Copyright 2017-2018 Leibniz Universitaet Hannover
-# Copyright 2017-2018 Deutscher Wetterdienst Offenbach
+# Copyright 2017-2019 Leibniz Universitaet Hannover
+# Copyright 2017-2019 Deutscher Wetterdienst Offenbach
 #------------------------------------------------------------------------------#
 #
@@ -25,4 +25,8 @@
 # -----------------
 # $Id$
+# Updated copyright note
+# 
+# 
+# 3618 2018-12-10 13:25:22Z eckhard
 # Prefixed INIFOR modules with inifor_
 # 
Index: palm/trunk/UTIL/inifor/tests/test-boundaries.f90
===================================================================
--- palm/trunk/UTIL/inifor/tests/test-boundaries.f90	(revision 3779)
+++ palm/trunk/UTIL/inifor/tests/test-boundaries.f90	(revision 3785)
@@ -15,6 +15,6 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 2017-2018 Leibniz Universitaet Hannover
-! Copyright 2017-2018 Deutscher Wetterdienst Offenbach
+! Copyright 2017-2019 Leibniz Universitaet Hannover
+! Copyright 2017-2019 Deutscher Wetterdienst Offenbach
 !------------------------------------------------------------------------------!
 !
@@ -104,5 +104,5 @@
    
        CALL fini_grid_definition(boundary_grid)
-    END DO
+    ENDDO
 
     CALL end_test(title, res)
Index: palm/trunk/UTIL/inifor/tests/test-centre-velocities.f90
===================================================================
--- palm/trunk/UTIL/inifor/tests/test-centre-velocities.f90	(revision 3779)
+++ palm/trunk/UTIL/inifor/tests/test-centre-velocities.f90	(revision 3785)
@@ -15,6 +15,6 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 2017-2018 Leibniz Universitaet Hannover
-! Copyright 2017-2018 Deutscher Wetterdienst Offenbach
+! Copyright 2017-2019 Leibniz Universitaet Hannover
+! Copyright 2017-2019 Deutscher Wetterdienst Offenbach
 !------------------------------------------------------------------------------!
 !
@@ -75,5 +75,5 @@
        res = res .AND. assert_equal(u_centre(:,i,1), u_ref(:,i,1), 'centering u')
        res = res .AND. assert_equal(v_centre(i,:,1), v_ref(i,:,1), 'centering v')
-    END DO
+    ENDDO
 
     CALL end_test(title, res)
Index: palm/trunk/UTIL/inifor/tests/test-grid.f90
===================================================================
--- palm/trunk/UTIL/inifor/tests/test-grid.f90	(revision 3779)
+++ palm/trunk/UTIL/inifor/tests/test-grid.f90	(revision 3785)
@@ -15,6 +15,6 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 2017-2018 Leibniz Universitaet Hannover
-! Copyright 2017-2018 Deutscher Wetterdienst Offenbach
+! Copyright 2017-2019 Leibniz Universitaet Hannover
+! Copyright 2017-2019 Deutscher Wetterdienst Offenbach
 !------------------------------------------------------------------------------!
 !
@@ -74,5 +74,5 @@
        xu(i) = real(i) / (nx+1) * lx
        x(i)  = 0.5*dx + xu(i)
-    END DO
+    ENDDO
 
     dy = ly / (ny + 1)
@@ -80,5 +80,5 @@
        yv(i) = real(i) / (ny+1) * ly
        y(i)  = 0.5*dy + yv(i)
-    END DO
+    ENDDO
 
     dz(:) = lz / (nz + 1)
@@ -86,5 +86,5 @@
        IF (i < nz)  zw(i) = real(i) / (nz+1) * lz
        z(i) = 0.5*dz(1) + zw(i)
-    END DO
+    ENDDO
 
     ! Act
Index: palm/trunk/UTIL/inifor/tests/test-input-files.f90
===================================================================
--- palm/trunk/UTIL/inifor/tests/test-input-files.f90	(revision 3779)
+++ palm/trunk/UTIL/inifor/tests/test-input-files.f90	(revision 3785)
@@ -15,6 +15,6 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 2017-2018 Leibniz Universitaet Hannover
-! Copyright 2017-2018 Deutscher Wetterdienst Offenbach
+! Copyright 2017-2019 Leibniz Universitaet Hannover
+! Copyright 2017-2019 Deutscher Wetterdienst Offenbach
 !------------------------------------------------------------------------------!
 !
@@ -90,5 +90,5 @@
     DO i = 1, 6
        res = res .AND. (TRIM(ref_list(i)) .EQ. TRIM(file_list(i)))
-    END DO
+    ENDDO
 
     DEALLOCATE( ref_list, file_list )
@@ -115,5 +115,5 @@
     DO i = 1, 2
        res = res .AND. (TRIM(ref_list(i)) .EQ. TRIM(file_list(i)))
-    END DO
+    ENDDO
 
     DEALLOCATE( ref_list, file_list )
@@ -145,5 +145,5 @@
     DO i = 1, 2
        res = res .AND. (TRIM(ref_list(i)) .EQ. TRIM(file_list(i)))
-    END DO
+    ENDDO
 
     DEALLOCATE( ref_list, file_list )
Index: palm/trunk/UTIL/inifor/tests/test-interpolation.f90
===================================================================
--- palm/trunk/UTIL/inifor/tests/test-interpolation.f90	(revision 3779)
+++ palm/trunk/UTIL/inifor/tests/test-interpolation.f90	(revision 3785)
@@ -15,6 +15,6 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 2017-2018 Leibniz Universitaet Hannover
-! Copyright 2017-2018 Deutscher Wetterdienst Offenbach
+! Copyright 2017-2019 Leibniz Universitaet Hannover
+! Copyright 2017-2019 Deutscher Wetterdienst Offenbach
 !------------------------------------------------------------------------------!
 !
@@ -146,6 +146,6 @@
        PRINT *, "jj     : ", palm_grid%jj(i,j,:)
        PRINT *, "jj_ref : ", jj_ref(i,j,:), " indices match? ", res
-    END DO
-    END DO
+    ENDDO
+    ENDDO
 
     CALL end_test(title, res)
@@ -180,6 +180,6 @@
     DO i = 0, 1
        PRINT *, "PALM lon, lat: ", palm_grid % clon(i,j) * TO_DEGREES, palm_grid % clat(i,j)*TO_DEGREES
-    END DO
-    END DO
+    ENDDO
+    ENDDO
 
     ! Act
@@ -203,6 +203,6 @@
        PRINT *, "jj     : ", palm_grid%jj(i,j,:)
        PRINT *, "jj_ref : ", jj_ref(i,j,:), " indices match? ", res
-    END DO
-    END DO
+    ENDDO
+    ENDDO
 
     ! asserting that all four weights equal, 0.5, 0.25, 1./6., and 1./12., resp.
Index: palm/trunk/UTIL/inifor/tests/test-prototype.f90
===================================================================
--- palm/trunk/UTIL/inifor/tests/test-prototype.f90	(revision 3779)
+++ palm/trunk/UTIL/inifor/tests/test-prototype.f90	(revision 3785)
@@ -15,6 +15,6 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 2017-2018 Leibniz Universitaet Hannover
-! Copyright 2017-2018 Deutscher Wetterdienst Offenbach
+! Copyright 2017-2019 Leibniz Universitaet Hannover
+! Copyright 2017-2019 Deutscher Wetterdienst Offenbach
 !------------------------------------------------------------------------------!
 !
Index: palm/trunk/UTIL/inifor/tests/test-stretching.f90
===================================================================
--- palm/trunk/UTIL/inifor/tests/test-stretching.f90	(revision 3779)
+++ palm/trunk/UTIL/inifor/tests/test-stretching.f90	(revision 3785)
@@ -15,6 +15,6 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 2017-2018 Leibniz Universitaet Hannover
-! Copyright 2017-2018 Deutscher Wetterdienst Offenbach
+! Copyright 2017-2019 Leibniz Universitaet Hannover
+! Copyright 2017-2019 Deutscher Wetterdienst Offenbach
 !------------------------------------------------------------------------------!
 !
Index: palm/trunk/UTIL/inifor/tests/test-transform.f90
===================================================================
--- palm/trunk/UTIL/inifor/tests/test-transform.f90	(revision 3779)
+++ palm/trunk/UTIL/inifor/tests/test-transform.f90	(revision 3785)
@@ -15,6 +15,6 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 2017-2018 Leibniz Universitaet Hannover
-! Copyright 2017-2018 Deutscher Wetterdienst Offenbach
+! Copyright 2017-2019 Leibniz Universitaet Hannover
+! Copyright 2017-2019 Deutscher Wetterdienst Offenbach
 !------------------------------------------------------------------------------!
 !
Index: palm/trunk/UTIL/inifor/tests/util.f90
===================================================================
--- palm/trunk/UTIL/inifor/tests/util.f90	(revision 3779)
+++ palm/trunk/UTIL/inifor/tests/util.f90	(revision 3785)
@@ -15,6 +15,6 @@
 ! PALM. If not, see <http://www.gnu.org/licenses/>.
 !
-! Copyright 2017-2018 Leibniz Universitaet Hannover
-! Copyright 2017-2018 Deutscher Wetterdienst Offenbach
+! Copyright 2017-2019 Leibniz Universitaet Hannover
+! Copyright 2017-2019 Deutscher Wetterdienst Offenbach
 !------------------------------------------------------------------------------!
 !
@@ -71,5 +71,5 @@
           msg = 'failed.'
           label = ' [XX]'
-       END IF
+       ENDIF
 
        PRINT '(/A, A, A, A)', TRIM(label) // "  Test '", TRIM(title), "' ", TRIM(msg)
@@ -87,5 +87,5 @@
        ELSE
            assert_equal = assert(a, b, 'eq')
-       END IF
+       ENDIF
 
        IF (assert_equal .eqv. .TRUE.)  THEN
@@ -94,5 +94,5 @@
            PRINT *, "Equality assertion for ", msg, " failed. Maximum error is ",               &
               MAXVAL( ABS( a - b))
-       END IF
+       ENDIF
 
     END FUNCTION assert_equal
@@ -125,6 +125,6 @@
                 mag    = MAX( ABS(a(i)), ABS(b(i)) )
                 assert = assert .AND. (diff < mag * max_rel_diff )
-             END DO
-          END IF 
+             ENDDO
+          ENDIF 
 
        CASE DEFAULT
