Index: palm/trunk/SOURCE/modules.f90
===================================================================
--- palm/trunk/SOURCE/modules.f90	(revision 941)
+++ palm/trunk/SOURCE/modules.f90	(revision 951)
@@ -4,5 +4,5 @@
 ! Current revisions:
 ! -----------------
-!
+! changing profile_columns and profile_rows
 !
 ! Former revisions:
@@ -1402,5 +1402,5 @@
                          ( '                               ', i9 = 1, 94 ) /)
 
-    INTEGER ::  profile_columns = 3, profile_rows = 2, profile_number = 0
+    INTEGER ::  profile_columns = 2, profile_rows = 3, profile_number = 0
 
     INTEGER ::  cross_linecolors(100,crmax) = 1, &
Index: palm/trunk/SOURCE/netcdf.f90
===================================================================
--- palm/trunk/SOURCE/netcdf.f90	(revision 941)
+++ palm/trunk/SOURCE/netcdf.f90	(revision 951)
@@ -7,4 +7,5 @@
 ! Current revisions:
 ! ------------------
+! cross_profiles, profile_rows, profile_columns are written to NetCDF header
 !
 ! Former revisions:
@@ -113,7 +114,13 @@
     CHARACTER (LEN=10)             ::  netcdf_var_name, precision, var
     CHARACTER (LEN=80)             ::  time_average_text
-    CHARACTER (LEN=2000)           ::  var_list, var_list_old
-
-    INTEGER ::  av, file_id, i, id_x, id_y, id_z, j, ns, ns_old, nz_old
+    CHARACTER (LEN=2000)           ::  char_cross_profiles, var_list, &
+                                       var_list_old
+
+    CHARACTER (LEN=100), DIMENSION(1:crmax) :: cross_profiles_adj,   &
+                                               cross_profiles_char
+
+    INTEGER ::  av, cross_profiles_count, cross_profiles_maxi, delim, &
+                delim_old, file_id, i, id_last, id_x, id_y, id_z, j,  &
+                k, ns, ns_old, nz_old
 
     INTEGER, DIMENSION(1) ::  id_dim_time_old, id_dim_x_yz_old,  &
@@ -122,5 +129,7 @@
                               id_dim_zu_mask_old
 
-    LOGICAL ::  found
+    INTEGER, DIMENSION(1:crmax) :: cross_profiles_numb
+
+    LOGICAL ::  cross_profiles_log, found
 
     LOGICAL, INTENT (INOUT) ::  extend
@@ -132,6 +141,4 @@
     REAL, DIMENSION(:), ALLOCATABLE   ::  netcdf_data
     REAL, DIMENSION(:,:), ALLOCATABLE ::  netcdf_data_2d
-
-
 
 !
@@ -3132,4 +3139,132 @@
 
 !
+!--       Write columns and rows of cross_profiles to netcdf header. 
+!--       This information can be used by palmplot.
+
+          nc_stat = NF90_PUT_ATT( id_set_pr, NF90_GLOBAL,                     &
+                                  'no_rows',                                  & 
+                                  profile_rows ) 
+          CALL handle_netcdf_error( 'netcdf', 519 )
+
+          nc_stat = NF90_PUT_ATT( id_set_pr, NF90_GLOBAL,                     &
+                                  'no_columns',                               & 
+                                  profile_columns ) 
+          CALL handle_netcdf_error( 'netcdf', 520 )
+
+
+	  cross_profiles_adj  = ADJUSTL( cross_profiles )
+          cross_profiles_numb = 999999
+
+	  k = 1
+
+!
+!--       Each profile defined in cross_profiles is written to a array 
+!--       (cross_profiles_char). The number of its cross is assigned in a 
+!--       second array (cross_profiles_numb).
+
+	  DO  i = 1, crmax
+	    IF ( TRIM( cross_profiles_adj(i) ) == ' ' )  EXIT
+	    delim_old = 0
+	    DO   j = 1, 100
+	      delim = INDEX( cross_profiles_adj(i)(delim_old+1:), ' ' )
+	      IF (delim .EQ. 1)  EXIT
+	      cross_profiles_char(k) = cross_profiles_adj(i)(delim_old+1:    &
+                                       delim_old+delim-1)
+	      cross_profiles_numb(k) = i
+	      k = k+1
+	      cross_profiles_maxi  = i
+	      delim_old = delim_old + delim
+	    ENDDO
+	  ENDDO
+
+          cross_profiles_count = k-1
+          
+!
+!--       Check if all profiles defined in cross_profiles are defined in 
+!--       data_output_pr. If not, they will be skipped.
+
+          cross_profiles_log = .FALSE.
+          message_string = ' '
+
+	  DO  i = 1, cross_profiles_count
+	    DO  j = 1, dopr_n
+	      IF ( TRIM(cross_profiles_char(i)) == TRIM(data_output_pr(j)) ) &
+		 EXIT
+	      IF ( j == dopr_n)  THEN
+		cross_profiles_numb(i) = 999999
+                cross_profiles_log = .TRUE.
+                message_string = TRIM(message_string) // ', ' //              &
+				 TRIM(cross_profiles_char(i))
+	      ENDIF
+	    ENDDO
+	  ENDDO
+
+	  IF (cross_profiles_log)  THEN
+	    message_string = TRIM(message_string(2:)) // ' is/are not' //     &
+                             ' defined in data_output_pr.'
+	    CALL message( 'define_netcdf_header', 'PA0352', 0, 0, 0, 6, 0 )
+	  ENDIF
+
+!
+!--       Check if all profiles defined in data_output_pr are defined in 
+!--       cross_profiles. If not, they will be added to cross_profiles.
+
+          cross_profiles_log = .FALSE.
+          message_string = ' '
+
+	  DO  i = 1, dopr_n
+	    DO  j = 1, cross_profiles_count
+	      IF ( TRIM( cross_profiles_char(j) ) == TRIM( data_output_pr(i)) )&
+		 EXIT
+              IF ( j == cross_profiles_count )  THEN
+		cross_profiles_count = cross_profiles_count + 1
+		cross_profiles_maxi  = cross_profiles_maxi  + 1
+		cross_profiles_char( cross_profiles_count ) =                  &
+                                                      TRIM( data_output_pr(i) )
+		cross_profiles_numb(cross_profiles_count) = cross_profiles_maxi
+		cross_profiles_log = .TRUE.
+                message_string = TRIM( message_string ) // ', ' //             &
+				 TRIM( data_output_pr(i) )
+	      ENDIF
+	    ENDDO
+	  ENDDO
+
+	  IF ( cross_profiles_log )  THEN
+	    message_string = TRIM(message_string(2:)) // ' has/have been' //  & 
+			     ' added to cross_profiles.'
+	    CALL message( 'define_netcdf_header', 'PA0353', 0, 0, 0, 6, 0 )
+	  ENDIF
+
+!
+!--       Writing cross_profiles to netcdf header. This information can be 
+!--       used by palmplot. Each profile is separated by ",", each cross is 
+!--       separated by ";".
+
+	  char_cross_profiles = ';'
+	  id_last = 1
+
+	  DO  i = 1, cross_profiles_count
+	    IF ( cross_profiles_numb(i) /= 999999 )  THEN
+              IF ( TRIM( char_cross_profiles ) == ';' )  THEN
+               char_cross_profiles = TRIM( char_cross_profiles ) // &
+                                     TRIM( cross_profiles_char(i) )
+	      ELSEIF ( id_last == cross_profiles_numb(i) )  THEN
+		char_cross_profiles = TRIM( char_cross_profiles ) // &
+                                      ',' // TRIM( cross_profiles_char(i) )
+	      ELSE
+		char_cross_profiles = TRIM( char_cross_profiles ) // &
+                                      ';' // TRIM( cross_profiles_char(i) )
+	      ENDIF
+	      id_last = cross_profiles_numb(i)
+	    ENDIF
+	  ENDDO
+         
+          char_cross_profiles = TRIM( char_cross_profiles ) // ';'
+
+	  nc_stat = NF90_PUT_ATT( id_set_pr, NF90_GLOBAL, 'cross_profiles',   &
+                                  TRIM( char_cross_profiles ) )
+	  CALL handle_netcdf_error( 'netcdf', 521 )
+
+!
 !--       Define time coordinate for profiles (unlimited dimension)
           nc_stat = NF90_DEF_DIM( id_set_pr, 'time', NF90_UNLIMITED, &
@@ -3403,4 +3538,5 @@
                                   TRIM( time_average_text ) )
           CALL handle_netcdf_error( 'netcdf', 248 )
+
           nc_stat = NF90_ENDDEF( id_set_pr )
           CALL handle_netcdf_error( 'netcdf', 438 )
