Index: palm/trunk/SOURCE/data_output_binary_module.f90
===================================================================
--- palm/trunk/SOURCE/data_output_binary_module.f90	(revision 4578)
+++ palm/trunk/SOURCE/data_output_binary_module.f90	(revision 4579)
@@ -19,9 +19,12 @@
 ! Current revisions:
 ! ------------------
-! 
-! 
+!
+!
 ! Former revisions:
 ! -----------------
 ! $Id$
+! corrected formatting to follow PALM coding standard
+!
+! 4577 2020-06-25 09:53:58Z raasch
 ! further re-formatting to follow the PALM coding standard
 !
@@ -192,13 +195,11 @@
 
     CHARACTER(LEN=charlen)             ::  bin_filename = ''  !< actual name of binary file
-    CHARACTER(LEN=7)                   ::  my_rank_char       !< string containing value of my_rank with leading zeros
-
     CHARACTER(LEN=charlen), INTENT(IN) ::  file_name          !< name of file
     CHARACTER(LEN=*),       INTENT(IN) ::  mode               !< operation mode
-
+    CHARACTER(LEN=7)                   ::  my_rank_char       !< string containing value of my_rank with leading zeros
+
+    INTEGER, INTENT(OUT) ::  file_id       !< file ID
     INTEGER              ::  my_rank       !< MPI rank of local processor
     INTEGER              ::  nranks        !< number of MPI ranks participating in output
-
-    INTEGER, INTENT(OUT) ::  file_id       !< file ID
     INTEGER, INTENT(OUT) ::  return_value  !< return value
 
@@ -250,5 +251,5 @@
           ENDIF
 
-          OPEN( config_file_unit, FILE=TRIM( config_file_name ) // TRIM( file_suffix ),          &
+          OPEN( config_file_unit, FILE=TRIM( config_file_name ) // TRIM( file_suffix ),            &
                 FORM='UNFORMATTED', STATUS='NEW', IOSTAT=return_value )
 
@@ -352,15 +353,12 @@
     CHARACTER(LEN=*), PARAMETER ::  routine_name = 'binary_write_attribute'  !< name of this routine
 
-    CHARACTER(LEN=charlen)                       ::  attribute_type        !< data type of attribute
-    CHARACTER(LEN=charlen)                       ::  output_string         !< output string
-
-    CHARACTER(LEN=charlen), INTENT(IN)           ::  attribute_name        !< name of attribute
-    CHARACTER(LEN=charlen), INTENT(IN), OPTIONAL ::  value_char            !< value of attribute
-
+    CHARACTER(LEN=charlen), INTENT(IN)           ::  attribute_name  !< name of attribute
+    CHARACTER(LEN=charlen)                       ::  attribute_type  !< data type of attribute
+    CHARACTER(LEN=charlen)                       ::  output_string   !< output string
+    CHARACTER(LEN=charlen), INTENT(IN), OPTIONAL ::  value_char      !< value of attribute
 
     INTEGER, INTENT(IN)  ::  file_id       !< file ID
+    INTEGER, INTENT(OUT) ::  return_value  !< return value
     INTEGER, INTENT(IN)  ::  variable_id   !< variable ID
-
-    INTEGER, INTENT(OUT) ::  return_value  !< return value
 
     INTEGER(KIND=1), INTENT(IN), OPTIONAL ::  value_int8   !< value of attribute
@@ -427,14 +425,12 @@
     CHARACTER(LEN=*), PARAMETER ::  routine_name = 'binary_init_dimension'  !< name of this routine
 
-    CHARACTER(LEN=charlen)             ::  output_string   !< output string
-
     CHARACTER(LEN=charlen), INTENT(IN) ::  dimension_name  !< name of dimension
     CHARACTER(LEN=charlen), INTENT(IN) ::  dimension_type  !< data type of dimension
     CHARACTER(LEN=*),       INTENT(IN) ::  mode            !< operation mode
-
+    CHARACTER(LEN=charlen)             ::  output_string   !< output string
+
+    INTEGER, INTENT(OUT) ::  dimension_id      !< dimension ID
     INTEGER, INTENT(IN)  ::  dimension_length  !< length of dimension
     INTEGER, INTENT(IN)  ::  file_id           !< file ID
-
-    INTEGER, INTENT(OUT) ::  dimension_id      !< dimension ID
     INTEGER, INTENT(OUT) ::  return_value      !< return value
     INTEGER, INTENT(OUT) ::  variable_id       !< variable ID
@@ -461,6 +457,6 @@
 !
 !-- Define variable associated with dimension
-    CALL binary_init_variable( mode, file_id, variable_id, dimension_name, dimension_type,        &
-                                (/ dimension_id /), is_global=.TRUE., return_value=return_value )
+    CALL binary_init_variable( mode, file_id, variable_id, dimension_name, dimension_type,         &
+                               (/ dimension_id /), is_global=.TRUE., return_value=return_value )
     IF ( return_value /= 0 )  THEN
        CALL internal_message( 'error', routine_name //                                             &
@@ -477,4 +473,5 @@
  SUBROUTINE binary_init_variable( mode, file_id, variable_id, variable_name, variable_type,        &
                                   dimension_ids, is_global, return_value )
+
     CHARACTER(LEN=*), PARAMETER ::  routine_name = 'binary_init_variable'  !< name of this routine
 
@@ -815,5 +812,5 @@
 
        WRITE( temp_string, * ) file_id
-       CALL internal_message( 'debug', routine_name // &
+       CALL internal_message( 'debug', routine_name //                                             &
                               ': close file (file_id=' // TRIM( temp_string ) // ')' )
 
@@ -821,5 +818,5 @@
        IF ( return_value /= 0 )  THEN
           WRITE( temp_string, * ) file_id
-          CALL internal_message( 'error', routine_name // &
+          CALL internal_message( 'error', routine_name //                                          &
                                  ': cannot close file (file_id=' // TRIM( temp_string ) // ')' )
        ENDIF
Index: palm/trunk/SOURCE/data_output_module.f90
===================================================================
--- palm/trunk/SOURCE/data_output_module.f90	(revision 4578)
+++ palm/trunk/SOURCE/data_output_module.f90	(revision 4579)
@@ -19,9 +19,12 @@
 ! Current revisions:
 ! ------------------
-! 
-! 
+!
+!
 ! Former revisions:
 ! -----------------
 ! $Id$
+! corrected formatting to follow PALM coding standard
+!
+! 4577 2020-06-25 09:53:58Z raasch
 ! file re-formatted to follow the PALM coding standard
 !
@@ -115,13 +118,9 @@
        CHARACTER(LEN=charlen)                            ::  data_type = ''       !< data type
        CHARACTER(LEN=charlen)                            ::  name                 !< variable name
-       CHARACTER(LEN=charlen), DIMENSION(:), ALLOCATABLE ::  dimension_names      !< list of
-                                                                                  !< dimension names used by variable
        INTEGER                                           ::  id = no_id           !< id within file
-       LOGICAL                                           ::  is_global = .FALSE.  !< true if global
-                                                                                  !< variable
-       INTEGER,                DIMENSION(:), ALLOCATABLE ::  dimension_ids        !< list of
-                                                                                  !< dimension ids used by variable
-       TYPE(attribute_type),   DIMENSION(:), ALLOCATABLE ::  attributes           !< list of
-                                                                                  !< attributes
+       LOGICAL                                           ::  is_global = .FALSE.  !< true if global variable
+       CHARACTER(LEN=charlen), DIMENSION(:), ALLOCATABLE ::  dimension_names      !< list of dimension names used by variable
+       INTEGER,                DIMENSION(:), ALLOCATABLE ::  dimension_ids        !< list of dimension ids used by variable
+       TYPE(attribute_type),   DIMENSION(:), ALLOCATABLE ::  attributes           !< list of attributes
     END TYPE variable_type
 
@@ -129,45 +128,26 @@
        CHARACTER(LEN=charlen)                     ::  data_type = ''        !< data type
        CHARACTER(LEN=charlen)                     ::  name                  !< dimension name
-       INTEGER                                    ::  id = no_id            !< dimension id within
-                                                                            !< file
+       INTEGER                                    ::  id = no_id            !< dimension id within file
        INTEGER                                    ::  length                !< length of dimension
-       INTEGER                                    ::  length_mask           !< length of masked
-                                                                            !< dimension
-       INTEGER                                    ::  variable_id = no_id   !< associated variable
-                                                                            !< id within file
+       INTEGER                                    ::  length_mask           !< length of masked dimension
+       INTEGER                                    ::  variable_id = no_id   !< associated variable id within file
        LOGICAL                                    ::  is_masked = .FALSE.   !< true if masked
-       INTEGER,         DIMENSION(2)              ::  bounds                !< lower and upper bound
-                                                                            !< of dimension
-       INTEGER,         DIMENSION(:), ALLOCATABLE ::  masked_indices        !< list of masked
-                                                                            !< indices of dimension
-       INTEGER(KIND=1), DIMENSION(:), ALLOCATABLE ::  masked_values_int8    !< masked dimension
-                                                                            !< values if 16bit integer
-       INTEGER(KIND=2), DIMENSION(:), ALLOCATABLE ::  masked_values_int16   !< masked dimension
-                                                                            !< values if 16bit integer
-       INTEGER(KIND=4), DIMENSION(:), ALLOCATABLE ::  masked_values_int32   !< masked dimension
-                                                                            !< values if 32bit integer
-       INTEGER(iwp),    DIMENSION(:), ALLOCATABLE ::  masked_values_intwp   !< masked dimension
-                                                                            !< values if working-precision int
-       INTEGER(KIND=1), DIMENSION(:), ALLOCATABLE ::  values_int8           !< dimension values if
-                                                                            !< 16bit integer
-       INTEGER(KIND=2), DIMENSION(:), ALLOCATABLE ::  values_int16          !< dimension values if
-                                                                            !< 16bit integer
-       INTEGER(KIND=4), DIMENSION(:), ALLOCATABLE ::  values_int32          !< dimension values if
-                                                                            !< 32bit integer
-       INTEGER(iwp),    DIMENSION(:), ALLOCATABLE ::  values_intwp          !< dimension values if
-                                                                            !< working-precision integer
+       INTEGER,         DIMENSION(2)              ::  bounds                !< lower and upper bound of dimension
+       INTEGER,         DIMENSION(:), ALLOCATABLE ::  masked_indices        !< list of masked indices of dimension
+       INTEGER(KIND=1), DIMENSION(:), ALLOCATABLE ::  masked_values_int8    !< masked dimension values if 16bit integer
+       INTEGER(KIND=2), DIMENSION(:), ALLOCATABLE ::  masked_values_int16   !< masked dimension values if 16bit integer
+       INTEGER(KIND=4), DIMENSION(:), ALLOCATABLE ::  masked_values_int32   !< masked dimension values if 32bit integer
+       INTEGER(iwp),    DIMENSION(:), ALLOCATABLE ::  masked_values_intwp   !< masked dimension values if working-precision int
+       INTEGER(KIND=1), DIMENSION(:), ALLOCATABLE ::  values_int8           !< dimension values if 16bit integer
+       INTEGER(KIND=2), DIMENSION(:), ALLOCATABLE ::  values_int16          !< dimension values if 16bit integer
+       INTEGER(KIND=4), DIMENSION(:), ALLOCATABLE ::  values_int32          !< dimension values if 32bit integer
+       INTEGER(iwp),    DIMENSION(:), ALLOCATABLE ::  values_intwp          !< dimension values if working-precision integer
        LOGICAL,         DIMENSION(:), ALLOCATABLE ::  mask                  !< mask
-       REAL(KIND=4),    DIMENSION(:), ALLOCATABLE ::  masked_values_real32  !< masked dimension
-                                                                            !< values if 32bit real
-       REAL(KIND=8),    DIMENSION(:), ALLOCATABLE ::  masked_values_real64  !< masked dimension
-                                                                            !< values if 64bit real
-       REAL(wp),        DIMENSION(:), ALLOCATABLE ::  masked_values_realwp  !< masked dimension
-                                                                            !< values if working-precision real
-       REAL(KIND=4),    DIMENSION(:), ALLOCATABLE ::  values_real32         !< dimension values if
-                                                                            !< 32bit real
-       REAL(KIND=8),    DIMENSION(:), ALLOCATABLE ::  values_real64         !< dimension values if
-                                                                            !< 64bit real
-       REAL(wp),        DIMENSION(:), ALLOCATABLE ::  values_realwp         !< dimension values if
-                                                                            !< working-precision real
+       REAL(KIND=4),    DIMENSION(:), ALLOCATABLE ::  masked_values_real32  !< masked dimension values if 32bit real
+       REAL(KIND=8),    DIMENSION(:), ALLOCATABLE ::  masked_values_real64  !< masked dimension values if 64bit real
+       REAL(wp),        DIMENSION(:), ALLOCATABLE ::  masked_values_realwp  !< masked dimension values if working-precision real
+       REAL(KIND=4),    DIMENSION(:), ALLOCATABLE ::  values_real32         !< dimension values if 32bit real
+       REAL(KIND=8),    DIMENSION(:), ALLOCATABLE ::  values_real64         !< dimension values if 64bit real
+       REAL(wp),        DIMENSION(:), ALLOCATABLE ::  values_realwp         !< dimension values if working-precision real
        TYPE(attribute_type), DIMENSION(:), ALLOCATABLE ::  attributes       !< list of attributes
     END TYPE dimension_type
@@ -256,15 +236,15 @@
     END INTERFACE dom_database_debug_output
 
-    PUBLIC &
-       dom_init, &
-       dom_def_file, &
-       dom_def_dim, &
-       dom_def_var, &
-       dom_def_att, &
-       dom_def_end, &
-       dom_write_var, &
-       dom_finalize_output, &
-       dom_get_error_message, &
-       dom_database_debug_output
+    PUBLIC                                                                                         &
+       dom_database_debug_output,                                                                  &
+       dom_def_att,                                                                                &
+       dom_def_dim,                                                                                &
+       dom_def_end,                                                                                &
+       dom_def_file,                                                                               &
+       dom_def_var,                                                                                &
+       dom_finalize_output,                                                                        &
+       dom_get_error_message,                                                                      &
+       dom_init,                                                                                   &
+       dom_write_var
 
  CONTAINS
@@ -281,5 +261,5 @@
 !> prevents that multiple groups try to open and write to the same output file.
 !--------------------------------------------------------------------------------------------------!
- SUBROUTINE dom_init( file_suffix_of_output_group, mpi_comm_of_output_group, master_output_rank, &
+ SUBROUTINE dom_init( file_suffix_of_output_group, mpi_comm_of_output_group, master_output_rank,   &
                       program_debug_output_unit, debug_output )
 
@@ -304,8 +284,8 @@
     print_debug_output = debug_output
 
-    CALL binary_init_module( output_file_suffix, output_group_comm, master_rank, &
+    CALL binary_init_module( output_file_suffix, output_group_comm, master_rank,                   &
                              debug_output_unit, debug_output, no_id )
 
-    CALL netcdf4_init_module( output_file_suffix, output_group_comm, master_rank, &
+    CALL netcdf4_init_module( output_file_suffix, output_group_comm, master_rank,                  &
                              debug_output_unit, debug_output, no_id )
 
@@ -350,6 +330,6 @@
           IF ( files(f)%name == TRIM( file_name ) )  THEN
              return_value = 1
-             CALL internal_message( 'error', routine_name // &
-                     ': file "' // TRIM( file_name ) // '" already exists' )
+             CALL internal_message( 'error', routine_name //                                       &
+                                    ': file "' // TRIM( file_name ) // '" already exists' )
              EXIT
           ENDIF
@@ -405,8 +385,9 @@
 !> @todo Convert given values into selected output_type.
 !--------------------------------------------------------------------------------------------------!
- FUNCTION dom_def_dim( file_name, dimension_name, output_type, bounds,        &
-                       values_int8, values_int16, values_int32, values_intwp, &
-                       values_real32, values_real64, values_realwp,           &
-                       mask ) RESULT( return_value )
+ FUNCTION dom_def_dim( file_name, dimension_name, output_type, bounds,                             &
+                       values_int8, values_int16, values_int32, values_intwp,                      &
+                       values_real32, values_real64, values_realwp,                                &
+                       mask )                                                                      &
+             RESULT( return_value )
 
     CHARACTER(LEN=*), PARAMETER ::  routine_name = 'dom_def_dim'  !< name of this routine
@@ -982,6 +963,8 @@
 !>                   value=' and this part was appended', append=.TRUE. )
 !--------------------------------------------------------------------------------------------------!
- FUNCTION dom_def_att_char( file_name, variable_name, attribute_name, value, append ) &
+ FUNCTION dom_def_att_char( file_name, variable_name, attribute_name, value, append )              &
              RESULT( return_value )
+
+    ! CHARACTER(LEN=*), PARAMETER ::  routine_name = 'dom_def_att_char'  !< name of routine
 
     CHARACTER(LEN=*),      INTENT(IN)           ::  attribute_name          !< name of attribute
@@ -990,6 +973,4 @@
     CHARACTER(LEN=*),      INTENT(IN), OPTIONAL ::  variable_name           !< name of variable
     CHARACTER(LEN=charlen)                      ::  variable_name_internal  !< internal copy of variable_name
-
-    ! CHARACTER(LEN=*), PARAMETER ::  routine_name = 'dom_def_att_char'  !< name of routine
 
     INTEGER ::  return_value  !< return value
@@ -1563,13 +1544,13 @@
 !--------------------------------------------------------------------------------------------------!
  FUNCTION dom_write_var( file_name, variable_name, bounds_start, bounds_end,                       &
-             values_char_0d,   values_char_1d,   values_char_2d,   values_char_3d,                 &
-             values_int8_0d,   values_int8_1d,   values_int8_2d,   values_int8_3d,                 &
-             values_int16_0d,  values_int16_1d,  values_int16_2d,  values_int16_3d,                &
-             values_int32_0d,  values_int32_1d,  values_int32_2d,  values_int32_3d,                &
-             values_intwp_0d,  values_intwp_1d,  values_intwp_2d,  values_intwp_3d,                &
-             values_real32_0d, values_real32_1d, values_real32_2d, values_real32_3d,               &
-             values_real64_0d, values_real64_1d, values_real64_2d, values_real64_3d,               &
-             values_realwp_0d, values_realwp_1d, values_realwp_2d, values_realwp_3d                &
-             ) RESULT( return_value )
+                         values_char_0d,   values_char_1d,   values_char_2d,   values_char_3d,     &
+                         values_int8_0d,   values_int8_1d,   values_int8_2d,   values_int8_3d,     &
+                         values_int16_0d,  values_int16_1d,  values_int16_2d,  values_int16_3d,    &
+                         values_int32_0d,  values_int32_1d,  values_int32_2d,  values_int32_3d,    &
+                         values_intwp_0d,  values_intwp_1d,  values_intwp_2d,  values_intwp_3d,    &
+                         values_real32_0d, values_real32_1d, values_real32_2d, values_real32_3d,   &
+                         values_real64_0d, values_real64_1d, values_real64_2d, values_real64_3d,   &
+                         values_realwp_0d, values_realwp_1d, values_realwp_2d, values_realwp_3d )  &
+             RESULT( return_value )
 
     CHARACTER(LEN=*), PARAMETER ::  routine_name = 'dom_write_var'  !< name of routine
@@ -1778,5 +1759,6 @@
        ELSEIF ( PRESENT( values_char_2d ) )  THEN
           IF ( do_output ) THEN
-             ALLOCATE( values_char_2d_resorted(0:value_counts(1)-1,0:value_counts(2)-1) )
+             ALLOCATE( values_char_2d_resorted(0:value_counts(1)-1,                                &
+                                               0:value_counts(2)-1) )
              !$OMP PARALLEL PRIVATE (i,j)
              !$OMP DO
@@ -1835,5 +1817,6 @@
        ELSEIF ( PRESENT( values_int8_2d ) )  THEN
           IF ( do_output ) THEN
-             ALLOCATE( values_int8_2d_resorted(0:value_counts(1)-1,0:value_counts(2)-1) )
+             ALLOCATE( values_int8_2d_resorted(0:value_counts(1)-1,                                &
+                                               0:value_counts(2)-1) )
              !$OMP PARALLEL PRIVATE (i,j)
              !$OMP DO
@@ -1892,5 +1875,6 @@
        ELSEIF ( PRESENT( values_int16_2d ) )  THEN
           IF ( do_output ) THEN
-             ALLOCATE( values_int16_2d_resorted(0:value_counts(1)-1,0:value_counts(2)-1) )
+             ALLOCATE( values_int16_2d_resorted(0:value_counts(1)-1,                               &
+                                                0:value_counts(2)-1) )
              !$OMP PARALLEL PRIVATE (i,j)
              !$OMP DO
@@ -1949,5 +1933,6 @@
        ELSEIF ( PRESENT( values_int32_2d ) )  THEN
           IF ( do_output ) THEN
-             ALLOCATE( values_int32_2d_resorted(0:value_counts(1)-1,0:value_counts(2)-1) )
+             ALLOCATE( values_int32_2d_resorted(0:value_counts(1)-1,                               &
+                                                0:value_counts(2)-1) )
              !$OMP PARALLEL PRIVATE (i,j)
              !$OMP DO
@@ -2006,5 +1991,6 @@
        ELSEIF ( PRESENT( values_intwp_2d ) )  THEN
           IF ( do_output ) THEN
-             ALLOCATE( values_intwp_2d_resorted(0:value_counts(1)-1,0:value_counts(2)-1) )
+             ALLOCATE( values_intwp_2d_resorted(0:value_counts(1)-1,                               &
+                                                0:value_counts(2)-1) )
              !$OMP PARALLEL PRIVATE (i,j)
              !$OMP DO
@@ -2063,5 +2049,6 @@
        ELSEIF ( PRESENT( values_real32_2d ) )  THEN
           IF ( do_output ) THEN
-             ALLOCATE( values_real32_2d_resorted(0:value_counts(1)-1,0:value_counts(2)-1) )
+             ALLOCATE( values_real32_2d_resorted(0:value_counts(1)-1,                              &
+                                                 0:value_counts(2)-1) )
              !$OMP PARALLEL PRIVATE (i,j)
              !$OMP DO
@@ -2120,5 +2107,6 @@
        ELSEIF ( PRESENT( values_real64_2d ) )  THEN
           IF ( do_output ) THEN
-             ALLOCATE( values_real64_2d_resorted(0:value_counts(1)-1,0:value_counts(2)-1) )
+             ALLOCATE( values_real64_2d_resorted(0:value_counts(1)-1,                              &
+                                                 0:value_counts(2)-1) )
              !$OMP PARALLEL PRIVATE (i,j)
              !$OMP DO
@@ -2177,5 +2165,6 @@
        ELSEIF ( PRESENT( values_realwp_2d ) )  THEN
           IF ( do_output ) THEN
-             ALLOCATE( values_realwp_2d_resorted(0:value_counts(1)-1,0:value_counts(2)-1) )
+             ALLOCATE( values_realwp_2d_resorted(0:value_counts(1)-1,                              &
+                                                 0:value_counts(2)-1) )
              !$OMP PARALLEL PRIVATE (i,j)
              !$OMP DO
@@ -2649,5 +2638,5 @@
 !> @todo Try to combine similar code parts and shorten routine.
 !--------------------------------------------------------------------------------------------------!
- FUNCTION save_attribute_in_database( file_name, variable_name, attribute, append ) &
+ FUNCTION save_attribute_in_database( file_name, variable_name, attribute, append )                &
              RESULT( return_value )
 
@@ -2707,6 +2696,6 @@
 !--                      Append existing string attribute
                          files(f)%attributes(a)%value_char =                                       &
-                                                      TRIM( files(f)%attributes(a)%value_char ) // &
-                                                      TRIM( attribute%value_char )
+                            TRIM( files(f)%attributes(a)%value_char ) //                           &
+                            TRIM( attribute%value_char )
                       ELSE
                          files(f)%attributes(a) = attribute
@@ -2756,5 +2745,5 @@
 !--                      Check if attribute already exists
                          DO  a = 1, natts
-                            IF ( files(f)%dimensions(d)%attributes(a)%name == attribute%name ) &
+                            IF ( files(f)%dimensions(d)%attributes(a)%name == attribute%name )     &
                             THEN
                                IF ( append )  THEN
@@ -3081,7 +3070,7 @@
 !--          Initialize masked dimension
              CALL init_file_dimension( file%format, file%id, file%name,                            &
-                                       file%dimensions(d)%id, file%dimensions(d)%name,             &
-                                       file%dimensions(d)%data_type, file%dimensions(d)%length_mask,&
-                                       file%dimensions(d)%variable_id, return_value )
+                                     file%dimensions(d)%id, file%dimensions(d)%name,               &
+                                     file%dimensions(d)%data_type, file%dimensions(d)%length_mask, &
+                                     file%dimensions(d)%variable_id, return_value )
 
           ENDIF
@@ -3105,5 +3094,5 @@
 !--    Save dimension IDs for variables wihtin database
        IF ( return_value == 0 )                                                                    &
-          CALL collect_dimesion_ids_for_variables( file%name, file%variables, file%dimensions, &
+          CALL collect_dimesion_ids_for_variables( file%name, file%variables, file%dimensions,     &
                                                    return_value )
 !
@@ -3230,5 +3219,5 @@
     output_return_value = 0
 
-    temp_string = '(file "' // TRIM( file_name ) // &
+    temp_string = '(file "' // TRIM( file_name ) //                                                &
                   '", variable "' // TRIM( variable_name ) // '")'
 
@@ -3257,5 +3246,5 @@
     IF ( output_return_value /= 0 )  THEN
        return_value = output_return_value
-       CALL internal_message( 'error', routine_name // &
+       CALL internal_message( 'error', routine_name //                                             &
                               ': error while defining variable ' // TRIM( temp_string ) )
     ENDIF
@@ -3268,6 +3257,7 @@
 !> Write attribute to file.
 !--------------------------------------------------------------------------------------------------!
- FUNCTION write_attribute( file_format, file_id, file_name, variable_id, variable_name, attribute )&
-    RESULT( return_value )
+ FUNCTION write_attribute( file_format, file_id, file_name,                                        &
+                           variable_id, variable_name, attribute )                                 &
+             RESULT( return_value )
 
     CHARACTER(LEN=*), PARAMETER ::  routine_name = 'write_attribute'  !< file format chosen for file
@@ -3409,5 +3399,5 @@
     CHARACTER(LEN=*), PARAMETER ::  routine_name = 'collect_dimesion_ids_for_variables'  !< file format chosen for file
 
-    CHARACTER(LEN=*), INTENT(IN) ::  file_name !< name of file
+    CHARACTER(LEN=*), INTENT(IN) ::  file_name  !< name of file
 
     INTEGER              ::  d             !< loop index
@@ -3418,5 +3408,5 @@
     INTEGER, INTENT(OUT) ::  return_value  !< return value
 
-    LOGICAL ::  found = .FALSE. !< true if dimension required by variable was found in dimension list
+    LOGICAL ::  found = .FALSE.  !< true if dimension required by variable was found in dimension list
 
     TYPE(dimension_type), DIMENSION(:), INTENT(IN) ::  dimensions  !< list of dimensions in file
@@ -3747,17 +3737,17 @@
  SUBROUTINE dom_database_debug_output
 
+    CHARACTER(LEN=*), PARAMETER ::  routine_name = 'dom_database_debug_output'  !< name of this routine
     CHARACTER(LEN=*), PARAMETER ::  separation_string = '---'                   !< string separating blocks in output
-    CHARACTER(LEN=*), PARAMETER ::  routine_name = 'dom_database_debug_output'  !< name of this routine
 
     INTEGER, PARAMETER ::  indent_depth = 3        !< space per indentation
     INTEGER, PARAMETER ::  max_keyname_length = 6  !< length of longest key name
 
-    CHARACTER(LEN=50)           ::  write_format1                               !< format for write statements
-
-    INTEGER            ::  f                       !< loop index
-    INTEGER            ::  indent_level            !< indentation level
-    INTEGER            ::  natts                   !< number of attributes
-    INTEGER            ::  ndims                   !< number of dimensions
-    INTEGER            ::  nvars                   !< number of variables
+    CHARACTER(LEN=50) ::  write_format1  !< format for write statements
+
+    INTEGER ::  f             !< loop index
+    INTEGER ::  indent_level  !< indentation level
+    INTEGER ::  natts         !< number of attributes
+    INTEGER ::  ndims         !< number of dimensions
+    INTEGER ::  nvars         !< number of variables
 
 
@@ -3820,7 +3810,7 @@
        CHARACTER(LEN=50) ::  write_format2  !< format for write statements
 
-       INTEGER             ::  i                       !< loop index
-       INTEGER, INTENT(IN) ::  indent_level            !< indentation level
-       INTEGER             ::  nelement                !< number of elements to print
+       INTEGER             ::  i             !< loop index
+       INTEGER, INTENT(IN) ::  indent_level  !< indentation level
+       INTEGER             ::  nelement      !< number of elements to print
 
        TYPE(attribute_type), DIMENSION(:), INTENT(IN) ::  attributes  !< list of attributes
@@ -3880,8 +3870,8 @@
        CHARACTER(LEN=50) ::  write_format2  !< format for write statements
 
-       INTEGER             ::  i                        !< loop index
-       INTEGER, INTENT(IN) ::  indent_level             !< indentation level
-       INTEGER             ::  j                        !< loop index
-       INTEGER             ::  nelement                 !< number of elements to print
+       INTEGER             ::  i             !< loop index
+       INTEGER, INTENT(IN) ::  indent_level  !< indentation level
+       INTEGER             ::  j             !< loop index
+       INTEGER             ::  nelement      !< number of elements to print
 
        LOGICAL ::  is_masked  !< true if dimension is masked
@@ -4095,8 +4085,8 @@
        CHARACTER(LEN=50) ::  write_format2  !< format for write statements
 
-       INTEGER             ::  i                        !< loop index
-       INTEGER, INTENT(IN) ::  indent_level             !< indentation level
-       INTEGER             ::  j                        !< loop index
-       INTEGER             ::  nelement                 !< number of elements to print
+       INTEGER             ::  i             !< loop index
+       INTEGER, INTENT(IN) ::  indent_level  !< indentation level
+       INTEGER             ::  j             !< loop index
+       INTEGER             ::  nelement      !< number of elements to print
 
        TYPE(variable_type), DIMENSION(:), INTENT(IN) ::  variables  !< list of variables
Index: palm/trunk/SOURCE/data_output_netcdf4_module.f90
===================================================================
--- palm/trunk/SOURCE/data_output_netcdf4_module.f90	(revision 4578)
+++ palm/trunk/SOURCE/data_output_netcdf4_module.f90	(revision 4579)
@@ -19,9 +19,12 @@
 ! Current revisions:
 ! ------------------
-! 
-! 
+!
+!
 ! Former revisions:
 ! -----------------
 ! $Id$
+! corrected formatting to follow PALM coding standard
+!
+! 4577 2020-06-25 09:53:58Z raasch
 ! file re-formatted to follow the PALM coding standard
 !
@@ -213,5 +216,5 @@
 #endif
 
-       IF ( return_value == 0 )  &
+       IF ( return_value == 0 )                                                                    &
           nc_stat = NF90_CREATE( TRIM( file_name ) // TRIM( file_suffix ),                         &
                                  IOR( NF90_NOCLOBBER, NF90_NETCDF4 ), file_id )
@@ -272,9 +275,8 @@
     CHARACTER(LEN=*), INTENT(IN), OPTIONAL ::  value_char      !< value of attribute
 
-    INTEGER ::  nc_stat    !< netcdf return value
-    INTEGER ::  target_id  !< ID of target which gets attribute (either global or variable_id)
-
     INTEGER, INTENT(IN)  ::  file_id       !< file ID
+    INTEGER              ::  nc_stat       !< netcdf return value
     INTEGER, INTENT(OUT) ::  return_value  !< return value
+    INTEGER              ::  target_id     !< ID of target which gets attribute (either global or variable_id)
     INTEGER, INTENT(IN)  ::  variable_id   !< variable ID
 
@@ -336,6 +338,6 @@
 !> Initialize dimension.
 !--------------------------------------------------------------------------------------------------!
- SUBROUTINE netcdf4_init_dimension( mode, file_id, dimension_id, variable_id, &
-               dimension_name, dimension_type, dimension_length, return_value )
+ SUBROUTINE netcdf4_init_dimension( mode, file_id, dimension_id, variable_id,                      &
+                                    dimension_name, dimension_type, dimension_length, return_value )
 
     CHARACTER(LEN=*), PARAMETER ::  routine_name = 'netcdf4_init_dimension'  !< name of this routine
@@ -374,5 +376,5 @@
 !
 !--    Define variable holding dimension values in file
-       CALL netcdf4_init_variable( mode, file_id, variable_id, dimension_name, dimension_type, &
+       CALL netcdf4_init_variable( mode, file_id, variable_id, dimension_name, dimension_type,     &
                                    (/ dimension_id /), is_global=.TRUE., return_value=return_value )
 
@@ -482,5 +484,5 @@
 
     WRITE( temp_string, * ) file_id
-    CALL internal_message( 'debug', routine_name // &
+    CALL internal_message( 'debug', routine_name //                                                &
                            ': finalize file definition (file_id=' // TRIM( temp_string ) // ')' )
 !
@@ -494,5 +496,5 @@
     IF ( nc_stat /= NF90_NOERR )  THEN
        return_value = 1
-       CALL internal_message( 'error', routine_name // &
+       CALL internal_message( 'error', routine_name //                                             &
                               ': NetCDF error: ' // NF90_STRERROR( nc_stat ) )
     ENDIF
