Index: palm/trunk/SOURCE/netcdf_interface_mod.f90
===================================================================
--- palm/trunk/SOURCE/netcdf_interface_mod.f90	(revision 4069)
+++ palm/trunk/SOURCE/netcdf_interface_mod.f90	(revision 4127)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! -Introduce new vertical dimension for plant-canopy output. 
+! -Temporarlily disable masked output for soil (merge from branch resler)
+! 
+! 4069 2019-07-01 14:05:51Z Giersch
 ! Masked output running index mid has been introduced as a local variable to 
 ! avoid runtime error (Loop variable has been modified) in time_integration
@@ -538,5 +542,6 @@
                     id_dim_y_xz, id_dim_yv_xz, id_dim_y_yz, id_dim_yv_yz, &
                     id_dim_y_3d, id_dim_yv_3d, id_dim_zs_xy, id_dim_zs_xz, &
-                    id_dim_zs_yz, id_dim_zs_3d, id_dim_zu_xy, id_dim_zu1_xy, &
+                    id_dim_zs_yz, id_dim_zs_3d, id_dim_zpc_3d, &
+                    id_dim_zu_xy, id_dim_zu1_xy, &
                     id_dim_zu_xz, id_dim_zu_yz, id_dim_zu_3d, id_dim_zw_xy, &
                     id_dim_zw_xz, id_dim_zw_yz, id_dim_zw_3d, id_set_xy, &
@@ -548,6 +553,6 @@
                     id_var_yv_xy, id_var_y_xz, id_var_yv_xz, id_var_y_yz, &
                     id_var_yv_yz, id_var_y_3d, id_var_yv_3d, id_var_zs_xy, &
-                    id_var_zs_xz, id_var_zs_yz, id_var_zs_3d, id_var_zusi_xy, &
-                    id_var_zusi_3d, id_var_zu_xy, id_var_zu1_xy, id_var_zu_xz, &
+                    id_var_zs_xz, id_var_zs_yz, id_var_zs_3d, id_var_zpc_3d, &
+                    id_var_zusi_xy, id_var_zusi_3d, id_var_zu_xy, id_var_zu1_xy, id_var_zu_xz, &
                     id_var_zu_yz, id_var_zu_3d, id_var_zwwi_xy, id_var_zwwi_3d, &
                     id_var_zw_xy, id_var_zw_xz, id_var_zw_yz, id_var_zw_3d
@@ -738,5 +743,5 @@
 
     USE plant_canopy_model_mod,                                                &
-        ONLY:  pcm_define_netcdf_grid
+        ONLY:  pch_index, pcm_define_netcdf_grid
 
     USE profil_parameter,                                                      &
@@ -1552,21 +1557,22 @@
 
           ENDIF
-
-          IF ( land_surface )  THEN
+!
+!--       soil is not in masked output for now - disable temporary this block
+!          IF ( land_surface )  THEN
 !
 !--          Write zs data (vertical axes for soil model), use negative values
 !--          to indicate soil depth
-             ALLOCATE( netcdf_data(mask_size(mid,3)) )
-
-             netcdf_data = zs( mask_k_global(mid,:mask_size(mid,3)) )
-
-             nc_stat = NF90_PUT_VAR( id_set_mask(mid,av), id_var_zs_mask(mid,av), &
-                                     netcdf_data, start = (/ 1 /), &
-                                     count = (/ mask_size(mid,3) /) )
-             CALL netcdf_handle_error( 'netcdf_define_header', 538 )
-
-             DEALLOCATE( netcdf_data )
-
-          ENDIF
+!             ALLOCATE( netcdf_data(mask_size(mid,3)) )
+!
+!             netcdf_data = zs( mask_k_global(mid,:mask_size(mid,3)) )
+!
+!             nc_stat = NF90_PUT_VAR( id_set_mask(mid,av), id_var_zs_mask(mid,av), &
+!                                     netcdf_data, start = (/ 1 /), &
+!                                     count = (/ mask_size(mid,3) /) )
+!             CALL netcdf_handle_error( 'netcdf_define_header', 538 )
+!
+!             DEALLOCATE( netcdf_data )
+!
+!          ENDIF
 
 !
@@ -1847,4 +1853,16 @@
           ENDIF
 
+          IF ( plant_canopy )  THEN
+!
+!--          Define vertical coordinate grid (zpc grid)
+             CALL netcdf_create_dim( id_set_3d(av), 'zpc_3d',                  &
+                                     pch_index+1, id_dim_zpc_3d(av), 70 )
+             !netcdf_create_dim(ncid, dim_name, ncdim_type, ncdim_id, error_no)
+             CALL netcdf_create_var( id_set_3d(av), (/ id_dim_zpc_3d(av) /),    &
+                                     'zpc_3d', NF90_DOUBLE, id_var_zpc_3d(av),   &
+                                     'meters', '', 71, 72, 00 )
+
+          ENDIF
+
 !
 !--       Define the variables
@@ -2006,4 +2024,6 @@
              ELSEIF ( grid_z == 'zs' )  THEN
                 id_z = id_dim_zs_3d(av)
+             ELSEIF ( grid_z == 'zpc' )  THEN
+                id_z = id_dim_zpc_3d(av)
              ENDIF
 
@@ -2248,4 +2268,13 @@
                                         - zs(nzb_soil:nzt_soil), start = (/ 1 /), &
                                         count = (/ nzt_soil-nzb_soil+1 /) )
+                CALL netcdf_handle_error( 'netcdf_define_header', 86 )
+             ENDIF
+
+             IF ( plant_canopy )  THEN
+!
+!--             Write zpc grid
+                nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_zpc_3d(av),  &
+                                        zu(nzb:nzb+pch_index), start = (/ 1 /), &
+                                        count = (/ pch_index+1 /) )
                 CALL netcdf_handle_error( 'netcdf_define_header', 86 )
              ENDIF
