Index: palm/trunk/SOURCE/data_output_binary_module.f90
===================================================================
--- palm/trunk/SOURCE/data_output_binary_module.f90	(revision 4579)
+++ palm/trunk/SOURCE/data_output_binary_module.f90	(revision 4597)
@@ -24,4 +24,7 @@
 ! -----------------
 ! $Id$
+! change: update argument list of routine binary_init_dimension due to changes in interface
+!
+! 4579 2020-06-25 20:05:07Z gronemeier
 ! corrected formatting to follow PALM coding standard
 !
@@ -68,5 +71,4 @@
     INCLUDE "mpif.h"
 #endif
-
 
     CHARACTER(LEN=*), PARAMETER ::  config_file_name = 'BINARY_TO_NETCDF_CONFIG'  !< name of config file
@@ -88,11 +90,8 @@
     INTEGER ::  output_group_comm               !< MPI communicator addressing all MPI ranks which participate in output
 
-    INTEGER, DIMENSION(:), ALLOCATABLE ::  files_highest_variable_id  !< highest assigned ID of
-                                                                      !< variable or dimension in a file
-
-    LOGICAL ::  binary_open_file_first_call = .TRUE.  !< true if binary_open_file routine was not
-                                                      !< called yet
-    LOGICAL ::  config_file_open = .FALSE.            !< true if config file is opened and not
-                                                      !< closed
+    INTEGER, DIMENSION(:), ALLOCATABLE ::  files_highest_variable_id  !< highest assigned ID of variable or dimension in a file
+
+    LOGICAL ::  binary_open_file_first_call = .TRUE.  !< true if binary_open_file routine was not called yet
+    LOGICAL ::  config_file_open = .FALSE.            !< true if config file is opened and not closed
     LOGICAL ::  print_debug_output = .FALSE.          !< if true, debug output is printed
 
@@ -165,8 +164,6 @@
 
     INTEGER, INTENT(IN) ::  dom_global_id              !< global id within a file defined by DOM
-    INTEGER, INTENT(IN) ::  master_output_rank         !< MPI rank executing tasks which must be
-                                                       !< executed by a single PE
-    INTEGER, INTENT(IN) ::  mpi_comm_of_output_group   !< MPI communicator specifying the rank group
-                                                       !< participating in output
+    INTEGER, INTENT(IN) ::  master_output_rank         !< MPI rank executing tasks which must be executed by a single PE
+    INTEGER, INTENT(IN) ::  mpi_comm_of_output_group   !< MPI communicator specifying the rank group participating in output
     INTEGER, INTENT(IN) ::  program_debug_output_unit  !< file unit number for debug output
 
@@ -174,12 +171,12 @@
 
 
-    file_suffix       = file_suffix_of_output_group
-    output_group_comm = mpi_comm_of_output_group
-    master_rank       = master_output_rank
+    file_suffix        = file_suffix_of_output_group
+    output_group_comm  = mpi_comm_of_output_group
+    master_rank        = master_output_rank
 
     debug_output_unit  = program_debug_output_unit
     print_debug_output = debug_output
 
-    global_id_in_file = dom_global_id
+    global_id_in_file  = dom_global_id
 
  END SUBROUTINE binary_init_module
@@ -204,6 +201,5 @@
     INTEGER, INTENT(OUT) ::  return_value  !< return value
 
-    INTEGER, DIMENSION(:), ALLOCATABLE ::  files_highest_variable_id_tmp  !< temporary list of given
-                                                                          !< variable IDs in file
+    INTEGER, DIMENSION(:), ALLOCATABLE ::  files_highest_variable_id_tmp  !< temporary list of given variable IDs in file
 
     LOGICAL ::  file_exists  !< true if file to be opened already exists
@@ -238,12 +234,13 @@
 !
 !--       Remove any pre-existing file
-          INQUIRE( FILE=TRIM( config_file_name ) // TRIM( file_suffix ), EXIST = file_exists )
+          INQUIRE( FILE=TRIM( config_file_name ) // TRIM( file_suffix ), EXIST=file_exists )
 
           IF ( file_exists )  THEN
-             CALL internal_message( 'debug', routine_name // ': Remove existing file ' //          &
+             CALL internal_message( 'debug', routine_name //                                       &
+                                    ': Remove existing file ' //                                   &
                                     TRIM( config_file_name ) // TRIM( file_suffix ) )
              !> @note Fortran2008 feature 'EXECUTE_COMMAND_LINE' not yet supported by
              !>       PGI 18.10 compiler. Hence, non-standard 'SYSTEM' call must be used
-             ! CALL EXECUTE_COMMAND_LINE(                                                &
+             ! CALL EXECUTE_COMMAND_LINE( &
              !         COMMAND='rm ' // TRIM( config_file_name ) // TRIM( file_suffix ), &
              !         WAIT=.TRUE., EXITSTAT=return_value )
@@ -288,6 +285,6 @@
 
        IF ( file_exists )  THEN
-          CALL internal_message( 'debug', routine_name // ': remove existing file ' //             &
-                                 TRIM( bin_filename ) )
+          CALL internal_message( 'debug', routine_name //                                          &
+                                 ': remove existing file ' // TRIM( bin_filename ) )
           !> @note Fortran2008 feature 'EXECUTE_COMMAND_LINE' not yet supported by
           !>       PGI 18.10 compiler. Hence, non-standard 'SYSTEM' call must be used
@@ -320,5 +317,5 @@
 !--       Extend file-variable/dimension-ID list by 1 and set it to 0 for new file.
           IF ( ALLOCATED( files_highest_variable_id ) )  THEN
-             ALLOCATE( files_highest_variable_id_tmp( SIZE( files_highest_variable_id ) ) )
+             ALLOCATE( files_highest_variable_id_tmp(SIZE( files_highest_variable_id )) )
              files_highest_variable_id_tmp = files_highest_variable_id
              DEALLOCATE( files_highest_variable_id )
@@ -333,6 +330,6 @@
        ELSE
           return_value = 1
-          CALL internal_message( 'error', routine_name // ': could not open file "' //             &
-                                 TRIM( file_name ) // '"')
+          CALL internal_message( 'error', routine_name //                                          &
+                                 ': could not open file "' // TRIM( file_name ) // '"')
        ENDIF
 
@@ -349,5 +346,4 @@
                                     value_int16, value_int32, value_real32, value_real64,          &
                                     return_value )
-
 
     CHARACTER(LEN=*), PARAMETER ::  routine_name = 'binary_write_attribute'  !< name of this routine
@@ -372,6 +368,6 @@
     return_value = 0
 
-    CALL internal_message( 'debug', TRIM( routine_name ) // ': write attribute ' //                &
-                           TRIM( attribute_name ) )
+    CALL internal_message( 'debug', TRIM( routine_name ) //                                        &
+                           ': write attribute ' // TRIM( attribute_name ) )
 !
 !-- Write attribute to file
@@ -418,8 +414,9 @@
 ! ------------
 !> Initialize dimension. Write information in file header and save dimension values to be later
-!< written to file.
+!> written to file.
 !--------------------------------------------------------------------------------------------------!
  SUBROUTINE binary_init_dimension( mode, file_id, dimension_id, variable_id, dimension_name,       &
-                                   dimension_type, dimension_length, return_value )
+                                   dimension_type, dimension_length, write_only_by_master_rank,    &
+                                   return_value )
 
     CHARACTER(LEN=*), PARAMETER ::  routine_name = 'binary_init_dimension'  !< name of this routine
@@ -436,4 +433,6 @@
     INTEGER, INTENT(OUT) ::  variable_id       !< variable ID
 
+    LOGICAL, INTENT(IN) ::  write_only_by_master_rank  !< true if only master rank shall write variable
+
 
     return_value = 0
@@ -441,5 +440,5 @@
     CALL internal_message( 'debug', routine_name // ': init dimension ' // TRIM( dimension_name ) )
 !
-!-- Check mode (not required, added for compatibility reasons only)
+!-- Required for compatibility reasons
     IF ( TRIM( mode ) == mode_binary )  CONTINUE
 !
@@ -458,5 +457,8 @@
 !-- 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 )
+                               (/ dimension_id /),                                                 &
+                               write_only_by_master_rank=write_only_by_master_rank,                &
+                               return_value=return_value )
+
     IF ( return_value /= 0 )  THEN
        CALL internal_message( 'error', routine_name //                                             &
@@ -472,10 +474,10 @@
 !--------------------------------------------------------------------------------------------------!
  SUBROUTINE binary_init_variable( mode, file_id, variable_id, variable_name, variable_type,        &
-                                  dimension_ids, is_global, return_value )
+                                  dimension_ids, write_only_by_master_rank, return_value )
 
     CHARACTER(LEN=*), PARAMETER ::  routine_name = 'binary_init_variable'  !< name of this routine
 
+    CHARACTER(LEN=*),       INTENT(IN) ::  mode            !< operation mode
     CHARACTER(LEN=charlen)             ::  output_string   !< output string
-    CHARACTER(LEN=*),       INTENT(IN) ::  mode            !< operation mode
     CHARACTER(LEN=charlen), INTENT(IN) ::  variable_name   !< name of variable
     CHARACTER(LEN=charlen), INTENT(IN) ::  variable_type   !< data type of variable
@@ -487,5 +489,5 @@
     INTEGER, DIMENSION(:), INTENT(IN) ::  dimension_ids  !< list of dimension IDs used by variable
 
-    LOGICAL, INTENT(IN)  ::  is_global  !< true if variable is global (same on all PE)
+    LOGICAL, INTENT(IN) ::  write_only_by_master_rank  !< true if only master rank shall write variable
 
 
@@ -494,9 +496,7 @@
     CALL internal_message( 'debug', routine_name // ': init variable ' // TRIM( variable_name ) )
 !
-!-- Check mode (not required, added for compatibility reasons only)
+!-- Required for compatibility reasons
     IF ( TRIM( mode ) == mode_binary )  CONTINUE
-!
-!-- Check if variable is global (not required, added for compatibility reasons only)
-    IF ( is_global )  CONTINUE
+    IF ( write_only_by_master_rank )  CONTINUE
 !
 !-- Assign variable ID
@@ -533,6 +533,6 @@
 
     WRITE( temp_string, * ) file_id
-    CALL internal_message( 'debug', routine_name // ': finalize file definition (file_id=' //      &
-                           TRIM( temp_string ) // ')' )
+    CALL internal_message( 'debug', routine_name //                                                &
+                           ': finalize file definition (file_id=' // TRIM( temp_string ) // ')' )
 
     output_string = '*** end file header ***'
@@ -547,16 +547,15 @@
 !--------------------------------------------------------------------------------------------------!
  SUBROUTINE binary_write_variable(                                                                 &
-                           file_id, variable_id, bounds_start, value_counts, bounds_origin,        &
-                           is_global,                                                              &
-                           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, &
-                           return_value )
-
+               file_id, variable_id, bounds_start, value_counts, bounds_origin,                    &
+               write_only_by_master_rank,                                                          &
+               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,             &
+               return_value )
 
     CHARACTER(LEN=*), PARAMETER ::  routine_name = 'binary_write_variable'  !< name of this routine
@@ -570,6 +569,6 @@
 
     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, DIMENSION(:), INTENT(IN) ::  bounds_origin  !< starting index of each dimension
@@ -594,5 +593,5 @@
     INTEGER(iwp),    POINTER, CONTIGUOUS, INTENT(IN), OPTIONAL, DIMENSION(:,:,:) ::  values_intwp_3d  !< output variable
 
-    LOGICAL, INTENT(IN) ::  is_global  !< true if variable is global (same on all PE)
+    LOGICAL, INTENT(IN) ::  write_only_by_master_rank  !< true if only master rank shall write variable
 
     REAL(KIND=4), POINTER,             INTENT(IN), OPTIONAL                   ::  values_real32_0d  !< output variable
@@ -614,6 +613,7 @@
     WRITE( temp_string, '(": write variable ",I6," into file ",I6)' ) variable_id, file_id
     CALL internal_message( 'debug', routine_name // TRIM( temp_string ) )
-
-    IF ( is_global )  CONTINUE  ! reqired to prevent compiler warning
+!
+!-- Required for compatibility reasons
+    IF ( write_only_by_master_rank )  CONTINUE
 
     IF ( .NOT. ANY( value_counts == 0 ) )  THEN
@@ -695,5 +695,5 @@
           WRITE( file_id )  values_int32_3d
 !
-!--    working-precision integer output
+!--    Working-precision integer output
        ELSEIF ( PRESENT( values_intwp_0d ) )  THEN
           output_string = 'intwp'
@@ -749,5 +749,5 @@
           WRITE( file_id )  values_real64_3d
 !
-!--    working-precision real output
+!--    Working-precision real output
        ELSEIF ( PRESENT( values_realwp_0d ) )  THEN
           output_string = 'realwp'
