Index: palm/trunk/UTIL/inifor/tests/test-boundaries.f90
===================================================================
--- palm/trunk/UTIL/inifor/tests/test-boundaries.f90	(revision 2718)
+++ palm/trunk/UTIL/inifor/tests/test-boundaries.f90	(revision 3182)
@@ -21,4 +21,5 @@
 ! Current revisions:
 ! -----------------
+! Updated test for new PALM grid strechting
 ! 
 ! 
@@ -54,5 +55,6 @@
     TYPE(grid_definition)           ::  boundary_grid
 
-    REAL ::  dx, dy, dz, lx, ly, lz, x(2), y(10), z(10)
+    REAL ::  dx, dy, dz, lx, ly, lz, x(2), y(10)
+    REAL, TARGET :: z(10)
 
     CALL begin_test(title, res)
@@ -79,8 +81,7 @@
           xmin = x(i), xmax = x(i),                                            &
           ymin =  0.5 * dy, ymax = ly - 0.5 * dy,                              &
-          zmin =  0.5 * dz, zmax = lz - 0.5 * dz,                              &
           x0 = 0.0, y0 = 0.0, z0 = 0.0,                                        &
-          nx = 0, ny = ny, nz = nz,                                            &
-          dx = dx, dy = dy, dz = dz )
+          nx = 0, ny = ny, nz = nz, z = z)
+          
    
        ! Assert
@@ -103,5 +104,5 @@
     TYPE(grid_definition), INTENT(INOUT) ::  grid
 
-    DEALLOCATE( grid % x, grid % y, grid % z )
+    DEALLOCATE( grid % x, grid % y )
     DEALLOCATE( grid % kk )
     DEALLOCATE( grid % w_verti )
Index: palm/trunk/UTIL/inifor/tests/test-grid.f90
===================================================================
--- palm/trunk/UTIL/inifor/tests/test-grid.f90	(revision 2718)
+++ palm/trunk/UTIL/inifor/tests/test-grid.f90	(revision 3182)
@@ -21,4 +21,5 @@
 ! Current revisions:
 ! -----------------
+! Updated test for new PALM grid strechting
 ! 
 ! 
@@ -41,5 +42,5 @@
  PROGRAM test_grid
 
-    USE grid, ONLY :  grid_definition, init_grid_definition
+    USE grid, ONLY :  grid_definition, init_grid_definition, dx, dy, dz
     USE test_utils
     
@@ -49,35 +50,41 @@
     LOGICAL                     ::  res
 
-    TYPE(grid_definition) ::  mygrid
-    INTEGER               ::  i
-    INTEGER, PARAMETER    ::  nx = 9,   ny = 19,   nz = 29
-    REAL, PARAMETER       ::  lx = 100., ly = 200., lz = 300.
-    REAL, DIMENSION(0:nx) ::  x, xu
-    REAL, DIMENSION(0:ny) ::  y, yv
-    REAL, DIMENSION(0:nz) ::  z, zw
+    TYPE(grid_definition)   ::  mygrid
+    INTEGER                 ::  i
+    INTEGER, PARAMETER      ::  nx = 9,   ny = 19,   nz = 29
+    REAL, PARAMETER         ::  lx = 100., ly = 200., lz = 300.
+    REAL, DIMENSION(0:nx)   ::  x, xu
+    REAL, DIMENSION(0:ny)   ::  y, yv
+    REAL, DIMENSION(1:nz)   ::  z
+    REAL, DIMENSION(1:nz-1) ::  zw
 
     CALL begin_test(title, res)
 
     ! Arange
+    dx = lx / (nx + 1)
+    DO i = 0, nx
+       xu(i) = real(i) / (nx+1) * lx
+       x(i)  = 0.5*dx + xu(i)
+    END DO
+
+    dy = ly / (ny + 1)
+    DO i = 0, ny
+       yv(i) = real(i) / (ny+1) * ly
+       y(i)  = 0.5*dy + yv(i)
+    END DO
+
+    dz(:) = lz / (nz + 1)
+    DO i = 1, nz
+       IF (i < nz)  zw(i) = real(i) / (nz+1) * lz
+       z(i) = 0.5*dz(1) + zw(i)
+    END DO
+
+    ! Act
     CALL init_grid_definition('palm', grid = mygrid,                           &
                               xmin = 0., xmax = lx,                            &
                               ymin = 0., ymax = ly,                            &
-                              zmin = 0., zmax = lz,                            &
                               x0 = 0.0, y0 = 0.0, z0 = 0.0,                    &
-                              nx = nx, ny = ny, nz = nz)
-
-    ! Act
-    DO i = 0, nx
-       xu(i) = real(i) / (nx+1) * lx
-       x(i)  = 0.5*mygrid%dx + xu(i)
-    END DO
-    DO i = 0, ny
-       yv(i) = real(i) / (ny+1) * ly
-       y(i)  = 0.5*mygrid%dy + yv(i)
-    END DO
-    DO i = 0, nz
-       zw(i) = real(i) / (nz+1) * lz
-       z(i)  = 0.5*mygrid%dz + zw(i)
-    END DO
+                              nx = nx, ny = ny, nz = nz,                       &
+                              z = z, zw = zw)
 
     ! Assert coordinates match
@@ -85,7 +92,7 @@
     res = res .AND. assert_equal(xu(1:), mygrid%xu, "xu")
     res = res .AND. assert_equal(y,      mygrid%y,  "y" )
-    res = res .AND. assert_equal(yv(1:), mygrid%yv, "yu")
+    res = res .AND. assert_equal(yv(1:), mygrid%yv, "yv")
     res = res .AND. assert_equal(z,      mygrid%z,  "z" )
-    res = res .AND. assert_equal(zw(1:), mygrid%zw, "zu")
+    res = res .AND. assert_equal(zw(1:), mygrid%zw, "zw")
 
     CALL end_test(title, res)
Index: palm/trunk/UTIL/inifor/tests/test-input-files.f90
===================================================================
--- palm/trunk/UTIL/inifor/tests/test-input-files.f90	(revision 2718)
+++ palm/trunk/UTIL/inifor/tests/test-input-files.f90	(revision 3182)
@@ -21,5 +21,6 @@
 ! Current revisions:
 ! -----------------
-! 
+! New test for negative start_hour and greater-than-one step_hour
+!
 ! 
 ! Former revisions:
@@ -44,13 +45,13 @@
         ONLY :  PATH
     USE grid,                                                                  & 
-        ONLY :  input_file_list
+        ONLY :  get_input_file_list
     USE test_utils
     
     IMPLICIT NONE
 
-    CHARACTER(LEN=50)                              ::  title
+    CHARACTER(LEN=60)                              ::  title
     CHARACTER(LEN=PATH), ALLOCATABLE, DIMENSION(:) ::  file_list, ref_list
     LOGICAL                                        ::  res
-    INTEGER                                        ::  i     
+    INTEGER                                        ::  i
 
     title = "input files - daylight saving to standard time"
@@ -70,8 +71,8 @@
 
     ! Act
-    CALL input_file_list(start_date_string='2017102823',                       &
-                         start_hour=0, end_hour=5, step_hour=1,                &
-                         path='./', prefix="laf", suffix='-test',              &
-                         file_list=file_list)
+    CALL get_input_file_list(start_date_string='2017102823',                   &
+                             start_hour=0, end_hour=5, step_hour=1,            &
+                             path='./', prefix="laf", suffix='-test',          &
+                             file_list=file_list)
 
     ! Assert
@@ -95,8 +96,38 @@
 
     ! Act
-    CALL input_file_list(start_date_string='2016022823',                       &
-                         start_hour=0, end_hour=1, step_hour=1,                &
-                         path='./', prefix="laf", suffix='-test',              &
-                         file_list=file_list)
+    CALL get_input_file_list(start_date_string='2016022823',                   &
+                             start_hour=0, end_hour=1, step_hour=1,            &
+                             path='./', prefix="laf", suffix='-test',          &
+                             file_list=file_list)
+
+    ! Assert
+    DO i = 1, 2
+       res = res .AND. (TRIM(ref_list(i)) .EQ. TRIM(file_list(i)))
+    END DO
+
+    DEALLOCATE( ref_list, file_list )
+    CALL end_test(title, res)
+
+
+
+    title = "input files - negative start_hour and step_hour > 1 hour"
+    CALL begin_test(title, res)
+
+    ! Arange
+    ! ...a date range that inlcudes a leap day (29. Feb. 2016) which should be
+    ! inlcuded in UTC time stamps.
+    ALLOCATE( ref_list(4) )
+    ref_list(1)  = './laf2017102823-test.nc'
+    ref_list(2)  = './laf2017102901-test.nc'
+    ref_list(3)  = './laf2017102903-test.nc'
+    ref_list(4)  = './laf2017102904-test.nc'
+
+    ! Act
+    CALL get_input_file_list(start_date_string='2017102901',                   &
+                             start_hour=-2, end_hour=3, step_hour=2,           &
+                             path='./', prefix="laf", suffix='-test',          &
+                             file_list=file_list)
+
+    PRINT *, file_list
 
     ! Assert
Index: palm/trunk/UTIL/inifor/tests/test-interpolation.f90
===================================================================
--- palm/trunk/UTIL/inifor/tests/test-interpolation.f90	(revision 2718)
+++ palm/trunk/UTIL/inifor/tests/test-interpolation.f90	(revision 3182)
@@ -21,5 +21,6 @@
 ! Current revisions:
 ! -----------------
-! 
+! Updated test for new grid_definition
+!
 ! 
 ! Former revisions:
@@ -76,5 +77,4 @@
                               xmin = -5.0 * TO_RADIANS, xmax = 5.5 * TO_RADIANS, &
                               ymin = -5.0 * TO_RADIANS, ymax = 6.5 * TO_RADIANS, &
-                              zmin =  0.0, zmax = 10.0,                        &
                               x0 = 0.0, y0 = 0.0, z0 = 0.0,                    &
                               nx = nlon-1, ny = nlat-1, nz = nlev-1)
@@ -86,5 +86,6 @@
     res = assert_equal( (/cosmo_grid%lat(0), cosmo_grid % lon(0),              &
                           cosmo_grid%lat(2), cosmo_grid % lon(2),              &
-                          cosmo_grid%dx*TO_DEGREES, cosmo_grid%dy*TO_DEGREES/),&
+                          (cosmo_grid%lon(1) - cosmo_grid%lon(0))*TO_DEGREES,  &
+                          (cosmo_grid%lat(1) - cosmo_grid%lat(0))*TO_DEGREES/),&
                         (/-5.0 * TO_RADIANS, -5.0 * TO_RADIANS,                &
                            6.5 * TO_RADIANS,  5.5 * TO_RADIANS,                &
@@ -97,5 +98,4 @@
                               xmin = 0.0, xmax = 1.0,                          &
                               ymin = 0.0, ymax = 1.0,                          &
-                              zmin = 0.0, zmax = 1.0,                          &
                               x0 = 0.0, y0 = 0.0, z0 = 0.0,                    &
                               nx = 1, ny = 1, nz = 1)
@@ -127,6 +127,6 @@
     ! Act
     CALL find_horizontal_neighbours(cosmo_grid % lat, cosmo_grid % lon,        &
-       cosmo_grid % dxi, cosmo_grid % dyi, palm_grid % clat, palm_grid % clon, &
-       palm_grid % ii, palm_grid % jj)
+                                    palm_grid % clat, palm_grid % clon,        &
+                                    palm_grid % ii, palm_grid % jj)
 
     ! Assert
@@ -178,10 +178,11 @@
     ! Act
     CALL find_horizontal_neighbours(cosmo_grid % lat, cosmo_grid % lon,        &
-       cosmo_grid % dxi, cosmo_grid % dyi, palm_grid % clat, palm_grid % clon, &
-       palm_grid % ii, palm_grid % jj)
+                                    palm_grid % clat, palm_grid % clon,        &
+                                    palm_grid % ii, palm_grid % jj)
 
     CALL compute_horizontal_interp_weights(cosmo_grid % lat, cosmo_grid % lon, &
-       cosmo_grid % dxi, cosmo_grid % dyi, palm_grid % clat,                   &
-       palm_grid % clon, palm_grid % ii, palm_grid % jj, palm_grid % w_horiz)
+                                           palm_grid % clat, palm_grid % clon, &
+                                           palm_grid % ii, palm_grid % jj,     &
+                                           palm_grid % w_horiz)
 
     ! Assert
Index: palm/trunk/UTIL/inifor/tests/test-prototype.f90
===================================================================
--- palm/trunk/UTIL/inifor/tests/test-prototype.f90	(revision 2718)
+++ palm/trunk/UTIL/inifor/tests/test-prototype.f90	(revision 3182)
@@ -21,5 +21,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! Added usage hints
 ! 
 ! Former revisions:
@@ -51,8 +51,11 @@
 
     ! Arange
+    !define parameters and reference values
 
     ! Act
+    !compute result
 
     ! Assert
+    !res = res .AND. assert_equal(<result_array>, <reference_array>, 'description')
 
     CALL end_test(title, res)
Index: palm/trunk/UTIL/inifor/tests/test-stretching.f90
===================================================================
--- palm/trunk/UTIL/inifor/tests/test-stretching.f90	(revision 3182)
+++ palm/trunk/UTIL/inifor/tests/test-stretching.f90	(revision 3182)
@@ -0,0 +1,97 @@
+!> @file tests/test-stretching.f90
+!------------------------------------------------------------------------------!
+! This file is part of the PALM model system.
+!
+! PALM 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.
+!
+! PALM 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
+! PALM. If not, see <http://www.gnu.org/licenses/>.
+!
+! Copyright 2017-2018 Leibniz Universitaet Hannover
+! Copyright 2017-2018 Deutscher Wetterdienst Offenbach
+!------------------------------------------------------------------------------!
+!
+! Current revisions:
+! -----------------
+! Initial revision
+! 
+! 
+! Former revisions:
+! -----------------
+! $Id$
+! 
+!
+! Authors:
+! --------
+! @author Eckhard Kadasch
+!
+! Description:
+! ------------
+!> This program tests INIFOR's implementation of PALM's grid stretching.
+!> 
+!------------------------------------------------------------------------------!
+ PROGRAM test_stretching
+
+    USE defs, &
+        ONLY :  dp
+
+    USE grid, &
+        ONLY :  stretched_z
+
+    USE test_utils
+    
+    IMPLICIT NONE
+
+    CHARACTER(LEN=*), PARAMETER ::  title = "stretched grid"
+    LOGICAL                     ::  res
+
+    INTEGER, PARAMETER ::  nz = 9
+    INTEGER            ::  k  = nz - 2
+
+    REAL(dp) ::  z(1:nz)
+    REAL(dp) ::  dz(10)            = -1.0_dp
+    REAL(dp) ::  dz_max            = 1000.0_dp
+    REAL(dp) ::  dz_stretch_factor = 1.08_dp
+    REAL(dp) ::  dz_stretch_level  = 2.0_dp
+    REAL(dp) ::  dz_stretch_level_start(9) = -9999999.9_dp
+    REAL(dp) ::  dz_stretch_level_end(9) = 9999999.9_dp
+    REAL(dp) ::  dz_stretch_factor_array(9) = 1.08_dp
+
+    CALL begin_test(title, res)
+
+    ! Arange
+    z(:)   = 0.0_dp
+    dz(1)  = 1.0_dp
+
+    ! Act
+    CALL stretched_z(z, dz, dz_max=dz_max, &
+                     dz_stretch_factor=dz_stretch_factor,                   &
+                     dz_stretch_level=dz_stretch_level,                     &
+                     dz_stretch_level_start=dz_stretch_level_start,         &
+                     dz_stretch_level_end=dz_stretch_level_end,             &
+                     dz_stretch_factor_array=dz_stretch_factor_array)
+
+    ! Assert, that the total distance covered by the stretched region 
+    ! matches the therotetial distance, i.e. the sum over the finite
+    ! exponential series
+    !
+    !          Sum_{i=0}^n( dz[i] ) = dz[0] * Sum_{i=0}^n( f^i )
+    !                               = dz[0] * (1 - f^(i+1)) / (1-f)
+    !
+    ! with f being the stretch factor.
+    res = res .AND. &
+          assert_equal( (/ z(UBOUND(z, 1)) - z(1)              /),             &
+                        (/ (1.0_dp - dz_stretch_factor**(k+1)) /               &
+                           (1.0_dp - dz_stretch_factor)        /),             &
+                        'length of stretched grid' )
+
+    CALL end_test(title, res)
+
+ END PROGRAM test_stretching
Index: palm/trunk/UTIL/inifor/tests/util.f90
===================================================================
--- palm/trunk/UTIL/inifor/tests/util.f90	(revision 2718)
+++ palm/trunk/UTIL/inifor/tests/util.f90	(revision 3182)
@@ -21,4 +21,5 @@
 ! Current revisions:
 ! -----------------
+! Expose error measure as parameter in assert_equal()
 ! 
 ! 
@@ -74,9 +75,15 @@
     END SUBROUTINE end_test
 
-    LOGICAL FUNCTION assert_equal(a, b, msg)
+    LOGICAL FUNCTION assert_equal(a, b, msg, ratio)
+       REAL, OPTIONAL, INTENT(IN)     ::  ratio
        REAL, DIMENSION(:), INTENT(IN) ::  a, b
-       CHARACTER(LEN=*), INTENT(IN)   :: msg
+       CHARACTER(LEN=*), INTENT(IN)   ::  msg
 
-       assert_equal = assert(a, b, 'eq')
+       IF ( PRESENT(ratio) )  THEN
+           assert_equal = assert(a, b, 'eq', ratio)
+       ELSE
+           assert_equal = assert(a, b, 'eq')
+       END IF
+
        IF (assert_equal .eqv. .TRUE.)  THEN
            PRINT *, "Equality assertion for ", msg, " was successful."
@@ -88,8 +95,8 @@
     END FUNCTION assert_equal
 
-    LOGICAL FUNCTION assert(a, b, mode, eps)
+    LOGICAL FUNCTION assert(a, b, mode, ratio)
 
        REAL, DIMENSION(:), INTENT(IN) ::  a, b
-       REAL, OPTIONAL, INTENT(IN)     ::  eps
+       REAL, OPTIONAL, INTENT(IN)     ::  ratio
        CHARACTER(LEN=*), INTENT(IN)   ::  mode
 
@@ -98,5 +105,5 @@
 
        max_rel_diff = 10 * EPSILON(1.0)
-       IF (PRESENT(eps)) max_rel_diff = eps
+       IF (PRESENT(ratio)) max_rel_diff = ratio
 
        SELECT CASE( TRIM(mode) )
