Index: palm/trunk/SOURCE/time_integration.f90
===================================================================
--- palm/trunk/SOURCE/time_integration.f90	(revision 3739)
+++ palm/trunk/SOURCE/time_integration.f90	(revision 3742)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! - Moved call of bio_calculate_thermal_index_maps from biometeorology module to
+! time_integration to make sure averaged input is updated before calculating.
+! 
+! 3739 2019-02-13 08:05:17Z dom_dwd_user
 ! Removed everything related to "time_bio_results" as this is never used.
 ! 
@@ -1635,5 +1639,5 @@
        IF ( time_dopr_listing >= dt_dopr_listing )  THEN
           CALL print_1d
-          time_dopr_listing = MOD( time_dopr_listing, MAX( dt_dopr_listing, &
+          time_dopr_listing = MOD( time_dopr_listing, MAX( dt_dopr_listing,    &
                                                            dt_3d ) )
        ENDIF
@@ -1641,5 +1645,5 @@
 !
 !--    Graphic output for PROFIL
-       IF (        time_dopr >= dt_dopr                                     &
+       IF (        time_dopr >= dt_dopr                                        &
             .AND.  time_since_reference_point >= skip_time_dopr )  THEN
           IF ( dopr_n /= 0 )  CALL data_output_profiles
@@ -1658,5 +1662,5 @@
 !--    Output of spectra (formatted for use with PROFIL), in case of no
 !--    time averaging, spectra has to be calculated before
-       IF (         time_dosp >= dt_dosp                                     &
+       IF (         time_dosp >= dt_dosp                                       &
              .AND.  time_since_reference_point >= skip_time_dosp )  THEN
           IF ( average_count_sp == 0 )  CALL calc_spectra
@@ -1667,15 +1671,15 @@
 !
 !--    2d-data output (cross-sections)
-       IF (         time_do2d_xy >= dt_do2d_xy                               &
+       IF (         time_do2d_xy >= dt_do2d_xy                                 &
              .AND.  time_since_reference_point >= skip_time_do2d_xy )  THEN
           CALL data_output_2d( 'xy', 0 )
           time_do2d_xy = MOD( time_do2d_xy, MAX( dt_do2d_xy, dt_3d ) )
        ENDIF
-       IF (         time_do2d_xz >= dt_do2d_xz                               &
+       IF (         time_do2d_xz >= dt_do2d_xz                                 &
              .AND.  time_since_reference_point >= skip_time_do2d_xz )  THEN
           CALL data_output_2d( 'xz', 0 )
           time_do2d_xz = MOD( time_do2d_xz, MAX( dt_do2d_xz, dt_3d ) )
        ENDIF
-       IF (         time_do2d_yz >= dt_do2d_yz                               &
+       IF (         time_do2d_yz >= dt_do2d_yz                                 &
              .AND.  time_since_reference_point >= skip_time_do2d_yz )  THEN
           CALL data_output_2d( 'yz', 0 )
@@ -1685,5 +1689,5 @@
 !
 !--    3d-data output (volume data)
-       IF (         time_do3d >= dt_do3d                                     & 
+       IF (         time_do3d >= dt_do3d                                       &
              .AND.  time_since_reference_point >= skip_time_do3d )  THEN
           CALL data_output_3d( 0 )
@@ -1694,8 +1698,8 @@
 !--    Masked data output
        DO  mid = 1, masks
-          IF (         time_domask(mid) >= dt_domask(mid)                          &
+          IF (         time_domask(mid) >= dt_domask(mid)                      &
                 .AND.  time_since_reference_point >= skip_time_domask(mid) )  THEN
              CALL data_output_mask( 0 )
-             time_domask(mid) = MOD( time_domask(mid),                             &
+             time_domask(mid) = MOD( time_domask(mid),                         &
                                      MAX( dt_domask(mid), dt_3d ) )
           ENDIF
@@ -1704,7 +1708,12 @@
 !
 !--    Output of time-averaged 2d/3d/masked data
-       IF (         time_do_av >= dt_data_output_av                                &
+       IF (         time_do_av >= dt_data_output_av                            &
              .AND.  time_since_reference_point >= skip_time_data_output_av )  THEN
           CALL average_3d_data
+!
+!--       Udate thermal comfort indices based on updated averaged input
+          IF ( biometeorology  .AND.  thermal_comfort )  THEN
+             CALL bio_calculate_thermal_index_maps ( .TRUE. )
+          ENDIF
           CALL data_output_2d( 'xy', 1 )
           CALL data_output_2d( 'xz', 1 )
@@ -1719,10 +1728,10 @@
 !--    Output of surface data, instantaneous and averaged data
        IF ( surface_output )  THEN
-          IF (         time_dosurf >= dt_dosurf                                    &
+          IF (         time_dosurf >= dt_dosurf                                &
                 .AND.  time_since_reference_point >= skip_time_dosurf )  THEN
              CALL surface_data_output( 0 )
              time_dosurf = MOD( time_dosurf, MAX( dt_dosurf, dt_3d ) )
           ENDIF
-          IF (         time_dosurf_av >= dt_dosurf_av                              &
+          IF (         time_dosurf_av >= dt_dosurf_av                          &
                 .AND.  time_since_reference_point >= skip_time_dosurf_av )  THEN
              CALL surface_data_output( 1 )
