Index: palm/trunk/SOURCE/surface_data_output_mod.f90
===================================================================
--- palm/trunk/SOURCE/surface_data_output_mod.f90	(revision 4546)
+++ palm/trunk/SOURCE/surface_data_output_mod.f90	(revision 4547)
@@ -25,4 +25,11 @@
 ! -----------------
 ! $Id$
+! Added surface albedo and emissivity, which are defined using
+! the tile approach
+! 
+! 4535 2020-05-15 12:07:23Z raasch
+! bugfix for restart data format query
+! 
+! 4535 2020-05-15 12:07:23Z raasch
 ! bugfix for restart data format query
 ! 
@@ -284,4 +291,14 @@
       MODULE PROCEDURE surface_data_output_wrd_local
    END INTERFACE  surface_data_output_wrd_local
+
+   INTERFACE  surface_data_output_sum_up
+      MODULE PROCEDURE surface_data_output_sum_up_1d
+      MODULE PROCEDURE surface_data_output_sum_up_2d
+   END INTERFACE  surface_data_output_sum_up
+
+   INTERFACE  surface_data_output_collect
+      MODULE PROCEDURE surface_data_output_collect_1d
+      MODULE PROCEDURE surface_data_output_collect_2d
+   END INTERFACE  surface_data_output_collect
 
 !
@@ -3068,4 +3085,64 @@
                ENDIF
 !
+!--         Surface albedo (tile approach)
+            CASE ( 'albedo' )
+!
+!--            Output of instantaneous data
+               IF ( av == 0 )  THEN
+                  CALL surface_data_output_collect( surf_def_h(0)%albedo,     &
+                                               surf_def_h(1)%albedo,          &
+                                               surf_lsm_h%albedo,             &
+                                               surf_usm_h%albedo,             &
+                                               surf_def_v(0)%albedo,          &
+                                               surf_lsm_v(0)%albedo,          &
+                                               surf_usm_v(0)%albedo,          &
+                                               surf_def_v(1)%albedo,          &
+                                               surf_lsm_v(1)%albedo,          &
+                                               surf_usm_v(1)%albedo,          &
+                                               surf_def_v(2)%albedo,          &
+                                               surf_lsm_v(2)%albedo,          &
+                                               surf_usm_v(2)%albedo,          &
+                                               surf_def_v(3)%albedo,          &
+                                               surf_lsm_v(3)%albedo,          &
+                                               surf_usm_v(3)%albedo )
+               ELSE
+!
+!--               Output of averaged data
+                  surfaces%var_out(:) = surfaces%var_av(:,n_out) /            &
+                                        REAL( average_count_surf, KIND=wp )
+                  surfaces%var_av(:,n_out) = 0.0_wp
+
+               ENDIF
+!
+!--         Surface emissivity (tile approach)
+            CASE ( 'emissivity' )
+!
+!--            Output of instantaneous data
+               IF ( av == 0 )  THEN
+                  CALL surface_data_output_collect( surf_def_h(0)%emissivity, &
+                                               surf_def_h(1)%emissivity,      &
+                                               surf_lsm_h%emissivity,         &
+                                               surf_usm_h%emissivity,         &
+                                               surf_def_v(0)%emissivity,      &
+                                               surf_lsm_v(0)%emissivity,      &
+                                               surf_usm_v(0)%emissivity,      &
+                                               surf_def_v(1)%emissivity,      &
+                                               surf_lsm_v(1)%emissivity,      &
+                                               surf_usm_v(1)%emissivity,      &
+                                               surf_def_v(2)%emissivity,      &
+                                               surf_lsm_v(2)%emissivity,      &
+                                               surf_usm_v(2)%emissivity,      &
+                                               surf_def_v(3)%emissivity,      &
+                                               surf_lsm_v(3)%emissivity,      &
+                                               surf_usm_v(3)%emissivity )
+               ELSE
+!
+!--               Output of averaged data
+                  surfaces%var_out(:) = surfaces%var_av(:,n_out) /            &
+                                        REAL( average_count_surf, KIND=wp )
+                  surfaces%var_av(:,n_out) = 0.0_wp
+
+               ENDIF
+!
 !--            Add further variables:
 !--            'css', 'cssws', 'qsws_liq', 'qsws_soil', 'qsws_veg'
@@ -4103,4 +4180,41 @@
                                            surf_usm_v(3)%iwghf_eb, n_out )
 
+            CASE ( 'albedo' )
+               CALL surface_data_output_sum_up( surf_def_h(0)%albedo,          &
+                                           surf_def_h(1)%albedo,               &
+                                           surf_lsm_h%albedo,                  &
+                                           surf_usm_h%albedo,                  &
+                                           surf_def_v(0)%albedo,               &
+                                           surf_lsm_v(0)%albedo,               &
+                                           surf_usm_v(0)%albedo,               &
+                                           surf_def_v(1)%albedo,               &
+                                           surf_lsm_v(1)%albedo,               &
+                                           surf_usm_v(1)%albedo,               &
+                                           surf_def_v(2)%albedo,               &
+                                           surf_lsm_v(2)%albedo,               &
+                                           surf_usm_v(2)%albedo,               &
+                                           surf_def_v(3)%albedo,               &
+                                           surf_lsm_v(3)%albedo,               &
+                                           surf_usm_v(3)%albedo, n_out )
+
+
+            CASE ( 'emissivity' )
+               CALL surface_data_output_sum_up( surf_def_h(0)%emissivity,      &
+                                           surf_def_h(1)%emissivity,           &
+                                           surf_lsm_h%emissivity,              &
+                                           surf_usm_h%emissivity,              &
+                                           surf_def_v(0)%emissivity,           &
+                                           surf_lsm_v(0)%emissivity,           &
+                                           surf_usm_v(0)%emissivity,           &
+                                           surf_def_v(1)%emissivity,           &
+                                           surf_lsm_v(1)%emissivity,           &
+                                           surf_usm_v(1)%emissivity,           &
+                                           surf_def_v(2)%emissivity,           &
+                                           surf_lsm_v(2)%emissivity,           &
+                                           surf_usm_v(2)%emissivity,           &
+                                           surf_def_v(3)%emissivity,           &
+                                           surf_lsm_v(3)%emissivity,           &
+                                           surf_usm_v(3)%emissivity, n_out )
+
          END SELECT
       ENDDO
@@ -4114,5 +4228,5 @@
 !> Sum-up the surface data for average output variables.
 !------------------------------------------------------------------------------!
-   SUBROUTINE surface_data_output_sum_up( var_def_h0, var_def_h1,              &
+   SUBROUTINE surface_data_output_sum_up_1d( var_def_h0, var_def_h1,           &
                                      var_lsm_h,  var_usm_h,                    &
                                      var_def_v0, var_lsm_v0, var_usm_v0,       &
@@ -4339,5 +4453,254 @@
       ENDIF
 
-   END SUBROUTINE surface_data_output_sum_up
+   END SUBROUTINE surface_data_output_sum_up_1d
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Sum-up the surface data for average output variables for properties which
+!> are defined using tile approach.
+!------------------------------------------------------------------------------!
+   SUBROUTINE surface_data_output_sum_up_2d( var_def_h0, var_def_h1,           &
+                                     var_lsm_h,  var_usm_h,                    &
+                                     var_def_v0, var_lsm_v0, var_usm_v0,       &
+                                     var_def_v1, var_lsm_v1, var_usm_v1,       &
+                                     var_def_v2, var_lsm_v2, var_usm_v2,       &
+                                     var_def_v3, var_lsm_v3, var_usm_v3, n_out,&
+                                     fac )
+
+      IMPLICIT NONE
+
+      INTEGER(iwp) ::  k          !< height index of surface element
+      INTEGER(iwp) ::  m          !< running index for surface elements
+      INTEGER(iwp) ::  n_out      !< index for output variable
+      INTEGER(iwp) ::  n_surf     !< running index for surface elements
+
+      REAL(wp), DIMENSION(:), OPTIONAL                ::  fac               !< passed output conversion factor for heatflux output
+      REAL(wp), DIMENSION(nzb:nzt+1)                  ::  conversion_factor !< effective array for output conversion factor
+
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_def_h0 !< output variable at upward-facing default-type surfaces
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_def_h1 !< output variable at downward-facing default-type surfaces
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_lsm_h  !< output variable at upward-facing natural-type surfaces
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_usm_h  !< output variable at upward-facing urban-type surfaces
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_def_v0 !< output variable at northward-facing default-type surfaces
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_def_v1 !< output variable at southward-facing default-type surfaces
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_def_v2 !< output variable at eastward-facing default-type surfaces
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_def_v3 !< output variable at westward-facing default-type surfaces
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_lsm_v0 !< output variable at northward-facing natural-type surfaces
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_lsm_v1 !< output variable at southward-facing natural-type surfaces
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_lsm_v2 !< output variable at eastward-facing natural-type surfaces
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_lsm_v3 !< output variable at westward-facing natural-type surfaces
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_usm_v0 !< output variable at northward-facing urban-type surfaces
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_usm_v1 !< output variable at southward-facing urban-type surfaces
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_usm_v2 !< output variable at eastward-facing urban-type surfaces
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_usm_v3 !< output variable at westward-facing urban-type surfaces
+
+!
+!--   Set conversion factor to one if not present
+      IF ( .NOT. PRESENT( fac ) )  THEN
+         conversion_factor = 1.0_wp
+      ELSE
+         conversion_factor = fac
+      ENDIF
+!
+!--   Set counter variable to zero before the variable is written to
+!--   the output array.
+      n_surf = 0
+
+!
+!--   Write the horizontal surfaces.
+!--   Before each the variable is written to the output data structure, first
+!--   check if the variable for the respective surface type is defined.
+!--   If a variable is not defined, skip the block and increment the counter
+!--   variable by the number of surface elements of this type. Usually this
+!--   is zere, however, there might be the situation that e.g. urban surfaces
+!--   are defined but the respective variable is not allocated for this surface
+!--   type. To write the data on the exact position, increment the counter.
+      IF ( ALLOCATED( var_def_h0 ) )  THEN
+         DO  m = 1, surf_def_h(0)%ns
+            n_surf                        = n_surf + 1
+            k                             = surf_def_h(0)%k(m)
+            surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)          &
+                                          + SUM ( surf_def_h(0)%frac(m,:) *        &
+                                            var_def_h0(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_def_h(0)%ns
+      ENDIF
+      IF ( ALLOCATED( var_def_h1 ) )  THEN
+         DO  m = 1, surf_def_h(1)%ns
+            n_surf                   = n_surf + 1
+            k                             = surf_def_h(1)%k(m)
+            surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)          &
+                                          + SUM ( surf_def_h(1)%frac(m,:) *        &
+                                            var_def_h1(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_def_h(1)%ns
+      ENDIF
+      IF ( ALLOCATED( var_lsm_h ) )  THEN
+         DO  m = 1, surf_lsm_h%ns
+            n_surf                        = n_surf + 1
+            k                             = surf_lsm_h%k(m)
+            surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)          &
+                                          + SUM ( surf_lsm_h%frac(m,:) *           &
+                                            var_lsm_h(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_lsm_h%ns
+      ENDIF
+      IF ( ALLOCATED( var_usm_h ) )  THEN
+         DO  m = 1, surf_usm_h%ns
+            n_surf                        = n_surf + 1
+            k                             = surf_usm_h%k(m)
+            surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)          &
+                                          + SUM ( surf_usm_h%frac(m,:) *           &
+                                            var_usm_h(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_usm_h%ns
+      ENDIF
+!
+!--   Write northward-facing
+      IF ( ALLOCATED( var_def_v0 ) )  THEN
+         DO  m = 1, surf_def_v(0)%ns
+            n_surf                        = n_surf + 1
+            k                             = surf_def_v(0)%k(m)
+            surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)          &
+                                          + SUM ( surf_def_v(0)%frac(m,:) *        &
+                                            var_def_v0(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_def_v(0)%ns
+      ENDIF
+      IF ( ALLOCATED( var_lsm_v0 ) )  THEN
+         DO  m = 1, surf_lsm_v(0)%ns
+            n_surf                        = n_surf + 1
+            k                             = surf_lsm_v(0)%k(m)
+            surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)          &
+                                          + SUM ( surf_lsm_v(0)%frac(m,:) *        &
+                                            var_lsm_v0(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_lsm_v(0)%ns
+      ENDIF
+      IF ( ALLOCATED( var_usm_v0 ) )  THEN
+         DO  m = 1, surf_usm_v(0)%ns
+            n_surf                        = n_surf + 1
+            k                             = surf_usm_v(0)%k(m)
+            surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)          &
+                                          + SUM ( surf_usm_v(0)%frac(m,:) *        &
+                                            var_usm_v0(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_usm_v(0)%ns
+      ENDIF
+!
+!--   Write southward-facing
+      IF ( ALLOCATED( var_def_v1 ) )  THEN
+         DO  m = 1, surf_def_v(1)%ns
+            n_surf                        = n_surf + 1
+            k                             = surf_def_v(1)%k(m)
+            surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)          &
+                                          + SUM ( surf_def_v(1)%frac(m,:) *        &
+                                            var_def_v1(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_def_v(1)%ns
+      ENDIF
+      IF ( ALLOCATED( var_lsm_v1 ) )  THEN
+         DO  m = 1, surf_lsm_v(1)%ns
+            n_surf                        = n_surf + 1
+            k                             = surf_lsm_v(1)%k(m)
+            surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)          &
+                                          + SUM ( surf_lsm_v(1)%frac(m,:) *        &
+                                            var_lsm_v1(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_lsm_v(1)%ns
+      ENDIF
+      IF ( ALLOCATED( var_usm_v1 ) )  THEN
+         DO  m = 1, surf_usm_v(1)%ns
+            n_surf                        = n_surf + 1
+            k                             = surf_usm_v(1)%k(m)
+            surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)          &
+                                          + SUM ( surf_usm_v(1)%frac(m,:) *        &
+                                            var_usm_v1(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_usm_v(1)%ns
+      ENDIF
+!
+!--   Write eastward-facing
+      IF ( ALLOCATED( var_def_v2 ) )  THEN
+         DO  m = 1, surf_def_v(2)%ns
+            n_surf                        = n_surf + 1
+            k                             = surf_def_v(2)%k(m)
+            surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)          &
+                                          + SUM ( surf_def_v(2)%frac(m,:) *        &
+                                            var_def_v2(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_def_v(2)%ns
+      ENDIF
+      IF ( ALLOCATED( var_lsm_v2 ) )  THEN
+         DO  m = 1, surf_lsm_v(2)%ns
+            n_surf                        = n_surf + 1
+            k                             = surf_lsm_v(2)%k(m)
+            surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)          &
+                                          + SUM ( surf_lsm_v(2)%frac(m,:) *        &
+                                            var_lsm_v2(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_lsm_v(2)%ns
+      ENDIF
+      IF ( ALLOCATED( var_usm_v2 ) )  THEN
+         DO  m = 1, surf_usm_v(2)%ns
+            n_surf                        = n_surf + 1
+            k                             = surf_usm_v(2)%k(m)
+            surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)          &
+                                          + SUM ( surf_usm_v(2)%frac(m,:) *        &
+                                            var_usm_v2(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_usm_v(2)%ns
+      ENDIF
+!
+!--   Write westward-facing
+      IF ( ALLOCATED( var_def_v3 ) )  THEN
+         DO  m = 1, surf_def_v(3)%ns
+            n_surf                        = n_surf + 1
+            k                             = surf_def_v(3)%k(m)
+            surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)          &
+                                          + SUM ( surf_def_v(3)%frac(m,:) *        &
+                                            var_def_v3(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_def_v(3)%ns
+      ENDIF
+      IF ( ALLOCATED( var_lsm_v3 ) )  THEN
+         DO  m = 1, surf_lsm_v(3)%ns
+            n_surf                        = n_surf + 1
+            k                             = surf_lsm_v(3)%k(m)
+            surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)          &
+                                          + SUM ( surf_lsm_v(3)%frac(m,:) *        &
+                                            var_lsm_v3(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_lsm_v(3)%ns
+      ENDIF
+      IF ( ALLOCATED( var_usm_v3 ) )  THEN
+         DO  m = 1, surf_usm_v(3)%ns
+            n_surf                        = n_surf + 1
+            k                             = surf_usm_v(3)%k(m)
+            surfaces%var_av(n_surf,n_out) = surfaces%var_av(n_surf,n_out)          &
+                                          + SUM ( surf_usm_v(3)%frac(m,:) *        &
+                                            var_usm_v3(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_usm_v(3)%ns
+      ENDIF
+
+   END SUBROUTINE surface_data_output_sum_up_2d
 
 !------------------------------------------------------------------------------!
@@ -4346,5 +4709,5 @@
 !> Collect the surface data from different types and different orientation.
 !------------------------------------------------------------------------------!
-   SUBROUTINE surface_data_output_collect( var_def_h0, var_def_h1,             &
+   SUBROUTINE surface_data_output_collect_1d( var_def_h0, var_def_h1,          &
                                       var_lsm_h,  var_usm_h,                   &
                                       var_def_v0, var_lsm_v0, var_usm_v0,      &
@@ -4553,5 +4916,236 @@
       ENDIF
 
-   END SUBROUTINE surface_data_output_collect
+   END SUBROUTINE surface_data_output_collect_1d
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Collect the surface data from different types and different orientation
+!>  for properties which are defined using tile approach.
+!------------------------------------------------------------------------------!
+   SUBROUTINE surface_data_output_collect_2d( var_def_h0, var_def_h1,          &
+                                      var_lsm_h,  var_usm_h,                   &
+                                      var_def_v0, var_lsm_v0, var_usm_v0,      &
+                                      var_def_v1, var_lsm_v1, var_usm_v1,      &
+                                      var_def_v2, var_lsm_v2, var_usm_v2,      &
+                                      var_def_v3, var_lsm_v3, var_usm_v3,      &
+                                      fac )
+
+      IMPLICIT NONE
+
+      INTEGER(iwp) ::  k      !< height index of surface element
+      INTEGER(iwp) ::  m      !< running index for surface elements
+      INTEGER(iwp) ::  n_surf !< running index for surface elements
+
+      REAL(wp), DIMENSION(:), OPTIONAL                ::  fac               !< passed output conversion factor for heatflux output
+      REAL(wp), DIMENSION(nzb:nzt+1)                  ::  conversion_factor !< effective array for output conversion factor
+
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_def_h0 !< output variable at upward-facing default-type surfaces
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_def_h1 !< output variable at downward-facing default-type surfaces
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_lsm_h  !< output variable at upward-facing natural-type surfaces
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_usm_h  !< output variable at upward-facing urban-type surfaces
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_def_v0 !< output variable at northward-facing default-type surfaces
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_def_v1 !< output variable at southward-facing default-type surfaces
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_def_v2 !< output variable at eastward-facing default-type surfaces
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_def_v3 !< output variable at westward-facing default-type surfaces
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_lsm_v0 !< output variable at northward-facing natural-type surfaces
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_lsm_v1 !< output variable at southward-facing natural-type surfaces
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_lsm_v2 !< output variable at eastward-facing natural-type surfaces
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_lsm_v3 !< output variable at westward-facing natural-type surfaces
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_usm_v0 !< output variable at northward-facing urban-type surfaces
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_usm_v1 !< output variable at southward-facing urban-type surfaces
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_usm_v2 !< output variable at eastward-facing urban-type surfaces
+      REAL(wp), DIMENSION(:,:), ALLOCATABLE, INTENT(IN) ::  var_usm_v3 !< output variable at westward-facing urban-type surfaces
+
+!
+!--   Set conversion factor to one if not present
+      IF ( .NOT. PRESENT( fac ) )  THEN
+         conversion_factor = 1.0_wp
+      ELSE
+         conversion_factor = fac
+      ENDIF
+!
+!--   Set counter variable to zero before the variable is written to
+!--   the output array.
+      n_surf = 0
+!
+!--   Write the horizontal surfaces.
+!--   Before each the variable is written to the output data structure, first
+!--   check if the variable for the respective surface type is defined.
+!--   If a variable is not defined, skip the block and increment the counter
+!--   variable by the number of surface elements of this type. Usually this
+!--   is zero, however, there might be the situation that e.g. urban surfaces
+!--   are defined but the respective variable is not allocated for this surface
+!--   type. To write the data on the exact position, increment the counter.
+      IF ( ALLOCATED( var_def_h0 ) )  THEN
+         DO  m = 1, surf_def_h(0)%ns
+            n_surf                   = n_surf + 1
+            k                        = surf_def_h(0)%k(m)
+            surfaces%var_out(n_surf) = SUM ( surf_def_h(0)%frac(m,:) *              &
+                                             var_def_h0(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_def_h(0)%ns
+      ENDIF
+      IF ( ALLOCATED( var_def_h1 ) )  THEN
+         DO  m = 1, surf_def_h(1)%ns
+            n_surf                   = n_surf + 1
+            k                        = surf_def_h(1)%k(m)
+            surfaces%var_out(n_surf) = SUM ( surf_def_h(1)%frac(m,:) *              &
+                                             var_def_h1(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_def_h(1)%ns
+      ENDIF
+      IF ( ALLOCATED( var_lsm_h ) )  THEN
+         DO  m = 1, surf_lsm_h%ns
+            n_surf                   = n_surf + 1
+            k                        = surf_lsm_h%k(m)
+            surfaces%var_out(n_surf) = SUM ( surf_lsm_h%frac(m,:) *                 &
+                                             var_lsm_h(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_lsm_h%ns
+      ENDIF
+      IF ( ALLOCATED( var_usm_h ) )  THEN
+         DO  m = 1, surf_usm_h%ns
+            n_surf                   = n_surf + 1
+            k                        = surf_usm_h%k(m)
+            surfaces%var_out(n_surf) = SUM ( surf_usm_h%frac(m,:) *                 &
+                                             var_usm_h(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_usm_h%ns
+      ENDIF
+!
+!--   Write northward-facing
+      IF ( ALLOCATED( var_def_v0 ) )  THEN
+         DO  m = 1, surf_def_v(0)%ns
+            n_surf                   = n_surf + 1
+            k                        = surf_def_v(0)%k(m)
+            surfaces%var_out(n_surf) = SUM ( surf_def_v(0)%frac(m,:) *              &
+                                             var_def_v0(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_def_v(0)%ns
+      ENDIF
+      IF ( ALLOCATED( var_lsm_v0 ) )  THEN
+         DO  m = 1, surf_lsm_v(0)%ns
+            n_surf                   = n_surf + 1
+            k                        = surf_lsm_v(0)%k(m)
+            surfaces%var_out(n_surf) = SUM ( surf_lsm_v(0)%frac(m,:) *              &
+                                             var_lsm_v0(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_lsm_v(0)%ns
+      ENDIF
+      IF ( ALLOCATED( var_usm_v0 ) )  THEN
+         DO  m = 1, surf_usm_v(0)%ns
+            n_surf                   = n_surf + 1
+            k                        = surf_usm_v(0)%k(m)
+            surfaces%var_out(n_surf) = SUM ( surf_usm_v(0)%frac(m,:) *              &
+                                             var_usm_v0(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_usm_v(0)%ns
+      ENDIF
+!
+!--   Write southward-facing
+      IF ( ALLOCATED( var_def_v1 ) )  THEN
+         DO  m = 1, surf_def_v(1)%ns
+            n_surf                   = n_surf + 1
+            k                        = surf_def_v(1)%k(m)
+            surfaces%var_out(n_surf) = SUM ( surf_def_v(1)%frac(m,:) *                   &
+                                             var_def_v1(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_def_v(1)%ns
+      ENDIF
+      IF ( ALLOCATED( var_lsm_v1 ) )  THEN
+         DO  m = 1, surf_lsm_v(1)%ns
+            n_surf                   = n_surf + 1
+            k                        = surf_lsm_v(1)%k(m)
+            surfaces%var_out(n_surf) = SUM ( surf_lsm_v(1)%frac(m,:) *              &
+                                             var_lsm_v1(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_lsm_v(1)%ns
+      ENDIF
+      IF ( ALLOCATED( var_usm_v1 ) )  THEN
+         DO  m = 1, surf_usm_v(1)%ns
+            n_surf                   = n_surf + 1
+            k                        = surf_usm_v(1)%k(m)
+            surfaces%var_out(n_surf) = SUM ( surf_usm_v(1)%frac(m,:) *              &
+                                             var_usm_v1(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_usm_v(1)%ns
+      ENDIF
+!
+!--   Write eastward-facing
+      IF ( ALLOCATED( var_def_v2 ) )  THEN
+         DO  m = 1, surf_def_v(2)%ns
+            n_surf                   = n_surf + 1
+            k                        = surf_def_v(2)%k(m)
+            surfaces%var_out(n_surf) = SUM ( surf_def_v(2)%frac(m,:) *              &
+                                             var_def_v2(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_def_v(2)%ns
+      ENDIF
+      IF ( ALLOCATED( var_lsm_v2 ) )  THEN
+         DO  m = 1, surf_lsm_v(2)%ns
+            n_surf                   = n_surf + 1
+            k                        = surf_lsm_v(2)%k(m)
+            surfaces%var_out(n_surf) = SUM ( surf_lsm_v(2)%frac(m,:) *              &
+                                             var_lsm_v2(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_lsm_v(2)%ns
+      ENDIF
+      IF ( ALLOCATED( var_usm_v2 ) )  THEN
+         DO  m = 1, surf_usm_v(2)%ns
+            n_surf                   = n_surf + 1
+            k                        = surf_usm_v(2)%k(m)
+            surfaces%var_out(n_surf) = SUM ( surf_usm_v(2)%frac(m,:) *              &
+                                             var_usm_v2(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_usm_v(2)%ns
+      ENDIF
+!
+!--   Write westward-facing
+      IF ( ALLOCATED( var_def_v3 ) )  THEN
+         DO  m = 1, surf_def_v(3)%ns
+            n_surf                   = n_surf + 1
+            k                        = surf_def_v(3)%k(m)
+            surfaces%var_out(n_surf) = SUM ( surf_def_v(3)%frac(m,:) *              &
+                                             var_def_v3(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_def_v(3)%ns
+      ENDIF
+      IF ( ALLOCATED( var_lsm_v3 ) )  THEN
+         DO  m = 1, surf_lsm_v(3)%ns
+            n_surf                   = n_surf + 1
+            k                        = surf_lsm_v(3)%k(m)
+            surfaces%var_out(n_surf) = SUM ( surf_lsm_v(3)%frac(m,:) *              &
+                                             var_lsm_v3(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_lsm_v(3)%ns
+      ENDIF
+      IF ( ALLOCATED( var_usm_v3 ) )  THEN
+         DO  m = 1, surf_usm_v(3)%ns
+            n_surf                   = n_surf + 1
+            k                        = surf_usm_v(3)%k(m)
+            surfaces%var_out(n_surf) = SUM ( surf_usm_v(3)%frac(m,:) *              &
+                                             var_usm_v3(m,:) ) * conversion_factor(k)
+         ENDDO
+      ELSE
+         n_surf = n_surf + surf_usm_v(3)%ns
+      ENDIF
+
+   END SUBROUTINE surface_data_output_collect_2d
 
 !------------------------------------------------------------------------------!
@@ -4785,4 +5379,7 @@
                unit = 'W/m2'
 
+            CASE ( 'albedo', 'emissivity' )
+               unit = '1'
+
             CASE DEFAULT
                message_string = TRIM( trimvar ) //                             &
