Index: palm/trunk/UTIL/inifor/src/inifor_util.f90
===================================================================
--- palm/trunk/UTIL/inifor/src/inifor_util.f90	(revision 3447)
+++ palm/trunk/UTIL/inifor/src/inifor_util.f90	(revision 3557)
@@ -26,4 +26,8 @@
 ! -----------------
 ! $Id$
+! Updated documentation
+! 
+! 
+! 3447 2018-10-29 15:52:54Z eckhard
 ! Renamed source files for compatibilty with PALM build system
 ! 
@@ -44,5 +48,5 @@
 ! Authors:
 ! --------
-! @author Eckhard Kadasch
+!> @author Eckhard Kadasch (Deutscher Wetterdienst, Offenbach)
 !
 ! Description:
@@ -61,4 +65,9 @@
     IMPLICIT NONE
 
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Fortran implementation of C's struct tm for representing points in time
+!------------------------------------------------------------------------------!
     TYPE, BIND(c) :: tm_struct
        INTEGER(C_INT) :: tm_sec     !< seconds after the minute [0, 61]
@@ -75,4 +84,10 @@
     INTERFACE
 
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Interface to C's strptime function, which converts a string to a tm
+!> structure.
+!------------------------------------------------------------------------------!
        FUNCTION strptime(string, format, timeinfo) BIND(c, NAME='strptime')
           IMPORT :: C_CHAR, C_SIZE_T, tm_struct
@@ -87,4 +102,10 @@
 
 
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Interface to C's strftime function, which converts the given 'timeinfo'
+!> structure to a string in the given 'format'.
+!------------------------------------------------------------------------------!
        FUNCTION strftime(string, string_len, format, timeinfo) BIND(c, NAME='strftime')
           IMPORT :: C_CHAR, C_SIZE_T, tm_struct
@@ -101,4 +122,12 @@
 
 
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Interface to C's mktime function, which converts the given tm structure to
+!> Unix time (number of seconds since 0 UTC, 1st January 1970). INIFOR uses the
+!> side effect that a call to mktime noramlizes the given 'timeinfo' structure,
+!> e.g. increments the date if hours overfow 24.
+!------------------------------------------------------------------------------!
        FUNCTION mktime(timeinfo) BIND(c, NAME='mktime')
           IMPORT :: C_PTR, tm_struct
@@ -115,4 +144,11 @@
  CONTAINS
 
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Takes a string of the form YYYYMMDDHH, adds the given number of hours to its
+!> tm structure representation, and returns the corresponding string in the same
+!> format
+!------------------------------------------------------------------------------!
     CHARACTER(LEN=DATE) FUNCTION add_hours_to(date_string, hours)
        CHARACTER(LEN=DATE), INTENT(IN)          ::  date_string
@@ -143,4 +179,9 @@
 
 
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Print all members of the given tm structure
+!------------------------------------------------------------------------------!
     SUBROUTINE print_tm(timeinfo)
        TYPE(tm_struct), INTENT(IN) :: timeinfo
@@ -158,4 +199,9 @@
 
     
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Initialize the given tm structure with zero values
+!------------------------------------------------------------------------------!
     SUBROUTINE init_tm(timeinfo)
        TYPE(tm_struct), INTENT(INOUT) :: timeinfo
@@ -177,44 +223,10 @@
 
 
-    SUBROUTINE fake_output_3d(a)
-
-       REAL(dp), INTENT(INOUT)       ::  a(:,:,:)
-       REAL(dp)                      ::  lxi, lyi
-       INTEGER ::  i,j,k
-
-       lyi = 2.0_dp * PI / (SIZE(a, 2) - 1.0_dp)
-       lxi = 2.0_dp * PI / (SIZE(a, 1) - 1.0_dp)
-
-       DO k = 1, SIZE(a, 3)
-       DO j = 1, SIZE(a, 2)
-       DO i = 1, SIZE(a, 1)
-           a(i,j,k) = SIN(lxi * i) * COS(lyi * j) + k
-       END DO
-       END DO
-       END DO
-
-    END SUBROUTINE fake_output_3d
-
-
-    SUBROUTINE fake_output_2d(a, offset)
-
-       REAL(dp), INTENT(INOUT) ::  a(:,:)
-       INTEGER, INTENT(IN)     ::  offset
-       REAL(dp)                ::  lxi, lyi
-       INTEGER                 ::  i,j
-
-       lyi = 2.0_dp*PI / (SIZE(a, 2) - 1.0_dp)
-       lxi = 2.0_dp*PI / (SIZE(a, 1) - 1.0_dp)
-
-       a(:,:) = 1.0_dp
-       DO j = 1, SIZE(a, 2)
-       DO i = 1, SIZE(a, 1)
-          a(i,j) = SIN(lxi * i) * COS(lyi * j) + offset
-       END DO
-       END DO
-
-    END SUBROUTINE fake_output_2d
-
-
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Fill the given array with values equally spaced between and including start
+!> and stop
+!------------------------------------------------------------------------------!
     SUBROUTINE linspace(start, stop, array)
 
@@ -255,4 +267,9 @@
 
 
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> 
+!------------------------------------------------------------------------------!
     SUBROUTINE deaverage(avg_1, t1, avg_2, t2, avg_3, t3)
 
@@ -270,4 +287,9 @@
 
 
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Compute the COSMO-DE/-D2 basic state pressure profile
+!------------------------------------------------------------------------------!
     SUBROUTINE get_basic_state(z, beta, p_sl, t_sl, rd, g, p0)
 
@@ -278,5 +300,5 @@
        REAL(dp), INTENT(IN)  ::  rd     !< ideal gas constant of dry air [J/kg/K]
        REAL(dp), INTENT(IN)  ::  g      !< acceleration of Earth's gravity [m/s^2]
-       REAL(dp), INTENT(OUT) ::  p0(1:) !< COSMO-DE basic state pressure [Pa]
+       REAL(dp), INTENT(OUT) ::  p0(1:) !< COSMO basic state pressure [Pa]
        REAL(dp) ::  root_frac, factor   !< precomputed factors
 
@@ -285,6 +307,6 @@
 
        p0(:) = p_sl * EXP(                                                     &
-                  factor * ( 1.0_dp - SQRT( 1.0_dp - root_frac * z(:) ) )  &
-               )
+                  factor * ( 1.0_dp - SQRT( 1.0_dp - root_frac * z(:) ) )      &
+       )
 
     END SUBROUTINE get_basic_state
@@ -345,4 +367,9 @@
 
 
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Converts the given real value to a string
+!------------------------------------------------------------------------------!
     CHARACTER(LEN=16) FUNCTION real_to_str_f(val)
 
@@ -355,4 +382,9 @@
 
 
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Converts the given integer value to a string
+!------------------------------------------------------------------------------!
     CHARACTER(LEN=10) FUNCTION str(val)
 
@@ -365,17 +397,9 @@
 
 
-    CHARACTER(LEN=30) FUNCTION strs(vals)
-
-        INTEGER, INTENT(IN) ::  vals(:)
-        INTEGER ::  i
-
-        strs = ''
-        DO i = 1, SIZE(vals)
-           strs = TRIM(strs) // TRIM(str(vals(i)))
-        END DO
-
-    END FUNCTION strs
-
-
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> If the given path is not conlcuded by a slash, add one.
+!------------------------------------------------------------------------------!
     SUBROUTINE normalize_path(path)
         
