Index: palm/trunk/SOURCE/check_parameters.f90
===================================================================
--- palm/trunk/SOURCE/check_parameters.f90	(revision 4633)
+++ palm/trunk/SOURCE/check_parameters.f90	(revision 4685)
@@ -24,15 +24,18 @@
 ! -----------------
 ! $Id$
+! filter data_output_pr and data_output list for duplicate entries
+!
+! 4633 2020-08-05 14:21:14Z suehring
 ! todo added
-! 
+!
 ! 4565 2020-06-15 08:30:38Z oliver.maas
 ! added check for pt_surface_heating_rate
-! 
+!
 ! 4564 2020-06-12 14:03:36Z raasch
 ! Vertical nesting method of Huq et al. (2019) removed
-! 
+!
 ! 4562 2020-06-12 08:38:47Z raasch
 ! bugfix: revised error message for exceeding allow number of time series
-! 
+!
 ! 4559 2020-06-11 08:51:48Z raasch
 ! file re-formatted to follow the PALM coding standard
@@ -214,4 +217,6 @@
     CHARACTER (LEN=40)  ::  coupling_string          !< string containing type of coupling
     CHARACTER (LEN=100) ::  action                   !< flag string
+
+    CHARACTER (LEN=varnamelength), DIMENSION(:), ALLOCATABLE ::  data_output_filtered  !< filtered list of output variables
 
     INTEGER(iwp) ::  i                               !< loop index
@@ -1635,4 +1640,10 @@
 
 !
+!-- Check data-output variable list for any duplicates and remove them
+    ALLOCATE( data_output_filtered(1:UBOUND( data_output_pr, DIM=1 )) )
+    CALL filter_duplicate_strings( varnamelength, data_output_pr, data_output_filtered )
+    data_output_pr = data_output_filtered
+    DEALLOCATE( data_output_filtered )
+!
 !-- Determine the number of output profiles and check whether they are permissible
     DO  WHILE ( data_output_pr(dopr_n+1) /= '          ' )
@@ -2241,5 +2252,10 @@
        ENDDO
     ENDIF
-
+!
+!-- Check data-output variable list for any duplicates and remove them
+    ALLOCATE( data_output_filtered(1:UBOUND( data_output, DIM=1 )) )
+    CALL filter_duplicate_strings( varnamelength, data_output, data_output_filtered )
+    data_output = data_output_filtered
+    DEALLOCATE( data_output_filtered )
 !
 !-- Check and set steering parameters for 2d/3d data output and averaging
@@ -3212,3 +3228,59 @@
 
 
+!--------------------------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Filter a list of strings for duplicates. The output list is of same length but does not contain
+!> any duplicates.
+!--------------------------------------------------------------------------------------------------!
+
+    SUBROUTINE filter_duplicate_strings( string_length, string_list, string_list_filtered )
+
+       IMPLICIT NONE
+
+       INTEGER, INTENT(IN) :: string_length  !< length of a single string in list
+
+       CHARACTER (LEN=*),             DIMENSION(:), INTENT(IN)               ::  string_list           !< non-filtered list
+       CHARACTER (LEN=string_length), DIMENSION(:), INTENT(OUT), ALLOCATABLE ::  string_list_filtered  !< filtered list
+
+       CHARACTER (LEN=string_length) ::  string_to_check  !< string to be check for duplicates
+
+       INTEGER(iwp) ::  i         !< loop index
+       INTEGER(iwp) ::  j         !< loop index
+       INTEGER(iwp) ::  k         !< loop index
+       INTEGER(iwp) ::  nstrings  !< number of strings in list
+
+       LOGICAL ::  is_duplicate  !< true if string has duplicates in list
+
+
+       nstrings = UBOUND( string_list, DIM=1 )
+       ALLOCATE( string_list_filtered(1:nstrings) )
+       string_list_filtered(:) = ' '
+
+       k = 0
+       DO  i = 1, nstrings
+          string_to_check = string_list(i)
+
+          IF ( string_to_check == ' ' )  EXIT
+
+          is_duplicate = .FALSE.
+          DO  j = 1, nstrings
+             IF ( string_list_filtered(j) == ' ' )  THEN
+                EXIT
+             ELSEIF ( string_to_check == string_list_filtered(j) )  THEN
+                is_duplicate = .TRUE.
+                EXIT
+             ENDIF
+          ENDDO
+
+          IF ( .NOT. is_duplicate )  THEN
+             k = k + 1
+             string_list_filtered(k) = string_to_check
+          ENDIF
+
+       ENDDO
+
+    END SUBROUTINE filter_duplicate_strings
+
+
  END SUBROUTINE check_parameters
