Index: palm/trunk/SOURCE/netcdf_data_input_mod.f90
===================================================================
--- palm/trunk/SOURCE/netcdf_data_input_mod.f90	(revision 3186)
+++ palm/trunk/SOURCE/netcdf_data_input_mod.f90	(revision 3209)
@@ -20,5 +20,11 @@
 ! Current revisions:
 ! -----------------
-! 
+! - Separate input of soil properties from input of atmospheric data. This 
+!   enables input of soil properties also in child domains without any 
+!   dependence on atmospheric input
+! - Check for missing initial 1D/3D data in dynamic input file
+! - Revise checks for matching grid spacing in model and input file 
+! - Bugfix, add netcdf4_parallel directive for collective read operation
+! - Revise error message numbers
 ! 
 ! Former revisions:
@@ -303,8 +309,8 @@
        REAL(wp) ::  rotation_angle   !< rotation angle of input data
 
-       REAL(wp), DIMENSION(:), ALLOCATABLE ::  msoil_init   !< initial vertical profile of soil moisture
+       REAL(wp), DIMENSION(:), ALLOCATABLE ::  msoil_1d     !< initial vertical profile of soil moisture
        REAL(wp), DIMENSION(:), ALLOCATABLE ::  pt_init      !< initial vertical profile of pt
        REAL(wp), DIMENSION(:), ALLOCATABLE ::  q_init       !< initial vertical profile of q
-       REAL(wp), DIMENSION(:), ALLOCATABLE ::  tsoil_init   !< initial vertical profile of soil temperature
+       REAL(wp), DIMENSION(:), ALLOCATABLE ::  tsoil_1d     !< initial vertical profile of soil temperature
        REAL(wp), DIMENSION(:), ALLOCATABLE ::  u_init       !< initial vertical profile of u
        REAL(wp), DIMENSION(:), ALLOCATABLE ::  ug_init      !< initial vertical profile of ug
@@ -317,6 +323,6 @@
 
 
-       REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  msoil        !< initial 3d soil moisture provide by Inifor and interpolated onto soil grid
-       REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  tsoil        !< initial 3d soil temperature provide by Inifor and interpolated onto soil grid
+       REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  msoil_3d !< initial 3d soil moisture provide by Inifor and interpolated onto soil grid
+       REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  tsoil_3d !< initial 3d soil temperature provide by Inifor and interpolated onto soil grid
 
     END TYPE init_type
@@ -573,4 +579,8 @@
        MODULE PROCEDURE netcdf_data_input_init_3d
     END INTERFACE netcdf_data_input_init_3d
+    
+    INTERFACE netcdf_data_input_init_lsm
+       MODULE PROCEDURE netcdf_data_input_init_lsm
+    END INTERFACE netcdf_data_input_init_lsm
 
     INTERFACE netcdf_data_input_lsf
@@ -595,5 +605,4 @@
        MODULE PROCEDURE get_variable_3d_real
        MODULE PROCEDURE get_variable_3d_real_dynamic
-!        MODULE PROCEDURE get_variable_3d_real_v
        MODULE PROCEDURE get_variable_4d_real
     END INTERFACE get_variable
@@ -626,5 +635,6 @@
     PUBLIC netcdf_data_input_check_dynamic, netcdf_data_input_check_static,    &
            netcdf_data_input_inquire_file,                                     &
-           netcdf_data_input_init, netcdf_data_input_init_3d,                  &
+           netcdf_data_input_init, netcdf_data_input_init_lsm,                 &
+           netcdf_data_input_init_3d,                                          &
            netcdf_data_input_interpolate, netcdf_data_input_lsf,               &
            netcdf_data_input_surface_data, netcdf_data_input_topo
@@ -1864,5 +1874,5 @@
                                  '(level of detail) is not set ' //            &
                                  'properly for buildings_2d.'
-                CALL message( 'netcdf_data_input_mod', 'NDI000',               &
+                CALL message( 'netcdf_data_input_mod', 'PA0540',               &
                                1, 2, 0, 6, 0 )
              ENDIF
@@ -1897,5 +1907,5 @@
                                  '(level of detail) is not set ' //            &
                                  'properly for buildings_3d.'
-                CALL message( 'netcdf_data_input_mod', 'NDI001',               &
+                CALL message( 'netcdf_data_input_mod', 'PA0541',               &
                                1, 2, 0, 6, 0 )
              ENDIF
@@ -1999,5 +2009,5 @@
              message_string = 'If building heigths are prescribed in ' //      &
                               'static input file, also an ID is required.'
-             CALL message( 'netcdf_data_input_mod', 'NDI002', 1, 2, 0, 6, 0 )
+             CALL message( 'netcdf_data_input_mod', 'PA0542', 1, 2, 0, 6, 0 )
           ENDIF
        ENDIF
@@ -2120,11 +2130,7 @@
        CALL inquire_variable_names( id_dynamic, var_names )
 !
-!--    Read vertical dimension of scalar und w grid. Will be used for
-!--    inter- and extrapolation in case of stretched numeric grid.
-!--    This will be removed when Inifor is able to handle stretched grids.
+!--    Read vertical dimension of scalar und w grid. 
        CALL get_dimension_length( id_dynamic, init_3d%nzu, 'z'     )
        CALL get_dimension_length( id_dynamic, init_3d%nzw, 'zw'    )
-       IF ( check_existence( var_names, 'zsoil' ) )                            &
-          CALL get_dimension_length( id_dynamic, init_3d%nzs, 'zsoil' )
 !
 !--    Read also the horizontal dimensions. These are used just used fo
@@ -2146,5 +2152,5 @@
                            'does not match the number of numeric grid '//      &
                            'points.'
-          CALL message( 'netcdf_data_input_mod', 'NDI003', 1, 2, 0, 6, 0 )
+          CALL message( 'netcdf_data_input_mod', 'PA0543', 1, 2, 0, 6, 0 )
        ENDIF
 
@@ -2153,5 +2159,5 @@
                            'does not match the number of numeric grid '//      &
                            'points.'
-          CALL message( 'netcdf_data_input_mod', 'NDI003', 1, 2, 0, 6, 0 )
+          CALL message( 'netcdf_data_input_mod', 'PA0543', 1, 2, 0, 6, 0 )
        ENDIF
 !
@@ -2165,8 +2171,4 @@
           ALLOCATE( init_3d%zw_atmos(1:init_3d%nzw) )
           CALL get_variable( id_dynamic, 'zw', init_3d%zw_atmos )
-       ENDIF
-       IF ( check_existence( var_names, 'zsoil' ) )  THEN
-          ALLOCATE( init_3d%z_soil(1:init_3d%nzs) )
-          CALL get_variable( id_dynamic, 'zsoil', init_3d%z_soil )
        ENDIF
 !
@@ -2184,5 +2186,5 @@
           message_string = 'Vertical grid in dynamic driver does not '// &
                            'match the numeric grid.'
-          CALL message( 'netcdf_data_input_mod', 'NDI003', 1, 2, 0, 6, 0 )
+          CALL message( 'netcdf_data_input_mod', 'PA0543', 1, 2, 0, 6, 0 )
        ENDIF
 !
@@ -2264,4 +2266,7 @@
           ENDIF
           init_3d%from_file_u = .TRUE.
+       ELSE
+          message_string = 'Missing initial data for u-component'
+          CALL message( 'netcdf_data_input_mod', 'PA0544', 1, 2, 0, 6, 0 )
        ENDIF
 !
@@ -2307,4 +2312,7 @@
           ENDIF
           init_3d%from_file_v = .TRUE.
+       ELSE
+          message_string = 'Missing initial data for v-component'
+          CALL message( 'netcdf_data_input_mod', 'PA0544', 1, 2, 0, 6, 0 )
        ENDIF
 !
@@ -2345,4 +2353,7 @@
           ENDIF
           init_3d%from_file_w = .TRUE.
+       ELSE
+          message_string = 'Missing initial data for w-component'
+          CALL message( 'netcdf_data_input_mod', 'PA0544', 1, 2, 0, 6, 0 )
        ENDIF
 !
@@ -2385,4 +2396,8 @@
              ENDIF
              init_3d%from_file_pt = .TRUE.
+          ELSE
+             message_string = 'Missing initial data for ' //                   &
+                              'potential temperature'
+             CALL message( 'netcdf_data_input_mod', 'PA0544', 1, 2, 0, 6, 0 )
           ENDIF
        ENDIF
@@ -2425,67 +2440,8 @@
              ENDIF
              init_3d%from_file_q = .TRUE.
-          ENDIF
-       ENDIF
-!
-!--    Read soil moisture
-       IF ( land_surface )  THEN
-
-          IF ( check_existence( var_names, 'init_soil_m' ) )  THEN
-!
-!--          Read attributes for the fill value and level-of-detail
-             CALL get_attribute( id_dynamic, char_fill,                        &
-                                 init_3d%fill_msoil,                           &
-                                 .FALSE., 'init_soil_m' )
-             CALL get_attribute( id_dynamic, char_lod,                         &
-                                 init_3d%lod_msoil,                            &
-                                 .FALSE., 'init_soil_m' )
-!
-!--          level-of-detail 1 - read initialization profile
-             IF ( init_3d%lod_msoil == 1 )  THEN
-                ALLOCATE( init_3d%msoil_init(0:init_3d%nzs-1) )
-
-                CALL get_variable( id_dynamic, 'init_soil_m',                  &
-                                   init_3d%msoil_init(0:init_3d%nzs-1) )
-!
-!--          level-of-detail 2 - read 3D initialization data
-             ELSEIF ( init_3d%lod_msoil == 2 )  THEN
-                ALLOCATE ( init_3d%msoil(0:init_3d%nzs-1,nys:nyn,nxl:nxr) )
-
-               CALL get_variable( id_dynamic, 'init_soil_m',                   &   
-                                init_3d%msoil(0:init_3d%nzs-1,nys:nyn,nxl:nxr),&
-                                nxl, nxr, nys, nyn, 0, init_3d%nzs-1 )
-
-             ENDIF
-             init_3d%from_file_msoil = .TRUE.
-          ENDIF
-!
-!--       Read soil temperature
-          IF ( check_existence( var_names, 'init_soil_t' ) )  THEN
-!
-!--          Read attributes for the fill value and level-of-detail
-             CALL get_attribute( id_dynamic, char_fill,                        &
-                                 init_3d%fill_tsoil,                           &
-                                 .FALSE., 'init_soil_t' )
-             CALL get_attribute( id_dynamic, char_lod,                         &
-                                 init_3d%lod_tsoil,                            &
-                                 .FALSE., 'init_soil_t' )
-!
-!--          level-of-detail 1 - read initialization profile
-             IF ( init_3d%lod_tsoil == 1 )  THEN
-                ALLOCATE( init_3d%tsoil_init(0:init_3d%nzs-1) )
-
-                CALL get_variable( id_dynamic, 'init_soil_t',                  &
-                                   init_3d%tsoil_init(0:init_3d%nzs-1) )
-
-!
-!--          level-of-detail 2 - read 3D initialization data
-             ELSEIF ( init_3d%lod_tsoil == 2 )  THEN
-                ALLOCATE ( init_3d%tsoil(0:init_3d%nzs-1,nys:nyn,nxl:nxr) )
-                
-                CALL get_variable( id_dynamic, 'init_soil_t',                  &   
-                                init_3d%tsoil(0:init_3d%nzs-1,nys:nyn,nxl:nxr),&
-                                nxl, nxr, nys, nyn, 0, init_3d%nzs-1 )
-             ENDIF
-             init_3d%from_file_tsoil = .TRUE.
+          ELSE
+             message_string = 'Missing initial data for ' //                   &
+                              'mixing ratio'
+             CALL message( 'netcdf_data_input_mod', 'PA0544', 1, 2, 0, 6, 0 )
           ENDIF
        ENDIF
@@ -2512,5 +2468,5 @@
              message_string = 'NetCDF input for init_atmosphere_u must ' //    &
                               'not contain any _FillValues'
-             CALL message( 'netcdf_data_input_mod', 'NDI004', 2, 2, 0, 6, 0 )
+             CALL message( 'netcdf_data_input_mod', 'PA0545', 2, 2, 0, 6, 0 )
           ENDIF
        ENDIF
@@ -2528,5 +2484,5 @@
              message_string = 'NetCDF input for init_atmosphere_v must ' //    &
                               'not contain any _FillValues'
-             CALL message( 'netcdf_data_input_mod', 'NDI005', 2, 2, 0, 6, 0 )
+             CALL message( 'netcdf_data_input_mod', 'PA0545', 2, 2, 0, 6, 0 )
           ENDIF
        ENDIF
@@ -2544,5 +2500,5 @@
              message_string = 'NetCDF input for init_atmosphere_w must ' //    &
                               'not contain any _FillValues'
-             CALL message( 'netcdf_data_input_mod', 'NDI006', 2, 2, 0, 6, 0 )
+             CALL message( 'netcdf_data_input_mod', 'PA0545', 2, 2, 0, 6, 0 )
           ENDIF
        ENDIF
@@ -2560,5 +2516,5 @@
              message_string = 'NetCDF input for init_atmosphere_pt must ' //   &
                               'not contain any _FillValues'
-             CALL message( 'netcdf_data_input_mod', 'NDI007', 2, 2, 0, 6, 0 )
+             CALL message( 'netcdf_data_input_mod', 'PA0545', 2, 2, 0, 6, 0 )
           ENDIF
        ENDIF
@@ -2576,5 +2532,5 @@
              message_string = 'NetCDF input for init_atmosphere_q must ' //    &
                               'not contain any _FillValues'
-             CALL message( 'netcdf_data_input_mod', 'NDI008', 2, 2, 0, 6, 0 )
+             CALL message( 'netcdf_data_input_mod', 'PA0545', 2, 2, 0, 6, 0 )
           ENDIF
        ENDIF
@@ -2585,4 +2541,147 @@
 
     END SUBROUTINE netcdf_data_input_init_3d
+    
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Reads initialization data of u, v, w, pt, q, geostrophic wind components,
+!> as well as soil moisture and soil temperature, derived from larger-scale
+!> model (COSMO) by Inifor.
+!------------------------------------------------------------------------------!
+    SUBROUTINE netcdf_data_input_init_lsm
+
+       USE arrays_3d,                                                          &
+           ONLY:  q, pt, u, v, w, zu, zw
+
+       USE control_parameters,                                                 &
+           ONLY:  bc_lr_cyc, bc_ns_cyc, humidity, land_surface, message_string,&
+                  nesting_offline, neutral, surface_pressure
+
+       USE indices,                                                            &
+           ONLY:  nx, nxl, nxlu, nxr, ny, nyn, nys, nysv, nzb, nz, nzt
+
+       IMPLICIT NONE
+
+       CHARACTER(LEN=100), DIMENSION(:), ALLOCATABLE ::  var_names
+      
+       INTEGER(iwp) ::  id_dynamic !< NetCDF id of dynamic input file
+       INTEGER(iwp) ::  num_vars   !< number of variables in netcdf input file
+
+!
+!--    Skip routine if no input file with dynamic input data is available.
+       IF ( .NOT. input_pids_dynamic )  RETURN
+!
+!--    CPU measurement
+       CALL cpu_log( log_point_s(85), 'NetCDF input init', 'start' )
+
+#if defined ( __netcdf )
+!
+!--    Open file in read-only mode
+       CALL open_read_file( TRIM( input_file_dynamic ) //                      &
+                            TRIM( coupling_char ), id_dynamic )
+
+!
+!--    At first, inquire all variable names.
+       CALL inquire_num_variables( id_dynamic, num_vars )
+!
+!--    Allocate memory to store variable names.
+       ALLOCATE( var_names(1:num_vars) )
+       CALL inquire_variable_names( id_dynamic, var_names )
+!
+!--    Read vertical dimension for soil depth. 
+       IF ( check_existence( var_names, 'zsoil' ) )                            &
+          CALL get_dimension_length( id_dynamic, init_3d%nzs, 'zsoil' )
+!
+!--    Read also the horizontal dimensions required for soil initialization.
+!--    Please note, in case of non-nested runs or in case of root domain, 
+!--    these data is already available, but will be read again for the sake
+!--    of clearness. 
+       CALL get_dimension_length( id_dynamic, init_3d%nx,  'x'  )
+       CALL get_dimension_length( id_dynamic, init_3d%ny,  'y'  )
+!
+!--    Check for correct horizontal and vertical dimension. Please note,
+!--    in case of non-nested runs or in case of root domain, these checks 
+!--    are already performed
+       IF ( init_3d%nx-1 /= nx  .OR.  init_3d%ny-1 /= ny )  THEN
+          message_string = 'Number of inifor horizontal grid points  '//       &
+                           'does not match the number of numeric grid points.'
+          CALL message( 'netcdf_data_input_mod', 'PA0543', 1, 2, 0, 6, 0 )
+       ENDIF
+!
+!--    Read vertical dimensions. Later, these are required for eventual
+!--    inter- and extrapolations of the initialization data.
+       IF ( check_existence( var_names, 'zsoil' ) )  THEN
+          ALLOCATE( init_3d%z_soil(1:init_3d%nzs) )
+          CALL get_variable( id_dynamic, 'zsoil', init_3d%z_soil )
+       ENDIF
+!
+!--    Read initial data for soil moisture
+       IF ( check_existence( var_names, 'init_soil_m' ) )  THEN
+!
+!--       Read attributes for the fill value and level-of-detail
+          CALL get_attribute( id_dynamic, char_fill,                           &
+                              init_3d%fill_msoil,                              &
+                              .FALSE., 'init_soil_m' )
+          CALL get_attribute( id_dynamic, char_lod,                            &
+                              init_3d%lod_msoil,                               &
+                              .FALSE., 'init_soil_m' )
+!
+!--       level-of-detail 1 - read initialization profile
+          IF ( init_3d%lod_msoil == 1 )  THEN
+             ALLOCATE( init_3d%msoil_1d(0:init_3d%nzs-1) )
+
+             CALL get_variable( id_dynamic, 'init_soil_m',                     &
+                                init_3d%msoil_1d(0:init_3d%nzs-1) )
+!
+!--       level-of-detail 2 - read 3D initialization data
+          ELSEIF ( init_3d%lod_msoil == 2 )  THEN
+             ALLOCATE ( init_3d%msoil_3d(0:init_3d%nzs-1,nys:nyn,nxl:nxr) )
+
+            CALL get_variable( id_dynamic, 'init_soil_m',                      &   
+                             init_3d%msoil_3d(0:init_3d%nzs-1,nys:nyn,nxl:nxr),&
+                             nxl, nxr, nys, nyn, 0, init_3d%nzs-1 )
+
+          ENDIF
+          init_3d%from_file_msoil = .TRUE.
+       ENDIF
+!
+!--    Read soil temperature
+       IF ( check_existence( var_names, 'init_soil_t' ) )  THEN
+!
+!--       Read attributes for the fill value and level-of-detail
+          CALL get_attribute( id_dynamic, char_fill,                           &
+                              init_3d%fill_tsoil,                              &
+                              .FALSE., 'init_soil_t' )
+          CALL get_attribute( id_dynamic, char_lod,                            &
+                              init_3d%lod_tsoil,                               &
+                              .FALSE., 'init_soil_t' )
+!
+!--       level-of-detail 1 - read initialization profile
+          IF ( init_3d%lod_tsoil == 1 )  THEN
+             ALLOCATE( init_3d%tsoil_1d(0:init_3d%nzs-1) )
+
+             CALL get_variable( id_dynamic, 'init_soil_t',                     &
+                                init_3d%tsoil_1d(0:init_3d%nzs-1) )
+
+!
+!--       level-of-detail 2 - read 3D initialization data
+          ELSEIF ( init_3d%lod_tsoil == 2 )  THEN
+             ALLOCATE ( init_3d%tsoil_3d(0:init_3d%nzs-1,nys:nyn,nxl:nxr) )
+             
+             CALL get_variable( id_dynamic, 'init_soil_t',                     &   
+                             init_3d%tsoil_3d(0:init_3d%nzs-1,nys:nyn,nxl:nxr),&
+                             nxl, nxr, nys, nyn, 0, init_3d%nzs-1 )
+          ENDIF
+          init_3d%from_file_tsoil = .TRUE.
+       ENDIF
+!
+!--    Close input file
+       CALL close_input_file( id_dynamic )
+#endif
+!
+!--    End of CPU measurement
+       CALL cpu_log( log_point_s(85), 'NetCDF input init', 'stop' )
+
+    END SUBROUTINE netcdf_data_input_init_lsm    
 
 !------------------------------------------------------------------------------!
@@ -2889,5 +2988,5 @@
                             'input file ' //                                   &
                             TRIM( input_file_dynamic ) // TRIM( coupling_char )
-          CALL message( 'netcdf_data_input_mod', 'NDI009', 1, 2, 0, 6, 0 )
+          CALL message( 'netcdf_data_input_mod', 'PA0546', 1, 2, 0, 6, 0 )
        ENDIF
 !
@@ -2899,5 +2998,5 @@
                            'input file ' // TRIM( input_file_dynamic ) //      &
                            TRIM( coupling_char )
-          CALL message( 'netcdf_data_input_mod', 'NDI010', 1, 2, 0, 6, 0 )
+          CALL message( 'netcdf_data_input_mod', 'PA0547', 1, 2, 0, 6, 0 )
        ENDIF
 
@@ -2940,15 +3039,15 @@
                            'x- and/or y-direction ' //                         &
                            'do not match the respective model dimension'
-          CALL message( 'netcdf_data_input_mod', 'NDI011', 1, 2, 0, 6, 0 )
+          CALL message( 'netcdf_data_input_mod', 'PA0548', 1, 2, 0, 6, 0 )
        ENDIF
 !
 !--    Check if grid spacing of provided input data matches the respective
-!--    grid spacing in the model.
-       IF ( dim_static%x(1) - dim_static%x(0) /= dx  .OR.                      &
-            dim_static%y(1) - dim_static%y(0) /= dy )  THEN
+!--    grid spacing in the model. 
+       IF ( ABS( dim_static%x(1) - dim_static%x(0) - dx ) > 10E-6_wp  .OR.     &
+            ABS( dim_static%y(1) - dim_static%y(0) - dy ) > 10E-6_wp )  THEN
           message_string = 'Static input file: horizontal grid spacing ' //    &
                            'in x- and/or y-direction ' //                      &
                            'do not match the respective model grid spacing.'
-          CALL message( 'netcdf_data_input_mod', 'NDI012', 1, 2, 0, 6, 0 )
+          CALL message( 'netcdf_data_input_mod', 'PA0549', 1, 2, 0, 6, 0 )
        ENDIF
 !
@@ -2960,5 +3059,5 @@
           message_string = 'NetCDF variable zt is not ' //                     &
                            'allowed to have missing data'
-          CALL message( 'netcdf_data_input_mod', 'NDI013', 2, 2, myid, 6, 0 )
+          CALL message( 'netcdf_data_input_mod', 'PA0550', 2, 2, myid, 6, 0 )
        ENDIF
 !
@@ -2967,5 +3066,5 @@
           message_string = 'NetCDF variable zt is not ' //                     &
                            'allowed to have negative values'
-          CALL message( 'netcdf_data_input_mod', 'NDI013', 2, 2, myid, 6, 0 )
+          CALL message( 'netcdf_data_input_mod', 'PA0551', 2, 2, myid, 6, 0 )
        ENDIF
 !
@@ -2977,5 +3076,5 @@
                 message_string = 'Reading 3D building data - too much ' //     &
                                  'data points along the vertical coordinate.'
-                CALL message( 'netcdf_data_input_mod', 'NDI014', 2, 2, 0, 6, 0 )
+                CALL message( 'netcdf_data_input_mod', 'PA0552', 2, 2, 0, 6, 0 )
              ENDIF
 
@@ -2984,5 +3083,5 @@
                 message_string = 'Reading 3D building data - vertical ' //     &
                                  'coordinate do not match numeric grid.'
-                CALL message( 'netcdf_data_input_mod', 'NDI015', 2, 2, 0, 6, 0 )
+                CALL message( 'netcdf_data_input_mod', 'PA0553', 2, 2, 0, 6, 0 )
              ENDIF
           ENDIF
@@ -3007,5 +3106,5 @@
                            'required. If urban-surface model is applied, ' //  &
                            'also building_type ist required'
-          CALL message( 'netcdf_data_input_mod', 'NDI016', 1, 2, 0, 6, 0 )
+          CALL message( 'netcdf_data_input_mod', 'PA0554', 1, 2, 0, 6, 0 )
        ENDIF
 !
@@ -3016,12 +3115,12 @@
           IF ( ANY( vegetation_type_f%var == 0 ) )  THEN
              IF ( .NOT. vegetation_pars_f%from_file )  THEN
-                message_string = 'If vegegation_type = 0 at any location, ' // &
+                message_string = 'If vegetation_type = 0 at any location, ' // &
                                  'vegetation_pars is required'
-                CALL message( 'netcdf_data_input_mod', 'NDI017', 2, 2, -1, 6, 0 )
+                CALL message( 'netcdf_data_input_mod', 'PA0555', 2, 2, -1, 6, 0 )
              ENDIF
              IF ( .NOT. root_area_density_lsm_f%from_file )  THEN
-                message_string = 'If vegegation_type = 0 at any location, ' // &
+                message_string = 'If vegetation_type = 0 at any location, ' // &
                                  'root_area_dens_s is required'
-                CALL message( 'netcdf_data_input_mod', 'NDI018', 2, 2, myid, 6, 0 )
+                CALL message( 'netcdf_data_input_mod', 'PA0556', 2, 2, myid, 6, 0 )
              ENDIF
           ENDIF
@@ -3043,5 +3142,5 @@
              message_string = 'If soil_type = 0 at any location, ' //          &
                               'soil_pars is required'
-             CALL message( 'netcdf_data_input_mod', 'NDI019', 2, 2, myid, 6, 0 )
+             CALL message( 'netcdf_data_input_mod', 'PA0557', 2, 2, myid, 6, 0 )
           ENDIF
        ENDIF
@@ -3053,5 +3152,5 @@
                 message_string = 'If building_type = 0 at any location, ' //   &
                                  'building_pars is required'
-                CALL message( 'netcdf_data_input_mod', 'NDI020', 2, 2, myid, 6, 0 )
+                CALL message( 'netcdf_data_input_mod', 'PA0558', 2, 2, myid, 6, 0 )
              ENDIF
           ENDIF
@@ -3064,5 +3163,5 @@
                 message_string = 'If albedo_type = 0 at any location, ' //     &
                                  'albedo_pars is required'
-                CALL message( 'netcdf_data_input_mod', 'NDI021', 2, 2, myid, 6, 0 )
+                CALL message( 'netcdf_data_input_mod', 'PA0559', 2, 2, myid, 6, 0 )
              ENDIF
           ENDIF
@@ -3075,5 +3174,5 @@
                 message_string = 'If pavement_type = 0 at any location, ' //   &
                                  'pavement_pars is required'
-                CALL message( 'netcdf_data_input_mod', 'NDI022', 2, 2, myid, 6, 0 )
+                CALL message( 'netcdf_data_input_mod', 'PA0560', 2, 2, myid, 6, 0 )
              ENDIF
           ENDIF
@@ -3087,5 +3186,5 @@
                 message_string = 'If pavement_type = 0 at any location, ' //   &
                                  'pavement_subsurface_pars is required'
-                CALL message( 'netcdf_data_input_mod', 'NDI023', 2, 2, myid, 6, 0 )
+                CALL message( 'netcdf_data_input_mod', 'PA0561', 2, 2, myid, 6, 0 )
              ENDIF
           ENDIF
@@ -3098,5 +3197,5 @@
                 message_string = 'If water_type = 0 at any location, ' //      &
                                  'water_pars is required'
-                CALL message( 'netcdf_data_input_mod', 'NDI024', 2, 2,myid, 6, 0 )
+                CALL message( 'netcdf_data_input_mod', 'PA0562', 2, 2,myid, 6, 0 )
              ENDIF
           ENDIF
@@ -3118,5 +3217,5 @@
                                  'building_type, or water_type must be set '// &
                                  'to a non-missing value. Grid point: ', j, i
-                CALL message( 'netcdf_data_input_mod', 'NDI025', 2, 2, myid, 6, 0 )
+                CALL message( 'netcdf_data_input_mod', 'PA0563', 2, 2, myid, 6, 0 )
              ENDIF
 !
@@ -3138,5 +3237,5 @@
                                  'location (y,x) where vegetation_type or ' // &
                                  'pavement_type is a non-missing value.'
-                   CALL message( 'netcdf_data_input_mod', 'NDI026',            &
+                   CALL message( 'netcdf_data_input_mod', 'PA0564',            &
                                   2, 2, myid, 6, 0 )
                 ENDIF
@@ -3159,5 +3258,5 @@
                                  'given at a location, surface_fraction ' //   &
                                  'must be provided.'
-                   CALL message( 'netcdf_data_input_mod', 'NDI027',            &
+                   CALL message( 'netcdf_data_input_mod', 'PA0565',            &
                                   2, 2, myid, 6, 0 )
                 ELSEIF ( ANY ( surface_fraction_f%frac(:,j,i) ==               &
@@ -3166,5 +3265,5 @@
                                  'given at a location, surface_fraction ' //   &
                                  'must be provided.'
-                   CALL message( 'netcdf_data_input_mod', 'NDI027',            &
+                   CALL message( 'netcdf_data_input_mod', 'PA0565',            &
                                   2, 2, myid, 6, 0 )
                 ENDIF
@@ -3179,5 +3278,5 @@
                 IF ( SUM ( surface_fraction_f%frac(0:2,j,i) ) > 1.0_wp )  THEN
                    message_string = 'surface_fraction must not exceed 1'
-                   CALL message( 'netcdf_data_input_mod', 'NDI028',            &
+                   CALL message( 'netcdf_data_input_mod', 'PA0566',            &
                                   2, 2, myid, 6, 0 )
                 ENDIF
@@ -3205,5 +3304,5 @@
                              'water surface is given at (i,j) = ( ', i, j,     &
                              ' ), but surface fraction is 0 for the given type.'
-                   CALL message( 'netcdf_data_input_mod', 'NDI029',            &
+                   CALL message( 'netcdf_data_input_mod', 'PA0567',            &
                                   2, 2, myid, 6, 0 )
                 ENDIF
@@ -3232,5 +3331,5 @@
                              ' ), but surface fraction is not 0 for the ' //   &
                              'given type.'
-                   CALL message( 'netcdf_data_input_mod', 'NDI030',            &
+                   CALL message( 'netcdf_data_input_mod', 'PA0568',            &
                                   2, 2, myid, 6, 0 )
                 ENDIF
@@ -3247,5 +3346,5 @@
                                        'parameters of vegetation_pars at '//   &
                                        'this location must be set.'
-                      CALL message( 'netcdf_data_input_mod', 'NDI031',         &
+                      CALL message( 'netcdf_data_input_mod', 'PA0569',         &
                                      2, 2, myid, 6, 0 )
                    ENDIF
@@ -3262,5 +3361,5 @@
                                        'levels of root_area_dens_s ' //        &
                                        'must be set at this location.'
-                      CALL message( 'netcdf_data_input_mod', 'NDI032',         &
+                      CALL message( 'netcdf_data_input_mod', 'PA0570',         &
                                      2, 2, myid, 6, 0 )
                    ENDIF
@@ -3286,5 +3385,5 @@
                    message_string = 'If soil_type(y,x) = 0, all levels of '  //&
                                     'soil_pars at this location must be set.'
-                   CALL message( 'netcdf_data_input_mod', 'NDI033',            &
+                   CALL message( 'netcdf_data_input_mod', 'PA0571',            &
                                   2, 2, myid, 6, 0 )
                 ENDIF
@@ -3301,5 +3400,5 @@
                                        'parameters of building_pars at this '//&
                                        'location must be set.'
-                      CALL message( 'netcdf_data_input_mod', 'NDI034',         &
+                      CALL message( 'netcdf_data_input_mod', 'PA0572',         &
                                      2, 2, myid, 6, 0 )
                    ENDIF
@@ -3318,5 +3417,5 @@
                                          'urban-surface model is applied. ' // &
                                          'i, j = ', i, j
-                      CALL message( 'netcdf_data_input_mod', 'NDI035',         &
+                      CALL message( 'netcdf_data_input_mod', 'PA0573',         &
                                      2, 2, myid, 6, 0 )
                    ENDIF
@@ -3330,5 +3429,5 @@
                                          'urban-surface model is applied. ' // &
                                          'i, j = ', i, j
-                      CALL message( 'netcdf_data_input_mod', 'NDI035',         &
+                      CALL message( 'netcdf_data_input_mod', 'PA0573',         &
                                      2, 2, myid, 6, 0 )
                    ENDIF
@@ -3345,5 +3444,5 @@
                                          'building is set requires an ID ' //  &
                                          '( and vice versa ). i, j = ', i, j
-                      CALL message( 'netcdf_data_input_mod', 'NDI036',         &
+                      CALL message( 'netcdf_data_input_mod', 'PA0574',         &
                                      2, 2, myid, 6, 0 )
                    ENDIF
@@ -3354,5 +3453,5 @@
                                          'building is set requires an ID ' //  &
                                          '( and vice versa ). i, j = ', i, j
-                      CALL message( 'netcdf_data_input_mod', 'NDI036',         &
+                      CALL message( 'netcdf_data_input_mod', 'PA0574',         &
                                      2, 2, myid, 6, 0 )
                    ENDIF
@@ -3368,5 +3467,5 @@
                       WRITE( message_string, * ) 'Each building grid point '// &
                                                  'requires an ID.', i, j
-                      CALL message( 'netcdf_data_input_mod', 'NDI036',         &
+                      CALL message( 'netcdf_data_input_mod', 'PA0575',         &
                                      2, 2, myid, 6, 0 )
                    ENDIF
@@ -3376,5 +3475,5 @@
                       WRITE( message_string, * ) 'Each building grid point '// &
                                                  'requires an ID.', i, j
-                      CALL message( 'netcdf_data_input_mod', 'NDI036',         &
+                      CALL message( 'netcdf_data_input_mod', 'PA0575',         &
                                      2, 2, myid, 6, 0 )
                    ENDIF
@@ -3391,5 +3490,5 @@
                                        'parameters of albedo_pars at this ' // &
                                        'location must be set.'
-                      CALL message( 'netcdf_data_input_mod', 'NDI037',         &
+                      CALL message( 'netcdf_data_input_mod', 'PA0576',         &
                                      2, 2, myid, 6, 0 )
                    ENDIF
@@ -3407,5 +3506,5 @@
                                        'parameters of pavement_pars at this '//&
                                        'location must be set.'
-                      CALL message( 'netcdf_data_input_mod', 'NDI038',         &
+                      CALL message( 'netcdf_data_input_mod', 'PA0577',         &
                                      2, 2, myid, 6, 0 )
                    ENDIF
@@ -3424,5 +3523,5 @@
                                        'pavement_subsurface_pars at this '//   &
                                        'location must be set.'
-                      CALL message( 'netcdf_data_input_mod', 'NDI039',         &
+                      CALL message( 'netcdf_data_input_mod', 'PA0578',         &
                                      2, 2, myid, 6, 0 )
                    ENDIF
@@ -3440,5 +3539,5 @@
                                        'parameters of water_pars at this ' //  &
                                        'location must be set.'
-                      CALL message( 'netcdf_data_input_mod', 'NDI040',         &
+                      CALL message( 'netcdf_data_input_mod', 'PA0579',         &
                                      2, 2, myid, 6, 0 )
                    ENDIF
@@ -4140,5 +4239,7 @@
 !--    required. 
        IF ( collective_read )  THEN
+#if defined( __netcdf4_parallel )
           nc_stat = NF90_VAR_PAR_ACCESS (id, id_var, NF90_COLLECTIVE)
+#endif
        ENDIF
 !
@@ -4200,5 +4301,7 @@
 !--    required. 
        IF ( collective_read )  THEN
+#if defined( __netcdf4_parallel )       
           nc_stat = NF90_VAR_PAR_ACCESS (id, id_var, NF90_COLLECTIVE)
+#endif
        ENDIF
 !
@@ -4260,5 +4363,7 @@
 !--    required. 
        IF ( collective_read )  THEN
+#if defined( __netcdf4_parallel )        
           nc_stat = NF90_VAR_PAR_ACCESS (id, id_var, NF90_COLLECTIVE)
+#endif          
        ENDIF
 !
@@ -4326,5 +4431,7 @@
 !--    required. 
        IF ( collective_read )  THEN
+#if defined( __netcdf4_parallel )
           nc_stat = NF90_VAR_PAR_ACCESS (id, id_var, NF90_COLLECTIVE)
+#endif          
        ENDIF
 !
@@ -4394,5 +4501,7 @@
 !--    required. 
        IF ( collective_read )  THEN
+#if defined( __netcdf4_parallel )       
           nc_stat = NF90_VAR_PAR_ACCESS (id, id_var, NF90_COLLECTIVE)
+#endif
        ENDIF
 !
@@ -4466,5 +4575,7 @@
 ! !--    required. 
 !        IF ( collective_read )  THEN
+! #if defined( __netcdf4_parallel )
 !           nc_stat = NF90_VAR_PAR_ACCESS (id, id_var, NF90_COLLECTIVE)
+! #endif
 !        ENDIF
 ! 
@@ -4542,5 +4653,7 @@
 !--    required. 
        IF ( collective_read )  THEN
+#if defined( __netcdf4_parallel )       
           nc_stat = NF90_VAR_PAR_ACCESS (id, id_var, NF90_COLLECTIVE)
+#endif
        ENDIF
 !
@@ -4632,5 +4745,7 @@
 !--    read operations are only enabled for top-boundary data.
        IF ( collective_read  .AND.  par_access )  THEN
+#if defined( __netcdf4_parallel )       
           nc_stat = NF90_VAR_PAR_ACCESS (id, id_var, NF90_COLLECTIVE)
+#endif
        ENDIF    
 !
