Index: palm/trunk/SOURCE/data_output_2d.f90
===================================================================
--- palm/trunk/SOURCE/data_output_2d.f90	(revision 1704)
+++ palm/trunk/SOURCE/data_output_2d.f90	(revision 1745)
@@ -19,5 +19,5 @@
 ! Current revisions:
 ! -----------------
-! 
+! Bugfix: test if time axis limit exceeds moved to point after call of check_open
 !
 ! Former revisions:
@@ -234,34 +234,4 @@
     IF ( mode == 'xz'  .AND.  .NOT. data_output_xz(av) )  RETURN
     IF ( mode == 'yz'  .AND.  .NOT. data_output_yz(av) )  RETURN
-!
-!-- For parallel netcdf output the time axis must be limited. Return, if this
-!-- limit is exceeded. This could be the case, if the simulated time exceeds 
-!-- the given end time by the length of the given output interval.
-    IF ( netcdf_data_format > 4 )  THEN
-       IF ( mode == 'xy'  .AND.  do2d_xy_time_count(av) + 1 >                  &
-            ntdim_2d_xy(av) )  THEN
-          WRITE ( message_string, * ) 'Output of xy cross-sections is not ',   &
-                          'given at t=', simulated_time, '&because the',       & 
-                          ' maximum number of output time levels is exceeded.'
-          CALL message( 'data_output_2d', 'PA0384', 0, 1, 0, 6, 0 )          
-          RETURN
-       ENDIF
-       IF ( mode == 'xz'  .AND.  do2d_xz_time_count(av) + 1 >                  &
-            ntdim_2d_xz(av) )  THEN
-          WRITE ( message_string, * ) 'Output of xz cross-sections is not ',   &
-                          'given at t=', simulated_time, '&because the',       & 
-                          ' maximum number of output time levels is exceeded.'
-          CALL message( 'data_output_2d', 'PA0385', 0, 1, 0, 6, 0 )          
-          RETURN
-       ENDIF
-       IF ( mode == 'yz'  .AND.  do2d_yz_time_count(av) + 1 >                  &
-            ntdim_2d_yz(av) )  THEN
-          WRITE ( message_string, * ) 'Output of yz cross-sections is not ',   &
-                          'given at t=', simulated_time, '&because the',       & 
-                          ' maximum number of output time levels is exceeded.'
-          CALL message( 'data_output_2d', 'PA0386', 0, 1, 0, 6, 0 )          
-          RETURN
-       ENDIF
-    ENDIF
 
     CALL cpu_log (log_point(3),'data_output_2d','start')
@@ -372,4 +342,38 @@
 
     END SELECT
+
+!
+!-- For parallel netcdf output the time axis must be limited. Return, if this
+!-- limit is exceeded. This could be the case, if the simulated time exceeds 
+!-- the given end time by the length of the given output interval.
+    IF ( netcdf_data_format > 4 )  THEN
+       IF ( mode == 'xy'  .AND.  do2d_xy_time_count(av) + 1 >                  &
+            ntdim_2d_xy(av) )  THEN
+          WRITE ( message_string, * ) 'Output of xy cross-sections is not ',   &
+                          'given at t=', simulated_time, '&because the',       & 
+                          ' maximum number of output time levels is exceeded.'
+          CALL message( 'data_output_2d', 'PA0384', 0, 1, 0, 6, 0 )
+          CALL cpu_log( log_point(3), 'data_output_2d', 'stop' )
+          RETURN
+       ENDIF
+       IF ( mode == 'xz'  .AND.  do2d_xz_time_count(av) + 1 >                  &
+            ntdim_2d_xz(av) )  THEN
+          WRITE ( message_string, * ) 'Output of xz cross-sections is not ',   &
+                          'given at t=', simulated_time, '&because the',       & 
+                          ' maximum number of output time levels is exceeded.'
+          CALL message( 'data_output_2d', 'PA0385', 0, 1, 0, 6, 0 )
+          CALL cpu_log( log_point(3), 'data_output_2d', 'stop' )
+          RETURN
+       ENDIF
+       IF ( mode == 'yz'  .AND.  do2d_yz_time_count(av) + 1 >                  &
+            ntdim_2d_yz(av) )  THEN
+          WRITE ( message_string, * ) 'Output of yz cross-sections is not ',   &
+                          'given at t=', simulated_time, '&because the',       & 
+                          ' maximum number of output time levels is exceeded.'
+          CALL message( 'data_output_2d', 'PA0386', 0, 1, 0, 6, 0 )
+          CALL cpu_log( log_point(3), 'data_output_2d', 'stop' )
+          RETURN
+       ENDIF
+    ENDIF
 
 !
