Index: palm/trunk/SOURCE/check_open.f90
===================================================================
--- palm/trunk/SOURCE/check_open.f90	(revision 563)
+++ palm/trunk/SOURCE/check_open.f90	(revision 564)
@@ -4,5 +4,6 @@
 ! Current revisions:
 ! -----------------
-! 
+! start number of mask output files changed to 201, netcdf message identifiers
+! of masked output changed
 !
 ! Former revisions:
@@ -139,5 +140,5 @@
           ENDIF
 
-       CASE ( 101:103, 106, 111:113, 116, 121:160 )
+       CASE ( 101:103, 106, 111:113, 116, 201:200+2*max_masks )
 
           IF ( netcdf_data_format < 3 )  THEN
@@ -1366,14 +1367,14 @@
           ENDIF
 
-       CASE ( 121:160 )
+       CASE ( 201:200+2*max_masks )
 !
 !--       Set filename depending on unit number
-          IF ( file_id <= 140 )  THEN
-             mid = file_id - 120
+          IF ( file_id <= 200+max_masks )  THEN
+             mid = file_id - 200
              WRITE ( mask_char,'(I2.2)')  mid
              filename = 'DATA_MASK_' // mask_char // '_NETCDF' // coupling_char
              av = 0
           ELSE
-             mid = file_id - 140
+             mid = file_id - (200+max_masks)
              WRITE ( mask_char,'(I2.2)')  mid
              filename = 'DATA_MASK_' // mask_char // '_AV_NETCDF' // &
@@ -1396,5 +1397,5 @@
              nc_stat = NF90_OPEN( filename, NF90_WRITE, id_set_mask(mid,av) )
 #endif
-             CALL handle_netcdf_error( 'check_open', 9998 )
+             CALL handle_netcdf_error( 'check_open', 456 )
 !
 !--          Read header information and set all ids. If there is a mismatch
@@ -1407,5 +1408,5 @@
              IF ( .NOT. netcdf_extend )  THEN
                 nc_stat = NF90_CLOSE( id_set_mask(mid,av) )
-                CALL handle_netcdf_error( 'check_open', 9998 )
+                CALL handle_netcdf_error( 'check_open', 457 )
                 CALL local_system('rm ' // TRIM( filename ) )
              ENDIF
@@ -1450,5 +1451,5 @@
              ENDIF
 
-             CALL handle_netcdf_error( 'check_open', 9998 )
+             CALL handle_netcdf_error( 'check_open', 458 )
 !
 !--          Define the header
@@ -1460,5 +1461,5 @@
 #else
 
-       CASE ( 101:109, 111:113, 116, 121:160 )
+       CASE ( 101:109, 111:113, 116, 201:200+2*max_masks )
 
 !
Index: palm/trunk/SOURCE/check_parameters.f90
===================================================================
--- palm/trunk/SOURCE/check_parameters.f90	(revision 563)
+++ palm/trunk/SOURCE/check_parameters.f90	(revision 564)
@@ -4,5 +4,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! palm message identifiers of masked output changed, 20 replaced by max_masks 
 !
 ! Former revisions:
@@ -1505,5 +1505,5 @@
        IF ( dt_do3d           == 9999999.9 )  dt_do3d           = dt_data_output
        IF ( dt_data_output_av == 9999999.9 )  dt_data_output_av = dt_data_output
-       DO  mid = 1, 20
+       DO  mid = 1, max_masks
           IF ( dt_domask(mid) == 9999999.9 )  dt_domask(mid)    = dt_data_output
        ENDDO
@@ -1526,5 +1526,5 @@
     IF ( skip_time_data_output_av == 9999999.9 ) &
                                 skip_time_data_output_av = skip_time_data_output
-    DO  mid = 1, 20
+    DO  mid = 1, max_masks
        IF ( skip_time_domask(mid) == 9999999.9 ) &
                                 skip_time_domask(mid)    = skip_time_data_output
@@ -2692,5 +2692,5 @@
        WRITE( message_string, * )  'illegal value: masks must be >= 0 and ', &
             '<= ', max_masks, ' (=max_masks)'
-       CALL message( 'check_parameters', 'PA9998', 1, 2, 0, 6, 0 )
+       CALL message( 'check_parameters', 'PA0325', 1, 2, 0, 6, 0 )
     ENDIF
     IF ( masks > 0 )  THEN
@@ -2702,5 +2702,5 @@
                'illegal value: mask_scale_x, mask_scale_y and mask_scale_z', &
                'must be > 0.0'
-          CALL message( 'check_parameters', 'PA9998', 1, 2, 0, 6, 0 )
+          CALL message( 'check_parameters', 'PA0326', 1, 2, 0, 6, 0 )
        ENDIF
 !
Index: palm/trunk/SOURCE/close_file.f90
===================================================================
--- palm/trunk/SOURCE/close_file.f90	(revision 563)
+++ palm/trunk/SOURCE/close_file.f90	(revision 564)
@@ -4,5 +4,6 @@
 ! Current revisions:
 ! -----------------
-! 
+! start number of mask output files changed to 201, netcdf message identifiers
+! of masked output changed
 !
 ! Former revisions:
@@ -100,5 +101,5 @@
 !
 !-- Close all open unit numbers
-    DO  fid = 1, 160
+    DO  fid = 1, 200+2*max_masks
 
        IF ( openfile(fid)%opened .OR. openfile(fid)%opened_before )  THEN
@@ -509,5 +510,5 @@
                 ENDIF
 
-             CASE ( 121:160 )
+             CASE ( 201:200+2*max_masks )
 	     
                 IF ( netcdf_output  .AND.  &
@@ -515,13 +516,13 @@
 !
 !--                decompose fid into mid and av
-                   IF ( fid <= 140 )  THEN
-                      mid = fid - 120
+                   IF ( fid <= 200+max_masks )  THEN
+                      mid = fid - 200
                       av = 0
                    ELSE
-                      mid = fid - 140
+                      mid = fid - (200+max_masks)
                       av = 1
                    ENDIF
                    nc_stat = NF90_CLOSE( id_set_mask(mid,av) )
-                   CALL handle_netcdf_error( 'close_file', 9998 )
+                   CALL handle_netcdf_error( 'close_file', 459 )
 		
                 ENDIF
Index: palm/trunk/SOURCE/data_output_mask.f90
===================================================================
--- palm/trunk/SOURCE/data_output_mask.f90	(revision 563)
+++ palm/trunk/SOURCE/data_output_mask.f90	(revision 564)
@@ -4,5 +4,6 @@
 ! Current revisions:
 ! -----------------
-! 
+! start number of mask output files changed to 201, netcdf message identifiers
+! of masked output changed, palm message identifiers of masked output changed 
 !
 ! Former revisions:
@@ -60,5 +61,5 @@
     IF ( netcdf_output  .AND.  ( myid == 0  .OR.  netcdf_data_format > 2 ) ) &
     THEN
-       CALL check_open( 120+mid+av*max_masks )
+       CALL check_open( 200+mid+av*max_masks )
     ENDIF 
 
@@ -82,5 +83,5 @@
                                start = (/ domask_time_count(mid,av) /),       &
                                count = (/ 1 /) )
-       CALL handle_netcdf_error( 'data_output_mask', 9998 )
+       CALL handle_netcdf_error( 'data_output_mask', 460 )
     ENDIF
 
@@ -300,5 +301,5 @@
                 WRITE ( message_string, * ) 'no output available for: ', &
                                             TRIM( domask(mid,av,if) )
-                CALL message( 'data_output_mask', 'PA9998', 0, 0, 0, 6, 0 )
+                CALL message( 'data_output_mask', 'PA0327', 0, 0, 0, 6, 0 )
              ENDIF
 
@@ -339,5 +340,5 @@
                count = (/ mask_size_l(mid,1), mask_size_l(mid,2),  &
                           mask_size_l(mid,3), 1 /) )
-          CALL handle_netcdf_error( 'data_output_mask', 9998 )
+          CALL handle_netcdf_error( 'data_output_mask', 461 )
        ELSE
 #endif
@@ -386,5 +387,5 @@
                   count = (/ mask_size(mid,1), mask_size(mid,2), &
                              mask_size(mid,3), 1 /) )
-             CALL handle_netcdf_error( 'data_output_mask', 9998 )
+             CALL handle_netcdf_error( 'data_output_mask', 462 )
 
           ELSE
@@ -431,5 +432,5 @@
             count = (/ mask_size_l(mid,1), mask_size_l(mid,2), &
                        mask_size_l(mid,3), 1 /) )
-       CALL handle_netcdf_error( 'data_output_mask', 9998 )
+       CALL handle_netcdf_error( 'data_output_mask', 463 )
 #endif
 
Index: palm/trunk/SOURCE/init_masks.f90
===================================================================
--- palm/trunk/SOURCE/init_masks.f90	(revision 563)
+++ palm/trunk/SOURCE/init_masks.f90	(revision 564)
@@ -4,5 +4,6 @@
 ! Current revisions:
 ! -----------------
-! 
+! assignment of mask_xyz_loop added, palm message identifiers of masked output
+! changed 
 !
 ! Former revisions:
@@ -64,5 +65,5 @@
                         '3 (NetCDF 4) and 4 (NetCDF 4 Classic model)'//  &
                         '&are currently not supported (not yet tested).'
-       CALL message( 'init_masks', 'PA9998', 1, 2, 0, 6, 0 )
+       CALL message( 'init_masks', 'PA0328', 1, 2, 0, 6, 0 )
     ENDIF
 
@@ -70,4 +71,5 @@
 !-- Store data output parameters for masked data output in few shared arrays
     DO mid = 1, masks
+    
        do_mask     (mid,:) = data_output_masks(mid,:)
        do_mask_user(mid,:) = data_output_masks_user(mid,:)
@@ -75,7 +77,27 @@
        mask      (mid,2,:) = mask_y(mid,:)
        mask      (mid,3,:) = mask_z(mid,:) 
-       mask_loop (mid,1,:) = mask_x_loop(mid,:) 
-       mask_loop (mid,2,:) = mask_y_loop(mid,:) 
-       mask_loop (mid,3,:) = mask_z_loop(mid,:) 
+       
+       IF ( mask_x_loop(mid,1) == -1.0 .AND. mask_x_loop(mid,2) == -1.0  &
+            .AND. mask_x_loop(mid,3) == -1.0 ) THEN
+	  mask_loop(mid,1,1:2) = -1.0
+          mask_loop(mid,1,3) = 0.0
+       ELSE
+          mask_loop(mid,1,:) = mask_x_loop(mid,:)
+       ENDIF
+       IF ( mask_y_loop(mid,1) == -1.0 .AND. mask_y_loop(mid,2) == -1.0  &
+            .AND. mask_y_loop(mid,3) == -1.0 ) THEN
+	  mask_loop(mid,2,1:2) = -1.0
+          mask_loop(mid,2,3) = 0.0
+       ELSE
+          mask_loop(mid,2,:) = mask_y_loop(mid,:)
+       ENDIF
+       IF ( mask_z_loop(mid,1) == -1.0 .AND. mask_z_loop(mid,2) == -1.0  &
+            .AND. mask_z_loop(mid,3) == -1.0 ) THEN
+	  mask_loop(mid,3,1:2) = -1.0
+          mask_loop(mid,3,3) = 0.0
+       ELSE
+          mask_loop(mid,3,:) = mask_z_loop(mid,:)
+       ENDIF
+       
     ENDDO
     
@@ -107,5 +129,5 @@
                      'given by data_output_mask and data_output_mask_user ', &
                      'exceeds the limit of 100'
-                CALL message( 'init_masks', 'PA9998', 1, 2, 0, 6, 0 )
+                CALL message( 'init_masks', 'PA0329', 1, 2, 0, 6, 0 )
              ENDIF
              do_mask(mid,i) = do_mask_user(mid,j)
@@ -138,5 +160,5 @@
                    WRITE ( message_string, * ) 'output of "', TRIM( var ), &
                         '" requires constant_diffusion = .FALSE.'
-                   CALL message( 'init_masks', 'PA9998', 1, 2, 0, 6, 0 )
+                   CALL message( 'init_masks', 'PA0103', 1, 2, 0, 6, 0 )
                 ENDIF
                 unit = 'm2/s2'
@@ -147,5 +169,5 @@
                         '" requires a "particles_par"-NAMELIST in the ', &
                         'parameter file (PARIN)'
-                   CALL message( 'init_masks', 'PA9998', 1, 2, 0, 6, 0 )
+                   CALL message( 'init_masks', 'PA0104', 1, 2, 0, 6, 0 )
                 ENDIF
                 IF ( TRIM( var ) == 'pc' )  unit = 'number'
@@ -156,5 +178,5 @@
                    WRITE ( message_string, * ) 'output of "', TRIM( var ), &
                         '" requires humidity = .TRUE.'
-                   CALL message( 'init_masks', 'PA9998', 1, 2, 0, 6, 0 )
+                   CALL message( 'init_masks', 'PA0105', 1, 2, 0, 6, 0 )
                 ENDIF
                 IF ( TRIM( var ) == 'q'   )  unit = 'kg/kg'
@@ -166,5 +188,5 @@
                         '" requires cloud_physics = .TRUE. or cloud_droplets', &
                         ' = .TRUE.'
-                   CALL message( 'init_masks', 'PA9998', 1, 2, 0, 6, 0 )
+                   CALL message( 'init_masks', 'PA0108', 1, 2, 0, 6, 0 )
                 ENDIF
                 unit = 'kg/kg'
@@ -174,5 +196,5 @@
                    WRITE ( message_string, * ) 'output of "', TRIM( var ), &
                         '" requires cloud_droplets = .TRUE.'
-                   CALL message( 'init_masks', 'PA9998', 1, 2, 0, 6, 0 )
+                   CALL message( 'init_masks', 'PA0107', 1, 2, 0, 6, 0 )
                 ENDIF
                 IF ( TRIM( var ) == 'ql_c'  )  unit = 'kg/kg'
@@ -184,5 +206,5 @@
                    WRITE ( message_string, * ) 'output of "', TRIM( var ), &
                         '" requires cloud_physics = .TRUE.'
-                   CALL message( 'init_masks', 'PA9998', 1, 2, 0, 6, 0 )
+                   CALL message( 'init_masks', 'PA0108', 1, 2, 0, 6, 0 )
                 ENDIF
                 unit = 'kg/kg'
@@ -192,5 +214,5 @@
                    WRITE ( message_string, * ) 'output of "', TRIM( var ), &
                         '" requires ocean = .TRUE.'
-                   CALL message( 'init_masks', 'PA9998', 1, 2, 0, 6, 0 )
+                   CALL message( 'init_masks', 'PA0109', 1, 2, 0, 6, 0 )
                 ENDIF
                 unit = 'kg/m3'
@@ -200,5 +222,5 @@
                    WRITE ( message_string, * ) 'output of "', TRIM( var ), &
                         '" requires passive_scalar = .TRUE.'
-                   CALL message( 'init_masks', 'PA9998', 1, 2, 0, 6, 0 )
+                   CALL message( 'init_masks', 'PA0110', 1, 2, 0, 6, 0 )
                 ENDIF
                 unit = 'conc'
@@ -208,5 +230,5 @@
                    WRITE ( message_string, * ) 'output of "', TRIM( var ), &
                         '" requires ocean = .TRUE.'
-                   CALL message( 'init_masks', 'PA9998', 1, 2, 0, 6, 0 )
+                   CALL message( 'init_masks', 'PA0109', 1, 2, 0, 6, 0 )
                 ENDIF
                 unit = 'psu'
@@ -216,14 +238,14 @@
                      'output: "', TRIM( var ), '" is only allowed', &
                      'for horizontal cross section'
-                CALL message( 'init_masks', 'PA9998', 1, 2, 0, 6, 0 )
+                CALL message( 'init_masks', 'PA0111', 1, 2, 0, 6, 0 )
 !                IF ( TRIM( var ) == 'lwp*'  .AND.  .NOT. cloud_physics )  THEN
 !                   WRITE ( message_string, * ) 'output of "', TRIM( var ), &
 !                         '" requires cloud_physics = .TRUE.'
-!                   CALL message( 'init_masks', 'PA9998', 1, 2, 0, 6, 0 )
+!                   CALL message( 'init_masks', 'PA0108', 1, 2, 0, 6, 0 )
 !                ENDIF
 !                IF ( TRIM( var ) == 'pra*'  .AND.  .NOT. precipitation )  THEN
 !                   WRITE ( message_string, * ) 'output of "', TRIM( var ), &
 !                         '" requires precipitation = .TRUE.'
-!                   CALL message( 'init_masks', 'PA9998', 1, 2, 0, 6, 0 )
+!                   CALL message( 'init_masks', 'PA0112', 1, 2, 0, 6, 0 )
 !                ENDIF
 !                IF ( TRIM( var ) == 'pra*'  .AND.  j == 1 )  THEN
@@ -231,10 +253,10 @@
 !                         ' precipitation amount "', TRIM( var ),         &
 !                         '" not possible' 
-!                   CALL message( 'init_masks', 'PA9998', 1, 2, 0, 6, 0 )
+!                   CALL message( 'init_masks', 'PA0113', 1, 2, 0, 6, 0 )
 !                ENDIF
 !                IF ( TRIM( var ) == 'prr*'  .AND.  .NOT. precipitation )  THEN
 !                   WRITE ( message_string, * ) 'output of "', TRIM( var ), &
 !                         '" requires precipitation = .TRUE.'
-!                   CALL message( 'init_masks', 'PA9998', 1, 2, 0, 6, 0 )
+!                   CALL message( 'init_masks', 'PA0112', 1, 2, 0, 6, 0 )
 !                ENDIF
 !
@@ -262,9 +284,9 @@
                            'output or data_output_user: "', &
                            TRIM( do_mask(mid,i) ), '"'
-                      CALL message( 'init_masks', 'PA9998', 1, 2, 0, 6, 0 )
+                      CALL message( 'init_masks', 'PA0114', 1, 2, 0, 6, 0 )
                    ELSE
                       WRITE ( message_string, * ) 'illegal value for data_',&
                            'output: "', TRIM( do_mask(mid,i) ), '"'
-                      CALL message( 'init_masks', 'PA9998', 1, 2, 0, 6, 0 )
+                      CALL message( 'init_masks', 'PA0330', 1, 2, 0, 6, 0 )
                    ENDIF
                 ENDIF
@@ -451,5 +473,5 @@
                      m,' in mask ',mid,' along dimension ',dim,  &
                      ' exceeds ',nxyz_string,' = ',nxyz
-                CALL message( 'init_masks', 'PA9998', 1, 2, 0, 6, 0 )
+                CALL message( 'init_masks', 'PA0331', 1, 2, 0, 6, 0 )
              ENDIF
              IF ( m >= lb .AND. m <= ub )  THEN
@@ -490,5 +512,5 @@
                      nxyz_string,'*',dxyz_string,'/mask_scale(',dim,')=', &
                      nxyz*dxyz/mask_scale(dim)
-                CALL message( 'init_masks', 'PA9998', 1, 2, 0, 6, 0 )
+                CALL message( 'init_masks', 'PA0332', 1, 2, 0, 6, 0 )
              ENDIF
              loop_begin  = NINT( mask_loop(mid,dim,1) * mask_scale(dim) * ddxyz )
@@ -507,5 +529,5 @@
                      mask_loop(mid,dim,2),'&exceed zw(nz)/mask_scale(',dim, &
                      ')=',zw(nz)/mask_scale(dim)
-                CALL message( 'init_masks', 'PA9998', 1, 2, 0, 6, 0 )
+                CALL message( 'init_masks', 'PA0333', 1, 2, 0, 6, 0 )
              ENDIF
              ind_array =  &
@@ -530,5 +552,5 @@
                      'match the desired heights&within the stretching ', &
                      'region. Recommendation: use mask instead of mask_loop.'
-                CALL message( 'init_masks', 'PA9998', 0, 1, 0, 6, 0 )
+                CALL message( 'init_masks', 'PA0334', 0, 1, 0, 6, 0 )
              ENDIF
 
Index: palm/trunk/SOURCE/modules.f90
===================================================================
--- palm/trunk/SOURCE/modules.f90	(revision 563)
+++ palm/trunk/SOURCE/modules.f90	(revision 564)
@@ -5,5 +5,7 @@
 ! Current revisions:
 ! -----------------
-! 
+! nc_precision and netcdf_precision dimension changed to 11, all default 
+! values of mask_xyz_loop changed to -1.0, dimension of openfile changed to 
+! 200+2*max_masks, max_masks changed to 50
 !
 ! Former revisions:
@@ -303,9 +305,9 @@
        LOGICAL ::  opened, opened_before
     END TYPE file_status
-
-    TYPE(file_status), DIMENSION(200) :: openfile = file_status(.FALSE.,.FALSE.)
-
-
-    INTEGER, PARAMETER :: mask_xyz_dimension = 100, max_masks = 20
+    
+    INTEGER, PARAMETER :: mask_xyz_dimension = 100, max_masks = 50
+
+    TYPE(file_status), DIMENSION(200+2*max_masks) ::                &
+                             openfile = file_status(.FALSE.,.FALSE.)
 
     CHARACTER (LEN=1)    ::  cycle_mg = 'w', timestep_reason = ' '
@@ -354,5 +356,5 @@
     CHARACTER (LEN=10), DIMENSION(300) ::  data_output_pr = ' '
     CHARACTER (LEN=10), DIMENSION(200) ::  data_output_pr_user = ' '
-    CHARACTER (LEN=20), DIMENSION(50)  ::  netcdf_precision = ' '
+    CHARACTER (LEN=20), DIMENSION(11)  ::  netcdf_precision = ' '
 
     CHARACTER (LEN=10), DIMENSION(max_masks,0:1,100) ::  domask = ' '
@@ -549,45 +551,8 @@
     REAL, DIMENSION(:), ALLOCATABLE ::  dp_smooth_factor
 
-    REAL, DIMENSION(max_masks,mask_xyz_dimension) ::       &
+    REAL, DIMENSION(max_masks,mask_xyz_dimension) :: &
         mask_x = -1.0, mask_y = -1.0, mask_z = -1.0
-    REAL, DIMENSION(max_masks,3) ::                        &
-        mask_x_loop = (/ -1.0, -1.0, -1.0, -1.0, -1.0,     &  
-	                 -1.0, -1.0, -1.0, -1.0, -1.0,     &
-			 -1.0, -1.0, -1.0, -1.0, -1.0,     &
-			 -1.0, -1.0, -1.0, -1.0, -1.0,     &
-			 -1.0, -1.0, -1.0, -1.0, -1.0,     &
-			 -1.0, -1.0, -1.0, -1.0, -1.0,     &
-			 -1.0, -1.0, -1.0, -1.0, -1.0,     &
-			 -1.0, -1.0, -1.0, -1.0, -1.0,     &
-			  0.0,  0.0,  0.0,  0.0,  0.0,     &
-	                  0.0,  0.0,  0.0,  0.0,  0.0,     &
-			  0.0,  0.0,  0.0,  0.0,  0.0,     &
-			  0.0,  0.0,  0.0,  0.0,  0.0  /), &
-	
-	mask_y_loop = (/ -1.0, -1.0, -1.0, -1.0, -1.0,     &  
-	                 -1.0, -1.0, -1.0, -1.0, -1.0,     &
-			 -1.0, -1.0, -1.0, -1.0, -1.0,     &
-			 -1.0, -1.0, -1.0, -1.0, -1.0,     &
-			 -1.0, -1.0, -1.0, -1.0, -1.0,     &
-			 -1.0, -1.0, -1.0, -1.0, -1.0,     &
-			 -1.0, -1.0, -1.0, -1.0, -1.0,     &
-			 -1.0, -1.0, -1.0, -1.0, -1.0,     &
-			  0.0,  0.0,  0.0,  0.0,  0.0,     &
-	                  0.0,  0.0,  0.0,  0.0,  0.0,     &
-			  0.0,  0.0,  0.0,  0.0,  0.0,     &
-			  0.0,  0.0,  0.0,  0.0,  0.0  /), &
-			   
-	mask_z_loop = (/ -1.0, -1.0, -1.0, -1.0, -1.0,     &  
-	                 -1.0, -1.0, -1.0, -1.0, -1.0,     &
-			 -1.0, -1.0, -1.0, -1.0, -1.0,     &
-			 -1.0, -1.0, -1.0, -1.0, -1.0,     &
-			 -1.0, -1.0, -1.0, -1.0, -1.0,     &
-			 -1.0, -1.0, -1.0, -1.0, -1.0,     &
-			 -1.0, -1.0, -1.0, -1.0, -1.0,     &
-			 -1.0, -1.0, -1.0, -1.0, -1.0,     &
-			  0.0,  0.0,  0.0,  0.0,  0.0,     &
-	                  0.0,  0.0,  0.0,  0.0,  0.0,     &
-			  0.0,  0.0,  0.0,  0.0,  0.0,     &
-			  0.0,  0.0,  0.0,  0.0,  0.0  /)  
+    REAL, DIMENSION(max_masks,3) ::                  &
+        mask_x_loop = -1.0, mask_y_loop = -1.0, mask_z_loop = -1.0
     
 !
@@ -1026,5 +991,5 @@
     INTEGER, DIMENSION(10)  ::  id_var_dospx, id_var_dospy
     INTEGER, DIMENSION(20)  ::  id_var_prt
-    INTEGER, DIMENSION(50)  ::  nc_precision
+    INTEGER, DIMENSION(11)  ::  nc_precision
     INTEGER, DIMENSION(dopr_norm_num) ::  id_var_norm_dopr
 
Index: palm/trunk/SOURCE/netcdf.f90
===================================================================
--- palm/trunk/SOURCE/netcdf.f90	(revision 563)
+++ palm/trunk/SOURCE/netcdf.f90	(revision 564)
@@ -7,5 +7,6 @@
 ! Current revisions:
 ! ------------------
-! 
+! nc_precision changed from 40 masks to 1 mask, start number of mask output
+! files changed to 201, netcdf message identifiers of masked output changed 
 !
 ! Former revisions:
@@ -176,85 +177,5 @@
                 nc_precision(8) = j
              CASE ( 'masks' )
-                nc_precision(11:50) = j
-             CASE ( 'mask01' )
                 nc_precision(11) = j
-             CASE ( 'mask02' )
-                nc_precision(12) = j
-             CASE ( 'mask03' )
-                nc_precision(13) = j
-             CASE ( 'mask04' )
-                nc_precision(14) = j
-             CASE ( 'mask05' )
-                nc_precision(15) = j
-             CASE ( 'mask06' )
-                nc_precision(16) = j
-             CASE ( 'mask07' )
-                nc_precision(17) = j
-             CASE ( 'mask08' )
-                nc_precision(18) = j
-             CASE ( 'mask09' )
-                nc_precision(19) = j
-             CASE ( 'mask10' )
-                nc_precision(20) = j
-             CASE ( 'mask11' )
-                nc_precision(21) = j
-             CASE ( 'mask12' )
-                nc_precision(22) = j
-             CASE ( 'mask13' )
-                nc_precision(23) = j
-             CASE ( 'mask14' )
-                nc_precision(24) = j
-             CASE ( 'mask15' )
-                nc_precision(25) = j
-             CASE ( 'mask16' )
-                nc_precision(26) = j
-             CASE ( 'mask17' )
-                nc_precision(27) = j
-             CASE ( 'mask18' )
-                nc_precision(28) = j
-             CASE ( 'mask19' )
-                nc_precision(29) = j
-             CASE ( 'mask20' )
-                nc_precision(30) = j
-             CASE ( 'maskav01' )
-                nc_precision(31) = j
-             CASE ( 'maskav02' )
-                nc_precision(32) = j
-             CASE ( 'maskav03' )
-                nc_precision(33) = j
-             CASE ( 'maskav04' )
-                nc_precision(34) = j
-             CASE ( 'maskav05' )
-                nc_precision(35) = j
-             CASE ( 'maskav06' )
-                nc_precision(36) = j
-             CASE ( 'maskav07' )
-                nc_precision(37) = j
-             CASE ( 'maskav08' )
-                nc_precision(38) = j
-             CASE ( 'maskav09' )
-                nc_precision(39) = j
-             CASE ( 'maskav10' )
-                nc_precision(40) = j
-             CASE ( 'maskav11' )
-                nc_precision(41) = j
-             CASE ( 'maskav12' )
-                nc_precision(42) = j
-             CASE ( 'maskav13' )
-                nc_precision(43) = j
-             CASE ( 'maskav14' )
-                nc_precision(44) = j
-             CASE ( 'maskav15' )
-                nc_precision(45) = j
-             CASE ( 'maskav16' )
-                nc_precision(46) = j
-             CASE ( 'maskav17' )
-                nc_precision(47) = j
-             CASE ( 'maskav18' )
-                nc_precision(48) = j
-             CASE ( 'maskav19' )
-                nc_precision(49) = j
-             CASE ( 'maskav20' )
-                nc_precision(50) = j
              CASE ( 'all' )
                 nc_precision    = j
@@ -297,9 +218,9 @@
 !--       mid and av
           file_id = av
-          IF ( file_id <= 140 )  THEN
-             mid = file_id - 120
+          IF ( file_id <= 200+max_masks )  THEN
+             mid = file_id - 200
              av = 0
           ELSE
-             mid = file_id - 140
+             mid = file_id - (200+max_masks)
              av = 1
           ENDIF
@@ -309,5 +230,5 @@
           nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), NF90_GLOBAL, &
                'Conventions', 'COARDS' )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 464 )
 
           IF ( av == 0 )  THEN
@@ -320,10 +241,10 @@
                                   TRIM( run_description_header ) //    &
                                   TRIM( time_average_text ) )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 465 )
           IF ( av == 1 )  THEN
              WRITE ( time_average_text,'(F7.1,'' s avg'')' )  averaging_interval
              nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), NF90_GLOBAL, &
                                      'time_avg', TRIM( time_average_text ) )
-             CALL handle_netcdf_error( 'netcdf', 9998 )
+             CALL handle_netcdf_error( 'netcdf', 466 )
           ENDIF
 
@@ -332,15 +253,15 @@
           nc_stat = NF90_DEF_DIM( id_set_mask(mid,av), 'time', NF90_UNLIMITED, &
                                   id_dim_time_mask(mid,av) )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 467 )
 
           nc_stat = NF90_DEF_VAR( id_set_mask(mid,av), 'time', NF90_DOUBLE, &
                                   id_dim_time_mask(mid,av), &
                                   id_var_time_mask(mid,av) )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 468 )
 
           nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), &
                                   id_var_time_mask(mid,av), 'units', &
                                   'seconds')
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 469 )
 
 !
@@ -349,14 +270,14 @@
           nc_stat = NF90_DEF_DIM( id_set_mask(mid,av), 'zu_3d', &
                                   mask_size(mid,3), id_dim_zu_mask(mid,av) )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 470 )
 
           nc_stat = NF90_DEF_VAR( id_set_mask(mid,av), 'zu_3d', NF90_DOUBLE, &
                                   id_dim_zu_mask(mid,av), &
                                   id_var_zu_mask(mid,av) )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 471 )
 
           nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), id_var_zu_mask(mid,av), &
                                   'units', 'meters' )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 472 )
 
 !
@@ -364,14 +285,14 @@
           nc_stat = NF90_DEF_DIM( id_set_mask(mid,av), 'zw_3d', &
                                   mask_size(mid,3), id_dim_zw_mask(mid,av) )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 473 )
 
           nc_stat = NF90_DEF_VAR( id_set_mask(mid,av), 'zw_3d', NF90_DOUBLE, &
                                   id_dim_zw_mask(mid,av), &
                                   id_var_zw_mask(mid,av) )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 474 )
 
           nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), id_var_zw_mask(mid,av), &
                                   'units', 'meters' )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 475 )
 
 !
@@ -379,13 +300,13 @@
           nc_stat = NF90_DEF_DIM( id_set_mask(mid,av), 'x', &
                                   mask_size(mid,1), id_dim_x_mask(mid,av) )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 476 )
 
           nc_stat = NF90_DEF_VAR( id_set_mask(mid,av), 'x', NF90_DOUBLE, &
                                   id_dim_x_mask(mid,av), id_var_x_mask(mid,av) )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 477 )
 
           nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), id_var_x_mask(mid,av), &
                                   'units', 'meters' )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 478 )
 
 !
@@ -393,14 +314,14 @@
           nc_stat = NF90_DEF_DIM( id_set_mask(mid,av), 'xu', &
                                   mask_size(mid,1), id_dim_xu_mask(mid,av) )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 479 )
 
           nc_stat = NF90_DEF_VAR( id_set_mask(mid,av), 'xu', NF90_DOUBLE, &
                                   id_dim_xu_mask(mid,av), &
                                   id_var_xu_mask(mid,av) )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 480 )
 
           nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), id_var_xu_mask(mid,av), &
                                   'units', 'meters' )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 481 )
 
 !
@@ -408,13 +329,13 @@
           nc_stat = NF90_DEF_DIM( id_set_mask(mid,av), 'y', &
                                   mask_size(mid,2), id_dim_y_mask(mid,av) )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 482 )
 
           nc_stat = NF90_DEF_VAR( id_set_mask(mid,av), 'y', NF90_DOUBLE, &
                                   id_dim_y_mask(mid,av), id_var_y_mask(mid,av) )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 483 )
 
           nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), id_var_y_mask(mid,av), &
                                   'units', 'meters' )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 484 )
 
 !
@@ -422,14 +343,14 @@
           nc_stat = NF90_DEF_DIM( id_set_mask(mid,av), 'yv', &
                                   mask_size(mid,2), id_dim_yv_mask(mid,av) )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 485 )
 
           nc_stat = NF90_DEF_VAR( id_set_mask(mid,av), 'yv', NF90_DOUBLE, &
                                   id_dim_yv_mask(mid,av), &
                                   id_var_yv_mask(mid,av) )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 486 )
 
           nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), id_var_yv_mask(mid,av), &
                                   'units', 'meters' )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 487 )
 
 !
@@ -443,15 +364,15 @@
                                         id_dim_y_mask(mid,av) /), &
                                      id_var_zusi_mask(mid,av) )
-             CALL handle_netcdf_error( 'netcdf', 9998 )
+             CALL handle_netcdf_error( 'netcdf', 488 )
              
              nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), &
                                      id_var_zusi_mask(mid,av), &
                                      'units', 'meters' )
-             CALL handle_netcdf_error( 'netcdf', 9998 )
+             CALL handle_netcdf_error( 'netcdf', 489 )
              
              nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), &
                                      id_var_zusi_mask(mid,av), &
                                      'long_name', 'zu(nzb_s_inner)' )
-             CALL handle_netcdf_error( 'netcdf', 9998 )
+             CALL handle_netcdf_error( 'netcdf', 490 )
 
 !             
@@ -461,15 +382,15 @@
                                         id_dim_y_mask(mid,av) /), &
                                      id_var_zwwi_mask(mid,av) )
-             CALL handle_netcdf_error( 'netcdf', 9998 )
+             CALL handle_netcdf_error( 'netcdf', 491 )
              
              nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), &
                                      id_var_zwwi_mask(mid,av), &
                                      'units', 'meters' )
-             CALL handle_netcdf_error( 'netcdf', 9998 )
+             CALL handle_netcdf_error( 'netcdf', 492 )
              
              nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), &
                                      id_var_zwwi_mask(mid,av), &
                                      'long_name', 'zw(nzb_w_inner)' )
-             CALL handle_netcdf_error( 'netcdf', 9998 )
+             CALL handle_netcdf_error( 'netcdf', 493 )
 
           ENDIF             
@@ -548,5 +469,5 @@
 !--          Define the grid
              nc_stat = NF90_DEF_VAR( id_set_mask(mid,av), domask(mid,av,i), &
-                                     nc_precision(10+mid+av*20),            &
+                                     nc_precision(11),            &
                                      (/ id_x, id_y, id_z,                   &
                                         id_dim_time_mask(mid,av) /),        &
@@ -556,10 +477,10 @@
                 WRITE ( message_string, * ) 'no grid defined for', &
                      ' variable ', TRIM( domask(mid,av,i) )
-                CALL message( 'define_netcdf_header', 'PA9998', 0, 1, 0, 6, 0 )
+                CALL message( 'define_netcdf_header', 'PA0244', 0, 1, 0, 6, 0 )
              ENDIF
 
              var_list = TRIM( var_list ) // TRIM( domask(mid,av,i) ) // ';'
 
-             CALL handle_netcdf_error( 'netcdf', 9998 )
+             CALL handle_netcdf_error( 'netcdf', 494 )
 !
 !--          Store the 'real' name of the variable (with *, for example)
@@ -569,5 +490,5 @@
                                      id_var_domask(mid,av,i), &
                                      'long_name', domask(mid,av,i) )
-             CALL handle_netcdf_error( 'netcdf', 9998 )
+             CALL handle_netcdf_error( 'netcdf', 495 )
 !
 !--          Define the variable's unit
@@ -575,5 +496,5 @@
                                      id_var_domask(mid,av,i), &
                                      'units', TRIM( domask_unit(mid,av,i) ) )
-             CALL handle_netcdf_error( 'netcdf', 9998 )
+             CALL handle_netcdf_error( 'netcdf', 496 )
 
              i = i + 1
@@ -590,10 +511,10 @@
           nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), NF90_GLOBAL, &
                                   'VAR_LIST', var_list )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 497 )
 
 !
 !--       Leave NetCDF define mode
           nc_stat = NF90_ENDDEF( id_set_mask(mid,av) )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 498 )
 
 !
@@ -606,5 +527,5 @@
                                   netcdf_data, start = (/ 1 /),               &
                                   count = (/ mask_size(mid,1) /) )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 499 )
 
           netcdf_data = mask_i_global(mid,:mask_size(mid,1)) * dx
@@ -613,5 +534,5 @@
                                   netcdf_data, start = (/ 1 /),               &
                                   count = (/ mask_size(mid,1) /) )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 500 )
 
           DEALLOCATE( netcdf_data )
@@ -626,5 +547,5 @@
                                   netcdf_data, start = (/ 1 /),               &
                                   count = (/ mask_size(mid,2) /))
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 501 )
 
           netcdf_data = mask_j_global(mid,:mask_size(mid,2)) * dy
@@ -633,5 +554,5 @@
                                   netcdf_data, start = (/ 1 /),    &
                                   count = (/ mask_size(mid,2) /))
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 502 )
 
           DEALLOCATE( netcdf_data )
@@ -646,5 +567,5 @@
                                   netcdf_data, start = (/ 1 /), &
                                   count = (/ mask_size(mid,3) /) )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 503 )
 
           netcdf_data = zw( mask_k_global(mid,:mask_size(mid,3)) )
@@ -653,5 +574,5 @@
                                   netcdf_data, start = (/ 1 /), &
                                   count = (/ mask_size(mid,3) /) )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 504 )
 
           DEALLOCATE( netcdf_data )
@@ -671,5 +592,5 @@
                                      count = (/ mask_size(mid,1), &
                                                 mask_size(mid,2) /) )
-             CALL handle_netcdf_error( 'netcdf', 9998 )
+             CALL handle_netcdf_error( 'netcdf', 505 )
 
              netcdf_data_2d = zw_w_inner( mask_i_global(mid,:mask_size(mid,1)),&
@@ -682,5 +603,5 @@
                                      count = (/ mask_size(mid,1), &
                                                 mask_size(mid,2) /) )
-             CALL handle_netcdf_error( 'netcdf', 9998 )
+             CALL handle_netcdf_error( 'netcdf', 506 )
 
              DEALLOCATE( netcdf_data_2d )
@@ -698,9 +619,9 @@
 !--       mid and av
           file_id = av
-          IF ( file_id <= 140 )  THEN
-             mid = file_id - 120
+          IF ( file_id <= 200+max_masks )  THEN
+             mid = file_id - 200
              av = 0
           ELSE
-             mid = file_id - 140
+             mid = file_id - (200+max_masks)
              av = 1
           ENDIF
@@ -713,5 +634,5 @@
           nc_stat = NF90_GET_ATT( id_set_mask(mid,av), NF90_GLOBAL, 'VAR_LIST',&
                                   var_list_old )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 507 )
 
           var_list = ';'
@@ -733,5 +654,5 @@
                   '&but this file cannot be extended due to variable ', &
                   'mismatch.&New file is created instead.'
-             CALL message( 'define_netcdf_header', 'PA9998', 0, 1, 0, 6, 0 )
+             CALL message( 'define_netcdf_header', 'PA0335', 0, 1, 0, 6, 0 )
              extend = .FALSE.
              RETURN
@@ -742,10 +663,10 @@
           nc_stat = NF90_INQ_VARID( id_set_mask(mid,av), 'zu', &
                                     id_var_zu_mask(mid,av) )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 508 )
 
           nc_stat = NF90_INQUIRE_VARIABLE( id_set_mask(mid,av),     &
                                            id_var_zu_mask(mid,av),  &
                                            dimids = id_dim_zu_mask_old )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 509 )
           id_dim_zu_mask(mid,av) = id_dim_zu_mask_old(1)
 
@@ -753,5 +674,5 @@
                                             id_dim_zu_mask(mid,av), &
                                             len = nz_old )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 510 )
 
           IF ( mask_size(mid,3) /= nz_old )  THEN
@@ -761,5 +682,5 @@
                   ' number of&vertical grid points.', &
                   '&New file is created instead.'
-             CALL message( 'define_netcdf_header', 'PA9998', 0, 1, 0, 6, 0 )
+             CALL message( 'define_netcdf_header', 'PA0336', 0, 1, 0, 6, 0 )
              extend = .FALSE.
              RETURN
@@ -773,10 +694,10 @@
           nc_stat = NF90_INQ_VARID( id_set_mask(mid,av), 'time', &
                                     id_var_time_mask(mid,av) )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 511 )
 
           nc_stat = NF90_INQUIRE_VARIABLE( id_set_mask(mid,av), &
                                            id_var_time_mask(mid,av), &
                                            dimids = id_dim_time_old )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 512 )
           id_dim_time_mask(mid,av) = id_dim_time_old(1)
 
@@ -784,5 +705,5 @@
                                             id_dim_time_mask(mid,av), &
                                             len = domask_time_count(mid,av) )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 513 )
 
           nc_stat = NF90_GET_VAR( id_set_mask(mid,av), &
@@ -791,5 +712,5 @@
                                   start = (/ domask_time_count(mid,av) /), &
                                   count = (/ 1 /) )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 514 )
 
           IF ( last_time_coordinate(1) >= simulated_time )  THEN
@@ -799,5 +720,5 @@
                   'output time&is less or equal than the last output time ', &
                   'on this file.&New file is created instead.'
-             CALL message( 'define_netcdf_header', 'PA9998', 0, 1, 0, 6, 0 )
+             CALL message( 'define_netcdf_header', 'PA0337', 0, 1, 0, 6, 0 )
              domask_time_count(mid,av) = 0
              extend = .FALSE.
@@ -813,5 +734,5 @@
                                        TRIM( domask(mid,av,i) ), &
                                        id_var_domask(mid,av,i) )
-             CALL handle_netcdf_error( 'netcdf', 9998 )
+             CALL handle_netcdf_error( 'netcdf', 515 )
              i = i + 1
           ENDDO
@@ -831,15 +752,15 @@
           ENDIF
           nc_stat = NF90_REDEF( id_set_mask(mid,av) )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 516 )
           nc_stat = NF90_PUT_ATT( id_set_mask(mid,av), NF90_GLOBAL, 'title', &
                                   TRIM( run_description_header ) //    &
                                   TRIM( time_average_text ) )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 517 )
           nc_stat = NF90_ENDDEF( id_set_mask(mid,av) )
-          CALL handle_netcdf_error( 'netcdf', 9998 )
+          CALL handle_netcdf_error( 'netcdf', 518 )
           WRITE ( message_string, * ) 'NetCDF file for ', TRIM( var ), &
                ' data for mask', mid, ' from previous run found.', &
                '&This file will be extended.'
-          CALL message( 'define_netcdf_header', 'PA9998', 0, 0, 0, 6, 0 )
+          CALL message( 'define_netcdf_header', 'PA0338', 0, 0, 0, 6, 0 )
 !
 !--       restore original parameter file_id (=formal parameter av) into av
