Index: palm/trunk/SCRIPTS/palmrun
===================================================================
--- palm/trunk/SCRIPTS/palmrun	(revision 2511)
+++ palm/trunk/SCRIPTS/palmrun	(revision 2512)
@@ -662,11 +662,11 @@
 
 
-             # CHECK, IF DIRECTORY IS UNDER SVN CONTROL
-          if [[ ! -d .svn ]]
+             # CHECK, IF TRUNK-DIRECTORY IS UNDER SVN CONTROL
+          if [[ ! -d ../.svn ]]
           then
              printf "\n\n  +++ source directory"
              printf "\n         \"$source_path\" "
              printf "\n         is not under control of \"subversion\"."
-             printf "\n         Please do not use palmmrun-option \"-s LM\"\n"
+             printf "\n         Please do not use palmrun-option \"-s LM\"\n"
           fi
 
Index: palm/trunk/SOURCE/check_open.f90
===================================================================
--- palm/trunk/SOURCE/check_open.f90	(revision 2511)
+++ palm/trunk/SOURCE/check_open.f90	(revision 2512)
@@ -25,4 +25,9 @@
 ! -----------------
 ! $Id$
+! upper bounds of cross section and 3d output changed from nx+1,ny+1 to nx,ny
+! no output of ghost layer data
+! iso2d-related parts removed
+! 
+! 2300 2017-06-29 13:31:14Z raasch
 ! -host
 ! 
@@ -178,54 +183,16 @@
     CHARACTER (LEN=2)   ::  mask_char               !<
     CHARACTER (LEN=2)   ::  suffix                  !<
-    CHARACTER (LEN=20)  ::  xtext = 'time in s'     !<
     CHARACTER (LEN=30)  ::  filename                !<
     CHARACTER (LEN=80)  ::  rtext                   !<
-    CHARACTER (LEN=100) ::  batch_scp               !<
     CHARACTER (LEN=100) ::  line                    !<
-    CHARACTER (LEN=400) ::  command                 !<
 
     INTEGER(iwp) ::  av          !<
-    INTEGER(iwp) ::  numline = 1 !<
-    INTEGER(iwp) ::  cranz       !<
     INTEGER(iwp) ::  file_id     !<
     INTEGER(iwp) ::  i           !<
-    INTEGER(iwp) ::  iaddres     !<
     INTEGER(iwp) ::  ioerr       !< IOSTAT flag for IO-commands ( 0 = no error )
-    INTEGER(iwp) ::  iusern      !<
     INTEGER(iwp) ::  j           !<
     INTEGER(iwp) ::  k           !<
-    INTEGER(iwp) ::  legpos = 1  !<
-    INTEGER(iwp) ::  timodex = 1 !<
     
-    INTEGER(iwp), DIMENSION(10) ::  klist !<
-
-    LOGICAL ::  datleg = .TRUE.               !<
-    LOGICAL ::  get_filenames                 !<
-    LOGICAL ::  grid = .TRUE.                 !<
-    LOGICAL ::  netcdf_extend                 !<
-    LOGICAL ::  rand = .TRUE.                 !<
-    LOGICAL ::  swap = .TRUE.                 !<
-    LOGICAL ::  twoxa = .TRUE.                !<
-    LOGICAL ::  twoya = .TRUE.                !<
-
-    REAL(wp) ::  ansx = -999.999_wp !<
-    REAL(wp) ::  ansy = -999.999_wp !<
-    REAL(wp) ::  gwid = 0.1_wp      !<
-    REAL(wp) ::  rlegfak = 1.5_wp   !<
-    REAL(wp) ::  sizex = 250.0_wp   !<
-    REAL(wp) ::  sizey = 40.0_wp    !<
-    REAL(wp) ::  texfac = 1.5_wp    !<
-
-    REAL(wp), DIMENSION(:), ALLOCATABLE      ::  eta !<
-    REAL(wp), DIMENSION(:), ALLOCATABLE      ::  ho  !<
-    REAL(wp), DIMENSION(:), ALLOCATABLE      ::  hu  !<
- 
-
-
-    NAMELIST /RAHMEN/  numline, cranz, datleg, rtext, swap
-    NAMELIST /CROSS/   ansx, ansy, grid, gwid, klist, legpos,                  &
-                       rand, rlegfak, sizex, sizey, texfac,                    &
-                       timodex, twoxa, twoya, xtext
-                       
+    LOGICAL ::  netcdf_extend    !<
 
 !
@@ -422,22 +389,8 @@
           IF ( myid == 0  .AND.  .NOT. openfile(file_id)%opened_before )  THEN
 !
-!--          Output for combine_plot_fields
+!--          Write index bounds of total domain for combine_plot_fields
              IF ( data_output_2d_on_each_pe  .AND.  myid_char /= '' )  THEN
-                WRITE (21)  -nbgp, nx+nbgp, -nbgp, ny+nbgp    ! total array size
-                WRITE (21)   0, nx+1,  0, ny+1    ! output part
-             ENDIF
-!
-!--          Determine and write ISO2D coordiante header
-             ALLOCATE( eta(0:ny+1), ho(0:nx+1), hu(0:nx+1) )
-             hu = 0.0_wp
-             ho = (ny+1) * dy
-             DO  i = 1, ny
-                eta(i) = REAL( i ) / ( ny + 1.0_wp )
-             ENDDO
-             eta(0)    = 0.0_wp
-             eta(ny+1) = 1.0_wp
-
-             WRITE (21)  dx,eta,hu,ho
-             DEALLOCATE( eta, ho, hu )
+                WRITE (21)   0, nx,  0, ny
+             ENDIF
 
           ENDIF
@@ -455,22 +408,8 @@
           IF ( myid == 0  .AND.  .NOT. openfile(file_id)%opened_before )  THEN
 !
-!--          Output for combine_plot_fields
+!--          Write index bounds of total domain for combine_plot_fields
              IF ( data_output_2d_on_each_pe  .AND.  myid_char /= '' )  THEN
-                WRITE (22)  -nbgp, nx+nbgp, 0, nz+1    ! total array size
-                WRITE (22)   0, nx+1, 0, nz+1    ! output part
-             ENDIF
-!
-!--          Determine and write ISO2D coordinate header
-             ALLOCATE( eta(0:nz+1), ho(0:nx+1), hu(0:nx+1) )
-             hu = 0.0_wp
-             ho = zu(nz+1)
-             DO  i = 1, nz
-                eta(i) = REAL( zu(i) ) / zu(nz+1)
-             ENDDO
-             eta(0)    = 0.0_wp
-             eta(nz+1) = 1.0_wp
-
-             WRITE (22)  dx,eta,hu,ho
-             DEALLOCATE( eta, ho, hu )
+                WRITE (22)   0, nx, 0, nz+1    ! output part
+             ENDIF
 
           ENDIF
@@ -488,22 +427,8 @@
           IF ( myid == 0  .AND.  .NOT. openfile(file_id)%opened_before )  THEN
 !
-!--          Output for combine_plot_fields
+!--          Write index bounds of total domain for combine_plot_fields
              IF ( data_output_2d_on_each_pe  .AND.  myid_char /= '' )  THEN
-                WRITE (23)  -nbgp, ny+nbgp, 0, nz+1    ! total array size
-                WRITE (23)   0, ny+1, 0, nz+1    ! output part
-             ENDIF
-!
-!--          Determine and write ISO2D coordiante header
-             ALLOCATE( eta(0:nz+1), ho(0:ny+1), hu(0:ny+1) )
-             hu = 0.0_wp
-             ho = zu(nz+1)
-             DO  i = 1, nz
-                eta(i) = REAL( zu(i) ) / zu(nz+1)
-             ENDDO
-             eta(0)    = 0.0_wp
-             eta(nz+1) = 1.0_wp
-
-             WRITE (23)  dx,eta,hu,ho
-             DEALLOCATE( eta, ho, hu )
+                WRITE (23)   0, ny, 0, nz+1    ! output part
+             ENDIF
 
           ENDIF
@@ -514,11 +439,8 @@
                      FORM='UNFORMATTED' )
 !
-!--       Write coordinate file for AVS
+!--       Specifications for combine_plot_fields
           IF ( myid == 0 )  THEN
 #if defined( __parallel )
-!
-!--          Specifications for combine_plot_fields
-             WRITE ( 30 )  -nbgp,nx+nbgp,-nbgp,ny+nbgp
-             WRITE ( 30 )  0,nx+1,0,ny+1,0,nz_do3d
+             WRITE ( 30 )  0, nx, 0, ny, 0, nz_do3d
 #endif
           ENDIF
Index: palm/trunk/SOURCE/data_output_2d.f90
===================================================================
--- palm/trunk/SOURCE/data_output_2d.f90	(revision 2511)
+++ palm/trunk/SOURCE/data_output_2d.f90	(revision 2512)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! upper bounds of cross section output changed from nx+1,ny+1 to nx,ny
+! no output of ghost layer data
+! 
+! 2292 2017-06-20 09:51:42Z schwenkel
 ! Implementation of new microphysic scheme: cloud_scheme = 'morrison' 
 ! includes two more prognostic equations for cloud drop concentration (nc)  
@@ -165,6 +169,6 @@
 ! Description:
 ! ------------
-!> Data output of horizontal cross-sections in netCDF format or binary format
-!> compatible to old graphic software iso2d.
+!> Data output of cross-sections in netCDF format or binary format
+!> to be later converted to NetCDF by helper routine combine_plot_fields.
 !> Attention: The position of the sectional planes is still not always computed 
 !> ---------  correctly. (zu is used always)!
@@ -201,6 +205,5 @@
         
     USE indices,                                                               &
-        ONLY:  nbgp, nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg,       &
-               nz, nzb, nzt
+        ONLY:  nbgp, nx, nxl, nxr, ny, nyn, nys, nz, nzb, nzt
                
     USE kinds
@@ -271,5 +274,4 @@
     REAL(wp), DIMENSION(:,:), ALLOCATABLE   ::  local_2d            !<
     REAL(wp), DIMENSION(:,:), ALLOCATABLE   ::  local_2d_l          !<
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE   ::  tmp_2d              !< temporary field used to exchange surface-related quantities
 
     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  local_pf            !<
@@ -303,5 +305,5 @@
        CASE ( 'xy' )
           s_ind = 1
-          ALLOCATE( level_z(nzb:nzt+1), local_2d(nxlg:nxrg,nysg:nyng) )
+          ALLOCATE( level_z(nzb:nzt+1), local_2d(nxl:nxr,nys:nyn) )
 
           IF ( netcdf_data_format > 4 )  THEN
@@ -311,5 +313,5 @@
              ENDDO
              ns = ns - 1
-             ALLOCATE( local_2d_sections(nxlg:nxrg,nysg:nyng,1:ns) )
+             ALLOCATE( local_2d_sections(nxl:nxr,nys:nyn,1:ns) )
              local_2d_sections = 0.0_wp
           ENDIF
@@ -325,5 +327,5 @@
              IF ( myid == 0 )  THEN
 #if defined( __parallel )
-                ALLOCATE( total_2d(-nbgp:nx+nbgp,-nbgp:ny+nbgp) )
+                ALLOCATE( total_2d(0:nx,0:ny) )
 #endif
              ENDIF
@@ -332,5 +334,5 @@
        CASE ( 'xz' )
           s_ind = 2
-          ALLOCATE( local_2d(nxlg:nxrg,nzb:nzt+1) )
+          ALLOCATE( local_2d(nxl:nxr,nzb:nzt+1) )
 
           IF ( netcdf_data_format > 4 )  THEN
@@ -340,6 +342,6 @@
              ENDDO
              ns = ns - 1
-             ALLOCATE( local_2d_sections(nxlg:nxrg,1:ns,nzb:nzt+1) )
-             ALLOCATE( local_2d_sections_l(nxlg:nxrg,1:ns,nzb:nzt+1) )
+             ALLOCATE( local_2d_sections(nxl:nxr,1:ns,nzb:nzt+1) )
+             ALLOCATE( local_2d_sections_l(nxl:nxr,1:ns,nzb:nzt+1) )
              local_2d_sections = 0.0_wp; local_2d_sections_l = 0.0_wp
           ENDIF
@@ -356,5 +358,5 @@
              IF ( myid == 0 )  THEN
 #if defined( __parallel )
-                ALLOCATE( total_2d(-nbgp:nx+nbgp,nzb:nzt+1) )
+                ALLOCATE( total_2d(0:nx,nzb:nzt+1) )
 #endif
              ENDIF
@@ -363,5 +365,5 @@
        CASE ( 'yz' )
           s_ind = 3
-          ALLOCATE( local_2d(nysg:nyng,nzb:nzt+1) )
+          ALLOCATE( local_2d(nys:nyn,nzb:nzt+1) )
 
           IF ( netcdf_data_format > 4 )  THEN
@@ -371,6 +373,6 @@
              ENDDO
              ns = ns - 1
-             ALLOCATE( local_2d_sections(1:ns,nysg:nyng,nzb:nzt+1) )
-             ALLOCATE( local_2d_sections_l(1:ns,nysg:nyng,nzb:nzt+1) )
+             ALLOCATE( local_2d_sections(1:ns,nys:nyn,nzb:nzt+1) )
+             ALLOCATE( local_2d_sections_l(1:ns,nys:nyn,nzb:nzt+1) )
              local_2d_sections = 0.0_wp; local_2d_sections_l = 0.0_wp
           ENDIF
@@ -387,5 +389,5 @@
              IF ( myid == 0 )  THEN
 #if defined( __parallel )
-                ALLOCATE( total_2d(-nbgp:ny+nbgp,nzb:nzt+1) )
+                ALLOCATE( total_2d(0:ny,nzb:nzt+1) )
 #endif
              ENDIF
@@ -434,10 +436,6 @@
 !
 !-- Allocate a temporary array for resorting (kji -> ijk).
-    ALLOCATE( local_pf(nxlg:nxrg,nysg:nyng,nzb:nzt+1) )
+    ALLOCATE( local_pf(nxl:nxr,nys:nyn,nzb:nzt+1) )
     local_pf = 0.0
-!
-!-- Allocate temporary array used for exchanging ghoist points of surface-data
-    ALLOCATE( tmp_2d(nysg:nyng,nxlg:nxrg) )
-    tmp_2d = 0.0
 
 !
@@ -481,6 +479,6 @@
              CASE ( 'lwp*_xy' )        ! 2d-array
                 IF ( av == 0 )  THEN
-                   DO  i = nxlg, nxrg
-                      DO  j = nysg, nyng
+                   DO  i = nxl, nxr
+                      DO  j = nys, nyn
                          local_pf(i,j,nzb+1) = SUM( ql(nzb:nzt,j,i) *          &
                                                     dzw(1:nzt+1) )
@@ -488,6 +486,6 @@
                    ENDDO
                 ELSE
-                   DO  i = nxlg, nxrg
-                      DO  j = nysg, nyng
+                   DO  i = nxl, nxr
+                      DO  j = nys, nyn
                          local_pf(i,j,nzb+1) = lwp_av(j,i)
                       ENDDO
@@ -519,28 +517,19 @@
                       i = surf_def_h(0)%i(m)
                       j = surf_def_h(0)%j(m)
-                      tmp_2d(j,i) = surf_def_h(0)%ol(m)
+                      local_pf(i,j,nzb+1) = surf_def_h(0)%ol(m)
                    ENDDO
                    DO  m = 1, surf_lsm_h%ns
                       i = surf_lsm_h%i(m)
                       j = surf_lsm_h%j(m)
-                      tmp_2d(j,i) = surf_lsm_h%ol(m)
+                      local_pf(i,j,nzb+1) = surf_lsm_h%ol(m)
                    ENDDO
                    DO  m = 1, surf_usm_h%ns
                       i = surf_usm_h%i(m)
                       j = surf_usm_h%j(m)
-                      tmp_2d(j,i) = surf_usm_h%ol(m)
-                   ENDDO
-
-                   CALL exchange_horiz_2d( tmp_2d, nbgp )
-
-                   DO  i = nxlg, nxrg
-                      DO  j = nysg, nyng
-                         local_pf(i,j,nzb+1) = tmp_2d(j,i)
-                      ENDDO
-                   ENDDO
-
-                ELSE
-                   DO  i = nxlg, nxrg
-                      DO  j = nysg, nyng
+                      local_pf(i,j,nzb+1) = surf_usm_h%ol(m)
+                   ENDDO
+                ELSE
+                   DO  i = nxl, nxr
+                      DO  j = nys, nyn
                          local_pf(i,j,nzb+1) = ol_av(j,i)
                       ENDDO
@@ -565,10 +554,10 @@
                    IF ( simulated_time >= particle_advection_start )  THEN
                       tend = prt_count
-                      CALL exchange_horiz( tend, nbgp )
+!                      CALL exchange_horiz( tend, nbgp )
                    ELSE
                       tend = 0.0_wp
                    ENDIF
-                   DO  i = nxlg, nxrg
-                      DO  j = nysg, nyng
+                   DO  i = nxl, nxr
+                      DO  j = nys, nyn
                          DO  k = nzb, nzt+1
                             local_pf(i,j,k) = tend(k,j,i)
@@ -578,5 +567,5 @@
                    resorted = .TRUE.
                 ELSE
-                   CALL exchange_horiz( pc_av, nbgp )
+!                   CALL exchange_horiz( pc_av, nbgp )
                    to_be_resorted => pc_av
                 ENDIF
@@ -610,10 +599,10 @@
                          ENDDO
                       ENDDO
-                      CALL exchange_horiz( tend, nbgp )
+!                      CALL exchange_horiz( tend, nbgp )
                    ELSE
                       tend = 0.0_wp
                    ENDIF
-                   DO  i = nxlg, nxrg
-                      DO  j = nysg, nyng
+                   DO  i = nxl, nxr
+                      DO  j = nys, nyn
                          DO  k = nzb, nzt+1
                             local_pf(i,j,k) = tend(k,j,i)
@@ -623,12 +612,12 @@
                    resorted = .TRUE.
                 ELSE
-                   CALL exchange_horiz( pr_av, nbgp )
+!                   CALL exchange_horiz( pr_av, nbgp )
                    to_be_resorted => pr_av
                 ENDIF
 
              CASE ( 'pra*_xy' )        ! 2d-array / integral quantity => no av
-                CALL exchange_horiz_2d( precipitation_amount )
-                   DO  i = nxlg, nxrg
-                      DO  j = nysg, nyng
+!                CALL exchange_horiz_2d( precipitation_amount )
+                   DO  i = nxl, nxr
+                      DO  j = nys, nyn
                       local_pf(i,j,nzb+1) =  precipitation_amount(j,i)
                    ENDDO
@@ -641,14 +630,14 @@
              CASE ( 'prr*_xy' )        ! 2d-array
                 IF ( av == 0 )  THEN
-                   CALL exchange_horiz_2d( prr(nzb+1,:,:) )
-                   DO  i = nxlg, nxrg
-                      DO  j = nysg, nyng
+!                   CALL exchange_horiz_2d( prr(nzb+1,:,:) )
+                   DO  i = nxl, nxr
+                      DO  j = nys, nyn
                          local_pf(i,j,nzb+1) = prr(nzb+1,j,i) * hyrho(nzb+1)
                       ENDDO
                    ENDDO
                 ELSE
-                   CALL exchange_horiz_2d( prr_av(nzb+1,:,:) )
-                   DO  i = nxlg, nxrg
-                      DO  j = nysg, nyng
+!                   CALL exchange_horiz_2d( prr_av(nzb+1,:,:) )
+                   DO  i = nxl, nxr
+                      DO  j = nys, nyn
                          local_pf(i,j,nzb+1) = prr_av(nzb+1,j,i) * hyrho(nzb+1)
                       ENDDO
@@ -661,7 +650,7 @@
              CASE ( 'prr_xy', 'prr_xz', 'prr_yz' )
                 IF ( av == 0 )  THEN
-                   CALL exchange_horiz( prr, nbgp )
-                   DO  i = nxlg, nxrg
-                      DO  j = nysg, nyng
+!                   CALL exchange_horiz( prr, nbgp )
+                   DO  i = nxl, nxr
+                      DO  j = nys, nyn
                          DO  k = nzb, nzt+1
                             local_pf(i,j,k) = prr(k,j,i) * hyrho(nzb+1)
@@ -670,7 +659,7 @@
                    ENDDO
                 ELSE
-                   CALL exchange_horiz( prr_av, nbgp )
-                   DO  i = nxlg, nxrg
-                      DO  j = nysg, nyng
+!                   CALL exchange_horiz( prr_av, nbgp )
+                   DO  i = nxl, nxr
+                      DO  j = nys, nyn
                          DO  k = nzb, nzt+1
                             local_pf(i,j,k) = prr_av(k,j,i) * hyrho(nzb+1)
@@ -687,6 +676,6 @@
                       to_be_resorted => pt
                    ELSE
-                   DO  i = nxlg, nxrg
-                      DO  j = nysg, nyng
+                   DO  i = nxl, nxr
+                      DO  j = nys, nyn
                             DO  k = nzb, nzt+1
                                local_pf(i,j,k) = pt(k,j,i) + l_d_cp *          &
@@ -762,10 +751,10 @@
                          ENDDO
                       ENDDO
-                      CALL exchange_horiz( tend, nbgp )
+!                      CALL exchange_horiz( tend, nbgp )
                    ELSE
                       tend = 0.0_wp
                    ENDIF
-                   DO  i = nxlg, nxrg
-                      DO  j = nysg, nyng
+                   DO  i = nxl, nxr
+                      DO  j = nys, nyn
                          DO  k = nzb, nzt+1
                             local_pf(i,j,k) = tend(k,j,i)
@@ -775,5 +764,5 @@
                    resorted = .TRUE.
                 ELSE
-                   CALL exchange_horiz( ql_vp_av, nbgp )
+!                   CALL exchange_horiz( ql_vp_av, nbgp )
                    to_be_resorted => ql_vp
                 ENDIF
@@ -793,27 +782,19 @@
                       i = surf_def_h(0)%i(m)
                       j = surf_def_h(0)%j(m)
-                      tmp_2d(j,i) = surf_def_h(0)%qsws(m)
+                      local_pf(i,j,nzb+1) = surf_def_h(0)%qsws(m)
                    ENDDO
                    DO  m = 1, surf_lsm_h%ns
                       i = surf_lsm_h%i(m)
                       j = surf_lsm_h%j(m)
-                      tmp_2d(j,i) = surf_lsm_h%qsws(m)
+                      local_pf(i,j,nzb+1) = surf_lsm_h%qsws(m)
                    ENDDO
                    DO  m = 1, surf_usm_h%ns
                       i = surf_usm_h%i(m)
                       j = surf_usm_h%j(m)
-                      tmp_2d(j,i) = surf_usm_h%qsws(m)
-                   ENDDO
-
-                   CALL exchange_horiz_2d( tmp_2d, nbgp )
-
-                   DO  i = nxlg, nxrg
-                      DO  j = nysg, nyng
-                         local_pf(i,j,nzb+1) = tmp_2d(j,i)
-                      ENDDO
-                   ENDDO
-                ELSE
-                   DO  i = nxlg, nxrg
-                      DO  j = nysg, nyng 
+                      local_pf(i,j,nzb+1) = surf_usm_h%qsws(m)
+                   ENDDO
+                ELSE
+                   DO  i = nxl, nxr
+                      DO  j = nys, nyn 
                          local_pf(i,j,nzb+1) =  qsws_av(j,i)
                       ENDDO
@@ -826,6 +807,6 @@
              CASE ( 'qv_xy', 'qv_xz', 'qv_yz' )
                 IF ( av == 0 )  THEN
-                   DO  i = nxlg, nxrg
-                      DO  j = nysg, nyng
+                   DO  i = nxl, nxr
+                      DO  j = nys, nyn
                          DO  k = nzb, nzt+1
                             local_pf(i,j,k) = q(k,j,i) - ql(k,j,i)
@@ -867,27 +848,19 @@
                       i = surf_def_h(0)%i(m)
                       j = surf_def_h(0)%j(m)
-                      tmp_2d(j,i) = surf_def_h(0)%shf(m)
+                      local_pf(i,j,nzb+1) = surf_def_h(0)%shf(m)
                    ENDDO
                    DO  m = 1, surf_lsm_h%ns
                       i = surf_lsm_h%i(m)
                       j = surf_lsm_h%j(m)
-                      tmp_2d(j,i) = surf_lsm_h%shf(m)
+                      local_pf(i,j,nzb+1) = surf_lsm_h%shf(m)
                    ENDDO
                    DO  m = 1, surf_usm_h%ns
                       i = surf_usm_h%i(m)
                       j = surf_usm_h%j(m)
-                      tmp_2d(j,i) = surf_usm_h%shf(m)
-                   ENDDO
-
-                   CALL exchange_horiz_2d( tmp_2d, nbgp )
-
-                   DO  i = nxlg, nxrg
-                      DO  j = nysg, nyng
-                         local_pf(i,j,nzb+1) = tmp_2d(j,i)
-                      ENDDO
-                   ENDDO
-                ELSE
-                   DO  i = nxlg, nxrg
-                      DO  j = nysg, nyng
+                      local_pf(i,j,nzb+1) = surf_usm_h%shf(m)
+                   ENDDO
+                ELSE
+                   DO  i = nxl, nxr
+                      DO  j = nys, nyn
                          local_pf(i,j,nzb+1) =  shf_av(j,i)
                       ENDDO
@@ -903,27 +876,19 @@
                       i = surf_def_h(0)%i(m)
                       j = surf_def_h(0)%j(m)
-                      tmp_2d(j,i) = surf_def_h(0)%ssws(m)
+                      local_pf(i,j,nzb+1) = surf_def_h(0)%ssws(m)
                    ENDDO
                    DO  m = 1, surf_lsm_h%ns
                       i = surf_lsm_h%i(m)
                       j = surf_lsm_h%j(m)
-                      tmp_2d(j,i) = surf_lsm_h%ssws(m)
+                      local_pf(i,j,nzb+1) = surf_lsm_h%ssws(m)
                    ENDDO
                    DO  m = 1, surf_usm_h%ns
                       i = surf_usm_h%i(m)
                       j = surf_usm_h%j(m)
-                      tmp_2d(j,i) = surf_usm_h%ssws(m)
-                   ENDDO
-
-                   CALL exchange_horiz_2d( tmp_2d, nbgp )
-
-                   DO  i = nxlg, nxrg
-                      DO  j = nysg, nyng
-                         local_pf(i,j,nzb+1) = tmp_2d(j,i)
-                      ENDDO
-                   ENDDO
-                ELSE
-                   DO  i = nxlg, nxrg
-                      DO  j = nysg, nyng 
+                      local_pf(i,j,nzb+1) = surf_usm_h%ssws(m)
+                   ENDDO
+                ELSE
+                   DO  i = nxl, nxr
+                      DO  j = nys, nyn 
                          local_pf(i,j,nzb+1) =  ssws_av(j,i)
                       ENDDO
@@ -939,28 +904,19 @@
                       i = surf_def_h(0)%i(m)
                       j = surf_def_h(0)%j(m)
-                      tmp_2d(j,i) = surf_def_h(0)%ts(m)
+                      local_pf(i,j,nzb+1) = surf_def_h(0)%ts(m)
                    ENDDO
                    DO  m = 1, surf_lsm_h%ns
                       i = surf_lsm_h%i(m)
                       j = surf_lsm_h%j(m)
-                      tmp_2d(j,i) = surf_lsm_h%ts(m)
+                      local_pf(i,j,nzb+1) = surf_lsm_h%ts(m)
                    ENDDO
                    DO  m = 1, surf_usm_h%ns
                       i = surf_usm_h%i(m)
                       j = surf_usm_h%j(m)
-                      tmp_2d(j,i) = surf_usm_h%ts(m)
-                   ENDDO
-
-                   CALL exchange_horiz_2d( tmp_2d, nbgp )
-
-                   DO  i = nxlg, nxrg
-                      DO  j = nysg, nyng
-                         local_pf(i,j,nzb+1) = tmp_2d(j,i)
-                      ENDDO
-                   ENDDO
-
-                ELSE
-                   DO  i = nxlg, nxrg
-                      DO  j = nysg, nyng
+                      local_pf(i,j,nzb+1) = surf_usm_h%ts(m)
+                   ENDDO
+                ELSE
+                   DO  i = nxl, nxr
+                      DO  j = nys, nyn
                          local_pf(i,j,nzb+1) = ts_av(j,i)
                       ENDDO
@@ -990,27 +946,19 @@
                       i = surf_def_h(0)%i(m)
                       j = surf_def_h(0)%j(m)
-                      tmp_2d(j,i) = surf_def_h(0)%us(m)
+                      local_pf(i,j,nzb+1) = surf_def_h(0)%us(m)
                    ENDDO
                    DO  m = 1, surf_lsm_h%ns
                       i = surf_lsm_h%i(m)
                       j = surf_lsm_h%j(m)
-                      tmp_2d(j,i) = surf_lsm_h%us(m)
+                      local_pf(i,j,nzb+1) = surf_lsm_h%us(m)
                    ENDDO
                    DO  m = 1, surf_usm_h%ns
                       i = surf_usm_h%i(m)
                       j = surf_usm_h%j(m)
-                      tmp_2d(j,i) = surf_usm_h%us(m)
-                   ENDDO
-
-                   CALL exchange_horiz_2d( tmp_2d, nbgp )
-
-                   DO  i = nxlg, nxrg
-                      DO  j = nysg, nyng
-                         local_pf(i,j,nzb+1) = tmp_2d(j,i)
-                      ENDDO
-                   ENDDO
-                ELSE
-                   DO  i = nxlg, nxrg
-                      DO  j = nysg, nyng
+                      local_pf(i,j,nzb+1) = surf_usm_h%us(m)
+                   ENDDO
+                ELSE
+                   DO  i = nxl, nxr
+                      DO  j = nys, nyn
                          local_pf(i,j,nzb+1) = us_av(j,i)
                       ENDDO
@@ -1056,28 +1004,19 @@
                       i = surf_def_h(0)%i(m)
                       j = surf_def_h(0)%j(m)
-                      tmp_2d(j,i) = surf_def_h(0)%z0(m)
+                      local_pf(i,j,nzb+1) = surf_def_h(0)%z0(m)
                    ENDDO
                    DO  m = 1, surf_lsm_h%ns
                       i = surf_lsm_h%i(m)
                       j = surf_lsm_h%j(m)
-                      tmp_2d(j,i) = surf_lsm_h%z0(m)
+                      local_pf(i,j,nzb+1) = surf_lsm_h%z0(m)
                    ENDDO
                    DO  m = 1, surf_usm_h%ns
                       i = surf_usm_h%i(m)
                       j = surf_usm_h%j(m)
-                      tmp_2d(j,i) = surf_usm_h%z0(m)
-                   ENDDO
-
-                   CALL exchange_horiz_2d( tmp_2d, nbgp )
-
-                   DO  i = nxlg, nxrg
-                      DO  j = nysg, nyng
-                         local_pf(i,j,nzb+1) = tmp_2d(j,i)
-                      ENDDO
-                   ENDDO
-
-                ELSE
-                   DO  i = nxlg, nxrg
-                      DO  j = nysg, nyng
+                      local_pf(i,j,nzb+1) = surf_usm_h%z0(m)
+                   ENDDO
+                ELSE
+                   DO  i = nxl, nxr
+                      DO  j = nys, nyn
                          local_pf(i,j,nzb+1) =  z0_av(j,i)
                       ENDDO
@@ -1093,27 +1032,19 @@
                       i = surf_def_h(0)%i(m)
                       j = surf_def_h(0)%j(m)
-                      tmp_2d(j,i) = surf_def_h(0)%z0h(m)
+                      local_pf(i,j,nzb+1) = surf_def_h(0)%z0h(m)
                    ENDDO
                    DO  m = 1, surf_lsm_h%ns
                       i = surf_lsm_h%i(m)
                       j = surf_lsm_h%j(m)
-                      tmp_2d(j,i) = surf_lsm_h%z0h(m)
+                      local_pf(i,j,nzb+1) = surf_lsm_h%z0h(m)
                    ENDDO
                    DO  m = 1, surf_usm_h%ns
                       i = surf_usm_h%i(m)
                       j = surf_usm_h%j(m)
-                      tmp_2d(j,i) = surf_usm_h%z0h(m)
-                   ENDDO
-
-                   CALL exchange_horiz_2d( tmp_2d, nbgp )
-
-                   DO  i = nxlg, nxrg
-                      DO  j = nysg, nyng
-                         local_pf(i,j,nzb+1) = tmp_2d(j,i)
-                      ENDDO
-                   ENDDO
-                ELSE
-                   DO  i = nxlg, nxrg
-                      DO  j = nysg, nyng
+                      local_pf(i,j,nzb+1) = surf_usm_h%z0h(m)
+                   ENDDO
+                ELSE
+                   DO  i = nxl, nxr
+                      DO  j = nys, nyn
                          local_pf(i,j,nzb+1) =  z0h_av(j,i)
                       ENDDO
@@ -1129,27 +1060,19 @@
                       i = surf_def_h(0)%i(m)
                       j = surf_def_h(0)%j(m)
-                      tmp_2d(j,i) = surf_def_h(0)%z0q(m)
+                      local_pf(i,j,nzb+1) = surf_def_h(0)%z0q(m)
                    ENDDO
                    DO  m = 1, surf_lsm_h%ns
                       i = surf_lsm_h%i(m)
                       j = surf_lsm_h%j(m)
-                      tmp_2d(j,i) = surf_lsm_h%z0q(m)
+                      local_pf(i,j,nzb+1) = surf_lsm_h%z0q(m)
                    ENDDO
                    DO  m = 1, surf_usm_h%ns
                       i = surf_usm_h%i(m)
                       j = surf_usm_h%j(m)
-                      tmp_2d(j,i) = surf_usm_h%z0q(m)
-                   ENDDO
-
-                   CALL exchange_horiz_2d( tmp_2d, nbgp )
-
-                   DO  i = nxlg, nxrg
-                      DO  j = nysg, nyng
-                         local_pf(i,j,nzb+1) = tmp_2d(j,i)
-                      ENDDO
-                   ENDDO
-                ELSE
-                   DO  i = nxlg, nxrg
-                      DO  j = nysg, nyng
+                      local_pf(i,j,nzb+1) = surf_usm_h%z0q(m)
+                   ENDDO
+                ELSE
+                   DO  i = nxl, nxr
+                      DO  j = nys, nyn
                          local_pf(i,j,nzb+1) =  z0q_av(j,i)
                       ENDDO
@@ -1206,6 +1129,6 @@
 !--       Resort the array to be output, if not done above
           IF ( .NOT. resorted )  THEN
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
                    DO  k = nzb_do, nzt_do
                       local_pf(i,j,k) = to_be_resorted(k,j,i)
@@ -1269,6 +1192,6 @@
 !--                   Carry out the averaging (all data are on the PE)
                       DO  k = nzb_do, nzt_do
-                         DO  j = nysg, nyng
-                            DO  i = nxlg, nxrg
+                         DO  j = nys, nyn
+                            DO  i = nxl, nxr
                                local_2d(i,j) = local_2d(i,j) + local_pf(i,j,k)
                             ENDDO
@@ -1300,6 +1223,6 @@
 !--                   here on a local array and will be written to the output
 !--                   file afterwards to increase the performance.
-                      DO  i = nxlg, nxrg
-                         DO  j = nysg, nyng
+                      DO  i = nxl, nxr
+                         DO  j = nys, nyn
                             local_2d_sections(i,j,iis) = local_2d(i,j)
                          ENDDO
@@ -1319,5 +1242,5 @@
                          DO  i = 0, io_blocks-1
                             IF ( i == io_group )  THEN
-                               WRITE ( 21 )  nxlg, nxrg, nysg, nyng, nysg, nyng
+                               WRITE ( 21 )  nxl, nxr, nys, nyn, nys, nyn
                                WRITE ( 21 )  local_2d
                             ENDIF
@@ -1335,9 +1258,9 @@
                          CALL MPI_BARRIER( comm2d, ierr )
 
-                         ngp = ( nxrg-nxlg+1 ) * ( nyng-nysg+1 )
+                         ngp = ( nxr-nxl+1 ) * ( nyn-nys+1 )
                          IF ( myid == 0 )  THEN
 !
 !--                         Local array can be relocated directly.
-                            total_2d(nxlg:nxrg,nysg:nyng) = local_2d
+                            total_2d(nxl:nxr,nys:nyn) = local_2d
 !
 !--                         Receive data from all other PEs.
@@ -1361,5 +1284,5 @@
 !--                         Relocate the local array for the next loop increment
                             DEALLOCATE( local_2d )
-                            ALLOCATE( local_2d(nxlg:nxrg,nysg:nyng) )
+                            ALLOCATE( local_2d(nxl:nxr,nys:nyn) )
 
 #if defined( __netcdf )
@@ -1367,13 +1290,13 @@
                                nc_stat = NF90_PUT_VAR( id_set_xy(av),       &
                                                        id_var_do2d(av,if),  &
-                                                   total_2d(0:nx+1,0:ny+1), &
+                                                       total_2d(0:nx,0:ny), &
                              start = (/ 1, 1, 1, do2d_xy_time_count(av) /), &
-                                             count = (/ nx+2, ny+2, 1, 1 /) )
+                                             count = (/ nx+1, ny+1, 1, 1 /) )
                             ELSE
                                nc_stat = NF90_PUT_VAR( id_set_xy(av),       &
                                                        id_var_do2d(av,if),  &
-                                                   total_2d(0:nx+1,0:ny+1), &
+                                                       total_2d(0:nx,0:ny), &
                             start = (/ 1, 1, is, do2d_xy_time_count(av) /), &
-                                             count = (/ nx+2, ny+2, 1, 1 /) )
+                                             count = (/ nx+1, ny+1, 1, 1 /) )
                             ENDIF
                             CALL netcdf_handle_error( 'data_output_2d', 54 )
@@ -1383,11 +1306,11 @@
 !
 !--                         First send the local index limits to PE0
-                            ind(1) = nxlg; ind(2) = nxrg
-                            ind(3) = nysg; ind(4) = nyng
+                            ind(1) = nxl; ind(2) = nxr
+                            ind(3) = nys; ind(4) = nyn
                             CALL MPI_SEND( ind(1), 4, MPI_INTEGER, 0, 0,       &
                                            comm2d, ierr )
 !
 !--                         Send data to PE0
-                            CALL MPI_SEND( local_2d(nxlg,nysg), ngp,           &
+                            CALL MPI_SEND( local_2d(nxl,nys), ngp,             &
                                            MPI_REAL, 0, 1, comm2d, ierr )
                          ENDIF
@@ -1405,13 +1328,13 @@
                       nc_stat = NF90_PUT_VAR( id_set_xy(av),                &
                                               id_var_do2d(av,if),           &
-                                             local_2d(nxl:nxr+1,nys:nyn+1), &
+                                              local_2d(nxl:nxr,nys:nyn),    &
                              start = (/ 1, 1, 1, do2d_xy_time_count(av) /), &
-                                           count = (/ nx+2, ny+2, 1, 1 /) )
+                                           count = (/ nx+1, ny+1, 1, 1 /) )
                    ELSE
                       nc_stat = NF90_PUT_VAR( id_set_xy(av),                &
                                               id_var_do2d(av,if),           &
-                                             local_2d(nxl:nxr+1,nys:nyn+1), &
+                                              local_2d(nxl:nxr,nys:nyn),    &
                             start = (/ 1, 1, is, do2d_xy_time_count(av) /), &
-                                           count = (/ nx+2, ny+2, 1, 1 /) )
+                                           count = (/ nx+1, ny+1, 1, 1 /) )
                    ENDIF
                    CALL netcdf_handle_error( 'data_output_2d', 447 )
@@ -1455,12 +1378,12 @@
                    IF ( section(is,s_ind) == -1 )  THEN
 
-                      ALLOCATE( local_2d_l(nxlg:nxrg,nzb_do:nzt_do) )
+                      ALLOCATE( local_2d_l(nxl:nxr,nzb_do:nzt_do) )
                       local_2d_l = 0.0_wp
-                      ngp = ( nxrg-nxlg + 1 ) * ( nzt_do-nzb_do + 1 )
+                      ngp = ( nxr-nxl + 1 ) * ( nzt_do-nzb_do + 1 )
 !
 !--                   First local averaging on the PE
                       DO  k = nzb_do, nzt_do
                          DO  j = nys, nyn
-                            DO  i = nxlg, nxrg
+                            DO  i = nxl, nxr
                                local_2d_l(i,k) = local_2d_l(i,k) +             &
                                                  local_pf(i,j,k)
@@ -1472,6 +1395,6 @@
 !--                   Now do the averaging over all PEs along y
                       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-                      CALL MPI_ALLREDUCE( local_2d_l(nxlg,nzb_do),                &
-                                          local_2d(nxlg,nzb_do), ngp, MPI_REAL,   &
+                      CALL MPI_ALLREDUCE( local_2d_l(nxl,nzb_do),                &
+                                          local_2d(nxl,nzb_do), ngp, MPI_REAL,   &
                                           MPI_SUM, comm1dy, ierr )
 #else
@@ -1508,5 +1431,5 @@
 !--                      stored here on a local array and will be written to the
 !--                      output file afterwards to increase the performance.
-                         DO  i = nxlg, nxrg
+                         DO  i = nxl, nxr
                             DO  k = nzb_do, nzt_do
                                local_2d_sections_l(i,is,k) = local_2d(i,k)
@@ -1536,5 +1459,5 @@
                                       nys-1 == -1 ) )                          &
                                THEN
-                                  WRITE (22)  nxlg, nxrg, nzb_do, nzt_do, nzb, nzt+1
+                                  WRITE (22)  nxl, nxr, nzb_do, nzt_do, nzb, nzt+1
                                   WRITE (22)  local_2d
                                ELSE
@@ -1555,5 +1478,5 @@
                          CALL MPI_BARRIER( comm2d, ierr )
 
-                         ngp = ( nxrg-nxlg + 1 ) * ( nzt_do-nzb_do + 1 )
+                         ngp = ( nxr-nxl + 1 ) * ( nzt_do-nzb_do + 1 )
                          IF ( myid == 0 )  THEN
 !
@@ -1563,5 +1486,5 @@
                                  ( section(is,s_ind) == -1  .AND.               &
                                    nys-1 == -1 ) )  THEN
-                               total_2d(nxlg:nxrg,nzb_do:nzt_do) = local_2d
+                               total_2d(nxl:nxr,nzb_do:nzt_do) = local_2d
                             ENDIF
 !
@@ -1592,12 +1515,12 @@
 !--                         Relocate the local array for the next loop increment
                             DEALLOCATE( local_2d )
-                            ALLOCATE( local_2d(nxlg:nxrg,nzb_do:nzt_do) )
+                            ALLOCATE( local_2d(nxl:nxr,nzb_do:nzt_do) )
 
 #if defined( __netcdf )
-                            nc_stat = NF90_PUT_VAR( id_set_xz(av),          &
-                                                 id_var_do2d(av,if),        &
-                                                 total_2d(0:nx+1,nzb_do:nzt_do),&
-                            start = (/ 1, is, 1, do2d_xz_time_count(av) /), &
-                                             count = (/ nx+2, 1, nzt_do-nzb_do+1, 1 /) )
+                            nc_stat = NF90_PUT_VAR( id_set_xz(av),             &
+                                                 id_var_do2d(av,if),           &
+                                                 total_2d(0:nx,nzb_do:nzt_do), &
+                               start = (/ 1, is, 1, do2d_xz_time_count(av) /), &
+                                          count = (/ nx+1, 1, nzt_do-nzb_do+1, 1 /) )
                             CALL netcdf_handle_error( 'data_output_2d', 58 )
 #endif
@@ -1611,5 +1534,5 @@
                                  ( section(is,s_ind) == -1  .AND.  nys-1 == -1 ) ) &
                             THEN
-                               ind(1) = nxlg; ind(2) = nxrg
+                               ind(1) = nxl; ind(2) = nxr
                                ind(3) = nzb_do;   ind(4) = nzt_do
                             ELSE
@@ -1622,5 +1545,5 @@
 !--                         If applicable, send data to PE0.
                             IF ( ind(1) /= -9999 )  THEN
-                               CALL MPI_SEND( local_2d(nxlg,nzb_do), ngp,         &
+                               CALL MPI_SEND( local_2d(nxl,nzb_do), ngp,         &
                                               MPI_REAL, 0, 1, comm2d, ierr )
                             ENDIF
@@ -1638,7 +1561,7 @@
                    nc_stat = NF90_PUT_VAR( id_set_xz(av),                   &
                                            id_var_do2d(av,if),              &
-                                           local_2d(nxl:nxr+1,nzb_do:nzt_do),   &
+                                           local_2d(nxl:nxr,nzb_do:nzt_do), &
                             start = (/ 1, is, 1, do2d_xz_time_count(av) /), &
-                                           count = (/ nx+2, 1, nzt_do-nzb_do+1, 1 /) )
+                                       count = (/ nx+1, 1, nzt_do-nzb_do+1, 1 /) )
                    CALL netcdf_handle_error( 'data_output_2d', 451 )
 #endif
@@ -1673,11 +1596,11 @@
                    IF ( section(is,s_ind) == -1 )  THEN
 
-                      ALLOCATE( local_2d_l(nysg:nyng,nzb_do:nzt_do) )
+                      ALLOCATE( local_2d_l(nys:nyn,nzb_do:nzt_do) )
                       local_2d_l = 0.0_wp
-                      ngp = ( nyng-nysg+1 ) * ( nzt_do-nzb_do+1 )
+                      ngp = ( nyn-nys+1 ) * ( nzt_do-nzb_do+1 )
 !
 !--                   First local averaging on the PE
                       DO  k = nzb_do, nzt_do
-                         DO  j = nysg, nyng
+                         DO  j = nys, nyn
                             DO  i = nxl, nxr
                                local_2d_l(j,k) = local_2d_l(j,k) +             &
@@ -1690,6 +1613,6 @@
 !--                   Now do the averaging over all PEs along x
                       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-                      CALL MPI_ALLREDUCE( local_2d_l(nysg,nzb_do),                &
-                                          local_2d(nysg,nzb_do), ngp, MPI_REAL,   &
+                      CALL MPI_ALLREDUCE( local_2d_l(nys,nzb_do),                &
+                                          local_2d(nys,nzb_do), ngp, MPI_REAL,   &
                                           MPI_SUM, comm1dx, ierr )
 #else
@@ -1726,5 +1649,5 @@
 !--                      stored here on a local array and will be written to the
 !--                      output file afterwards to increase the performance.
-                         DO  j = nysg, nyng
+                         DO  j = nys, nyn
                             DO  k = nzb_do, nzt_do
                                local_2d_sections_l(is,j,k) = local_2d(j,k)
@@ -1754,5 +1677,5 @@
                                       nxl-1 == -1 ) )                          &
                                THEN
-                                  WRITE (23)  nysg, nyng, nzb_do, nzt_do, nzb, nzt+1
+                                  WRITE (23)  nys, nyn, nzb_do, nzt_do, nzb, nzt+1
                                   WRITE (23)  local_2d
                                ELSE
@@ -1773,5 +1696,5 @@
                          CALL MPI_BARRIER( comm2d, ierr )
 
-                         ngp = ( nyng-nysg+1 ) * ( nzt_do-nzb_do+1 )
+                         ngp = ( nyn-nys+1 ) * ( nzt_do-nzb_do+1 )
                          IF ( myid == 0 )  THEN
 !
@@ -1781,5 +1704,5 @@
                                  ( section(is,s_ind) == -1  .AND.  nxl-1 == -1 ) ) &
                             THEN
-                               total_2d(nysg:nyng,nzb_do:nzt_do) = local_2d
+                               total_2d(nys:nyn,nzb_do:nzt_do) = local_2d
                             ENDIF
 !
@@ -1810,12 +1733,12 @@
 !--                         Relocate the local array for the next loop increment
                             DEALLOCATE( local_2d )
-                            ALLOCATE( local_2d(nysg:nyng,nzb_do:nzt_do) )
+                            ALLOCATE( local_2d(nys:nyn,nzb_do:nzt_do) )
 
 #if defined( __netcdf )
-                            nc_stat = NF90_PUT_VAR( id_set_yz(av),          &
-                                                 id_var_do2d(av,if),        &
-                                                 total_2d(0:ny+1,nzb_do:nzt_do),&
-                            start = (/ is, 1, 1, do2d_yz_time_count(av) /), &
-                                             count = (/ 1, ny+2, nzt_do-nzb_do+1, 1 /) )
+                            nc_stat = NF90_PUT_VAR( id_set_yz(av),             &
+                                                 id_var_do2d(av,if),           &
+                                                 total_2d(0:ny,nzb_do:nzt_do), &
+                            start = (/ is, 1, 1, do2d_yz_time_count(av) /),    &
+                                       count = (/ 1, ny+1, nzt_do-nzb_do+1, 1 /) )
                             CALL netcdf_handle_error( 'data_output_2d', 61 )
 #endif
@@ -1829,5 +1752,5 @@
                                  ( section(is,s_ind) == -1  .AND.  nxl-1 == -1 ) ) &
                             THEN
-                               ind(1) = nysg; ind(2) = nyng
+                               ind(1) = nys; ind(2) = nyn
                                ind(3) = nzb_do;   ind(4) = nzt_do
                             ELSE
@@ -1840,5 +1763,5 @@
 !--                         If applicable, send data to PE0.
                             IF ( ind(1) /= -9999 )  THEN
-                               CALL MPI_SEND( local_2d(nysg,nzb_do), ngp,         &
+                               CALL MPI_SEND( local_2d(nys,nzb_do), ngp,         &
                                               MPI_REAL, 0, 1, comm2d, ierr )
                             ENDIF
@@ -1856,7 +1779,7 @@
                    nc_stat = NF90_PUT_VAR( id_set_yz(av),                   &
                                            id_var_do2d(av,if),              &
-                                           local_2d(nys:nyn+1,nzb_do:nzt_do),   &
+                                           local_2d(nys:nyn,nzb_do:nzt_do), &
                             start = (/ is, 1, 1, do2d_xz_time_count(av) /), &
-                                           count = (/ 1, ny+2, nzt_do-nzb_do+1, 1 /) )
+                                           count = (/ 1, ny+1, nzt_do-nzb_do+1, 1 /) )
                    CALL netcdf_handle_error( 'data_output_2d', 452 )
 #endif
@@ -1887,35 +1810,35 @@
 !--                   Do not output redundant ghost point data except for the
 !--                   boundaries of the total domain.
-                      IF ( nxr == nx  .AND.  nyn /= ny )  THEN
-                         nc_stat = NF90_PUT_VAR( id_set_xy(av),                &
-                                                 id_var_do2d(av,if),           &
-                                                 local_2d_sections(nxl:nxr+1,  &
-                                                    nys:nyn,1:nis),            &
-                                                 start = (/ nxl+1, nys+1, 1,   &
-                                                    do2d_xy_time_count(av) /), &
-                                                 count = (/ nxr-nxl+2,         &
-                                                            nyn-nys+1, nis, 1  &
-                                                          /) )
-                      ELSEIF ( nxr /= nx  .AND.  nyn == ny )  THEN
-                         nc_stat = NF90_PUT_VAR( id_set_xy(av),                &
-                                                 id_var_do2d(av,if),           &
-                                                 local_2d_sections(nxl:nxr,    &
-                                                    nys:nyn+1,1:nis),          &
-                                                 start = (/ nxl+1, nys+1, 1,   &
-                                                    do2d_xy_time_count(av) /), &
-                                                 count = (/ nxr-nxl+1,         &
-                                                            nyn-nys+2, nis, 1  &
-                                                          /) )
-                      ELSEIF ( nxr == nx  .AND.  nyn == ny )  THEN
-                         nc_stat = NF90_PUT_VAR( id_set_xy(av),                &
-                                                 id_var_do2d(av,if),           &
-                                                 local_2d_sections(nxl:nxr+1,  &
-                                                    nys:nyn+1,1:nis),          &
-                                                 start = (/ nxl+1, nys+1, 1,   &
-                                                    do2d_xy_time_count(av) /), &
-                                                 count = (/ nxr-nxl+2,         &
-                                                            nyn-nys+2, nis, 1  &
-                                                          /) )
-                      ELSE
+!                      IF ( nxr == nx  .AND.  nyn /= ny )  THEN
+!                         nc_stat = NF90_PUT_VAR( id_set_xy(av),                &
+!                                                 id_var_do2d(av,if),           &
+!                                                 local_2d_sections(nxl:nxr+1,  &
+!                                                    nys:nyn,1:nis),            &
+!                                                 start = (/ nxl+1, nys+1, 1,   &
+!                                                    do2d_xy_time_count(av) /), &
+!                                                 count = (/ nxr-nxl+2,         &
+!                                                            nyn-nys+1, nis, 1  &
+!                                                          /) )
+!                      ELSEIF ( nxr /= nx  .AND.  nyn == ny )  THEN
+!                         nc_stat = NF90_PUT_VAR( id_set_xy(av),                &
+!                                                 id_var_do2d(av,if),           &
+!                                                 local_2d_sections(nxl:nxr,    &
+!                                                    nys:nyn+1,1:nis),          &
+!                                                 start = (/ nxl+1, nys+1, 1,   &
+!                                                    do2d_xy_time_count(av) /), &
+!                                                 count = (/ nxr-nxl+1,         &
+!                                                            nyn-nys+2, nis, 1  &
+!                                                          /) )
+!                      ELSEIF ( nxr == nx  .AND.  nyn == ny )  THEN
+!                         nc_stat = NF90_PUT_VAR( id_set_xy(av),                &
+!                                                 id_var_do2d(av,if),           &
+!                                                 local_2d_sections(nxl:nxr+1,  &
+!                                                    nys:nyn+1,1:nis),          &
+!                                                 start = (/ nxl+1, nys+1, 1,   &
+!                                                    do2d_xy_time_count(av) /), &
+!                                                 count = (/ nxr-nxl+2,         &
+!                                                            nyn-nys+2, nis, 1  &
+!                                                          /) )
+!                      ELSE
                          nc_stat = NF90_PUT_VAR( id_set_xy(av),                &
                                                  id_var_do2d(av,if),           &
@@ -1927,5 +1850,5 @@
                                                             nyn-nys+1, nis, 1  &
                                                           /) )
-                      ENDIF    
+!                      ENDIF    
 
                       CALL netcdf_handle_error( 'data_output_2d', 55 )
@@ -1946,8 +1869,8 @@
 !
 !--                      Distribute data over all PEs along y
-                         ngp = ( nxrg-nxlg+1 ) * ( nzt_do-nzb_do+1 ) * ns
+                         ngp = ( nxr-nxl+1 ) * ( nzt_do-nzb_do+1 ) * ns
                          IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr )
-                         CALL MPI_ALLREDUCE( local_2d_sections_l(nxlg,1,nzb_do),  &
-                                             local_2d_sections(nxlg,1,nzb_do),    &
+                         CALL MPI_ALLREDUCE( local_2d_sections_l(nxl,1,nzb_do),  &
+                                             local_2d_sections(nxl,1,nzb_do),    &
                                              ngp, MPI_REAL, MPI_SUM, comm1dy,  &
                                              ierr )
@@ -1959,14 +1882,14 @@
 !--                   Do not output redundant ghost point data except for the
 !--                   boundaries of the total domain.
-                      IF ( nxr == nx )  THEN
-                         nc_stat = NF90_PUT_VAR( id_set_xz(av),                &
-                                             id_var_do2d(av,if),               & 
-                                             local_2d_sections(nxl:nxr+1,1:ns, &
-                                                nzb_do:nzt_do),                &
-                                             start = (/ nxl+1, 1, 1,           &
-                                                do2d_xz_time_count(av) /),     &
-                                             count = (/ nxr-nxl+2, ns, nzt_do-nzb_do+1,  &
-                                                        1 /) )
-                      ELSE
+!                      IF ( nxr == nx )  THEN
+!                         nc_stat = NF90_PUT_VAR( id_set_xz(av),                &
+!                                             id_var_do2d(av,if),               & 
+!                                             local_2d_sections(nxl:nxr+1,1:ns, &
+!                                                nzb_do:nzt_do),                &
+!                                             start = (/ nxl+1, 1, 1,           &
+!                                                do2d_xz_time_count(av) /),     &
+!                                             count = (/ nxr-nxl+2, ns, nzt_do-nzb_do+1,  &
+!                                                        1 /) )
+!                      ELSE
                          nc_stat = NF90_PUT_VAR( id_set_xz(av),                &
                                              id_var_do2d(av,if),               &
@@ -1977,5 +1900,5 @@
                                              count = (/ nxr-nxl+1, ns, nzt_do-nzb_do+1,  &
                                                 1 /) )
-                      ENDIF
+!                      ENDIF
 
                       CALL netcdf_handle_error( 'data_output_2d', 57 )
@@ -1996,8 +1919,8 @@
 !
 !--                      Distribute data over all PEs along x
-                         ngp = ( nyng-nysg+1 ) * ( nzt-nzb + 2 ) * ns
+                         ngp = ( nyn-nys+1 ) * ( nzt-nzb + 2 ) * ns
                          IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr )
-                         CALL MPI_ALLREDUCE( local_2d_sections_l(1,nysg,nzb_do),  &
-                                             local_2d_sections(1,nysg,nzb_do),    &
+                         CALL MPI_ALLREDUCE( local_2d_sections_l(1,nys,nzb_do),  &
+                                             local_2d_sections(1,nys,nzb_do),    &
                                              ngp, MPI_REAL, MPI_SUM, comm1dx,  &
                                              ierr )
@@ -2009,14 +1932,14 @@
 !--                   Do not output redundant ghost point data except for the
 !--                   boundaries of the total domain.
-                      IF ( nyn == ny )  THEN
-                         nc_stat = NF90_PUT_VAR( id_set_yz(av),                &
-                                             id_var_do2d(av,if),               &
-                                             local_2d_sections(1:ns,           &
-                                                nys:nyn+1,nzb_do:nzt_do),      &
-                                             start = (/ 1, nys+1, 1,           &
-                                                do2d_yz_time_count(av) /),     &
-                                             count = (/ ns, nyn-nys+2,         &
-                                                        nzt_do-nzb_do+1, 1 /) )
-                      ELSE
+!                      IF ( nyn == ny )  THEN
+!                         nc_stat = NF90_PUT_VAR( id_set_yz(av),                &
+!                                             id_var_do2d(av,if),               &
+!                                             local_2d_sections(1:ns,           &
+!                                                nys:nyn+1,nzb_do:nzt_do),      &
+!                                             start = (/ 1, nys+1, 1,           &
+!                                                do2d_yz_time_count(av) /),     &
+!                                             count = (/ ns, nyn-nys+2,         &
+!                                                        nzt_do-nzb_do+1, 1 /) )
+!                      ELSE
                          nc_stat = NF90_PUT_VAR( id_set_yz(av),                &
                                              id_var_do2d(av,if),               &
@@ -2027,5 +1950,5 @@
                                              count = (/ ns, nyn-nys+1,         &
                                                         nzt_do-nzb_do+1, 1 /) )
-                      ENDIF
+!                      ENDIF
 
                       CALL netcdf_handle_error( 'data_output_2d', 60 )
Index: palm/trunk/SOURCE/data_output_3d.f90
===================================================================
--- palm/trunk/SOURCE/data_output_3d.f90	(revision 2511)
+++ palm/trunk/SOURCE/data_output_3d.f90	(revision 2512)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! upper bounds of 3d output changed from nx+1,ny+1 to nx,ny
+! no output of ghost layer data
+! 
+! 2292 2017-06-20 09:51:42Z schwenkel
 ! Implementation of new microphysic scheme: cloud_scheme = 'morrison' 
 ! includes two more prognostic equations for cloud drop concentration (nc)  
@@ -178,5 +182,5 @@
         
     USE indices,                                                               &
-        ONLY:  nbgp, nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg, nzb
+        ONLY:  nbgp, nx, nxl, nxr, ny, nyn, nys, nzb
         
     USE kinds
@@ -241,11 +245,7 @@
 !
 !-- Open output file.
-!-- Also creates coordinate and fld-file for AVS.
-!-- For classic or 64bit netCDF output or output of other (old) data formats,
-!-- for a run on more than one PE, each PE opens its own file and
-!-- writes the data of its subdomain in binary format (regardless of the format
-!-- the user has requested). After the run, these files are combined to one
-!-- file by combine_plot_fields in the format requested by the user (netcdf
-!-- and/or avs).
+!-- For classic or 64bit netCDF output on more than one PE, each PE opens its
+!-- own file and writes the data of its subdomain in binary format. After the
+!-- run, these files are combined to one NetCDF file by combine_plot_fields.
 !-- For netCDF4/HDF5 output, data is written in parallel into one file.
     IF ( netcdf_data_format < 5 )  THEN
@@ -314,5 +314,5 @@
 !
 !--    Allocate a temporary array with the desired output dimensions.
-       ALLOCATE( local_pf(nxlg:nxrg,nysg:nyng,nzb_do:nzt_do) )
+       ALLOCATE( local_pf(nxl:nxr,nys:nyn,nzb_do:nzt_do) )
 
        SELECT CASE ( trimvar )
@@ -359,10 +359,9 @@
                 IF ( simulated_time >= particle_advection_start )  THEN
                    tend = prt_count
-                   CALL exchange_horiz( tend, nbgp )
                 ELSE
                    tend = 0.0_wp
                 ENDIF
-                DO  i = nxlg, nxrg
-                   DO  j = nysg, nyng
+                DO  i = nxl, nxr
+                   DO  j = nys, nyn
                       DO  k = nzb_do, nzt_do
                          local_pf(i,j,k) = tend(k,j,i)
@@ -372,5 +371,4 @@
                 resorted = .TRUE.
              ELSE
-                CALL exchange_horiz( pc_av, nbgp )
                 to_be_resorted => pc_av
              ENDIF
@@ -404,10 +402,9 @@
                       ENDDO
                    ENDDO
-                   CALL exchange_horiz( tend, nbgp )
                 ELSE
                    tend = 0.0_wp
                 ENDIF
-                DO  i = nxlg, nxrg
-                   DO  j = nysg, nyng
+                DO  i = nxl, nxr
+                   DO  j = nys, nyn
                       DO  k = nzb_do, nzt_do
                          local_pf(i,j,k) = tend(k,j,i)
@@ -417,5 +414,4 @@
                 resorted = .TRUE.
              ELSE
-                CALL exchange_horiz( pr_av, nbgp )
                 to_be_resorted => pr_av
              ENDIF
@@ -423,7 +419,6 @@
           CASE ( 'prr' )
              IF ( av == 0 )  THEN
-                CALL exchange_horiz( prr, nbgp )
-                DO  i = nxlg, nxrg
-                   DO  j = nysg, nyng
+                DO  i = nxl, nxr
+                   DO  j = nys, nyn
                       DO  k = nzb_do, nzt_do
                          local_pf(i,j,k) = prr(k,j,i)
@@ -432,7 +427,6 @@
                 ENDDO
              ELSE
-                CALL exchange_horiz( prr_av, nbgp )
-                DO  i = nxlg, nxrg
-                   DO  j = nysg, nyng
+                DO  i = nxl, nxr
+                   DO  j = nys, nyn
                       DO  k = nzb_do, nzt_do
                          local_pf(i,j,k) = prr_av(k,j,i)
@@ -448,6 +442,6 @@
                    to_be_resorted => pt
                 ELSE
-                   DO  i = nxlg, nxrg
-                      DO  j = nysg, nyng
+                   DO  i = nxl, nxr
+                      DO  j = nys, nyn
                          DO  k = nzb_do, nzt_do
                             local_pf(i,j,k) = pt(k,j,i) + l_d_cp *             &
@@ -517,10 +511,9 @@
                       ENDDO
                    ENDDO
-                   CALL exchange_horiz( tend, nbgp )
                 ELSE
                    tend = 0.0_wp
                 ENDIF
-                DO  i = nxlg, nxrg
-                   DO  j = nysg, nyng
+                DO  i = nxl, nxr
+                   DO  j = nys, nyn
                       DO  k = nzb_do, nzt_do
                          local_pf(i,j,k) = tend(k,j,i)
@@ -530,5 +523,4 @@
                 resorted = .TRUE.
              ELSE
-                CALL exchange_horiz( ql_vp_av, nbgp )
                 to_be_resorted => ql_vp_av
              ENDIF
@@ -543,6 +535,6 @@
           CASE ( 'qv' )
              IF ( av == 0 )  THEN
-                DO  i = nxlg, nxrg
-                   DO  j = nysg, nyng
+                DO  i = nxl, nxr
+                   DO  j = nys, nyn
                       DO  k = nzb_do, nzt_do
                          local_pf(i,j,k) = q(k,j,i) - ql(k,j,i)
@@ -620,5 +612,5 @@
 
                 DEALLOCATE ( local_pf )
-                ALLOCATE( local_pf(nxlg:nxrg,nysg:nyng,nzb_do:nzt_do) )
+                ALLOCATE( local_pf(nxl:nxr,nys:nyn,nzb_do:nzt_do) )
 
                 CALL lsm_data_output_3d( av, do3d(av,if), found, local_pf )
@@ -632,5 +624,5 @@
 
                    DEALLOCATE ( local_pf )
-                   ALLOCATE( local_pf(nxlg:nxrg,nysg:nyng,nzb_do:nzt_do) )                 
+                   ALLOCATE( local_pf(nxl:nxr,nys:nyn,nzb_do:nzt_do) )                 
                 ENDIF
 
@@ -672,6 +664,6 @@
 !--    Resort the array to be output, if not done above
        IF ( .NOT. resorted )  THEN
-          DO  i = nxlg, nxrg
-             DO  j = nysg, nyng
+          DO  i = nxl, nxr
+             DO  j = nys, nyn
                 DO  k = nzb_do, nzt_do
                    local_pf(i,j,k) = to_be_resorted(k,j,i)
@@ -695,5 +687,5 @@
           DO  i = 0, io_blocks-1
              IF ( i == io_group )  THEN
-                WRITE ( 30 )  nxlg, nxrg, nysg, nyng, nzb_do, nzt_do
+                WRITE ( 30 )  nxl, nxr, nys, nyn, nzb_do, nzt_do
                 WRITE ( 30 )  local_pf(:,:,nzb_do:nzt_do)
              ENDIF
@@ -707,27 +699,25 @@
 !
 !--       Parallel output in netCDF4/HDF5 format.
-!--       Do not output redundant ghost point data except for the
-!--       boundaries of the total domain.
-          IF ( nxr == nx  .AND.  nyn /= ny )  THEN
-             nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if),  &
-                               local_pf(nxl:nxr+1,nys:nyn,nzb_do:nzt_do),    &
-                start = (/ nxl+1, nys+1, nzb_do+1, do3d_time_count(av) /),  &
-                count = (/ nxr-nxl+2, nyn-nys+1, nzt_do-nzb_do+1, 1 /) )
-          ELSEIF ( nxr /= nx  .AND.  nyn == ny )  THEN
-             nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if),  &
-                               local_pf(nxl:nxr,nys:nyn+1,nzb_do:nzt_do),    &
-                start = (/ nxl+1, nys+1, nzb_do+1, do3d_time_count(av) /),  &
-                count = (/ nxr-nxl+1, nyn-nys+2, nzt_do-nzb_do+1, 1 /) )
-          ELSEIF ( nxr == nx  .AND.  nyn == ny )  THEN
-             nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if),  &
-                             local_pf(nxl:nxr+1,nys:nyn+1,nzb_do:nzt_do  ),  &
-                start = (/ nxl+1, nys+1, nzb_do+1, do3d_time_count(av) /),  &
-                count = (/ nxr-nxl+2, nyn-nys+2, nzt_do-nzb_do+1, 1 /) )
-          ELSE
+!          IF ( nxr == nx  .AND.  nyn /= ny )  THEN
+!             nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if),  &
+!                               local_pf(nxl:nxr+1,nys:nyn,nzb_do:nzt_do),    &
+!                start = (/ nxl+1, nys+1, nzb_do+1, do3d_time_count(av) /),  &
+!                count = (/ nxr-nxl+2, nyn-nys+1, nzt_do-nzb_do+1, 1 /) )
+!          ELSEIF ( nxr /= nx  .AND.  nyn == ny )  THEN
+!             nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if),  &
+!                               local_pf(nxl:nxr,nys:nyn+1,nzb_do:nzt_do),    &
+!                start = (/ nxl+1, nys+1, nzb_do+1, do3d_time_count(av) /),  &
+!                count = (/ nxr-nxl+1, nyn-nys+2, nzt_do-nzb_do+1, 1 /) )
+!          ELSEIF ( nxr == nx  .AND.  nyn == ny )  THEN
+!             nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if),  &
+!                             local_pf(nxl:nxr+1,nys:nyn+1,nzb_do:nzt_do  ),  &
+!                start = (/ nxl+1, nys+1, nzb_do+1, do3d_time_count(av) /),  &
+!                count = (/ nxr-nxl+2, nyn-nys+2, nzt_do-nzb_do+1, 1 /) )
+!          ELSE
              nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_do3d(av,if),  &
                                  local_pf(nxl:nxr,nys:nyn,nzb_do:nzt_do),    &
                 start = (/ nxl+1, nys+1, nzb_do+1, do3d_time_count(av) /),  &
                 count = (/ nxr-nxl+1, nyn-nys+1, nzt_do-nzb_do+1, 1 /) )
-          ENDIF
+!          ENDIF
           CALL netcdf_handle_error( 'data_output_3d', 386 )
 #endif
@@ -738,5 +728,5 @@
                          local_pf(nxl:nxr+1,nys:nyn+1,nzb_do:nzt_do),        &
                          start = (/ 1, 1, 1, do3d_time_count(av) /),     &
-                         count = (/ nx+2, ny+2, nzt_do-nzb_do+1, 1 /) )
+                         count = (/ nx+1, ny+1, nzt_do-nzb_do+1, 1 /) )
        CALL netcdf_handle_error( 'data_output_3d', 446 )
 #endif
Index: palm/trunk/SOURCE/land_surface_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/land_surface_model_mod.f90	(revision 2511)
+++ palm/trunk/SOURCE/land_surface_model_mod.f90	(revision 2512)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! upper bounds of cross section and 3d output changed from nx+1,ny+1 to nx,ny
+! no output of ghost layer data
+! 
+! 2504 2017-09-27 10:36:13Z maronga
 ! Support roots and water under pavement. Added several pavement types.
 ! 
@@ -3886,5 +3890,5 @@
     LOGICAL      ::  two_d !< flag parameter that indicates 2D variables (horizontal cross sections)
 
-    REAL(wp), DIMENSION(nxlg:nxrg,nysg:nyng,nzb:nzt+1) ::  local_pf !< 
+    REAL(wp), DIMENSION(nxl:nxr,nys:nyn,nzb:nzt+1) ::  local_pf !< 
 
 
@@ -3903,6 +3907,6 @@
              ENDDO
           ELSE
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
                    local_pf(i,j,nzb+1) = c_liq_av(j,i)
                 ENDDO
@@ -3921,6 +3925,6 @@
              ENDDO
           ELSE
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
                    local_pf(i,j,nzb+1) = c_soil_av(j,i)
                 ENDDO
@@ -3939,6 +3943,6 @@
              ENDDO
           ELSE
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
                    local_pf(i,j,nzb+1) = c_veg_av(j,i)
                 ENDDO
@@ -3957,6 +3961,6 @@
              ENDDO
           ELSE
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
                    local_pf(i,j,nzb+1) = ghf_av(j,i)
                 ENDDO
@@ -3975,6 +3979,6 @@
              ENDDO
           ELSE
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
                    local_pf(i,j,nzb+1) = lai_av(j,i)
                 ENDDO
@@ -3993,6 +3997,6 @@
              ENDDO
           ELSE
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
                    local_pf(i,j,nzb+1) = m_liq_av(j,i)
                 ENDDO
@@ -4013,6 +4017,6 @@
              ENDDO
           ELSE
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
                    DO k = nzb_soil, nzt_soil
                       local_pf(i,j,k) = m_soil_av(k,j,i)
@@ -4035,6 +4039,6 @@
              ENDDO
           ELSE
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng 
+             DO  i = nxl, nxr
+                DO  j = nys, nyn 
                    local_pf(i,j,nzb+1) =  qsws_liq_av(j,i)
                 ENDDO
@@ -4053,6 +4057,6 @@
              ENDDO
           ELSE
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng 
+             DO  i = nxl, nxr
+                DO  j = nys, nyn 
                    local_pf(i,j,nzb+1) =  qsws_soil_av(j,i)
                 ENDDO
@@ -4071,6 +4075,6 @@
              ENDDO
           ELSE
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng 
+             DO  i = nxl, nxr
+                DO  j = nys, nyn 
                    local_pf(i,j,nzb+1) =  qsws_veg_av(j,i)
                 ENDDO
@@ -4090,6 +4094,6 @@
              ENDDO
           ELSE
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
                    local_pf(i,j,nzb+1) = r_a_av(j,i)
                 ENDDO
@@ -4108,6 +4112,6 @@
              ENDDO
           ELSE
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
                    local_pf(i,j,nzb+1) = r_s_av(j,i)
                 ENDDO
@@ -4128,6 +4132,6 @@
              ENDDO
           ELSE
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
                    DO k = nzb_soil, nzt_soil
                       local_pf(i,j,k) = t_soil_av(k,j,i)
@@ -4177,5 +4181,5 @@
     LOGICAL      ::  found !< 
 
-    REAL(sp), DIMENSION(nxlg:nxrg,nysg:nyng,nzb_soil:nzt_soil) ::  local_pf !< 
+    REAL(sp), DIMENSION(nxl:nxr,nys:nyn,nzb_soil:nzt_soil) ::  local_pf !< 
 
 
Index: palm/trunk/SOURCE/netcdf_interface_mod.f90
===================================================================
--- palm/trunk/SOURCE/netcdf_interface_mod.f90	(revision 2511)
+++ palm/trunk/SOURCE/netcdf_interface_mod.f90	(revision 2512)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! upper bounds of cross section and 3d output changed from nx+1,ny+1 to nx,ny
+! no output of ghost layer data any more
+! 
+! 2302 2017-07-03 14:07:20Z suehring
 ! Reading of 3D topography using NetCDF data type NC_BYTE
 ! 
@@ -1307,5 +1311,5 @@
 !
 !--       Define x-axis (for scalar position)
-          CALL netcdf_create_dim( id_set_3d(av), 'x', nx+2, id_dim_x_3d(av),   &
+          CALL netcdf_create_dim( id_set_3d(av), 'x', nx+1, id_dim_x_3d(av),   &
                                   73 )
           CALL netcdf_create_var( id_set_3d(av), (/ id_dim_x_3d(av) /), 'x',   &
@@ -1314,5 +1318,5 @@
 !
 !--       Define x-axis (for u position)
-          CALL netcdf_create_dim( id_set_3d(av), 'xu', nx+2, id_dim_xu_3d(av), &
+          CALL netcdf_create_dim( id_set_3d(av), 'xu', nx+1, id_dim_xu_3d(av), &
                                   358 )
           CALL netcdf_create_var( id_set_3d(av), (/ id_dim_xu_3d(av) /), 'xu', &
@@ -1321,5 +1325,5 @@
 !
 !--       Define y-axis (for scalar position)
-          CALL netcdf_create_dim( id_set_3d(av), 'y', ny+2, id_dim_y_3d(av),   &
+          CALL netcdf_create_dim( id_set_3d(av), 'y', ny+1, id_dim_y_3d(av),   &
                                   76 )
           CALL netcdf_create_var( id_set_3d(av), (/ id_dim_y_3d(av) /), 'y',   &
@@ -1328,5 +1332,5 @@
 !
 !--       Define y-axis (for v position)
-          CALL netcdf_create_dim( id_set_3d(av), 'yv', ny+2, id_dim_yv_3d(av), &
+          CALL netcdf_create_dim( id_set_3d(av), 'yv', ny+1, id_dim_yv_3d(av), &
                                   361 )
           CALL netcdf_create_var( id_set_3d(av), (/ id_dim_yv_3d(av) /), 'yv', &
@@ -1537,7 +1541,7 @@
 !
 !--          Write data for x (shifted by +dx/2) and xu axis
-             ALLOCATE( netcdf_data(0:nx+1) )
-
-             DO  i = 0, nx+1
+             ALLOCATE( netcdf_data(0:nx) )
+
+             DO  i = 0, nx
                 netcdf_data(i) = ( i + 0.5 ) * dx
              ENDDO
@@ -1545,8 +1549,8 @@
              nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_x_3d(av),  &
                                      netcdf_data, start = (/ 1 /),    &
-                                     count = (/ nx+2 /) )
+                                     count = (/ nx+1 /) )
              CALL netcdf_handle_error( 'netcdf_define_header', 83 )
 
-             DO  i = 0, nx+1
+             DO  i = 0, nx
                 netcdf_data(i) = i * dx
              ENDDO
@@ -1554,5 +1558,5 @@
              nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_xu_3d(av), &
                                      netcdf_data, start = (/ 1 /),    &
-                                     count = (/ nx+2 /) )
+                                     count = (/ nx+1 /) )
              CALL netcdf_handle_error( 'netcdf_define_header', 385 )
 
@@ -1561,7 +1565,7 @@
 !
 !--          Write data for y (shifted by +dy/2) and yv axis
-             ALLOCATE( netcdf_data(0:ny+1) )
-
-             DO  i = 0, ny+1
+             ALLOCATE( netcdf_data(0:ny) )
+
+             DO  i = 0, ny
                 netcdf_data(i) = ( i + 0.5_wp ) * dy
              ENDDO
@@ -1569,8 +1573,8 @@
              nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_y_3d(av),  &
                                      netcdf_data, start = (/ 1 /),    &
-                                     count = (/ ny+2 /) )
+                                     count = (/ ny+1 /) )
              CALL netcdf_handle_error( 'netcdf_define_header', 84 )
 
-             DO  i = 0, ny+1
+             DO  i = 0, ny
                 netcdf_data(i) = i * dy
              ENDDO
@@ -1578,5 +1582,5 @@
              nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_yv_3d(av), &
                                      netcdf_data, start = (/ 1 /),    &
-                                     count = (/ ny+2 /))
+                                     count = (/ ny+1 /))
              CALL netcdf_handle_error( 'netcdf_define_header', 387 )
 
@@ -1612,48 +1616,48 @@
                netcdf_data_format > 4 )  THEN
 
-             IF ( nxr == nx  .AND.  nyn /= ny )  THEN
-                nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_zusi_3d(av),     &
-                                        zu_s_inner(nxl:nxr+1,nys:nyn),         &
-                                        start = (/ nxl+1, nys+1 /),            &
-                                        count = (/ nxr-nxl+2, nyn-nys+1 /) )
-             ELSEIF ( nxr /= nx  .AND.  nyn == ny )  THEN
-                nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_zusi_3d(av),     &
-                                        zu_s_inner(nxl:nxr,nys:nyn+1),         &
-                                        start = (/ nxl+1, nys+1 /),            &
-                                        count = (/ nxr-nxl+1, nyn-nys+2 /) )
-             ELSEIF ( nxr == nx  .AND.  nyn == ny )  THEN
-                nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_zusi_3d(av),     &
-                                        zu_s_inner(nxl:nxr+1,nys:nyn+1),       &
-                                        start = (/ nxl+1, nys+1 /),            &
-                                        count = (/ nxr-nxl+2, nyn-nys+2 /) )
-             ELSE
+!             IF ( nxr == nx  .AND.  nyn /= ny )  THEN
+!                nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_zusi_3d(av),     &
+!                                        zu_s_inner(nxl:nxr+1,nys:nyn),         &
+!                                        start = (/ nxl+1, nys+1 /),            &
+!                                        count = (/ nxr-nxl+2, nyn-nys+1 /) )
+!             ELSEIF ( nxr /= nx  .AND.  nyn == ny )  THEN
+!                nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_zusi_3d(av),     &
+!                                        zu_s_inner(nxl:nxr,nys:nyn+1),         &
+!                                        start = (/ nxl+1, nys+1 /),            &
+!                                        count = (/ nxr-nxl+1, nyn-nys+2 /) )
+!             ELSEIF ( nxr == nx  .AND.  nyn == ny )  THEN
+!                nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_zusi_3d(av),     &
+!                                        zu_s_inner(nxl:nxr+1,nys:nyn+1),       &
+!                                        start = (/ nxl+1, nys+1 /),            &
+!                                        count = (/ nxr-nxl+2, nyn-nys+2 /) )
+!             ELSE
                 nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_zusi_3d(av),     &
                                         zu_s_inner(nxl:nxr,nys:nyn),           &
                                         start = (/ nxl+1, nys+1 /),            &
                                         count = (/ nxr-nxl+1, nyn-nys+1 /) )
-             ENDIF
+!             ENDIF
              CALL netcdf_handle_error( 'netcdf_define_header', 419 )
 
-             IF ( nxr == nx  .AND.  nyn /= ny )  THEN
-                nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_zwwi_3d(av),     &
-                                        zw_w_inner(nxl:nxr+1,nys:nyn),         &
-                                        start = (/ nxl+1, nys+1 /),            &
-                                        count = (/ nxr-nxl+2, nyn-nys+1 /) )
-             ELSEIF ( nxr /= nx  .AND.  nyn == ny )  THEN
-                nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_zwwi_3d(av),     &
-                                        zw_w_inner(nxl:nxr,nys:nyn+1),         &
-                                        start = (/ nxl+1, nys+1 /),            &
-                                        count = (/ nxr-nxl+1, nyn-nys+2 /) )
-             ELSEIF ( nxr == nx  .AND.  nyn == ny )  THEN
-                nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_zwwi_3d(av),     &
-                                        zw_w_inner(nxl:nxr+1,nys:nyn+1),       &
-                                        start = (/ nxl+1, nys+1 /),            &
-                                        count = (/ nxr-nxl+2, nyn-nys+2 /) )
-             ELSE
+!             IF ( nxr == nx  .AND.  nyn /= ny )  THEN
+!                nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_zwwi_3d(av),     &
+!                                        zw_w_inner(nxl:nxr+1,nys:nyn),         &
+!                                        start = (/ nxl+1, nys+1 /),            &
+!                                        count = (/ nxr-nxl+2, nyn-nys+1 /) )
+!             ELSEIF ( nxr /= nx  .AND.  nyn == ny )  THEN
+!                nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_zwwi_3d(av),     &
+!                                        zw_w_inner(nxl:nxr,nys:nyn+1),         &
+!                                        start = (/ nxl+1, nys+1 /),            &
+!                                        count = (/ nxr-nxl+1, nyn-nys+2 /) )
+!             ELSEIF ( nxr == nx  .AND.  nyn == ny )  THEN
+!                nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_zwwi_3d(av),     &
+!                                        zw_w_inner(nxl:nxr+1,nys:nyn+1),       &
+!                                        start = (/ nxl+1, nys+1 /),            &
+!                                        count = (/ nxr-nxl+2, nyn-nys+2 /) )
+!             ELSE
                 nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_zwwi_3d(av),     &
                                         zw_w_inner(nxl:nxr,nys:nyn),           &
                                         start = (/ nxl+1, nys+1 /),            &
                                         count = (/ nxr-nxl+1, nyn-nys+1 /) )
-             ENDIF
+!             ENDIF
              CALL netcdf_handle_error( 'netcdf_define_header', 420 )
 
@@ -1961,5 +1965,5 @@
 !
 !--       Define x-axis (for scalar position)
-          CALL netcdf_create_dim( id_set_xy(av), 'x', nx+2, id_dim_x_xy(av),   &
+          CALL netcdf_create_dim( id_set_xy(av), 'x', nx+1, id_dim_x_xy(av),   &
                                   113 )
           CALL netcdf_create_var( id_set_xy(av), (/ id_dim_x_xy(av) /), 'x',   &
@@ -1968,5 +1972,5 @@
 !
 !--       Define x-axis (for u position)
-          CALL netcdf_create_dim( id_set_xy(av), 'xu', nx+2,                   &
+          CALL netcdf_create_dim( id_set_xy(av), 'xu', nx+1,                   &
                                   id_dim_xu_xy(av), 388 )
           CALL netcdf_create_var( id_set_xy(av), (/ id_dim_xu_xy(av) /), 'xu', &
@@ -1975,5 +1979,5 @@
 !
 !--       Define y-axis (for scalar position)
-          CALL netcdf_create_dim( id_set_xy(av), 'y', ny+2, id_dim_y_xy(av),   &
+          CALL netcdf_create_dim( id_set_xy(av), 'y', ny+1, id_dim_y_xy(av),   &
                                   116 )
           CALL netcdf_create_var( id_set_xy(av), (/ id_dim_y_xy(av) /), 'y',   &
@@ -1982,5 +1986,5 @@
 !
 !--       Define y-axis (for scalar position)
-          CALL netcdf_create_dim( id_set_xy(av), 'yv', ny+2,                   &
+          CALL netcdf_create_dim( id_set_xy(av), 'yv', ny+1,                   &
                                   id_dim_yv_xy(av), 364 )
           CALL netcdf_create_var( id_set_xy(av), (/ id_dim_yv_xy(av) /), 'yv', &
@@ -2255,7 +2259,7 @@
 !
 !--          Write data for x (shifted by +dx/2) and xu axis
-             ALLOCATE( netcdf_data(0:nx+1) )
-
-             DO  i = 0, nx+1
+             ALLOCATE( netcdf_data(0:nx) )
+
+             DO  i = 0, nx
                 netcdf_data(i) = ( i + 0.5_wp ) * dx
              ENDDO
@@ -2263,8 +2267,8 @@
              nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_x_xy(av), &
                                      netcdf_data, start = (/ 1 /),   &
-                                     count = (/ nx+2 /) )
+                                     count = (/ nx+1 /) )
              CALL netcdf_handle_error( 'netcdf_define_header', 127 )
 
-             DO  i = 0, nx+1
+             DO  i = 0, nx
                 netcdf_data(i) = i * dx
              ENDDO
@@ -2272,5 +2276,5 @@
              nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_xu_xy(av), &
                                      netcdf_data, start = (/ 1 /),    &
-                                     count = (/ nx+2 /) )
+                                     count = (/ nx+1 /) )
              CALL netcdf_handle_error( 'netcdf_define_header', 367 )
 
@@ -2281,5 +2285,5 @@
              ALLOCATE( netcdf_data(0:ny+1) )
 
-             DO  i = 0, ny+1
+             DO  i = 0, ny
                 netcdf_data(i) = ( i + 0.5_wp ) * dy
              ENDDO
@@ -2287,8 +2291,8 @@
              nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_y_xy(av), &
                                      netcdf_data, start = (/ 1 /),   &
-                                     count = (/ ny+2 /))
+                                     count = (/ ny+1 /))
              CALL netcdf_handle_error( 'netcdf_define_header', 128 )
 
-             DO  i = 0, ny+1
+             DO  i = 0, ny
                 netcdf_data(i) = i * dy
              ENDDO
@@ -2296,5 +2300,5 @@
              nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_yv_xy(av), &
                                      netcdf_data, start = (/ 1 /),    &
-                                     count = (/ ny+2 /))
+                                     count = (/ ny+1 /))
              CALL netcdf_handle_error( 'netcdf_define_header', 368 )
 
@@ -2309,48 +2313,48 @@
                netcdf_data_format > 4  )  THEN
 
-             IF ( nxr == nx  .AND.  nyn /= ny )  THEN
-                nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_zusi_xy(av),     &
-                                        zu_s_inner(nxl:nxr+1,nys:nyn),         &
-                                        start = (/ nxl+1, nys+1 /),            &
-                                        count = (/ nxr-nxl+2, nyn-nys+1 /) )
-             ELSEIF ( nxr /= nx  .AND.  nyn == ny )  THEN
-                nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_zusi_xy(av),     &
-                                        zu_s_inner(nxl:nxr,nys:nyn+1),         &
-                                        start = (/ nxl+1, nys+1 /),            &
-                                        count = (/ nxr-nxl+1, nyn-nys+2 /) )
-             ELSEIF ( nxr == nx  .AND.  nyn == ny )  THEN
-                nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_zusi_xy(av),     &
-                                        zu_s_inner(nxl:nxr+1,nys:nyn+1),       &
-                                        start = (/ nxl+1, nys+1 /),            &
-                                        count = (/ nxr-nxl+2, nyn-nys+2 /) )
-             ELSE
+!             IF ( nxr == nx  .AND.  nyn /= ny )  THEN
+!                nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_zusi_xy(av),     &
+!                                        zu_s_inner(nxl:nxr+1,nys:nyn),         &
+!                                        start = (/ nxl+1, nys+1 /),            &
+!                                        count = (/ nxr-nxl+2, nyn-nys+1 /) )
+!             ELSEIF ( nxr /= nx  .AND.  nyn == ny )  THEN
+!                nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_zusi_xy(av),     &
+!                                        zu_s_inner(nxl:nxr,nys:nyn+1),         &
+!                                        start = (/ nxl+1, nys+1 /),            &
+!                                        count = (/ nxr-nxl+1, nyn-nys+2 /) )
+!             ELSEIF ( nxr == nx  .AND.  nyn == ny )  THEN
+!                nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_zusi_xy(av),     &
+!                                        zu_s_inner(nxl:nxr+1,nys:nyn+1),       &
+!                                        start = (/ nxl+1, nys+1 /),            &
+!                                        count = (/ nxr-nxl+2, nyn-nys+2 /) )
+!             ELSE
                 nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_zusi_xy(av),     &
                                         zu_s_inner(nxl:nxr,nys:nyn),           &
                                         start = (/ nxl+1, nys+1 /),            &
                                         count = (/ nxr-nxl+1, nyn-nys+1 /) )
-             ENDIF
+!             ENDIF
              CALL netcdf_handle_error( 'netcdf_define_header', 427 )
 
-             IF ( nxr == nx  .AND.  nyn /= ny )  THEN
-                nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_zwwi_xy(av),     &
-                                        zw_w_inner(nxl:nxr+1,nys:nyn),         &
-                                        start = (/ nxl+1, nys+1 /),            &
-                                        count = (/ nxr-nxl+2, nyn-nys+1 /) )
-             ELSEIF ( nxr /= nx  .AND.  nyn == ny )  THEN
-                nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_zwwi_xy(av),     &
-                                        zw_w_inner(nxl:nxr,nys:nyn+1),         &
-                                        start = (/ nxl+1, nys+1 /),            &
-                                        count = (/ nxr-nxl+1, nyn-nys+2 /) )
-             ELSEIF ( nxr == nx  .AND.  nyn == ny )  THEN
-                nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_zwwi_xy(av),     &
-                                        zw_w_inner(nxl:nxr+1,nys:nyn+1),       &
-                                        start = (/ nxl+1, nys+1 /),            &
-                                        count = (/ nxr-nxl+2, nyn-nys+2 /) )
-             ELSE
+!             IF ( nxr == nx  .AND.  nyn /= ny )  THEN
+!                nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_zwwi_xy(av),     &
+!                                        zw_w_inner(nxl:nxr+1,nys:nyn),         &
+!                                        start = (/ nxl+1, nys+1 /),            &
+!                                        count = (/ nxr-nxl+2, nyn-nys+1 /) )
+!             ELSEIF ( nxr /= nx  .AND.  nyn == ny )  THEN
+!                nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_zwwi_xy(av),     &
+!                                        zw_w_inner(nxl:nxr,nys:nyn+1),         &
+!                                        start = (/ nxl+1, nys+1 /),            &
+!                                        count = (/ nxr-nxl+1, nyn-nys+2 /) )
+!             ELSEIF ( nxr == nx  .AND.  nyn == ny )  THEN
+!                nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_zwwi_xy(av),     &
+!                                        zw_w_inner(nxl:nxr+1,nys:nyn+1),       &
+!                                        start = (/ nxl+1, nys+1 /),            &
+!                                        count = (/ nxr-nxl+2, nyn-nys+2 /) )
+!             ELSE
                 nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_zwwi_xy(av),     &
                                         zw_w_inner(nxl:nxr,nys:nyn),           &
                                         start = (/ nxl+1, nys+1 /),            &
                                         count = (/ nxr-nxl+1, nyn-nys+1 /) )
-             ENDIF
+!             ENDIF
              CALL netcdf_handle_error( 'netcdf_define_header', 428 )
 
@@ -2684,5 +2688,5 @@
 !
 !--       Define x-axis (for scalar position)
-          CALL netcdf_create_dim( id_set_xz(av), 'x', nx+2, id_dim_x_xz(av),   &
+          CALL netcdf_create_dim( id_set_xz(av), 'x', nx+1, id_dim_x_xz(av),   &
                                   150 )
           CALL netcdf_create_var( id_set_xz(av), (/ id_dim_x_xz(av) /), 'x',   &
@@ -2691,5 +2695,5 @@
 !
 !--       Define x-axis (for u position)
-          CALL netcdf_create_dim( id_set_xz(av), 'xu', nx+2, id_dim_xu_xz(av), &
+          CALL netcdf_create_dim( id_set_xz(av), 'xu', nx+1, id_dim_xu_xz(av), &
                                   372 )
           CALL netcdf_create_var( id_set_xz(av), (/ id_dim_xu_xz(av) /), 'xu', &
@@ -2940,7 +2944,7 @@
 !
 !--          Write data for x (shifted by +dx/2) and xu axis
-             ALLOCATE( netcdf_data(0:nx+1) )
-
-             DO  i = 0, nx+1
+             ALLOCATE( netcdf_data(0:nx) )
+
+             DO  i = 0, nx
                 netcdf_data(i) = ( i + 0.5_wp ) * dx
              ENDDO
@@ -2948,8 +2952,8 @@
              nc_stat = NF90_PUT_VAR( id_set_xz(av), id_var_x_xz(av), &
                                      netcdf_data, start = (/ 1 /),   &
-                                     count = (/ nx+2 /) )
+                                     count = (/ nx+1 /) )
              CALL netcdf_handle_error( 'netcdf_define_header', 165 )
 
-             DO  i = 0, nx+1
+             DO  i = 0, nx
                 netcdf_data(i) = i * dx
              ENDDO
@@ -2957,5 +2961,5 @@
              nc_stat = NF90_PUT_VAR( id_set_xz(av), id_var_xu_xz(av), &
                                      netcdf_data, start = (/ 1 /),    &
-                                     count = (/ nx+2 /) )
+                                     count = (/ nx+1 /) )
              CALL netcdf_handle_error( 'netcdf_define_header', 377 )
 
@@ -3337,5 +3341,5 @@
 !
 !--       Define y-axis (for scalar position)
-          CALL netcdf_create_dim( id_set_yz(av), 'y', ny+2, id_dim_y_yz(av),   &
+          CALL netcdf_create_dim( id_set_yz(av), 'y', ny+1, id_dim_y_yz(av),   &
                                   189 )
           CALL netcdf_create_var( id_set_yz(av), (/ id_dim_y_yz(av) /), 'y',   &
@@ -3344,5 +3348,5 @@
 !
 !--       Define y-axis (for v position)
-          CALL netcdf_create_dim( id_set_yz(av), 'yv', ny+2, id_dim_yv_yz(av), &
+          CALL netcdf_create_dim( id_set_yz(av), 'yv', ny+1, id_dim_yv_yz(av), &
                                   380 )
           CALL netcdf_create_var( id_set_yz(av), (/ id_dim_yv_yz(av) /), 'yv', &
@@ -3592,7 +3596,7 @@
 !
 !--          Write data for y (shifted by +dy/2) and yv axis
-             ALLOCATE( netcdf_data(0:ny+1) )
-
-             DO  j = 0, ny+1
+             ALLOCATE( netcdf_data(0:ny) )
+
+             DO  j = 0, ny
                 netcdf_data(j) = ( j + 0.5_wp ) * dy
              ENDDO
@@ -3600,8 +3604,8 @@
              nc_stat = NF90_PUT_VAR( id_set_yz(av), id_var_y_yz(av), &
                                      netcdf_data, start = (/ 1 /),   &
-                                     count = (/ ny+2 /) )
+                                     count = (/ ny+1 /) )
              CALL netcdf_handle_error( 'netcdf_define_header', 204 )
 
-             DO  j = 0, ny+1
+             DO  j = 0, ny
                 netcdf_data(j) = j * dy
              ENDDO
@@ -3609,5 +3613,5 @@
              nc_stat = NF90_PUT_VAR( id_set_yz(av), id_var_yv_yz(av), &
                                      netcdf_data, start = (/ 1 /),    &
-                                     count = (/ ny+2 /) )
+                                     count = (/ ny+1 /) )
              CALL netcdf_handle_error( 'netcdf_define_header', 384 )
 
Index: palm/trunk/SOURCE/palm.f90
===================================================================
--- palm/trunk/SOURCE/palm.f90	(revision 2511)
+++ palm/trunk/SOURCE/palm.f90	(revision 2512)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! user interface required revision updated
+! 
+! 2320 2017-07-21 12:47:43Z suehring
 ! Modularize large-scale forcing and nudging
 ! 
@@ -237,5 +240,5 @@
 
     version = 'PALM 4.0'
-    user_interface_required_revision = 'r2297'
+    user_interface_required_revision = 'r2512'
 
 #if defined( __parallel )
Index: palm/trunk/SOURCE/plant_canopy_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/plant_canopy_model_mod.f90	(revision 2511)
+++ palm/trunk/SOURCE/plant_canopy_model_mod.f90	(revision 2512)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! upper bounds of 3d output changed from nx+1,ny+1 to nx,ny
+! no output of ghost layer data
+! 
+! 2318 2017-07-20 17:27:44Z suehring
 ! Get topography top index via Function call 
 ! 
@@ -356,5 +360,5 @@
     LOGICAL      ::  found !< 
 
-    REAL(sp), DIMENSION(nxlg:nxrg,nysg:nyng,nzb:nz_do3d) ::  local_pf !< 
+    REAL(sp), DIMENSION(nxl:nxr,nys:nyn,nzb:nz_do3d) ::  local_pf !< 
 
 
@@ -365,8 +369,7 @@
 
       CASE ( 'pcm_heatrate' )
-         CALL exchange_horiz( pc_heating_rate, nbgp )
          IF ( av == 0 )  THEN
-            DO  i = nxlg, nxrg
-               DO  j = nysg, nyng
+            DO  i = nxl, nxr
+               DO  j = nys, nyn
                   DO  k = nzb_s_inner(j,i), nz_do3d
                      local_pf(i,j,k) = pc_heating_rate(k-nzb_s_inner(j,i),j,i)
@@ -379,6 +382,6 @@
       CASE ( 'pcm_lad' )
          IF ( av == 0 )  THEN
-            DO  i = nxlg, nxrg
-               DO  j = nysg, nyng
+            DO  i = nxl, nxr
+               DO  j = nys, nyn
                   DO  k = nzb_s_inner(j,i), nz_do3d
                      local_pf(i,j,k) = lad_s(k-nzb_s_inner(j,i),j,i)
Index: palm/trunk/SOURCE/radiation_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/radiation_model_mod.f90	(revision 2511)
+++ palm/trunk/SOURCE/radiation_model_mod.f90	(revision 2512)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! upper bounds of cross section and 3d output changed from nx+1,ny+1 to nx,ny
+! no output of ghost layer data
+! 
+! 2504 2017-09-27 10:36:13Z maronga
 ! Updates pavement types and albedo parameters
 ! 
@@ -2810,5 +2814,5 @@
     LOGICAL      ::  two_d !< flag parameter that indicates 2D variables (horizontal cross sections)
 
-    REAL(wp), DIMENSION(nxlg:nxrg,nysg:nyng,nzb:nzt+1) ::  local_pf !< 
+    REAL(wp), DIMENSION(nxl:nxr,nys:nyn,nzb:nzt+1) ::  local_pf !< 
 
     found = .TRUE.
@@ -2818,12 +2822,12 @@
        CASE ( 'rad_net*_xy' )        ! 2d-array
           IF ( av == 0 ) THEN
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
                    local_pf(i,j,nzb+1) = rad_net(j,i)
                 ENDDO
              ENDDO
           ELSE
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng 
+             DO  i = nxl, nxr
+                DO  j = nys, nyn 
                    local_pf(i,j,nzb+1) = rad_net_av(j,i)
                 ENDDO
@@ -2836,6 +2840,6 @@
        CASE ( 'rad_lw_in_xy', 'rad_lw_in_xz', 'rad_lw_in_yz' )
           IF ( av == 0 ) THEN
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
                    DO  k = nzb, nzt+1
                       local_pf(i,j,k) = rad_lw_in(k,j,i)
@@ -2844,6 +2848,6 @@
              ENDDO
           ELSE
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng 
+             DO  i = nxl, nxr
+                DO  j = nys, nyn 
                    DO  k = nzb, nzt+1
                       local_pf(i,j,k) = rad_lw_in_av(k,j,i)
@@ -2856,6 +2860,6 @@
        CASE ( 'rad_lw_out_xy', 'rad_lw_out_xz', 'rad_lw_out_yz' )
           IF ( av == 0 ) THEN
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
                    DO  k = nzb, nzt+1
                       local_pf(i,j,k) = rad_lw_out(k,j,i)
@@ -2864,6 +2868,6 @@
              ENDDO
           ELSE
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng 
+             DO  i = nxl, nxr
+                DO  j = nys, nyn 
                    DO  k = nzb, nzt+1
                       local_pf(i,j,k) = rad_lw_out_av(k,j,i)
@@ -2876,6 +2880,6 @@
        CASE ( 'rad_lw_cs_hr_xy', 'rad_lw_cs_hr_xz', 'rad_lw_cs_hr_yz' )
           IF ( av == 0 ) THEN
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
                    DO  k = nzb, nzt+1
                       local_pf(i,j,k) = rad_lw_cs_hr(k,j,i)
@@ -2884,6 +2888,6 @@
              ENDDO
           ELSE
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng 
+             DO  i = nxl, nxr
+                DO  j = nys, nyn 
                    DO  k = nzb, nzt+1
                       local_pf(i,j,k) = rad_lw_cs_hr_av(k,j,i)
@@ -2896,6 +2900,6 @@
        CASE ( 'rad_lw_hr_xy', 'rad_lw_hr_xz', 'rad_lw_hr_yz' )
           IF ( av == 0 ) THEN
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
                    DO  k = nzb, nzt+1
                       local_pf(i,j,k) = rad_lw_hr(k,j,i)
@@ -2904,6 +2908,6 @@
              ENDDO
           ELSE
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng 
+             DO  i = nxl, nxr
+                DO  j = nys, nyn 
                    DO  k = nzb, nzt+1
                       local_pf(i,j,k) = rad_lw_hr_av(k,j,i)
@@ -2916,6 +2920,6 @@
        CASE ( 'rad_sw_in_xy', 'rad_sw_in_xz', 'rad_sw_in_yz' )
           IF ( av == 0 ) THEN
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
                    DO  k = nzb, nzt+1
                       local_pf(i,j,k) = rad_sw_in(k,j,i)
@@ -2924,6 +2928,6 @@
              ENDDO
           ELSE
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng 
+             DO  i = nxl, nxr
+                DO  j = nys, nyn 
                    DO  k = nzb, nzt+1
                       local_pf(i,j,k) = rad_sw_in_av(k,j,i)
@@ -2936,6 +2940,6 @@
        CASE ( 'rad_sw_out_xy', 'rad_sw_out_xz', 'rad_sw_out_yz' )
           IF ( av == 0 ) THEN
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
                    DO  k = nzb, nzt+1
                       local_pf(i,j,k) = rad_sw_out(k,j,i)
@@ -2944,6 +2948,6 @@
              ENDDO
           ELSE
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng 
+             DO  i = nxl, nxr
+                DO  j = nys, nyn 
                    DO  k = nzb, nzt+1
                       local_pf(i,j,k) = rad_sw_out_av(k,j,i)
@@ -2956,6 +2960,6 @@
        CASE ( 'rad_sw_cs_hr_xy', 'rad_sw_cs_hr_xz', 'rad_sw_cs_hr_yz' )
           IF ( av == 0 ) THEN
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
                    DO  k = nzb, nzt+1
                       local_pf(i,j,k) = rad_sw_cs_hr(k,j,i)
@@ -2964,6 +2968,6 @@
              ENDDO
           ELSE
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng 
+             DO  i = nxl, nxr
+                DO  j = nys, nyn 
                    DO  k = nzb, nzt+1
                       local_pf(i,j,k) = rad_sw_cs_hr_av(k,j,i)
@@ -2976,6 +2980,6 @@
        CASE ( 'rad_sw_hr_xy', 'rad_sw_hr_xz', 'rad_sw_hr_yz' )
           IF ( av == 0 ) THEN
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng
+             DO  i = nxl, nxr
+                DO  j = nys, nyn
                    DO  k = nzb, nzt+1
                       local_pf(i,j,k) = rad_sw_hr(k,j,i)
@@ -2984,6 +2988,6 @@
              ENDDO
           ELSE
-             DO  i = nxlg, nxrg
-                DO  j = nysg, nyng 
+             DO  i = nxl, nxr
+                DO  j = nys, nyn 
                    DO  k = nzb, nzt+1
                       local_pf(i,j,k) = rad_sw_hr_av(k,j,i)
@@ -3028,5 +3032,5 @@
     LOGICAL      ::  found !< 
 
-    REAL(sp), DIMENSION(nxlg:nxrg,nysg:nyng,nzb:nzt+1) ::  local_pf !< 
+    REAL(sp), DIMENSION(nxl:nxr,nys:nyn,nzb:nzt+1) ::  local_pf !< 
 
 
@@ -3038,6 +3042,6 @@
       CASE ( 'rad_sw_in' )
          IF ( av == 0 )  THEN
-            DO  i = nxlg, nxrg
-               DO  j = nysg, nyng
+            DO  i = nxl, nxr
+               DO  j = nys, nyn
                   DO  k = nzb, nzt+1
                      local_pf(i,j,k) = rad_sw_in(k,j,i)
@@ -3046,6 +3050,6 @@
             ENDDO
          ELSE
-            DO  i = nxlg, nxrg
-               DO  j = nysg, nyng
+            DO  i = nxl, nxr
+               DO  j = nys, nyn
                   DO  k = nzb, nzt+1
                      local_pf(i,j,k) = rad_sw_in_av(k,j,i)
@@ -3057,6 +3061,6 @@
       CASE ( 'rad_sw_out' )
          IF ( av == 0 )  THEN
-            DO  i = nxlg, nxrg
-               DO  j = nysg, nyng
+            DO  i = nxl, nxr
+               DO  j = nys, nyn
                   DO  k = nzb, nzt+1
                      local_pf(i,j,k) = rad_sw_out(k,j,i)
@@ -3065,6 +3069,6 @@
             ENDDO
          ELSE
-            DO  i = nxlg, nxrg
-               DO  j = nysg, nyng
+            DO  i = nxl, nxr
+               DO  j = nys, nyn
                   DO  k = nzb, nzt+1
                      local_pf(i,j,k) = rad_sw_out_av(k,j,i)
@@ -3076,6 +3080,6 @@
       CASE ( 'rad_sw_cs_hr' )
          IF ( av == 0 )  THEN
-            DO  i = nxlg, nxrg
-               DO  j = nysg, nyng
+            DO  i = nxl, nxr
+               DO  j = nys, nyn
                   DO  k = nzb, nzt+1
                      local_pf(i,j,k) = rad_sw_cs_hr(k,j,i)
@@ -3084,6 +3088,6 @@
             ENDDO
          ELSE
-            DO  i = nxlg, nxrg
-               DO  j = nysg, nyng
+            DO  i = nxl, nxr
+               DO  j = nys, nyn
                   DO  k = nzb, nzt+1
                      local_pf(i,j,k) = rad_sw_cs_hr_av(k,j,i)
@@ -3095,6 +3099,6 @@
       CASE ( 'rad_sw_hr' )
          IF ( av == 0 )  THEN
-            DO  i = nxlg, nxrg
-               DO  j = nysg, nyng
+            DO  i = nxl, nxr
+               DO  j = nys, nyn
                   DO  k = nzb, nzt+1
                      local_pf(i,j,k) = rad_sw_hr(k,j,i)
@@ -3103,6 +3107,6 @@
             ENDDO
          ELSE
-            DO  i = nxlg, nxrg
-               DO  j = nysg, nyng
+            DO  i = nxl, nxr
+               DO  j = nys, nyn
                   DO  k = nzb, nzt+1
                      local_pf(i,j,k) = rad_sw_hr_av(k,j,i)
@@ -3114,6 +3118,6 @@
       CASE ( 'rad_lw_in' )
          IF ( av == 0 )  THEN
-            DO  i = nxlg, nxrg
-               DO  j = nysg, nyng
+            DO  i = nxl, nxr
+               DO  j = nys, nyn
                   DO  k = nzb, nzt+1
                      local_pf(i,j,k) = rad_lw_in(k,j,i)
@@ -3122,6 +3126,6 @@
             ENDDO
          ELSE
-            DO  i = nxlg, nxrg
-               DO  j = nysg, nyng
+            DO  i = nxl, nxr
+               DO  j = nys, nyn
                   DO  k = nzb, nzt+1
                      local_pf(i,j,k) = rad_lw_in_av(k,j,i)
@@ -3133,6 +3137,6 @@
       CASE ( 'rad_lw_out' )
          IF ( av == 0 )  THEN
-            DO  i = nxlg, nxrg
-               DO  j = nysg, nyng
+            DO  i = nxl, nxr
+               DO  j = nys, nyn
                   DO  k = nzb, nzt+1
                      local_pf(i,j,k) = rad_lw_out(k,j,i)
@@ -3141,6 +3145,6 @@
             ENDDO
          ELSE
-            DO  i = nxlg, nxrg
-               DO  j = nysg, nyng
+            DO  i = nxl, nxr
+               DO  j = nys, nyn
                   DO  k = nzb, nzt+1
                      local_pf(i,j,k) = rad_lw_out_av(k,j,i)
@@ -3152,6 +3156,6 @@
       CASE ( 'rad_lw_cs_hr' )
          IF ( av == 0 )  THEN
-            DO  i = nxlg, nxrg
-               DO  j = nysg, nyng
+            DO  i = nxl, nxr
+               DO  j = nys, nyn
                   DO  k = nzb, nzt+1
                      local_pf(i,j,k) = rad_lw_cs_hr(k,j,i)
@@ -3160,6 +3164,6 @@
             ENDDO
          ELSE
-            DO  i = nxlg, nxrg
-               DO  j = nysg, nyng
+            DO  i = nxl, nxr
+               DO  j = nys, nyn
                   DO  k = nzb, nzt+1
                      local_pf(i,j,k) = rad_lw_cs_hr_av(k,j,i)
@@ -3171,6 +3175,6 @@
       CASE ( 'rad_lw_hr' )
          IF ( av == 0 )  THEN
-            DO  i = nxlg, nxrg
-               DO  j = nysg, nyng
+            DO  i = nxl, nxr
+               DO  j = nys, nyn
                   DO  k = nzb, nzt+1
                      local_pf(i,j,k) = rad_lw_hr(k,j,i)
@@ -3179,6 +3183,6 @@
             ENDDO
          ELSE
-            DO  i = nxlg, nxrg
-               DO  j = nysg, nyng
+            DO  i = nxl, nxr
+               DO  j = nys, nyn
                   DO  k = nzb, nzt+1
                      local_pf(i,j,k) = rad_lw_hr_av(k,j,i)
Index: palm/trunk/SOURCE/urban_surface_mod.f90
===================================================================
--- palm/trunk/SOURCE/urban_surface_mod.f90	(revision 2511)
+++ palm/trunk/SOURCE/urban_surface_mod.f90	(revision 2512)
@@ -26,4 +26,8 @@
 ! -----------------
 ! $Id$
+! upper bounds of 3d output changed from nx+1,ny+1 to nx,ny
+! no output of ghost layer data
+! 
+! 2350 2017-08-15 11:48:26Z kanani
 ! Bugfix and error message for nopointer version. 
 ! Additional "! defined(__nopointer)" as workaround to enable compilation of 
@@ -2424,6 +2428,6 @@
         INTEGER(iwp), INTENT(IN)       ::  nzt_do    !< vertical upper limit of the data output (usually nz_do3d)
         LOGICAL, INTENT(OUT)           ::  found     !< 
-        REAL(sp), DIMENSION(nxlg:nxrg,nysg:nyng,nzb_do:nzt_do) ::  local_pf   !< sp - it has to correspond to module data_output_3d
-        REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg)     ::  temp_pf    !< temp array for urban surface output procedure
+        REAL(sp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do) ::  local_pf   !< sp - it has to correspond to module data_output_3d
+        REAL(wp), DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr)     ::  temp_pf    !< temp array for urban surface output procedure
         
         CHARACTER (len=varnamelength)                          :: var, surfid
@@ -2900,12 +2904,9 @@
               
         END SELECT
-        
-!--     fill out array local_pf which is subsequently treated by data_output_3d
-        CALL exchange_horiz( temp_pf, nbgp )
-!
-!--  To Do: why reversed loop order
-        DO j = nysg,nyng
-            DO i = nxlg,nxrg
-                DO k = nzb_do, nzt_do
+!
+!--     Rearrange dimensions for NetCDF output
+        DO  j = nys, nyn
+            DO  i = nxl, nxr
+                DO  k = nzb_do, nzt_do
                     local_pf(i,j,k) = temp_pf(k,j,i)
                 ENDDO
Index: palm/trunk/SOURCE/user_data_output_2d.f90
===================================================================
--- palm/trunk/SOURCE/user_data_output_2d.f90	(revision 2511)
+++ palm/trunk/SOURCE/user_data_output_2d.f90	(revision 2512)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! ghost layer points removed from output array local_pf
+! 
+! 2233 2017-05-30 18:08:54Z suehring
 !
 ! 2232 2017-05-30 17:47:52Z suehring
@@ -85,5 +88,5 @@
     LOGICAL      ::  two_d !< flag parameter that indicates 2D variables (horizontal cross sections)
 
-    REAL(wp), DIMENSION(nxlg:nxrg,nysg:nyng,nzb:nzt+1) ::  local_pf !< 
+    REAL(wp), DIMENSION(nxl:nxr,nys:nyn,nzb:nzt+1) ::  local_pf !< 
 
 
@@ -99,6 +102,6 @@
 !       CASE ( 'u2_xy', 'u2_xz', 'u2_yz' )
 !          IF ( av == 0 )  THEN
-!             DO  i = nxlg, nxrg
-!                DO  j = nysg, nyng
+!             DO  i = nxl, nxr
+!                DO  j = nys, nyn
 !                   DO  k = nzb_do, nzt_do
 !                      local_pf(i,j,k) = u2(k,j,i)
@@ -107,6 +110,6 @@
 !             ENDDO
 !          ELSE
-!             DO  i = nxlg, nxrg
-!                DO  j = nysg, nyng
+!             DO  i = nxl, nxr
+!                DO  j = nys, nyn
 !                   DO  k = nzb_do, nzt_do
 !                      local_pf(i,j,k) = u2_av(k,j,i)
@@ -118,5 +121,5 @@
 !          grid = 'zu'
 !
-!--    In case two-dimensional surface variables are outputted, the user
+!--    In case two-dimensional surface variables are output, the user
 !--    has to access related surface-type. Uncomment and extend following lines
 !--    appropriately (example output of vertical surface momentum flux of u-
@@ -160,3 +163,2 @@
 
  END SUBROUTINE user_data_output_2d
-
Index: palm/trunk/SOURCE/user_data_output_3d.f90
===================================================================
--- palm/trunk/SOURCE/user_data_output_3d.f90	(revision 2511)
+++ palm/trunk/SOURCE/user_data_output_3d.f90	(revision 2512)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! ghost layer points removed from output array local_pf
+! 
+! 2101 2017-01-05 16:42:31Z suehring
 !
 ! 2000 2016-08-20 18:09:15Z knoop
@@ -78,5 +81,5 @@
     LOGICAL      ::  found !< 
 
-   REAL(sp), DIMENSION(nxlg:nxrg,nysg:nyng,nzb_do:nzt_do) ::  local_pf !< 
+   REAL(sp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do) ::  local_pf !< 
 
 
@@ -92,6 +95,6 @@
 !       CASE ( 'u2' )
 !          IF ( av == 0 )  THEN
-!             DO  i = nxlg, nxrg
-!                DO  j = nysg, nyng
+!             DO  i = nxl, nxr
+!                DO  j = nys, nyn
 !                   DO  k = nzb_do, nzt_do
 !                      local_pf(i,j,k) = u2(k,j,i)
@@ -100,6 +103,6 @@
 !             ENDDO
 !          ELSE
-!             DO  i = nxlg, nxrg
-!                DO  j = nysg, nyng
+!             DO  i = nxl, nxr
+!                DO  j = nys, nyn
 !                   DO  k = nzb_do, nzt_do
 !                      local_pf(i,j,k) = u2_av(k,j,i)
Index: palm/trunk/SOURCE/user_parin.f90
===================================================================
--- palm/trunk/SOURCE/user_parin.f90	(revision 2511)
+++ palm/trunk/SOURCE/user_parin.f90	(revision 2512)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! current interface revision number number set to r2512
+! 
+! 2298 2017-06-29 09:28:18Z raasch
 ! user interface current revision updated
 ! 
@@ -102,5 +105,5 @@
 !-- current revision does not match with previous revisions (e.g. if routines
 !-- have been added/deleted or if parameter lists in subroutines have been changed).
-    user_interface_current_revision = 'r2297'
+    user_interface_current_revision = 'r2512'
 
 !
Index: palm/trunk/UTIL/combine_plot_fields.f90
===================================================================
--- palm/trunk/UTIL/combine_plot_fields.f90	(revision 2511)
+++ palm/trunk/UTIL/combine_plot_fields.f90	(revision 2512)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! PALM output does not contain ghost layer data any more
+! avs- and iso2d-related parts removed, handling of compressed data removed
+! 
+! 2365 2017-08-21 14:59:59Z kanani
 ! Vertical grid nesting implemented (SadiqHuq)
 !
@@ -121,10 +125,8 @@
     INTEGER(iwp), DIMENSION(0:1,1000) ::  id_var, levels
 
-    LOGICAL  ::  avs_output, compressed, found, iso2d_output, netcdf_output,   &
-                 netcdf_parallel, netcdf_0, netcdf_1
+    LOGICAL  ::  found, netcdf_output, netcdf_parallel, netcdf_0, netcdf_1
     LOGICAL  ::  vnest
 
     REAL(wp) ::  cpu_start_time, cpu_end_time, dx, simulated_time
-    REAL(wp),  DIMENSION(:),   ALLOCATABLE   ::  eta, ho, hu
     REAL(wp),  DIMENSION(:,:), ALLOCATABLE   ::  pf, pf_tmp
     REAL(spk), DIMENSION(:,:,:), ALLOCATABLE ::  pf3d, pf3d_tmp
@@ -227,9 +229,4 @@
 
 !
-!--       Inquire whether an iso2d parameter file exists
-          INQUIRE( FILE='PLOT2D_'//modus//'_GLOBAL'//TRIM( model_string ), &
-               EXIST=iso2d_output )
-
-!
 !--       Inquire whether a NetCDF file exists
           INQUIRE( FILE='DATA_2D_'//modus//'_NETCDF'//TRIM( model_string ), &
@@ -387,19 +384,11 @@
 !--                File from PE0 contains special information at the beginning,
 !--                concerning the lower and upper indices of the total-domain
-!--                used in PALM (nxag, nxeg, nyag, nyeg) and the lower and
-!--                upper indices of the array to be written by this routine
-!--                (nxa, nxe, nya, nye). Usually in the horizontal directions
-!--                nxag=-1 and nxa=0 while all other variables have the same
-!--                value (i.e. nxeg=nxe).
+!--                used in PALM (nxa, nxe, nya, nye).
 !--                Allocate necessary arrays, open the output file and write
 !--                the coordinate informations needed by ISO2D.
                    IF ( id == 0  .AND.  fanz(0) == 0  .AND.  fanz(1) == 0 ) THEN
-                      READ ( id+110 )  nxag, nxeg, nyag, nyeg
+
                       READ ( id+110 )  nxa, nxe, nya, nye
-                      ALLOCATE ( eta(nya:nye), ho(nxa:nxe), hu(nxa:nxe), &
-                                 pf(nxag:nxeg,nyag:nyeg) )
-                      READ ( id+110 )  dx, eta, hu, ho
-
-
+                      ALLOCATE ( pf(nxa:nxe,nya:nye) )
 !
 !--                   Set actual domain bounds to total domain
@@ -407,21 +396,9 @@
                       ye_do = nye
 
-                      IF ( iso2d_output )  THEN
-                         OPEN ( 2, FILE='PLOT2D_'//modus//TRIM( model_string ),&
-                                   FORM='UNFORMATTED' )
-                         WRITE ( 2 )  dx, eta, hu, ho
-                      ENDIF
                    ENDIF
 !
 !--                Read output time
                    IF ( netcdf_output  .AND.  id == 0 )  THEN
-                      IF ( netcdf_1 )  THEN
-                         READ ( id+110, END=998 )  simulated_time, time_step, av
-                      ELSE
-!
-!--                      For compatibility with earlier PALM versions
-                         READ ( id+110, END=998 )  simulated_time, time_step
-                         av = 0
-                      ENDIF
+                      READ ( id+110, END=998 )  simulated_time, time_step, av
                    ENDIF
 !
@@ -460,9 +437,5 @@
                 ENDDO
 !
-!--             Write the data of the total domain cross-section
-                IF ( iso2d_output )  WRITE ( 2 )  pf(nxa:nxe,nya:nye)
-       
-!
-!--             Write same data in NetCDF format
+!--             Write data in NetCDF format
                 IF ( netcdf_output )  THEN
 #if defined( __netcdf )
@@ -544,5 +517,5 @@
              ENDDO
              CLOSE ( 2 )
-             DEALLOCATE ( eta, ho, hu, pf )
+             DEALLOCATE ( pf )
 
 !
@@ -598,8 +571,4 @@
        CALL SYSTEM_CLOCK( count, count_rate )
        cpu_start_time = REAL( count ) / REAL( count_rate )
-
-!
-!--    Inquire whether an avs fld file exists
-       INQUIRE( FILE='PLOT3D_FLD'//TRIM( model_string ), EXIST=avs_output )
 
 !
@@ -639,12 +608,6 @@
 
 !
-!--    Combination only works, if data are not compressed. In that case, 
-!--    PALM created a flag file (PLOT3D_COMPRESSED)
-       INQUIRE ( FILE='PLOT3D_COMPRESSED'//TRIM( model_string ), &
-            EXIST=compressed )
-
-!
 !--    Find out the number of files and open them
-       DO  WHILE ( found  .AND.  .NOT. compressed )
+       DO  WHILE ( found )
 
           OPEN ( danz+110, &
@@ -678,9 +641,5 @@
              PRINT*, '    3D-data:     ', danz, ' file(s) found'
           ELSE
-             IF ( found .AND. compressed )  THEN
-                PRINT*, '+++ no 3D-data processing, since data are compressed'
-             ELSE
-                PRINT*, '    no 3D-data file available'
-             ENDIF
+             PRINT*, '    no 3D-data file available'
           ENDIF
        ENDIF
@@ -764,19 +723,11 @@
              DO  id = 0, danz-1
 !
-!--             File from PE0 contains special information at the beginning,
-!--             concerning the lower and upper indices of the total-domain used
-!--             in PALM (nxag, nxeg, nyag, nyeg) and the lower and
-!--             upper indices of the array to be written by this routine (nxa,
-!--             nxe, nya, nye, nza, nze). Usually nxag=-1 and nxa=0, nyag=-1
-!--             and nya=0, nzeg=nz and nze=nz_do3d.
-!--             Allocate necessary array and open the output file.
+!--             File from PE0 contains at the beginning the index bounds 
+!--             of PALM's total domain.
+!--             Allocate the array for storing the total domain data
                 IF ( id == 0  .AND.  fanz(0) == 0  .AND.  fanz(1) == 0 )  THEN
-                   READ ( id+110 )  nxag, nxeg, nyag, nyeg
+!                   READ ( id+110 )  nxag, nxeg, nyag, nyeg
                    READ ( id+110 )  nxa, nxe, nya, nye, nza, nze
                    ALLOCATE ( pf3d(nxa:nxe,nya:nye,nza:nze) )
-                   IF ( avs_output )  THEN
-                      OPEN ( 2, FILE='PLOT3D_DATA'//TRIM( model_string ), &
-                             FORM='UNFORMATTED' )
-                   ENDIF
                 ENDIF
 
@@ -818,9 +769,5 @@
 
 !
-!--          Write data of the total domain
-             IF ( avs_output )  WRITE ( 2 )  pf3d(nxa:nxe,nya:nye,nza:nze)
-       
-!
-!--          Write same data in NetCDF format
+!--          Write data of the total domain in NetCDF format
              IF ( netcdf_output )  THEN
 #if defined( __netcdf )
