Index: palm/trunk/SOURCE/radiation_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/radiation_model_mod.f90	(revision 4429)
+++ palm/trunk/SOURCE/radiation_model_mod.f90	(revision 4441)
@@ -23,5 +23,7 @@
 ! Current revisions:
 ! ------------------
-! 
+! - Change order of dimension in surface arrays %frac, %emissivity and %albedo 
+!   to allow for better vectorization in the radiation interactions.
+! - Minor formatting issues
 ! 
 ! Former revisions:
@@ -1831,9 +1833,9 @@
 !--       via namelist paramter, unless not already allocated.
           IF ( .NOT. ALLOCATED(surf_lsm_h%albedo) )  THEN
-             ALLOCATE( surf_lsm_h%albedo(0:2,1:surf_lsm_h%ns)     )
+             ALLOCATE( surf_lsm_h%albedo(1:surf_lsm_h%ns,0:2)     )
              surf_lsm_h%albedo    = albedo
           ENDIF
           IF ( .NOT. ALLOCATED(surf_usm_h%albedo) )  THEN
-             ALLOCATE( surf_usm_h%albedo(0:2,1:surf_usm_h%ns)     )
+             ALLOCATE( surf_usm_h%albedo(1:surf_usm_h%ns,0:2)     )
              surf_usm_h%albedo    = albedo
           ENDIF
@@ -1841,9 +1843,9 @@
           DO  l = 0, 3
              IF ( .NOT. ALLOCATED( surf_lsm_v(l)%albedo ) )  THEN
-                ALLOCATE( surf_lsm_v(l)%albedo(0:2,1:surf_lsm_v(l)%ns) )
+                ALLOCATE( surf_lsm_v(l)%albedo(1:surf_lsm_v(l)%ns,0:2) )
                 surf_lsm_v(l)%albedo = albedo
              ENDIF
              IF ( .NOT. ALLOCATED( surf_usm_v(l)%albedo ) )  THEN
-                ALLOCATE( surf_usm_v(l)%albedo(0:2,1:surf_usm_v(l)%ns) )
+                ALLOCATE( surf_usm_v(l)%albedo(1:surf_usm_v(l)%ns,0:2) )
                 surf_usm_v(l)%albedo = albedo
              ENDIF
@@ -1855,48 +1857,48 @@
 !--       albedo won't be overwritten. 
           DO  m = 1, surf_lsm_h%ns
-             IF ( surf_lsm_h%albedo_type(ind_veg_wall,m) /= 0 )                &
-                surf_lsm_h%albedo(ind_veg_wall,m) =                            &
-                           albedo_pars(0,surf_lsm_h%albedo_type(ind_veg_wall,m))
-             IF ( surf_lsm_h%albedo_type(ind_pav_green,m) /= 0 )               &
-                surf_lsm_h%albedo(ind_pav_green,m) =                           &
-                           albedo_pars(0,surf_lsm_h%albedo_type(ind_pav_green,m))
-             IF ( surf_lsm_h%albedo_type(ind_wat_win,m) /= 0 )                 &
-                surf_lsm_h%albedo(ind_wat_win,m) =                             &
-                           albedo_pars(0,surf_lsm_h%albedo_type(ind_wat_win,m))
+             IF ( surf_lsm_h%albedo_type(m,ind_veg_wall) /= 0 )                &
+                surf_lsm_h%albedo(m,ind_veg_wall) =                            &
+                           albedo_pars(0,surf_lsm_h%albedo_type(m,ind_veg_wall))
+             IF ( surf_lsm_h%albedo_type(m,ind_pav_green) /= 0 )               &
+                surf_lsm_h%albedo(m,ind_pav_green) =                           &
+                           albedo_pars(0,surf_lsm_h%albedo_type(m,ind_pav_green))
+             IF ( surf_lsm_h%albedo_type(m,ind_wat_win) /= 0 )                 &
+                surf_lsm_h%albedo(m,ind_wat_win) =                             &
+                           albedo_pars(0,surf_lsm_h%albedo_type(m,ind_wat_win))
           ENDDO
           DO  m = 1, surf_usm_h%ns
-             IF ( surf_usm_h%albedo_type(ind_veg_wall,m) /= 0 )                &
-                surf_usm_h%albedo(ind_veg_wall,m) =                            &
-                           albedo_pars(0,surf_usm_h%albedo_type(ind_veg_wall,m))
-             IF ( surf_usm_h%albedo_type(ind_pav_green,m) /= 0 )               &
-                surf_usm_h%albedo(ind_pav_green,m) =                           &
-                           albedo_pars(0,surf_usm_h%albedo_type(ind_pav_green,m))
-             IF ( surf_usm_h%albedo_type(ind_wat_win,m) /= 0 )                 &
-                surf_usm_h%albedo(ind_wat_win,m) =                             &
-                           albedo_pars(0,surf_usm_h%albedo_type(ind_wat_win,m))
+             IF ( surf_usm_h%albedo_type(m,ind_veg_wall) /= 0 )                &
+                surf_usm_h%albedo(m,ind_veg_wall) =                            &
+                           albedo_pars(0,surf_usm_h%albedo_type(m,ind_veg_wall))
+             IF ( surf_usm_h%albedo_type(m,ind_pav_green) /= 0 )               &
+                surf_usm_h%albedo(m,ind_pav_green) =                           &
+                           albedo_pars(0,surf_usm_h%albedo_type(m,ind_pav_green))
+             IF ( surf_usm_h%albedo_type(m,ind_wat_win) /= 0 )                 &
+                surf_usm_h%albedo(m,ind_wat_win) =                             &
+                           albedo_pars(0,surf_usm_h%albedo_type(m,ind_wat_win))
           ENDDO
 
           DO  l = 0, 3
              DO  m = 1, surf_lsm_v(l)%ns
-                IF ( surf_lsm_v(l)%albedo_type(ind_veg_wall,m) /= 0 )          &
-                   surf_lsm_v(l)%albedo(ind_veg_wall,m) =                      &
-                        albedo_pars(0,surf_lsm_v(l)%albedo_type(ind_veg_wall,m))
-                IF ( surf_lsm_v(l)%albedo_type(ind_pav_green,m) /= 0 )         &
-                   surf_lsm_v(l)%albedo(ind_pav_green,m) =                     &
-                        albedo_pars(0,surf_lsm_v(l)%albedo_type(ind_pav_green,m))
-                IF ( surf_lsm_v(l)%albedo_type(ind_wat_win,m) /= 0 )           &
-                   surf_lsm_v(l)%albedo(ind_wat_win,m) =                       &
-                        albedo_pars(0,surf_lsm_v(l)%albedo_type(ind_wat_win,m))
+                IF ( surf_lsm_v(l)%albedo_type(m,ind_veg_wall) /= 0 )          &
+                   surf_lsm_v(l)%albedo(m,ind_veg_wall) =                      &
+                        albedo_pars(0,surf_lsm_v(l)%albedo_type(m,ind_veg_wall))
+                IF ( surf_lsm_v(l)%albedo_type(m,ind_pav_green) /= 0 )         &
+                   surf_lsm_v(l)%albedo(m,ind_pav_green) =                     &
+                        albedo_pars(0,surf_lsm_v(l)%albedo_type(m,ind_pav_green))
+                IF ( surf_lsm_v(l)%albedo_type(m,ind_wat_win) /= 0 )           &
+                   surf_lsm_v(l)%albedo(m,ind_wat_win) =                       &
+                        albedo_pars(0,surf_lsm_v(l)%albedo_type(m,ind_wat_win))
              ENDDO
              DO  m = 1, surf_usm_v(l)%ns
-                IF ( surf_usm_v(l)%albedo_type(ind_veg_wall,m) /= 0 )          &
-                   surf_usm_v(l)%albedo(ind_veg_wall,m) =                      &
-                        albedo_pars(0,surf_usm_v(l)%albedo_type(ind_veg_wall,m))
-                IF ( surf_usm_v(l)%albedo_type(ind_pav_green,m) /= 0 )         &
-                   surf_usm_v(l)%albedo(ind_pav_green,m) =                     &
-                        albedo_pars(0,surf_usm_v(l)%albedo_type(ind_pav_green,m))
-                IF ( surf_usm_v(l)%albedo_type(ind_wat_win,m) /= 0 )           &
-                   surf_usm_v(l)%albedo(ind_wat_win,m) =                       &
-                        albedo_pars(0,surf_usm_v(l)%albedo_type(ind_wat_win,m))
+                IF ( surf_usm_v(l)%albedo_type(m,ind_veg_wall) /= 0 )          &
+                   surf_usm_v(l)%albedo(m,ind_veg_wall) =                      &
+                        albedo_pars(0,surf_usm_v(l)%albedo_type(m,ind_veg_wall))
+                IF ( surf_usm_v(l)%albedo_type(m,ind_pav_green) /= 0 )         &
+                   surf_usm_v(l)%albedo(m,ind_pav_green) =                     &
+                        albedo_pars(0,surf_usm_v(l)%albedo_type(m,ind_pav_green))
+                IF ( surf_usm_v(l)%albedo_type(m,ind_wat_win) /= 0 )           &
+                   surf_usm_v(l)%albedo(m,ind_wat_win) =                       &
+                        albedo_pars(0,surf_usm_v(l)%albedo_type(m,ind_wat_win))
              ENDDO
           ENDDO
@@ -1913,7 +1915,7 @@
                 j = surf_lsm_h%j(m)
                 IF ( albedo_pars_f%pars_xy(0,j,i) /= albedo_pars_f%fill )  THEN
-                   surf_lsm_h%albedo(ind_veg_wall,m)  = albedo_pars_f%pars_xy(0,j,i)
-                   surf_lsm_h%albedo(ind_pav_green,m) = albedo_pars_f%pars_xy(0,j,i)
-                   surf_lsm_h%albedo(ind_wat_win,m)   = albedo_pars_f%pars_xy(0,j,i)
+                   surf_lsm_h%albedo(m,ind_veg_wall)  = albedo_pars_f%pars_xy(0,j,i)
+                   surf_lsm_h%albedo(m,ind_pav_green) = albedo_pars_f%pars_xy(0,j,i)
+                   surf_lsm_h%albedo(m,ind_wat_win)   = albedo_pars_f%pars_xy(0,j,i)
                 ENDIF
              ENDDO
@@ -1922,7 +1924,7 @@
                 j = surf_usm_h%j(m)
                 IF ( albedo_pars_f%pars_xy(0,j,i) /= albedo_pars_f%fill )  THEN
-                   surf_usm_h%albedo(ind_veg_wall,m)  = albedo_pars_f%pars_xy(0,j,i)
-                   surf_usm_h%albedo(ind_pav_green,m) = albedo_pars_f%pars_xy(0,j,i)
-                   surf_usm_h%albedo(ind_wat_win,m)   = albedo_pars_f%pars_xy(0,j,i)
+                   surf_usm_h%albedo(m,ind_veg_wall)  = albedo_pars_f%pars_xy(0,j,i)
+                   surf_usm_h%albedo(m,ind_pav_green) = albedo_pars_f%pars_xy(0,j,i)
+                   surf_usm_h%albedo(m,ind_wat_win)   = albedo_pars_f%pars_xy(0,j,i)
                 ENDIF
              ENDDO 
@@ -1937,7 +1939,7 @@
                    j = surf_lsm_v(l)%j(m) + joff
                    IF ( albedo_pars_f%pars_xy(0,j,i) /= albedo_pars_f%fill )  THEN
-                      surf_lsm_v(l)%albedo(ind_veg_wall,m) = albedo_pars_f%pars_xy(0,j,i)
-                      surf_lsm_v(l)%albedo(ind_pav_green,m) = albedo_pars_f%pars_xy(0,j,i)
-                      surf_lsm_v(l)%albedo(ind_wat_win,m) = albedo_pars_f%pars_xy(0,j,i)
+                      surf_lsm_v(l)%albedo(m,ind_veg_wall) = albedo_pars_f%pars_xy(0,j,i)
+                      surf_lsm_v(l)%albedo(m,ind_pav_green) = albedo_pars_f%pars_xy(0,j,i)
+                      surf_lsm_v(l)%albedo(m,ind_wat_win) = albedo_pars_f%pars_xy(0,j,i)
                    ENDIF
                 ENDDO
@@ -1949,7 +1951,7 @@
                    j = surf_usm_v(l)%j(m) + joff
                    IF ( albedo_pars_f%pars_xy(0,j,i) /= albedo_pars_f%fill )  THEN
-                      surf_usm_v(l)%albedo(ind_veg_wall,m) = albedo_pars_f%pars_xy(0,j,i)
-                      surf_usm_v(l)%albedo(ind_pav_green,m) = albedo_pars_f%pars_xy(0,j,i)
-                      surf_usm_v(l)%albedo(ind_wat_win,m) = albedo_pars_f%pars_xy(0,j,i)
+                      surf_usm_v(l)%albedo(m,ind_veg_wall) = albedo_pars_f%pars_xy(0,j,i)
+                      surf_usm_v(l)%albedo(m,ind_pav_green) = albedo_pars_f%pars_xy(0,j,i)
+                      surf_usm_v(l)%albedo(m,ind_wat_win) = albedo_pars_f%pars_xy(0,j,i)
                    ENDIF
                 ENDDO
@@ -1975,21 +1977,21 @@
                       IF ( building_surface_pars_f%pars(ind_s_alb_b_wall,is) /=      &
                            building_surface_pars_f%fill )  THEN
-                         surf_usm_h%albedo(ind_veg_wall,m) =                         &
+                         surf_usm_h%albedo(m,ind_veg_wall) =                         &
                                   building_surface_pars_f%pars(ind_s_alb_b_wall,is)
-                         surf_usm_h%albedo_type(ind_veg_wall,m) = 0
+                         surf_usm_h%albedo_type(m,ind_veg_wall) = 0
                       ENDIF
 
                       IF ( building_surface_pars_f%pars(ind_s_alb_b_win,is) /=       &
                            building_surface_pars_f%fill )  THEN
-                         surf_usm_h%albedo(ind_wat_win,m) =                          &
+                         surf_usm_h%albedo(m,ind_wat_win) =                          &
                                   building_surface_pars_f%pars(ind_s_alb_b_win,is)
-                         surf_usm_h%albedo_type(ind_wat_win,m) = 0
+                         surf_usm_h%albedo_type(m,ind_wat_win) = 0
                       ENDIF
 
                       IF ( building_surface_pars_f%pars(ind_s_alb_b_green,is) /=     &
                            building_surface_pars_f%fill )  THEN
-                         surf_usm_h%albedo(ind_pav_green,m) =                        &
+                         surf_usm_h%albedo(m,ind_pav_green) =                        &
                                   building_surface_pars_f%pars(ind_s_alb_b_green,is)
-                         surf_usm_h%albedo_type(ind_pav_green,m) = 0
+                         surf_usm_h%albedo_type(m,ind_pav_green) = 0
                       ENDIF
 
@@ -2014,21 +2016,21 @@
                          IF ( building_surface_pars_f%pars(ind_s_alb_b_wall,is) /=      &
                               building_surface_pars_f%fill )  THEN
-                            surf_usm_v(l)%albedo(ind_veg_wall,m) =                      &
+                            surf_usm_v(l)%albedo(m,ind_veg_wall) =                      &
                                      building_surface_pars_f%pars(ind_s_alb_b_wall,is)
-                            surf_usm_v(l)%albedo_type(ind_veg_wall,m) = 0
+                            surf_usm_v(l)%albedo_type(m,ind_veg_wall) = 0
                          ENDIF
 
                          IF ( building_surface_pars_f%pars(ind_s_alb_b_win,is) /=       &
                               building_surface_pars_f%fill )  THEN
-                            surf_usm_v(l)%albedo(ind_wat_win,m) =                       &
+                            surf_usm_v(l)%albedo(m,ind_wat_win) =                       &
                                      building_surface_pars_f%pars(ind_s_alb_b_win,is)
-                            surf_usm_v(l)%albedo_type(ind_wat_win,m) = 0
+                            surf_usm_v(l)%albedo_type(m,ind_wat_win) = 0
                          ENDIF
 
                          IF ( building_surface_pars_f%pars(ind_s_alb_b_green,is) /=     &
                               building_surface_pars_f%fill )  THEN
-                            surf_usm_v(l)%albedo(ind_pav_green,m) =                     &
+                            surf_usm_v(l)%albedo(m,ind_pav_green) =                     &
                                      building_surface_pars_f%pars(ind_s_alb_b_green,is)
-                            surf_usm_v(l)%albedo_type(ind_pav_green,m) = 0
+                            surf_usm_v(l)%albedo_type(m,ind_pav_green) = 0
                          ENDIF
 
@@ -2047,21 +2049,21 @@
 !--       for wall/green/window (USM) or vegetation/pavement/water surfaces
 !--       (LSM). 
-          ALLOCATE ( surf_lsm_h%aldif(0:2,1:surf_lsm_h%ns)       )
-          ALLOCATE ( surf_lsm_h%aldir(0:2,1:surf_lsm_h%ns)       )
-          ALLOCATE ( surf_lsm_h%asdif(0:2,1:surf_lsm_h%ns)       )
-          ALLOCATE ( surf_lsm_h%asdir(0:2,1:surf_lsm_h%ns)       )
-          ALLOCATE ( surf_lsm_h%rrtm_aldif(0:2,1:surf_lsm_h%ns)  )
-          ALLOCATE ( surf_lsm_h%rrtm_aldir(0:2,1:surf_lsm_h%ns)  )
-          ALLOCATE ( surf_lsm_h%rrtm_asdif(0:2,1:surf_lsm_h%ns)  )
-          ALLOCATE ( surf_lsm_h%rrtm_asdir(0:2,1:surf_lsm_h%ns)  )
-
-          ALLOCATE ( surf_usm_h%aldif(0:2,1:surf_usm_h%ns)       )
-          ALLOCATE ( surf_usm_h%aldir(0:2,1:surf_usm_h%ns)       )
-          ALLOCATE ( surf_usm_h%asdif(0:2,1:surf_usm_h%ns)       )
-          ALLOCATE ( surf_usm_h%asdir(0:2,1:surf_usm_h%ns)       )
-          ALLOCATE ( surf_usm_h%rrtm_aldif(0:2,1:surf_usm_h%ns)  )
-          ALLOCATE ( surf_usm_h%rrtm_aldir(0:2,1:surf_usm_h%ns)  )
-          ALLOCATE ( surf_usm_h%rrtm_asdif(0:2,1:surf_usm_h%ns)  )
-          ALLOCATE ( surf_usm_h%rrtm_asdir(0:2,1:surf_usm_h%ns)  )
+          ALLOCATE ( surf_lsm_h%aldif(1:surf_lsm_h%ns,0:2)       )
+          ALLOCATE ( surf_lsm_h%aldir(1:surf_lsm_h%ns,0:2)       )
+          ALLOCATE ( surf_lsm_h%asdif(1:surf_lsm_h%ns,0:2)       )
+          ALLOCATE ( surf_lsm_h%asdir(1:surf_lsm_h%ns,0:2)       )
+          ALLOCATE ( surf_lsm_h%rrtm_aldif(1:surf_lsm_h%ns,0:2)  )
+          ALLOCATE ( surf_lsm_h%rrtm_aldir(1:surf_lsm_h%ns,0:2)  )
+          ALLOCATE ( surf_lsm_h%rrtm_asdif(1:surf_lsm_h%ns,0:2)  )
+          ALLOCATE ( surf_lsm_h%rrtm_asdir(1:surf_lsm_h%ns,0:2)  )
+
+          ALLOCATE ( surf_usm_h%aldif(1:surf_usm_h%ns,0:2)       )
+          ALLOCATE ( surf_usm_h%aldir(1:surf_usm_h%ns,0:2)       )
+          ALLOCATE ( surf_usm_h%asdif(1:surf_usm_h%ns,0:2)       )
+          ALLOCATE ( surf_usm_h%asdir(1:surf_usm_h%ns,0:2)       )
+          ALLOCATE ( surf_usm_h%rrtm_aldif(1:surf_usm_h%ns,0:2)  )
+          ALLOCATE ( surf_usm_h%rrtm_aldir(1:surf_usm_h%ns,0:2)  )
+          ALLOCATE ( surf_usm_h%rrtm_asdif(1:surf_usm_h%ns,0:2)  )
+          ALLOCATE ( surf_usm_h%rrtm_asdir(1:surf_usm_h%ns,0:2)  )
 
 !
@@ -2069,7 +2071,7 @@
 !--       implementations)
           IF ( .NOT. ALLOCATED(surf_lsm_h%albedo) )                            &
-             ALLOCATE( surf_lsm_h%albedo(0:2,1:surf_lsm_h%ns)     )
+             ALLOCATE( surf_lsm_h%albedo(1:surf_lsm_h%ns,0:2)     )
           IF ( .NOT. ALLOCATED(surf_usm_h%albedo) )                            &
-             ALLOCATE( surf_usm_h%albedo(0:2,1:surf_usm_h%ns)     )
+             ALLOCATE( surf_usm_h%albedo(1:surf_usm_h%ns,0:2)     )
 
 !
@@ -2077,30 +2079,30 @@
           DO  l = 0, 3
 
-             ALLOCATE ( surf_lsm_v(l)%aldif(0:2,1:surf_lsm_v(l)%ns)      )
-             ALLOCATE ( surf_lsm_v(l)%aldir(0:2,1:surf_lsm_v(l)%ns)      )
-             ALLOCATE ( surf_lsm_v(l)%asdif(0:2,1:surf_lsm_v(l)%ns)      )
-             ALLOCATE ( surf_lsm_v(l)%asdir(0:2,1:surf_lsm_v(l)%ns)      )
-
-             ALLOCATE ( surf_lsm_v(l)%rrtm_aldif(0:2,1:surf_lsm_v(l)%ns) )
-             ALLOCATE ( surf_lsm_v(l)%rrtm_aldir(0:2,1:surf_lsm_v(l)%ns) )
-             ALLOCATE ( surf_lsm_v(l)%rrtm_asdif(0:2,1:surf_lsm_v(l)%ns) )
-             ALLOCATE ( surf_lsm_v(l)%rrtm_asdir(0:2,1:surf_lsm_v(l)%ns) )
-
-             ALLOCATE ( surf_usm_v(l)%aldif(0:2,1:surf_usm_v(l)%ns)      )
-             ALLOCATE ( surf_usm_v(l)%aldir(0:2,1:surf_usm_v(l)%ns)      )
-             ALLOCATE ( surf_usm_v(l)%asdif(0:2,1:surf_usm_v(l)%ns)      )
-             ALLOCATE ( surf_usm_v(l)%asdir(0:2,1:surf_usm_v(l)%ns)      )
-
-             ALLOCATE ( surf_usm_v(l)%rrtm_aldif(0:2,1:surf_usm_v(l)%ns) )
-             ALLOCATE ( surf_usm_v(l)%rrtm_aldir(0:2,1:surf_usm_v(l)%ns) )
-             ALLOCATE ( surf_usm_v(l)%rrtm_asdif(0:2,1:surf_usm_v(l)%ns) )
-             ALLOCATE ( surf_usm_v(l)%rrtm_asdir(0:2,1:surf_usm_v(l)%ns) )
+             ALLOCATE ( surf_lsm_v(l)%aldif(1:surf_lsm_v(l)%ns,0:2)      )
+             ALLOCATE ( surf_lsm_v(l)%aldir(1:surf_lsm_v(l)%ns,0:2)      )
+             ALLOCATE ( surf_lsm_v(l)%asdif(1:surf_lsm_v(l)%ns,0:2)      )
+             ALLOCATE ( surf_lsm_v(l)%asdir(1:surf_lsm_v(l)%ns,0:2)      )
+
+             ALLOCATE ( surf_lsm_v(l)%rrtm_aldif(1:surf_lsm_v(l)%ns,0:2) )
+             ALLOCATE ( surf_lsm_v(l)%rrtm_aldir(1:surf_lsm_v(l)%ns,0:2) )
+             ALLOCATE ( surf_lsm_v(l)%rrtm_asdif(1:surf_lsm_v(l)%ns,0:2) )
+             ALLOCATE ( surf_lsm_v(l)%rrtm_asdir(1:surf_lsm_v(l)%ns,0:2) )
+
+             ALLOCATE ( surf_usm_v(l)%aldif(1:surf_usm_v(l)%ns,0:2)      )
+             ALLOCATE ( surf_usm_v(l)%aldir(1:surf_usm_v(l)%ns,0:2)      )
+             ALLOCATE ( surf_usm_v(l)%asdif(1:surf_usm_v(l)%ns,0:2)      )
+             ALLOCATE ( surf_usm_v(l)%asdir(1:surf_usm_v(l)%ns,0:2)      )
+
+             ALLOCATE ( surf_usm_v(l)%rrtm_aldif(1:surf_usm_v(l)%ns,0:2) )
+             ALLOCATE ( surf_usm_v(l)%rrtm_aldir(1:surf_usm_v(l)%ns,0:2) )
+             ALLOCATE ( surf_usm_v(l)%rrtm_asdif(1:surf_usm_v(l)%ns,0:2) )
+             ALLOCATE ( surf_usm_v(l)%rrtm_asdir(1:surf_usm_v(l)%ns,0:2) )
 !
 !--          Allocate broadband albedo (temporary for the current radiation
 !--          implementations)
              IF ( .NOT. ALLOCATED( surf_lsm_v(l)%albedo ) )                    &
-                ALLOCATE( surf_lsm_v(l)%albedo(0:2,1:surf_lsm_v(l)%ns) )
+                ALLOCATE( surf_lsm_v(l)%albedo(1:surf_lsm_v(l)%ns,0:2) )
              IF ( .NOT. ALLOCATED( surf_usm_v(l)%albedo ) )                    &
-                ALLOCATE( surf_usm_v(l)%albedo(0:2,1:surf_usm_v(l)%ns) )
+                ALLOCATE( surf_usm_v(l)%albedo(1:surf_usm_v(l)%ns,0:2) )
 
           ENDDO
@@ -2165,15 +2167,15 @@
 !--          Spectral albedos for vegetation/pavement/water surfaces
              DO  ind_type = 0, 2
-                IF ( surf_lsm_h%albedo_type(ind_type,m) /= 0 )  THEN
-                   surf_lsm_h%aldif(ind_type,m) =                              &
-                               albedo_pars(1,surf_lsm_h%albedo_type(ind_type,m))
-                   surf_lsm_h%asdif(ind_type,m) =                              &
-                               albedo_pars(2,surf_lsm_h%albedo_type(ind_type,m))
-                   surf_lsm_h%aldir(ind_type,m) =                              &
-                               albedo_pars(1,surf_lsm_h%albedo_type(ind_type,m))
-                   surf_lsm_h%asdir(ind_type,m) =                              &
-                               albedo_pars(2,surf_lsm_h%albedo_type(ind_type,m))
-                   surf_lsm_h%albedo(ind_type,m) =                             &
-                               albedo_pars(0,surf_lsm_h%albedo_type(ind_type,m))
+                IF ( surf_lsm_h%albedo_type(m,ind_type) /= 0 )  THEN
+                   surf_lsm_h%aldif(m,ind_type) =                              &
+                               albedo_pars(1,surf_lsm_h%albedo_type(m,ind_type))
+                   surf_lsm_h%asdif(m,ind_type) =                              &
+                               albedo_pars(2,surf_lsm_h%albedo_type(m,ind_type))
+                   surf_lsm_h%aldir(m,ind_type) =                              &
+                               albedo_pars(1,surf_lsm_h%albedo_type(m,ind_type))
+                   surf_lsm_h%asdir(m,ind_type) =                              &
+                               albedo_pars(2,surf_lsm_h%albedo_type(m,ind_type))
+                   surf_lsm_h%albedo(m,ind_type) =                             &
+                               albedo_pars(0,surf_lsm_h%albedo_type(m,ind_type))
                 ENDIF
              ENDDO
@@ -2188,15 +2190,15 @@
 !--             Spectral albedos for wall/green/window surfaces
                 DO  ind_type = 0, 2
-                   IF ( surf_usm_h%albedo_type(ind_type,m) /= 0 )  THEN
-                      surf_usm_h%aldif(ind_type,m) =                           &
-                               albedo_pars(1,surf_usm_h%albedo_type(ind_type,m))
-                      surf_usm_h%asdif(ind_type,m) =                           &
-                               albedo_pars(2,surf_usm_h%albedo_type(ind_type,m))
-                      surf_usm_h%aldir(ind_type,m) =                           &
-                               albedo_pars(1,surf_usm_h%albedo_type(ind_type,m))
-                      surf_usm_h%asdir(ind_type,m) =                           &
-                               albedo_pars(2,surf_usm_h%albedo_type(ind_type,m))
-                      surf_usm_h%albedo(ind_type,m) =                          &
-                               albedo_pars(0,surf_usm_h%albedo_type(ind_type,m))
+                   IF ( surf_usm_h%albedo_type(m,ind_type) /= 0 )  THEN
+                      surf_usm_h%aldif(m,ind_type) =                           &
+                               albedo_pars(1,surf_usm_h%albedo_type(m,ind_type))
+                      surf_usm_h%asdif(m,ind_type) =                           &
+                               albedo_pars(2,surf_usm_h%albedo_type(m,ind_type))
+                      surf_usm_h%aldir(m,ind_type) =                           &
+                               albedo_pars(1,surf_usm_h%albedo_type(m,ind_type))
+                      surf_usm_h%asdir(m,ind_type) =                           &
+                               albedo_pars(2,surf_usm_h%albedo_type(m,ind_type))
+                      surf_usm_h%albedo(m,ind_type) =                          &
+                               albedo_pars(0,surf_usm_h%albedo_type(m,ind_type))
                    ENDIF
                 ENDDO
@@ -2211,15 +2213,15 @@
 !--             Spectral albedos for vegetation/pavement/water surfaces
                 DO  ind_type = 0, 2
-                   IF ( surf_lsm_v(l)%albedo_type(ind_type,m) /= 0 )  THEN
-                      surf_lsm_v(l)%aldif(ind_type,m) =                        &
-                            albedo_pars(1,surf_lsm_v(l)%albedo_type(ind_type,m))
-                      surf_lsm_v(l)%asdif(ind_type,m) =                        &
-                            albedo_pars(2,surf_lsm_v(l)%albedo_type(ind_type,m))
-                      surf_lsm_v(l)%aldir(ind_type,m) =                        &
-                            albedo_pars(1,surf_lsm_v(l)%albedo_type(ind_type,m))
-                      surf_lsm_v(l)%asdir(ind_type,m) =                        &
-                            albedo_pars(2,surf_lsm_v(l)%albedo_type(ind_type,m))
-                      surf_lsm_v(l)%albedo(ind_type,m) =                       &
-                            albedo_pars(0,surf_lsm_v(l)%albedo_type(ind_type,m))
+                   IF ( surf_lsm_v(l)%albedo_type(m,ind_type) /= 0 )  THEN
+                      surf_lsm_v(l)%aldif(m,ind_type) =                        &
+                            albedo_pars(1,surf_lsm_v(l)%albedo_type(m,ind_type))
+                      surf_lsm_v(l)%asdif(m,ind_type) =                        &
+                            albedo_pars(2,surf_lsm_v(l)%albedo_type(m,ind_type))
+                      surf_lsm_v(l)%aldir(m,ind_type) =                        &
+                            albedo_pars(1,surf_lsm_v(l)%albedo_type(m,ind_type))
+                      surf_lsm_v(l)%asdir(m,ind_type) =                        &
+                            albedo_pars(2,surf_lsm_v(l)%albedo_type(m,ind_type))
+                      surf_lsm_v(l)%albedo(m,ind_type) =                       &
+                            albedo_pars(0,surf_lsm_v(l)%albedo_type(m,ind_type))
                    ENDIF
                 ENDDO
@@ -2233,15 +2235,15 @@
 !--                Spectral albedos for wall/green/window surfaces
                    DO  ind_type = 0, 2
-                      IF ( surf_usm_v(l)%albedo_type(ind_type,m) /= 0 )  THEN
-                         surf_usm_v(l)%aldif(ind_type,m) =                     &
-                            albedo_pars(1,surf_usm_v(l)%albedo_type(ind_type,m))
-                         surf_usm_v(l)%asdif(ind_type,m) =                     &
-                            albedo_pars(2,surf_usm_v(l)%albedo_type(ind_type,m))
-                         surf_usm_v(l)%aldir(ind_type,m) =                     &
-                            albedo_pars(1,surf_usm_v(l)%albedo_type(ind_type,m))
-                         surf_usm_v(l)%asdir(ind_type,m) =                     &
-                            albedo_pars(2,surf_usm_v(l)%albedo_type(ind_type,m))
-                         surf_usm_v(l)%albedo(ind_type,m) =                    &
-                            albedo_pars(0,surf_usm_v(l)%albedo_type(ind_type,m))
+                      IF ( surf_usm_v(l)%albedo_type(m,ind_type) /= 0 )  THEN
+                         surf_usm_v(l)%aldif(m,ind_type) =                     &
+                            albedo_pars(1,surf_usm_v(l)%albedo_type(m,ind_type))
+                         surf_usm_v(l)%asdif(m,ind_type) =                     &
+                            albedo_pars(2,surf_usm_v(l)%albedo_type(m,ind_type))
+                         surf_usm_v(l)%aldir(m,ind_type) =                     &
+                            albedo_pars(1,surf_usm_v(l)%albedo_type(m,ind_type))
+                         surf_usm_v(l)%asdir(m,ind_type) =                     &
+                            albedo_pars(2,surf_usm_v(l)%albedo_type(m,ind_type))
+                         surf_usm_v(l)%albedo(m,ind_type) =                    &
+                            albedo_pars(0,surf_usm_v(l)%albedo_type(m,ind_type))
                       ENDIF
                    ENDDO
@@ -2263,17 +2265,17 @@
                 DO  ind_type = 0, 2
                    IF ( albedo_pars_f%pars_xy(0,j,i) /= albedo_pars_f%fill )   &
-                      surf_lsm_h%albedo(ind_type,m) =                          &
+                      surf_lsm_h%albedo(m,ind_type) =                          &
                                              albedo_pars_f%pars_xy(0,j,i)      
                    IF ( albedo_pars_f%pars_xy(1,j,i) /= albedo_pars_f%fill )   &
-                      surf_lsm_h%aldir(ind_type,m) =                           &
+                      surf_lsm_h%aldir(m,ind_type) =                           &
                                              albedo_pars_f%pars_xy(1,j,i)      
                    IF ( albedo_pars_f%pars_xy(1,j,i) /= albedo_pars_f%fill )   &
-                      surf_lsm_h%aldif(ind_type,m) =                           &
+                      surf_lsm_h%aldif(m,ind_type) =                           &
                                              albedo_pars_f%pars_xy(1,j,i)      
                    IF ( albedo_pars_f%pars_xy(2,j,i) /= albedo_pars_f%fill )   &
-                      surf_lsm_h%asdir(ind_type,m) =                           &
+                      surf_lsm_h%asdir(m,ind_type) =                           &
                                              albedo_pars_f%pars_xy(2,j,i)      
                    IF ( albedo_pars_f%pars_xy(2,j,i) /= albedo_pars_f%fill )   &
-                      surf_lsm_h%asdif(ind_type,m) =                           &
+                      surf_lsm_h%asdif(m,ind_type) =                           &
                                              albedo_pars_f%pars_xy(2,j,i)
                 ENDDO
@@ -2290,5 +2292,5 @@
                    DO  ind_type = 0, 2
                       IF ( albedo_pars_f%pars_xy(0,j,i) /= albedo_pars_f%fill )&
-                         surf_usm_h%albedo(ind_type,m) =                       &
+                         surf_usm_h%albedo(m,ind_type) =                       &
                                              albedo_pars_f%pars_xy(0,j,i)
                    ENDDO
@@ -2296,13 +2298,13 @@
 !--                Spectral albedos especially for building wall surfaces
                    IF ( albedo_pars_f%pars_xy(1,j,i) /= albedo_pars_f%fill )  THEN
-                      surf_usm_h%aldir(ind_veg_wall,m) =                       &
+                      surf_usm_h%aldir(m,ind_veg_wall) =                       &
                                                 albedo_pars_f%pars_xy(1,j,i)
-                      surf_usm_h%aldif(ind_veg_wall,m) =                       &
+                      surf_usm_h%aldif(m,ind_veg_wall) =                       &
                                                 albedo_pars_f%pars_xy(1,j,i)
                    ENDIF
                    IF ( albedo_pars_f%pars_xy(2,j,i) /= albedo_pars_f%fill )  THEN
-                      surf_usm_h%asdir(ind_veg_wall,m) =                       &
+                      surf_usm_h%asdir(m,ind_veg_wall) =                       &
                                                 albedo_pars_f%pars_xy(2,j,i)
-                      surf_usm_h%asdif(ind_veg_wall,m) =                       &
+                      surf_usm_h%asdif(m,ind_veg_wall) =                       &
                                                 albedo_pars_f%pars_xy(2,j,i)
                    ENDIF
@@ -2310,13 +2312,13 @@
 !--                Spectral albedos especially for building green surfaces
                    IF ( albedo_pars_f%pars_xy(3,j,i) /= albedo_pars_f%fill )  THEN
-                      surf_usm_h%aldir(ind_pav_green,m) =                      &
+                      surf_usm_h%aldir(m,ind_pav_green) =                      &
                                                 albedo_pars_f%pars_xy(3,j,i)
-                      surf_usm_h%aldif(ind_pav_green,m) =                      &
+                      surf_usm_h%aldif(m,ind_pav_green) =                      &
                                                 albedo_pars_f%pars_xy(3,j,i)
                    ENDIF
                    IF ( albedo_pars_f%pars_xy(4,j,i) /= albedo_pars_f%fill )  THEN
-                      surf_usm_h%asdir(ind_pav_green,m) =                      &
+                      surf_usm_h%asdir(m,ind_pav_green) =                      &
                                                 albedo_pars_f%pars_xy(4,j,i)
-                      surf_usm_h%asdif(ind_pav_green,m) =                      &
+                      surf_usm_h%asdif(m,ind_pav_green) =                      &
                                                 albedo_pars_f%pars_xy(4,j,i)
                    ENDIF
@@ -2324,13 +2326,13 @@
 !--                Spectral albedos especially for building window surfaces
                    IF ( albedo_pars_f%pars_xy(5,j,i) /= albedo_pars_f%fill )  THEN
-                      surf_usm_h%aldir(ind_wat_win,m) =                        &
+                      surf_usm_h%aldir(m,ind_wat_win) =                        &
                                                 albedo_pars_f%pars_xy(5,j,i)
-                      surf_usm_h%aldif(ind_wat_win,m) =                        &
+                      surf_usm_h%aldif(m,ind_wat_win) =                        &
                                                 albedo_pars_f%pars_xy(5,j,i)
                    ENDIF
                    IF ( albedo_pars_f%pars_xy(6,j,i) /= albedo_pars_f%fill )  THEN
-                      surf_usm_h%asdir(ind_wat_win,m) =                        &
+                      surf_usm_h%asdir(m,ind_wat_win) =                        &
                                                 albedo_pars_f%pars_xy(6,j,i)
-                      surf_usm_h%asdif(ind_wat_win,m) =                        &
+                      surf_usm_h%asdif(m,ind_wat_win) =                        &
                                                 albedo_pars_f%pars_xy(6,j,i)
                    ENDIF
@@ -2352,21 +2354,21 @@
                       IF ( albedo_pars_f%pars_xy(0,j+joff,i+ioff) /=           &
                            albedo_pars_f%fill )                                &
-                         surf_lsm_v(l)%albedo(ind_type,m) =                    &
+                         surf_lsm_v(l)%albedo(m,ind_type) =                    &
                                        albedo_pars_f%pars_xy(0,j+joff,i+ioff)
                       IF ( albedo_pars_f%pars_xy(1,j+joff,i+ioff) /=           &
                            albedo_pars_f%fill )                                &
-                         surf_lsm_v(l)%aldir(ind_type,m) =                     &
+                         surf_lsm_v(l)%aldir(m,ind_type) =                     &
                                        albedo_pars_f%pars_xy(1,j+joff,i+ioff)
                       IF ( albedo_pars_f%pars_xy(1,j+joff,i+ioff) /=           &
                            albedo_pars_f%fill )                                &
-                         surf_lsm_v(l)%aldif(ind_type,m) =                     &
+                         surf_lsm_v(l)%aldif(m,ind_type) =                     &
                                        albedo_pars_f%pars_xy(1,j+joff,i+ioff)
                       IF ( albedo_pars_f%pars_xy(2,j+joff,i+ioff) /=           &
                            albedo_pars_f%fill )                                &
-                         surf_lsm_v(l)%asdir(ind_type,m) =                     &
+                         surf_lsm_v(l)%asdir(m,ind_type) =                     &
                                        albedo_pars_f%pars_xy(2,j+joff,i+ioff)
                       IF ( albedo_pars_f%pars_xy(2,j+joff,i+ioff) /=           &
                            albedo_pars_f%fill )                                &
-                         surf_lsm_v(l)%asdif(ind_type,m) =                     &
+                         surf_lsm_v(l)%asdif(m,ind_type) =                     &
                                        albedo_pars_f%pars_xy(2,j+joff,i+ioff)
                    ENDDO
@@ -2387,5 +2389,5 @@
                          IF ( albedo_pars_f%pars_xy(0,j+joff,i+ioff) /=        &
                               albedo_pars_f%fill )                             &
-                            surf_usm_v(l)%albedo(ind_type,m) =                 &
+                            surf_usm_v(l)%albedo(m,ind_type) =                 &
                                           albedo_pars_f%pars_xy(0,j+joff,i+ioff)
                       ENDDO
@@ -2394,14 +2396,14 @@
                       IF ( albedo_pars_f%pars_xy(1,j+joff,i+ioff) /=           &
                            albedo_pars_f%fill )  THEN
-                         surf_usm_v(l)%aldir(ind_veg_wall,m) =                 &
+                         surf_usm_v(l)%aldir(m,ind_veg_wall) =                 &
                                          albedo_pars_f%pars_xy(1,j+joff,i+ioff)
-                         surf_usm_v(l)%aldif(ind_veg_wall,m) =                 &
+                         surf_usm_v(l)%aldif(m,ind_veg_wall) =                 &
                                          albedo_pars_f%pars_xy(1,j+joff,i+ioff)
                       ENDIF
                       IF ( albedo_pars_f%pars_xy(2,j+joff,i+ioff) /=           &
                            albedo_pars_f%fill )  THEN
-                         surf_usm_v(l)%asdir(ind_veg_wall,m) =                 &
+                         surf_usm_v(l)%asdir(m,ind_veg_wall) =                 &
                                          albedo_pars_f%pars_xy(2,j+joff,i+ioff)
-                         surf_usm_v(l)%asdif(ind_veg_wall,m) =                 &
+                         surf_usm_v(l)%asdif(m,ind_veg_wall) =                 &
                                          albedo_pars_f%pars_xy(2,j+joff,i+ioff)
                       ENDIF
@@ -2410,14 +2412,14 @@
                       IF ( albedo_pars_f%pars_xy(3,j+joff,i+ioff) /=           &
                            albedo_pars_f%fill )  THEN
-                         surf_usm_v(l)%aldir(ind_pav_green,m) =                &
+                         surf_usm_v(l)%aldir(m,ind_pav_green) =                &
                                          albedo_pars_f%pars_xy(3,j+joff,i+ioff)
-                         surf_usm_v(l)%aldif(ind_pav_green,m) =                &
+                         surf_usm_v(l)%aldif(m,ind_pav_green) =                &
                                          albedo_pars_f%pars_xy(3,j+joff,i+ioff)
                       ENDIF
                       IF ( albedo_pars_f%pars_xy(4,j+joff,i+ioff) /=           &
                            albedo_pars_f%fill )  THEN
-                         surf_usm_v(l)%asdir(ind_pav_green,m) =                &
+                         surf_usm_v(l)%asdir(m,ind_pav_green) =                &
                                          albedo_pars_f%pars_xy(4,j+joff,i+ioff)
-                         surf_usm_v(l)%asdif(ind_pav_green,m) =                &
+                         surf_usm_v(l)%asdif(m,ind_pav_green) =                &
                                          albedo_pars_f%pars_xy(4,j+joff,i+ioff)
                       ENDIF
@@ -2426,14 +2428,14 @@
                       IF ( albedo_pars_f%pars_xy(5,j+joff,i+ioff) /=           &
                            albedo_pars_f%fill )  THEN
-                         surf_usm_v(l)%aldir(ind_wat_win,m) =                  &
+                         surf_usm_v(l)%aldir(m,ind_wat_win) =                  &
                                          albedo_pars_f%pars_xy(5,j+joff,i+ioff)
-                         surf_usm_v(l)%aldif(ind_wat_win,m) =                  &
+                         surf_usm_v(l)%aldif(m,ind_wat_win) =                  &
                                          albedo_pars_f%pars_xy(5,j+joff,i+ioff)
                       ENDIF
                       IF ( albedo_pars_f%pars_xy(6,j+joff,i+ioff) /=           &
                            albedo_pars_f%fill )  THEN
-                         surf_usm_v(l)%asdir(ind_wat_win,m) =                  &
+                         surf_usm_v(l)%asdir(m,ind_wat_win) =                  &
                                          albedo_pars_f%pars_xy(6,j+joff,i+ioff)
-                         surf_usm_v(l)%asdif(ind_wat_win,m) =                  &
+                         surf_usm_v(l)%asdif(m,ind_wat_win) =                  &
                                          albedo_pars_f%pars_xy(6,j+joff,i+ioff)
                       ENDIF
@@ -2461,75 +2463,75 @@
                       IF ( building_surface_pars_f%pars(ind_s_alb_b_wall,is) /=      &
                            building_surface_pars_f%fill )  THEN
-                         surf_usm_h%albedo(ind_veg_wall,m) =                         &
+                         surf_usm_h%albedo(m,ind_veg_wall) =                         &
                                   building_surface_pars_f%pars(ind_s_alb_b_wall,is)
-                         surf_usm_h%albedo_type(ind_veg_wall,m) = 0
+                         surf_usm_h%albedo_type(m,ind_veg_wall) = 0
                       ENDIF
 
                       IF ( building_surface_pars_f%pars(ind_s_alb_l_wall,is) /=      &
                            building_surface_pars_f%fill )  THEN
-                         surf_usm_h%aldir(ind_veg_wall,m) =                          &
+                         surf_usm_h%aldir(m,ind_veg_wall) =                          &
                                   building_surface_pars_f%pars(ind_s_alb_l_wall,is)
-                         surf_usm_h%aldif(ind_veg_wall,m) =                          &
+                         surf_usm_h%aldif(m,ind_veg_wall) =                          &
                                   building_surface_pars_f%pars(ind_s_alb_l_wall,is)
-                         surf_usm_h%albedo_type(ind_veg_wall,m) = 0
+                         surf_usm_h%albedo_type(m,ind_veg_wall) = 0
                       ENDIF
 
                       IF ( building_surface_pars_f%pars(ind_s_alb_s_wall,is) /=      &
                            building_surface_pars_f%fill )  THEN
-                         surf_usm_h%asdir(ind_veg_wall,m) =                          &
+                         surf_usm_h%asdir(m,ind_veg_wall) =                          &
                                   building_surface_pars_f%pars(ind_s_alb_s_wall,is)
-                         surf_usm_h%asdif(ind_veg_wall,m) =                          &
+                         surf_usm_h%asdif(m,ind_veg_wall) =                          &
                                   building_surface_pars_f%pars(ind_s_alb_s_wall,is)
-                         surf_usm_h%albedo_type(ind_veg_wall,m) = 0
+                         surf_usm_h%albedo_type(m,ind_veg_wall) = 0
                       ENDIF
 
                       IF ( building_surface_pars_f%pars(ind_s_alb_b_win,is) /=       &
                            building_surface_pars_f%fill )  THEN
-                         surf_usm_h%albedo(ind_wat_win,m) =                          &
+                         surf_usm_h%albedo(m,ind_wat_win) =                          &
                                   building_surface_pars_f%pars(ind_s_alb_b_win,is)
-                         surf_usm_h%albedo_type(ind_wat_win,m) = 0
+                         surf_usm_h%albedo_type(m,ind_wat_win) = 0
                       ENDIF
 
                       IF ( building_surface_pars_f%pars(ind_s_alb_l_win,is) /=       &
                            building_surface_pars_f%fill )  THEN
-                         surf_usm_h%aldir(ind_wat_win,m) =                           &
+                         surf_usm_h%aldir(m,ind_wat_win) =                           &
                                   building_surface_pars_f%pars(ind_s_alb_l_win,is)
-                         surf_usm_h%aldif(ind_wat_win,m) =                           &
+                         surf_usm_h%aldif(m,ind_wat_win) =                           &
                                   building_surface_pars_f%pars(ind_s_alb_l_win,is)
-                         surf_usm_h%albedo_type(ind_wat_win,m) = 0
+                         surf_usm_h%albedo_type(m,ind_wat_win) = 0
                       ENDIF
 
                       IF ( building_surface_pars_f%pars(ind_s_alb_s_win,is) /=       &
                            building_surface_pars_f%fill )  THEN
-                         surf_usm_h%asdir(ind_wat_win,m) =                           &
+                         surf_usm_h%asdir(m,ind_wat_win) =                           &
                                   building_surface_pars_f%pars(ind_s_alb_s_win,is)
-                         surf_usm_h%asdif(ind_wat_win,m) =                           &
+                         surf_usm_h%asdif(m,ind_wat_win) =                           &
                                   building_surface_pars_f%pars(ind_s_alb_s_win,is)
-                         surf_usm_h%albedo_type(ind_wat_win,m) = 0
+                         surf_usm_h%albedo_type(m,ind_wat_win) = 0
                       ENDIF
 
                       IF ( building_surface_pars_f%pars(ind_s_alb_b_green,is) /=     &
                            building_surface_pars_f%fill )  THEN
-                         surf_usm_h%albedo(ind_pav_green,m) =                        &
+                         surf_usm_h%albedo(m,ind_pav_green) =                        &
                                   building_surface_pars_f%pars(ind_s_alb_b_green,is)
-                         surf_usm_h%albedo_type(ind_pav_green,m) = 0
+                         surf_usm_h%albedo_type(m,ind_pav_green) = 0
                       ENDIF
 
                       IF ( building_surface_pars_f%pars(ind_s_alb_l_green,is) /=     &
                            building_surface_pars_f%fill )  THEN
-                         surf_usm_h%aldir(ind_pav_green,m) =                         &
+                         surf_usm_h%aldir(m,ind_pav_green) =                         &
                                   building_surface_pars_f%pars(ind_s_alb_l_green,is)
-                         surf_usm_h%aldif(ind_pav_green,m) =                         &
+                         surf_usm_h%aldif(m,ind_pav_green) =                         &
                                   building_surface_pars_f%pars(ind_s_alb_l_green,is)
-                         surf_usm_h%albedo_type(ind_pav_green,m) = 0
+                         surf_usm_h%albedo_type(m,ind_pav_green) = 0
                       ENDIF
 
                       IF ( building_surface_pars_f%pars(ind_s_alb_s_green,is) /=     &
                            building_surface_pars_f%fill )  THEN
-                         surf_usm_h%asdir(ind_pav_green,m) =                         &
+                         surf_usm_h%asdir(m,ind_pav_green) =                         &
                                   building_surface_pars_f%pars(ind_s_alb_s_green,is)
-                         surf_usm_h%asdif(ind_pav_green,m) =                         &
+                         surf_usm_h%asdif(m,ind_pav_green) =                         &
                                   building_surface_pars_f%pars(ind_s_alb_s_green,is)
-                         surf_usm_h%albedo_type(ind_pav_green,m) = 0
+                         surf_usm_h%albedo_type(m,ind_pav_green) = 0
                       ENDIF
 
@@ -2554,75 +2556,75 @@
                          IF ( building_surface_pars_f%pars(ind_s_alb_b_wall,is) /=      &
                               building_surface_pars_f%fill )  THEN
-                            surf_usm_v(l)%albedo(ind_veg_wall,m) =                      &
+                            surf_usm_v(l)%albedo(m,ind_veg_wall) =                      &
                                      building_surface_pars_f%pars(ind_s_alb_b_wall,is)
-                            surf_usm_v(l)%albedo_type(ind_veg_wall,m) = 0
+                            surf_usm_v(l)%albedo_type(m,ind_veg_wall) = 0
                          ENDIF
 
                          IF ( building_surface_pars_f%pars(ind_s_alb_l_wall,is) /=      &
                               building_surface_pars_f%fill )  THEN
-                            surf_usm_v(l)%aldir(ind_veg_wall,m) =                       &
+                            surf_usm_v(l)%aldir(m,ind_veg_wall) =                       &
                                      building_surface_pars_f%pars(ind_s_alb_l_wall,is)
-                            surf_usm_v(l)%aldif(ind_veg_wall,m) =                       &
+                            surf_usm_v(l)%aldif(m,ind_veg_wall) =                       &
                                      building_surface_pars_f%pars(ind_s_alb_l_wall,is)
-                            surf_usm_v(l)%albedo_type(ind_veg_wall,m) = 0
+                            surf_usm_v(l)%albedo_type(m,ind_veg_wall) = 0
                          ENDIF
 
                          IF ( building_surface_pars_f%pars(ind_s_alb_s_wall,is) /=      &
                               building_surface_pars_f%fill )  THEN
-                            surf_usm_v(l)%asdir(ind_veg_wall,m) =                       &
+                            surf_usm_v(l)%asdir(m,ind_veg_wall) =                       &
                                      building_surface_pars_f%pars(ind_s_alb_s_wall,is)
-                            surf_usm_v(l)%asdif(ind_veg_wall,m) =                       &
+                            surf_usm_v(l)%asdif(m,ind_veg_wall) =                       &
                                      building_surface_pars_f%pars(ind_s_alb_s_wall,is)
-                            surf_usm_v(l)%albedo_type(ind_veg_wall,m) = 0
+                            surf_usm_v(l)%albedo_type(m,ind_veg_wall) = 0
                          ENDIF
 
                          IF ( building_surface_pars_f%pars(ind_s_alb_b_win,is) /=       &
                               building_surface_pars_f%fill )  THEN
-                            surf_usm_v(l)%albedo(ind_wat_win,m) =                       &
+                            surf_usm_v(l)%albedo(m,ind_wat_win) =                       &
                                      building_surface_pars_f%pars(ind_s_alb_b_win,is)
-                            surf_usm_v(l)%albedo_type(ind_wat_win,m) = 0
+                            surf_usm_v(l)%albedo_type(m,ind_wat_win) = 0
                          ENDIF
 
                          IF ( building_surface_pars_f%pars(ind_s_alb_l_win,is) /=       &
                               building_surface_pars_f%fill )  THEN
-                            surf_usm_v(l)%aldir(ind_wat_win,m) =                        &
+                            surf_usm_v(l)%aldir(m,ind_wat_win) =                        &
                                      building_surface_pars_f%pars(ind_s_alb_l_win,is)
-                            surf_usm_v(l)%aldif(ind_wat_win,m) =                        &
+                            surf_usm_v(l)%aldif(m,ind_wat_win) =                        &
                                      building_surface_pars_f%pars(ind_s_alb_l_win,is)
-                            surf_usm_v(l)%albedo_type(ind_wat_win,m) = 0
+                            surf_usm_v(l)%albedo_type(m,ind_wat_win) = 0
                          ENDIF
 
                          IF ( building_surface_pars_f%pars(ind_s_alb_s_win,is) /=       &
                               building_surface_pars_f%fill )  THEN
-                            surf_usm_v(l)%asdir(ind_wat_win,m) =                        &
+                            surf_usm_v(l)%asdir(m,ind_wat_win) =                        &
                                      building_surface_pars_f%pars(ind_s_alb_s_win,is)
-                            surf_usm_v(l)%asdif(ind_wat_win,m) =                        &
+                            surf_usm_v(l)%asdif(m,ind_wat_win) =                        &
                                      building_surface_pars_f%pars(ind_s_alb_s_win,is)
-                            surf_usm_v(l)%albedo_type(ind_wat_win,m) = 0
+                            surf_usm_v(l)%albedo_type(m,ind_wat_win) = 0
                          ENDIF
 
                          IF ( building_surface_pars_f%pars(ind_s_alb_b_green,is) /=     &
                               building_surface_pars_f%fill )  THEN
-                            surf_usm_v(l)%albedo(ind_pav_green,m) =                     &
+                            surf_usm_v(l)%albedo(m,ind_pav_green) =                     &
                                      building_surface_pars_f%pars(ind_s_alb_b_green,is)
-                            surf_usm_v(l)%albedo_type(ind_pav_green,m) = 0
+                            surf_usm_v(l)%albedo_type(m,ind_pav_green) = 0
                          ENDIF
 
                          IF ( building_surface_pars_f%pars(ind_s_alb_l_green,is) /=     &
                               building_surface_pars_f%fill )  THEN
-                            surf_usm_v(l)%aldir(ind_pav_green,m) =                      &
+                            surf_usm_v(l)%aldir(m,ind_pav_green) =                      &
                                      building_surface_pars_f%pars(ind_s_alb_l_green,is)
-                            surf_usm_v(l)%aldif(ind_pav_green,m) =                      &
+                            surf_usm_v(l)%aldif(m,ind_pav_green) =                      &
                                      building_surface_pars_f%pars(ind_s_alb_l_green,is)
-                            surf_usm_v(l)%albedo_type(ind_pav_green,m) = 0
+                            surf_usm_v(l)%albedo_type(m,ind_pav_green) = 0
                          ENDIF
 
                          IF ( building_surface_pars_f%pars(ind_s_alb_s_green,is) /=     &
                               building_surface_pars_f%fill )  THEN
-                            surf_usm_v(l)%asdir(ind_pav_green,m) =                      &
+                            surf_usm_v(l)%asdir(m,ind_pav_green) =                      &
                                      building_surface_pars_f%pars(ind_s_alb_s_green,is)
-                            surf_usm_v(l)%asdif(ind_pav_green,m) =                      &
+                            surf_usm_v(l)%asdif(m,ind_pav_green) =                      &
                                      building_surface_pars_f%pars(ind_s_alb_s_green,is)
-                            surf_usm_v(l)%albedo_type(ind_pav_green,m) = 0
+                            surf_usm_v(l)%albedo_type(m,ind_pav_green) = 0
                          ENDIF
 
@@ -3272,18 +3274,18 @@
                    DO  m = 1, surf%ns
                       k = surf%k(m)
-                      surf%rad_sw_out(m) = ( surf%frac(ind_veg_wall,m)  *      &
-                                             surf%albedo(ind_veg_wall,m)       &
-                                           + surf%frac(ind_pav_green,m) *      &
-                                             surf%albedo(ind_pav_green,m)      &
-                                           + surf%frac(ind_wat_win,m)   *      &
-                                             surf%albedo(ind_wat_win,m) )      &
+                      surf%rad_sw_out(m) = ( surf%frac(m,ind_veg_wall)  *      &
+                                             surf%albedo(m,ind_veg_wall)       &
+                                           + surf%frac(m,ind_pav_green) *      &
+                                             surf%albedo(m,ind_pav_green)      &
+                                           + surf%frac(m,ind_wat_win)   *      &
+                                             surf%albedo(m,ind_wat_win) )      &
                                            * surf%rad_sw_in(m)
                    
-                      surf%rad_lw_out(m) = ( surf%frac(ind_veg_wall,m)  *      &
-                                             surf%emissivity(ind_veg_wall,m)   &
-                                           + surf%frac(ind_pav_green,m) *      &
-                                             surf%emissivity(ind_pav_green,m)  &
-                                           + surf%frac(ind_wat_win,m)   *      &
-                                             surf%emissivity(ind_wat_win,m)    &
+                      surf%rad_lw_out(m) = ( surf%frac(m,ind_veg_wall)  *      &
+                                             surf%emissivity(m,ind_veg_wall)   &
+                                           + surf%frac(m,ind_pav_green) *      &
+                                             surf%emissivity(m,ind_pav_green)  &
+                                           + surf%frac(m,ind_wat_win)   *      &
+                                             surf%emissivity(m,ind_wat_win)    &
                                            )                                   &
                                            * sigma_sb                          &
@@ -3291,10 +3293,10 @@
                    
                       surf%rad_lw_out_change_0(m) =                            &
-                                         ( surf%frac(ind_veg_wall,m)  *        &
-                                           surf%emissivity(ind_veg_wall,m)     &
-                                         + surf%frac(ind_pav_green,m) *        &
-                                           surf%emissivity(ind_pav_green,m)    &
-                                         + surf%frac(ind_wat_win,m)   *        &
-                                           surf%emissivity(ind_wat_win,m)      &
+                                         ( surf%frac(m,ind_veg_wall)  *        &
+                                           surf%emissivity(m,ind_veg_wall)     &
+                                         + surf%frac(m,ind_pav_green) *        &
+                                           surf%emissivity(im,ind_pav_green)    &
+                                         + surf%frac(m,ind_wat_win)   *        &
+                                           surf%emissivity(m,ind_wat_win)      &
                                          ) * 4.0_wp * sigma_sb                 &
                                          * ( surf%pt_surface(m) * exner(k) )**3
@@ -3340,18 +3342,18 @@
 !
 !--                Weighted average according to surface fraction. 
-                   surf%rad_sw_out(m) = ( surf%frac(ind_veg_wall,m)  *         &
-                                          surf%albedo(ind_veg_wall,m)          &
-                                        + surf%frac(ind_pav_green,m) *         &
-                                          surf%albedo(ind_pav_green,m)         &
-                                        + surf%frac(ind_wat_win,m)   *         &
-                                          surf%albedo(ind_wat_win,m) )         &
+                   surf%rad_sw_out(m) = ( surf%frac(m,ind_veg_wall)  *         &
+                                          surf%albedo(m,ind_veg_wall)          &
+                                        + surf%frac(m,ind_pav_green) *         &
+                                          surf%albedo(m,ind_pav_green)         &
+                                        + surf%frac(m,ind_wat_win)   *         &
+                                          surf%albedo(m,ind_wat_win) )         &
                                         * surf%rad_sw_in(m)
 
-                   surf%rad_lw_out(m) = ( surf%frac(ind_veg_wall,m)  *         &
-                                          surf%emissivity(ind_veg_wall,m)      &
-                                        + surf%frac(ind_pav_green,m) *         &
-                                          surf%emissivity(ind_pav_green,m)     &
-                                        + surf%frac(ind_wat_win,m)   *         &
-                                          surf%emissivity(ind_wat_win,m)       &
+                   surf%rad_lw_out(m) = ( surf%frac(m,ind_veg_wall)  *         &
+                                          surf%emissivity(m,ind_veg_wall)      &
+                                        + surf%frac(m,ind_pav_green) *         &
+                                          surf%emissivity(m,ind_pav_green)     &
+                                        + surf%frac(m,ind_wat_win)   *         &
+                                          surf%emissivity(m,ind_wat_win)       &
                                         )                                      &
                                         * sigma_sb                             &
@@ -3359,10 +3361,10 @@
 
                    surf%rad_lw_out_change_0(m) =                               &
-                                      ( surf%frac(ind_veg_wall,m)  *           &
-                                        surf%emissivity(ind_veg_wall,m)        &
-                                      + surf%frac(ind_pav_green,m) *           &
-                                        surf%emissivity(ind_pav_green,m)       &
-                                      + surf%frac(ind_wat_win,m)   *           &
-                                        surf%emissivity(ind_wat_win,m)         &
+                                      ( surf%frac(m,ind_veg_wall)  *           &
+                                        surf%emissivity(m,ind_veg_wall)        &
+                                      + surf%frac(m,ind_pav_green) *           &
+                                        surf%emissivity(m,ind_pav_green)       &
+                                      + surf%frac(m,ind_wat_win)   *           &
+                                        surf%emissivity(m,ind_wat_win)         &
                                       ) * 4.0_wp * sigma_sb                    &
                                       * ( surf%pt_surface(m) * exner(k) )**3
@@ -3550,18 +3552,18 @@
 !--                calculated fluxes below are not actually used as they are 
 !--                overwritten in radiation_interaction.
-                   surf%rad_sw_out(m) = ( surf%frac(ind_veg_wall,m)  *         &
-                                          surf%albedo(ind_veg_wall,m)          &
-                                        + surf%frac(ind_pav_green,m) *         &
-                                          surf%albedo(ind_pav_green,m)         &
-                                        + surf%frac(ind_wat_win,m)   *         &
-                                          surf%albedo(ind_wat_win,m) )         &
+                   surf%rad_sw_out(m) = ( surf%frac(m,ind_veg_wall)  *         &
+                                          surf%albedo(m,ind_veg_wall)          &
+                                        + surf%frac(m,ind_pav_green) *         &
+                                          surf%albedo(m,ind_pav_green)         &
+                                        + surf%frac(m,ind_wat_win)   *         &
+                                          surf%albedo(m,ind_wat_win) )         &
                                         * surf%rad_sw_in(m)
 
-                   surf%rad_lw_out(m) = ( surf%frac(ind_veg_wall,m)  *         &
-                                          surf%emissivity(ind_veg_wall,m)      &
-                                        + surf%frac(ind_pav_green,m) *         &
-                                          surf%emissivity(ind_pav_green,m)     &
-                                        + surf%frac(ind_wat_win,m)   *         &
-                                          surf%emissivity(ind_wat_win,m)       &
+                   surf%rad_lw_out(m) = ( surf%frac(m,ind_veg_wall)  *         &
+                                          surf%emissivity(m,ind_veg_wall)      &
+                                        + surf%frac(m,ind_pav_green) *         &
+                                          surf%emissivity(m,ind_pav_green)     &
+                                        + surf%frac(m,ind_wat_win)   *         &
+                                          surf%emissivity(m,ind_wat_win)       &
                                         )                                      &
                                         * sigma_sb                             &
@@ -3569,10 +3571,10 @@
 
                    surf%rad_lw_out_change_0(m) =                               &
-                                      ( surf%frac(ind_veg_wall,m)  *           &
-                                        surf%emissivity(ind_veg_wall,m)        &
-                                      + surf%frac(ind_pav_green,m) *           &
-                                        surf%emissivity(ind_pav_green,m)       &
-                                      + surf%frac(ind_wat_win,m)   *           &
-                                        surf%emissivity(ind_wat_win,m)         &
+                                      ( surf%frac(m,ind_veg_wall)  *           &
+                                        surf%emissivity(m,ind_veg_wall)        &
+                                      + surf%frac(m,ind_pav_green) *           &
+                                        surf%emissivity(m,ind_pav_green)       &
+                                      + surf%frac(m,ind_wat_win)   *           &
+                                        surf%emissivity(m,ind_wat_win)         &
                                       ) * 4.0_wp * sigma_sb                    &
                                       * ( surf%pt_surface(m) * exner(nzb) )** 3
@@ -3749,10 +3751,10 @@
 !
 !--                Weighted average according to surface fraction. 
-                   surf%rad_lw_out(m) = ( surf%frac(ind_veg_wall,m)  *         &
-                                          surf%emissivity(ind_veg_wall,m)      &
-                                        + surf%frac(ind_pav_green,m) *         &
-                                          surf%emissivity(ind_pav_green,m)     &
-                                        + surf%frac(ind_wat_win,m)   *         &
-                                          surf%emissivity(ind_wat_win,m)       &
+                   surf%rad_lw_out(m) = ( surf%frac(m,ind_veg_wall)  *         &
+                                          surf%emissivity(m,ind_veg_wall)      &
+                                        + surf%frac(m,ind_pav_green) *         &
+                                          surf%emissivity(m,ind_pav_green)     &
+                                        + surf%frac(m,ind_wat_win)   *         &
+                                          surf%emissivity(m,ind_wat_win)       &
                                         )                                      &
                                       * sigma_sb                               &
@@ -3762,18 +3764,18 @@
                                        + surf%rad_lw_out(m) )                  &
                                        / ( 1.0_wp -                            &
-                                          ( surf%frac(ind_veg_wall,m)  *       &
-                                            surf%albedo(ind_veg_wall,m)        &
-                                         +  surf%frac(ind_pav_green,m) *       &
-                                            surf%albedo(ind_pav_green,m)       &
-                                         +  surf%frac(ind_wat_win,m)   *       &
-                                            surf%albedo(ind_wat_win,m) )       &
+                                          ( surf%frac(m,ind_veg_wall)  *       &
+                                            surf%albedo(m,ind_veg_wall)        &
+                                         +  surf%frac(m,ind_pav_green) *       &
+                                            surf%albedo(m,ind_pav_green)       &
+                                         +  surf%frac(m,ind_wat_win)   *       &
+                                            surf%albedo(m,ind_wat_win) )       &
                                          )
 
-                   surf%rad_sw_out(m) = ( surf%frac(ind_veg_wall,m)  *         &
-                                          surf%albedo(ind_veg_wall,m)          &
-                                        + surf%frac(ind_pav_green,m) *         &
-                                          surf%albedo(ind_pav_green,m)         &
-                                        + surf%frac(ind_wat_win,m)   *         &
-                                          surf%albedo(ind_wat_win,m) )         &
+                   surf%rad_sw_out(m) = ( surf%frac(m,ind_veg_wall)  *         &
+                                          surf%albedo(m,ind_veg_wall)          &
+                                        + surf%frac(m,ind_pav_green) *         &
+                                          surf%albedo(m,ind_pav_green)         &
+                                        + surf%frac(m,ind_wat_win)   *         &
+                                          surf%albedo(m,ind_wat_win) )         &
                                       * surf%rad_sw_in(m)
 
@@ -4531,19 +4533,19 @@
 !--             surfaces. 
                 DO  m = surf_lsm_h%start_index(j,i), surf_lsm_h%end_index(j,i)
-                   rrtm_emis = surf_lsm_h%frac(ind_veg_wall,m)  *              &
-                               surf_lsm_h%emissivity(ind_veg_wall,m)  +        &
-                               surf_lsm_h%frac(ind_pav_green,m) *              &
-                               surf_lsm_h%emissivity(ind_pav_green,m) +        & 
-                               surf_lsm_h%frac(ind_wat_win,m)   *              &
-                               surf_lsm_h%emissivity(ind_wat_win,m)
+                   rrtm_emis = surf_lsm_h%frac(m,ind_veg_wall)  *              &
+                               surf_lsm_h%emissivity(m,ind_veg_wall)  +        &
+                               surf_lsm_h%frac(m,ind_pav_green) *              &
+                               surf_lsm_h%emissivity(m,ind_pav_green) +        & 
+                               surf_lsm_h%frac(m,ind_wat_win)   *              &
+                               surf_lsm_h%emissivity(m,ind_wat_win)
                    rrtm_tsfc = surf_lsm_h%pt_surface(m) * exner(nzb)
                 ENDDO             
                 DO  m = surf_usm_h%start_index(j,i), surf_usm_h%end_index(j,i)
-                   rrtm_emis = surf_usm_h%frac(ind_veg_wall,m)  *              &
-                               surf_usm_h%emissivity(ind_veg_wall,m)  +        &
-                               surf_usm_h%frac(ind_pav_green,m) *              &
-                               surf_usm_h%emissivity(ind_pav_green,m) +        & 
-                               surf_usm_h%frac(ind_wat_win,m)   *              &
-                               surf_usm_h%emissivity(ind_wat_win,m)
+                   rrtm_emis = surf_usm_h%frac(m,ind_veg_wall)  *              &
+                               surf_usm_h%emissivity(m,ind_veg_wall)  +        &
+                               surf_usm_h%frac(m,ind_pav_green) *              &
+                               surf_usm_h%emissivity(m,ind_pav_green) +        & 
+                               surf_usm_h%frac(m,ind_wat_win)   *              &
+                               surf_usm_h%emissivity(m,ind_wat_win)
                    rrtm_tsfc = surf_usm_h%pt_surface(m) * exner(nzb)
                 ENDDO
@@ -4672,22 +4674,22 @@
                    DO  m = surf_lsm_h%start_index(j,i),                        &
                            surf_lsm_h%end_index(j,i)
-                      rrtm_asdir(1)  = SUM( surf_lsm_h%frac(:,m) *             &
+                      rrtm_asdir(1)  = SUM( surf_lsm_h%frac(m,:) *             &
                                             surf_lsm_h%rrtm_asdir(:,m) )
-                      rrtm_asdif(1)  = SUM( surf_lsm_h%frac(:,m) *             &
+                      rrtm_asdif(1)  = SUM( surf_lsm_h%frac(m,:) *             &
                                             surf_lsm_h%rrtm_asdif(:,m) )
-                      rrtm_aldir(1)  = SUM( surf_lsm_h%frac(:,m) *             &
+                      rrtm_aldir(1)  = SUM( surf_lsm_h%frac(m,:) *             &
                                             surf_lsm_h%rrtm_aldir(:,m) )
-                      rrtm_aldif(1)  = SUM( surf_lsm_h%frac(:,m) *             &
+                      rrtm_aldif(1)  = SUM( surf_lsm_h%frac(m,:) *             &
                                             surf_lsm_h%rrtm_aldif(:,m) )
                    ENDDO             
                    DO  m = surf_usm_h%start_index(j,i),                        &
                            surf_usm_h%end_index(j,i)
-                      rrtm_asdir(1)  = SUM( surf_usm_h%frac(:,m) *             &
+                      rrtm_asdir(1)  = SUM( surf_usm_h%frac(m,:) *             &
                                             surf_usm_h%rrtm_asdir(:,m) )
-                      rrtm_asdif(1)  = SUM( surf_usm_h%frac(:,m) *             &
+                      rrtm_asdif(1)  = SUM( surf_usm_h%frac(m,:) *             &
                                             surf_usm_h%rrtm_asdif(:,m) )
-                      rrtm_aldir(1)  = SUM( surf_usm_h%frac(:,m) *             &
+                      rrtm_aldir(1)  = SUM( surf_usm_h%frac(m,:) *             &
                                             surf_usm_h%rrtm_aldir(:,m) )
-                      rrtm_aldif(1)  = SUM( surf_usm_h%frac(:,m) *             &
+                      rrtm_aldif(1)  = SUM( surf_usm_h%frac(m,:) *             &
                                             surf_usm_h%rrtm_aldif(:,m) )
                    ENDDO
@@ -4989,73 +4991,73 @@
 !
 !--              Ocean
-                 IF ( surf%albedo_type(ind_type,m) == 1 )  THEN
-                    surf%rrtm_aldir(ind_type,m) = 0.026_wp /                    &
+                 IF ( surf%albedo_type(m,ind_type) == 1 )  THEN
+                    surf%rrtm_aldir(m,ind_type) = 0.026_wp /                    &
                                                 ( cos_zenith**1.7_wp + 0.065_wp )&
                                      + 0.15_wp * ( cos_zenith - 0.1_wp )         &
                                                * ( cos_zenith - 0.5_wp )         &
                                                * ( cos_zenith - 1.0_wp )
-                    surf%rrtm_asdir(ind_type,m) = surf%rrtm_aldir(ind_type,m)
+                    surf%rrtm_asdir(m,ind_type) = surf%rrtm_aldir(m,ind_type)
 !
 !--              Snow
-                 ELSEIF ( surf%albedo_type(ind_type,m) == 16 )  THEN
+                 ELSEIF ( surf%albedo_type(m,ind_type) == 16 )  THEN
                     IF ( cos_zenith < 0.5_wp )  THEN
-                       surf%rrtm_aldir(ind_type,m) =                           &
-                                 0.5_wp * ( 1.0_wp - surf%aldif(ind_type,m) )  &
+                       surf%rrtm_aldir(m,ind_type) =                           &
+                                 0.5_wp * ( 1.0_wp - surf%aldif(im,ind_type) )  &
                                         * ( ( 3.0_wp / ( 1.0_wp + 4.0_wp       &
                                         * cos_zenith ) ) - 1.0_wp )
-                       surf%rrtm_asdir(ind_type,m) =                           &
-                                 0.5_wp * ( 1.0_wp - surf%asdif(ind_type,m) )  &
+                       surf%rrtm_asdir(m,ind_type) =                           &
+                                 0.5_wp * ( 1.0_wp - surf%asdif(m,ind_type) )  &
                                         * ( ( 3.0_wp / ( 1.0_wp + 4.0_wp       &
                                         * cos_zenith ) ) - 1.0_wp )
 
-                       surf%rrtm_aldir(ind_type,m) =                           &
-                                       MIN(0.98_wp, surf%rrtm_aldir(ind_type,m))
-                       surf%rrtm_asdir(ind_type,m) =                           &
-                                       MIN(0.98_wp, surf%rrtm_asdir(ind_type,m))
+                       surf%rrtm_aldir(m,ind_type) =                           &
+                                       MIN(0.98_wp, surf%rrtm_aldir(m,ind_type))
+                       surf%rrtm_asdir(m,ind_type) =                           &
+                                       MIN(0.98_wp, surf%rrtm_asdir(m,ind_type))
                     ELSE
-                       surf%rrtm_aldir(ind_type,m) = surf%aldif(ind_type,m)
-                       surf%rrtm_asdir(ind_type,m) = surf%asdif(ind_type,m)
+                       surf%rrtm_aldir(m,ind_type) = surf%aldif(m,ind_type)
+                       surf%rrtm_asdir(m,ind_type) = surf%asdif(m,ind_type)
                     ENDIF
 !
 !--              Sea ice
-                 ELSEIF ( surf%albedo_type(ind_type,m) == 15 )  THEN
-                    surf%rrtm_aldir(ind_type,m) = surf%aldif(ind_type,m)
-                    surf%rrtm_asdir(ind_type,m) = surf%asdif(ind_type,m)
+                 ELSEIF ( surf%albedo_type(m,ind_type) == 15 )  THEN
+                    surf%rrtm_aldir(m,ind_type) = surf%aldif(m,ind_type)
+                    surf%rrtm_asdir(m,ind_type) = surf%asdif(m,ind_type)
 
 !
 !--              Asphalt
-                 ELSEIF ( surf%albedo_type(ind_type,m) == 17 )  THEN
-                    surf%rrtm_aldir(ind_type,m) = surf%aldif(ind_type,m)
-                    surf%rrtm_asdir(ind_type,m) = surf%asdif(ind_type,m)
+                 ELSEIF ( surf%albedo_type(m,ind_type) == 17 )  THEN
+                    surf%rrtm_aldir(m,ind_type) = surf%aldif(m,ind_type)
+                    surf%rrtm_asdir(m,ind_type) = surf%asdif(m,ind_type)
 
 
 !
 !--              Bare soil
-                 ELSEIF ( surf%albedo_type(ind_type,m) == 18 )  THEN
-                    surf%rrtm_aldir(ind_type,m) = surf%aldif(ind_type,m)
-                    surf%rrtm_asdir(ind_type,m) = surf%asdif(ind_type,m)
+                 ELSEIF ( surf%albedo_type(m,ind_type) == 18 )  THEN
+                    surf%rrtm_aldir(m,ind_type) = surf%aldif(m,ind_type)
+                    surf%rrtm_asdir(m,ind_type) = surf%asdif(m,ind_type)
 
 !
 !--              Land surfaces
                  ELSE
-                    SELECT CASE ( surf%albedo_type(ind_type,m) )
+                    SELECT CASE ( surf%albedo_type(m,ind_type) )
 
 !
 !--                    Surface types with strong zenith dependence
                        CASE ( 1, 2, 3, 4, 11, 12, 13 )
-                          surf%rrtm_aldir(ind_type,m) =                        &
-                                surf%aldif(ind_type,m) * 1.4_wp /              &
+                          surf%rrtm_aldir(m,ind_type) =                        &
+                                surf%aldif(m,ind_type) * 1.4_wp /              &
                                            ( 1.0_wp + 0.8_wp * cos_zenith )
-                          surf%rrtm_asdir(ind_type,m) =                        &
-                                surf%asdif(ind_type,m) * 1.4_wp /              &
+                          surf%rrtm_asdir(m,ind_type) =                        &
+                                surf%asdif(m,ind_type) * 1.4_wp /              &
                                            ( 1.0_wp + 0.8_wp * cos_zenith )
 !
 !--                    Surface types with weak zenith dependence
                        CASE ( 5, 6, 7, 8, 9, 10, 14 )
-                          surf%rrtm_aldir(ind_type,m) =                        &
-                                surf%aldif(ind_type,m) * 1.1_wp /              &
+                          surf%rrtm_aldir(m,ind_type) =                        &
+                                surf%aldif(m,ind_type) * 1.1_wp /              &
                                            ( 1.0_wp + 0.2_wp * cos_zenith )
-                          surf%rrtm_asdir(ind_type,m) =                        &
-                                surf%asdif(ind_type,m) * 1.1_wp /              &
+                          surf%rrtm_asdir(m,ind_type) =                        &
+                                surf%asdif(m,ind_type) * 1.1_wp /              &
                                            ( 1.0_wp + 0.2_wp * cos_zenith )
 
@@ -5066,6 +5068,6 @@
 !
 !--              Diffusive albedo is taken from Table 2
-                 surf%rrtm_aldif(ind_type,m) = surf%aldif(ind_type,m)
-                 surf%rrtm_asdif(ind_type,m) = surf%asdif(ind_type,m)
+                 surf%rrtm_aldif(m,ind_type) = surf%aldif(m,ind_type)
+                 surf%rrtm_asdif(m,ind_type) = surf%asdif(m,ind_type)
               ENDDO
            ENDDO
@@ -5883,26 +5885,28 @@
      DO  i = nxl, nxr
         DO  j = nys, nyn
-!--           urban
+!
+!--        urban
            DO  m = surf_usm_h%start_index(j,i), surf_usm_h%end_index(j,i)
-              surfoutll(mm) = SUM ( surf_usm_h%frac(:,m) *                  &
-                                    surf_usm_h%emissivity(:,m) )            &
+              surfoutll(mm) = SUM ( surf_usm_h%frac(m,:) *                  &
+                                    surf_usm_h%emissivity(m,:) )            &
                                   * sigma_sb                                &
                                   * surf_usm_h%pt_surface(m)**4
-              albedo_surf(mm) = SUM ( surf_usm_h%frac(:,m) *                &
-                                      surf_usm_h%albedo(:,m) )
-              emiss_surf(mm)  = SUM ( surf_usm_h%frac(:,m) *                &
-                                      surf_usm_h%emissivity(:,m) )
+              albedo_surf(mm) = SUM ( surf_usm_h%frac(m,:) *                &
+                                      surf_usm_h%albedo(m,:) )
+              emiss_surf(mm)  = SUM ( surf_usm_h%frac(m,:) *                &
+                                      surf_usm_h%emissivity(m,:) )
               mm = mm + 1
            ENDDO
-!--           land
+!
+!--        land
            DO  m = surf_lsm_h%start_index(j,i), surf_lsm_h%end_index(j,i)
-              surfoutll(mm) = SUM ( surf_lsm_h%frac(:,m) *                  &
-                                    surf_lsm_h%emissivity(:,m) )            &
+              surfoutll(mm) = SUM ( surf_lsm_h%frac(m,:) *                  &
+                                    surf_lsm_h%emissivity(m,:) )            &
                                   * sigma_sb                                &
                                   * surf_lsm_h%pt_surface(m)**4
-              albedo_surf(mm) = SUM ( surf_lsm_h%frac(:,m) *                &
-                                      surf_lsm_h%albedo(:,m) )
-              emiss_surf(mm)  = SUM ( surf_lsm_h%frac(:,m) *                &
-                                      surf_lsm_h%emissivity(:,m) )
+              albedo_surf(mm) = SUM ( surf_lsm_h%frac(m,:) *                &
+                                      surf_lsm_h%albedo(m,:) )
+              emiss_surf(mm)  = SUM ( surf_lsm_h%frac(m,:) *                &
+                                      surf_lsm_h%emissivity(m,:) )
               mm = mm + 1
            ENDDO
@@ -5910,33 +5914,35 @@
      ENDDO
 !
-!--     Vertical walls
+!--  Vertical walls
      DO  i = nxl, nxr
         DO  j = nys, nyn
            DO  ll = 0, 3
               l = reorder(ll)
-!--              urban
+!
+!--           urban
               DO  m = surf_usm_v(l)%start_index(j,i),                       &
                       surf_usm_v(l)%end_index(j,i)
-                 surfoutll(mm) = SUM ( surf_usm_v(l)%frac(:,m) *            &
-                                       surf_usm_v(l)%emissivity(:,m) )      &
+                 surfoutll(mm) = SUM ( surf_usm_v(l)%frac(m,:) *            &
+                                       surf_usm_v(l)%emissivity(m,:) )      &
                                   * sigma_sb                                &
                                   * surf_usm_v(l)%pt_surface(m)**4
-                 albedo_surf(mm) = SUM ( surf_usm_v(l)%frac(:,m) *          &
-                                         surf_usm_v(l)%albedo(:,m) )
-                 emiss_surf(mm)  = SUM ( surf_usm_v(l)%frac(:,m) *          &
-                                         surf_usm_v(l)%emissivity(:,m) )
+                 albedo_surf(mm) = SUM ( surf_usm_v(l)%frac(m,:) *          &
+                                         surf_usm_v(l)%albedo(m,:) )
+                 emiss_surf(mm)  = SUM ( surf_usm_v(l)%frac(m,:) *          &
+                                         surf_usm_v(l)%emissivity(m,:) )
                  mm = mm + 1
               ENDDO
-!--              land
+!
+!--           land
               DO  m = surf_lsm_v(l)%start_index(j,i),                       &
                       surf_lsm_v(l)%end_index(j,i)
-                 surfoutll(mm) = SUM ( surf_lsm_v(l)%frac(:,m) *            &
-                                       surf_lsm_v(l)%emissivity(:,m) )      &
+                 surfoutll(mm) = SUM ( surf_lsm_v(l)%frac(m,:) *            &
+                                       surf_lsm_v(l)%emissivity(m,:) )      &
                                   * sigma_sb                                &
                                   * surf_lsm_v(l)%pt_surface(m)**4
-                 albedo_surf(mm) = SUM ( surf_lsm_v(l)%frac(:,m) *          &
-                                         surf_lsm_v(l)%albedo(:,m) )
-                 emiss_surf(mm)  = SUM ( surf_lsm_v(l)%frac(:,m) *          &
-                                         surf_lsm_v(l)%emissivity(:,m) )
+                 albedo_surf(mm) = SUM ( surf_lsm_v(l)%frac(m,:) *          &
+                                         surf_lsm_v(l)%albedo(m,:) )
+                 emiss_surf(mm)  = SUM ( surf_lsm_v(l)%frac(m,:) *          &
+                                         surf_lsm_v(l)%emissivity(m,:) )
                  mm = mm + 1
               ENDDO
@@ -5945,5 +5951,5 @@
      ENDDO
 
-     IF ( trace_fluxes_above >= 0._wp )  THEN
+     IF ( trace_fluxes_above >= 0.0_wp )  THEN
         CALL radiation_print_debug_surf( 'surfoutll before initial pass', surfoutll )
         CALL radiation_print_debug_horz( 'rad_lw_in_diff before initial pass', rad_lw_in_diff )
@@ -6008,5 +6014,5 @@
         j = FLOOR(ACOS(cos_zenith) / pi * raytrace_discrete_elevs)
         i = MODULO(NINT(ATAN2(sun_dir_lon, sun_dir_lat)               &
-                        / (2._wp*pi) * raytrace_discrete_azims-.5_wp, iwp), &
+                        / (2.0_wp*pi) * raytrace_discrete_azims-0.5_wp, iwp), &
                    raytrace_discrete_azims)
         isd = dsidir_rev(j, i)
@@ -6024,5 +6030,5 @@
            i = mrtbl(ix, imrt)
            mrtinsw(imrt) = mrtinsw(imrt) + mrtdsit(imrt, isd) * rad_sw_in_dir(j,i) &
-                                     / cos_zenith / 4._wp ! normal to sphere
+                                     / cos_zenith / 4.0_wp ! normal to sphere
         ENDDO
      ENDIF
@@ -6039,7 +6045,7 @@
      IF ( npcbl > 0 )  THEN
 
-         pcbinswdir(:) = 0._wp
-         pcbinswdif(:) = 0._wp
-         pcbinlw(:) = 0._wp
+         pcbinswdir(:) = 0.0_wp
+         pcbinswdif(:) = 0.0_wp
+         pcbinlw(:) = 0.0_wp
 
          DO icsf = 1, ncsfl
@@ -6065,5 +6071,5 @@
                 IF ( cos_zenith > 0 )  THEN
 !--                Estimate directed box absorption
-                   pc_abs_frac = 1._wp - exp(pc_abs_eff * lad_s(k,j,i))
+                   pc_abs_frac = 1.0_wp - exp(pc_abs_eff * lad_s(k,j,i))
 !
 !--                isd has already been established, see 1)
@@ -6091,5 +6097,5 @@
      ENDIF
 
-     IF ( trace_fluxes_above >= 0._wp )  THEN
+     IF ( trace_fluxes_above >= 0.0_wp )  THEN
         CALL radiation_print_debug_surf( 'surfinl after initial pass', surfinl )
         CALL radiation_print_debug_surf( 'surfinlwdif after initial pass', surfinlwdif )
@@ -6118,5 +6124,5 @@
      ENDIF
 
-     IF ( trace_fluxes_above >= 0._wp )  THEN
+     IF ( trace_fluxes_above >= 0.0_wp )  THEN
         CALL radiation_print_debug_surf( 'surfinl after PC emiss', surfinl )
      ENDIF
@@ -6135,5 +6141,5 @@
         nrefsteps = 0
         surfoutsl = albedo_surf * surfins
-        surfoutll = (1._wp - emiss_surf) * surfinl
+        surfoutll = (1.0_wp - emiss_surf) * surfinl
         surfoutsw = surfoutsw + surfoutsl
         surfoutlw = surfoutlw + surfoutll
@@ -6148,7 +6154,7 @@
 !
 !--      for non-transparent surfaces, longwave albedo is 1 - emissivity
-         surfoutll = (1._wp - emiss_surf) * surfinl
-
-         IF ( trace_fluxes_above >= 0._wp )  THEN
+         surfoutll = (1.0_wp - emiss_surf) * surfinl
+
+         IF ( trace_fluxes_above >= 0.0_wp )  THEN
             CALL radiation_print_debug_surf( 'surfoutll before reflective pass', surfoutll, refstep )
             CALL radiation_print_debug_surf( 'surfoutsl before reflective pass', surfoutsl, refstep )
@@ -6178,6 +6184,6 @@
 !
 !--      Reset for the input from next reflective pass
-         surfins = 0._wp
-         surfinl = 0._wp
+         surfins = 0.0_wp
+         surfinl = 0.00_wp
 !
 !--      Reflected radiation
@@ -6222,5 +6228,5 @@
          ENDDO
 
-         IF ( trace_fluxes_above >= 0._wp )  THEN
+         IF ( trace_fluxes_above >= 0.0_wp )  THEN
             CALL radiation_print_debug_surf( 'surfinl after reflected pass', surfinl, refstep )
             CALL radiation_print_debug_surf( 'surfins after reflected pass', surfins, refstep )
@@ -6268,7 +6274,7 @@
      IF ( nmrtbl > 0 )  THEN
         IF ( mrt_include_sw )  THEN
-           mrt(:) = ((mrtinsw(:) + mrtinlw(:)) / sigma_sb) ** .25_wp
+           mrt(:) = ((mrtinsw(:) + mrtinlw(:)) / sigma_sb) ** 0.25_wp
         ELSE
-           mrt(:) = (mrtinlw(:) / sigma_sb) ** .25_wp
+           mrt(:) = (mrtinlw(:) / sigma_sb) ** 0.25_wp
         ENDIF
      ENDIF
