Index: /palm/trunk/SOURCE/data_output_mask.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_mask.f90	(revision 3029)
+++ /palm/trunk/SOURCE/data_output_mask.f90	(revision 3030)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! variable if renamed ivar
+! 
+! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
 ! 
@@ -159,5 +162,5 @@
     INTEGER(iwp) ::  ngp      !< 
     INTEGER(iwp) ::  i        !< 
-    INTEGER(iwp) ::  if       !< 
+    INTEGER(iwp) ::  ivar     !<
     INTEGER(iwp) ::  j        !< 
     INTEGER(iwp) ::  k        !< 
@@ -223,10 +226,10 @@
 !
 !-- Loop over all variables to be written.
-    if = 1
-
-    DO  WHILE ( domask(mid,av,if)(1:1) /= ' ' )
+    ivar = 1
+
+    DO  WHILE ( domask(mid,av,ivar)(1:1) /= ' ' )
 !
 !--    Reallocate local_pf on PE 0 since its shape changes during MPI exchange
-       IF ( netcdf_data_format < 5   .AND.  myid == 0  .AND.  if > 1 )  THEN
+       IF ( netcdf_data_format < 5   .AND.  myid == 0  .AND.  ivar > 1 )  THEN
           DEALLOCATE( local_pf )
           ALLOCATE( local_pf(mask_size_l(mid,1),mask_size_l(mid,2), &
@@ -240,5 +243,5 @@
 !--    Store the variable chosen.
        resorted = .FALSE.
-       SELECT CASE ( TRIM( domask(mid,av,if) ) )
+       SELECT CASE ( TRIM( domask(mid,av,ivar) ) )
 
           CASE ( 'e' )
@@ -511,5 +514,5 @@
 !--          Radiation quantity
              IF ( radiation )  THEN
-                CALL radiation_data_output_mask(av, domask(mid,av,if), found,  &
+                CALL radiation_data_output_mask(av, domask(mid,av,ivar), found,&
                                                 local_pf )
              ENDIF
@@ -518,5 +521,5 @@
 !--          User defined quantity
              IF ( .NOT. found )  THEN
-                CALL user_data_output_mask(av, domask(mid,av,if), found,       &
+                CALL user_data_output_mask(av, domask(mid,av,ivar), found,     &
                                            local_pf )
              ENDIF
@@ -526,5 +529,5 @@
              IF ( .NOT. found )  THEN
                 WRITE ( message_string, * ) 'no output available for: ', &
-                                            TRIM( domask(mid,av,if) )
+                                            TRIM( domask(mid,av,ivar) )
                 CALL message( 'data_output_mask', 'PA0327', 0, 0, 0, 6, 0 )
              ENDIF
@@ -559,10 +562,9 @@
 !
 !--       (1) a. Parallel I/O using netCDF 4 (not yet tested)
-          nc_stat = NF90_PUT_VAR( id_set_mask(mid,av),  &
-               id_var_domask(mid,av,if),  &
-               local_pf,  &
-               start = (/ mask_start_l(mid,1), mask_start_l(mid,2),  &
-                          mask_start_l(mid,3), domask_time_count(mid,av) /),  &
-               count = (/ mask_size_l(mid,1), mask_size_l(mid,2),  &
+          nc_stat = NF90_PUT_VAR( id_set_mask(mid,av),                         &
+               id_var_domask(mid,av,ivar), local_pf,                           &
+               start = (/ mask_start_l(mid,1), mask_start_l(mid,2),            &
+                          mask_start_l(mid,3), domask_time_count(mid,av) /),   &
+               count = (/ mask_size_l(mid,1), mask_size_l(mid,2),              &
                           mask_size_l(mid,3), 1 /) )
           CALL netcdf_handle_error( 'data_output_mask', 461 )
@@ -608,8 +610,8 @@
              ENDDO
 
-             nc_stat = NF90_PUT_VAR( id_set_mask(mid,av),  &
-                  id_var_domask(mid,av,if), total_pf, &
-                  start = (/ 1, 1, 1, domask_time_count(mid,av) /), &
-                  count = (/ mask_size(mid,1), mask_size(mid,2), &
+             nc_stat = NF90_PUT_VAR( id_set_mask(mid,av),                      &
+                  id_var_domask(mid,av,ivar), total_pf,                        &
+                  start = (/ 1, 1, 1, domask_time_count(mid,av) /),            &
+                  count = (/ mask_size(mid,1), mask_size(mid,2),               &
                              mask_size(mid,3), 1 /) )
              CALL netcdf_handle_error( 'data_output_mask', 462 )
@@ -652,14 +654,13 @@
 !--    (2) For serial execution of PALM, the single processor (PE0) holds all
 !--    data and writes them directly to file.
-       nc_stat = NF90_PUT_VAR( id_set_mask(mid,av),  &
-            id_var_domask(mid,av,if),       &
-            local_pf, &
-            start = (/ 1, 1, 1, domask_time_count(mid,av) /), &
-            count = (/ mask_size_l(mid,1), mask_size_l(mid,2), &
-                       mask_size_l(mid,3), 1 /) )
+       nc_stat = NF90_PUT_VAR( id_set_mask(mid,av),                            &
+                               id_var_domask(mid,av,ivar), local_pf,           &
+                             start = (/ 1, 1, 1, domask_time_count(mid,av) /), &
+                             count = (/ mask_size_l(mid,1), mask_size_l(mid,2),&
+                               mask_size_l(mid,3), 1 /) )
        CALL netcdf_handle_error( 'data_output_mask', 463 )
 #endif
 
-       if = if + 1
+       ivar = ivar + 1
 
     ENDDO
