Index: palm/trunk/SOURCE/header.f90
===================================================================
--- palm/trunk/SOURCE/header.f90	(revision 392)
+++ palm/trunk/SOURCE/header.f90	(revision 410)
@@ -6,4 +6,9 @@
 ! 
 !
+! Branch revisions:
+! -----------------
+! Masked data output: + dt_domask, mask_01~20_x|y|z, mask_01~20_x|y|z_loop, 
+! mask_scale|_x|y|z, masks, netcdf_format_mask[_av], skip_time_domask
+! 
 ! Former revisions:
 ! -----------------
@@ -105,11 +110,13 @@
     CHARACTER (LEN=70) ::  char1, char2, dopr_chr, &
                            do2d_xy, do2d_xz, do2d_yz, do3d_chr, &
-                           run_classification
+                           domask_chr, run_classification
     CHARACTER (LEN=86) ::  coordinates, gradients, learde, slices,  &
                            temperatures, ugcomponent, vgcomponent
     CHARACTER (LEN=85) ::  roben, runten
 
-    INTEGER ::  av, bh, blx, bly, bxl, bxr, byn, bys, ch, cwx, cwy, cxl, cxr, &
-                cyn, cys, i, ihost, io, j, l, ll, m, mpi_type
+    CHARACTER (LEN=1), DIMENSION(1:3) ::  dir = (/ 'x', 'y', 'z' /)
+
+    INTEGER ::  av, bh, blx, bly, bxl, bxr, byn, bys, ch, count, cwx, cwy,  &
+         cxl, cxr, cyn, cys, dim, i, ihost, io, j, l, ll, m, mpi_type
     REAL    ::  cpuseconds_per_simulated_second
 
@@ -988,4 +995,84 @@
        ENDIF
 
+    ENDDO
+
+!
+!-- masked arrays
+    IF ( masks > 0 )  WRITE ( io, 345 )  &
+         mask_scale_x, mask_scale_y, mask_scale_z
+    DO  mid = 1, masks
+       DO  av = 0, 1
+
+          i = 1
+          domask_chr = ''
+          DO  WHILE ( domask(mid,av,i) /= ' ' )
+             domask_chr = TRIM( domask_chr ) // ' ' //  &
+                          TRIM( domask(mid,av,i) ) // ','
+             i = i + 1
+          ENDDO
+
+          IF ( domask_chr /= '' )  THEN
+             IF ( av == 0 )  THEN
+                WRITE ( io, 346 )  '', mid
+             ELSE
+                WRITE ( io, 346 )  ' (time-averaged)', mid
+             ENDIF
+
+             output_format = ''
+             IF ( netcdf_output )  THEN
+                SELECT CASE ( nc_format_mask(mid,av) )
+                   CASE ( 1 )
+                      output_format = 'netcdf (classic format)'
+                   CASE ( 2 )
+                      output_format = 'netcdf (64bit offset format)'
+                   CASE ( 3 )
+                      output_format = 'netcdf (NetCDF 4 format)'
+                   CASE ( 4 )
+                      output_format = 'netcdf (NetCDF 4 classic model format)'
+                END SELECT
+             ENDIF
+             WRITE ( io, 344 )  output_format
+
+             IF ( av == 0 )  THEN
+                WRITE ( io, 347 )  domask_chr, dt_domask(mid)
+             ELSE
+                WRITE ( io, 348 )  domask_chr, dt_data_output_av, &
+                                   averaging_interval, dt_averaging_input
+             ENDIF
+
+             IF ( av == 0 )  THEN
+                IF ( skip_time_domask(mid) /= 0.0 )  THEN
+                   WRITE ( io, 339 )  skip_time_domask(mid)
+                ENDIF
+             ELSE
+                IF ( skip_time_data_output_av /= 0.0 )  THEN
+                   WRITE ( io, 339 )  skip_time_data_output_av
+                ENDIF
+             ENDIF
+!
+!--          output locations
+             DO  dim = 1, 3
+                IF ( mask(mid,dim,1) >= 0.0 )  THEN
+                   count = 0
+                   DO  WHILE ( mask(mid,dim,count+1) >= 0.0 )
+                      count = count + 1
+                   ENDDO
+                   WRITE ( io, 349 )  dir(dim), dir(dim), mid, dir(dim), &
+                                      mask(mid,dim,:count)
+                ELSEIF ( mask_loop(mid,dim,1) < 0.0 .AND.  &
+                         mask_loop(mid,dim,2) < 0.0 .AND.  &
+                         mask_loop(mid,dim,3) == 0.0 )  THEN
+                   WRITE ( io, 350 )  dir(dim), dir(dim)
+                ELSEIF ( mask_loop(mid,dim,3) == 0.0 )  THEN
+                   WRITE ( io, 351 )  dir(dim), dir(dim), mid, dir(dim), &
+                                      mask_loop(mid,dim,1:2)
+                ELSE
+                   WRITE ( io, 351 )  dir(dim), dir(dim), mid, dir(dim), &
+                                      mask_loop(mid,dim,1:3)
+                ENDIF
+             ENDDO
+          ENDIF
+
+       ENDDO
     ENDDO
 
@@ -1619,4 +1706,23 @@
             '       Upper output limit at    ',F8.2,' m  (GP ',I4,')'/)
 344 FORMAT ('       Output format: ',A/)
+345 FORMAT (/'    Scaling lengths for output locations of all subsequent mask IDs:',/ &
+            '       mask_scale_x (in x-direction): ',F9.3, ' m',/ &
+            '       mask_scale_y (in y-direction): ',F9.3, ' m',/ &
+            '       mask_scale_z (in z-direction): ',F9.3, ' m' )
+346 FORMAT (/'    Masked data output',A,' for mask ID ',I2, ':')
+347 FORMAT ('       Variables: ',A/ &
+            '       Output every             ',F8.2,' s')
+348 FORMAT ('       Variables: ',A/ &
+            '       Output every             ',F8.2,' s'/ &
+            '       Time averaged over       ',F8.2,' s'/ &
+            '       Averaging input every    ',F8.2,' s')
+349 FORMAT (/'       Output locations in ',A,'-direction in multiples of ', &
+            'mask_scale_',A,' predefined by array mask_',I2.2,'_',A,':'/ &
+            13('       ',8(F8.2,',')/) )
+350 FORMAT (/'       Output locations in ',A,'-direction: ', &
+            'all gridpoints along ',A,'-direction (default).' )
+351 FORMAT (/'       Output locations in ',A,'-direction in multiples of ', &
+            'mask_scale_',A,' constructed from array mask_',I2.2,'_',A,'_loop:'/ &
+            '          loop begin:',F8.2,', end:',F8.2,', stride:',F8.2 )
 #if defined( __dvrp_graphics )
 360 FORMAT ('    Plot-Sequence with dvrp-software:'/ &
