Index: /palm/trunk/SOURCE/netcdf_data_input_mod.f90
===================================================================
--- /palm/trunk/SOURCE/netcdf_data_input_mod.f90	(revision 2873)
+++ /palm/trunk/SOURCE/netcdf_data_input_mod.f90	(revision 2874)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Bugfix: wrong placement of netcdf cpp-macros fixed
+! 
+! 2794 2018-02-07 14:09:43Z knoop
 ! Check if 3D building input is consistent to numeric grid.
 ! 
@@ -1635,8 +1638,8 @@
        DO  ii = 0, io_blocks-1
           IF ( ii == io_group )  THEN
-#if defined ( __netcdf )
 !
 !--          Input via palm-input data standard 
              IF ( input_pids_static )  THEN
+#if defined ( __netcdf )
 !
 !--             Open file in read-only mode
@@ -1774,4 +1777,6 @@
 !--             Close topography input file
                 CALL close_input_file( id_topo )
+#else
+                CONTINUE
 #endif
 !
@@ -3455,5 +3460,4 @@
      SUBROUTINE get_attribute_int32( id, attribute_name, value, global,        &
                                      variable_name )
-#if defined( __netcdf )
 
        USE pegrid
@@ -3469,4 +3473,5 @@
 
        LOGICAL, INTENT(IN) ::  global                   !< flag indicating global attribute
+#if defined( __netcdf )
 
 !
@@ -3494,5 +3499,4 @@
      SUBROUTINE get_attribute_int8( id, attribute_name, value, global,         &
                                     variable_name )
-#if defined( __netcdf )
 
        USE pegrid
@@ -3508,4 +3512,5 @@
 
        LOGICAL, INTENT(IN) ::  global                   !< flag indicating global attribute
+#if defined( __netcdf )
 
 !
@@ -3533,5 +3538,4 @@
      SUBROUTINE get_attribute_real( id, attribute_name, value, global,         &
                                     variable_name )
-#if defined( __netcdf )
 
        USE pegrid
@@ -3548,4 +3552,5 @@
 
        REAL(wp), INTENT(INOUT)     ::  value            !< read value
+#if defined( __netcdf )
 
 
@@ -3576,5 +3581,4 @@
      SUBROUTINE get_attribute_string( id, attribute_name, value, global,       &
                                       variable_name )
-#if defined( __netcdf )
 
        USE pegrid
@@ -3590,4 +3594,5 @@
 
        LOGICAL, INTENT(IN) ::  global                   !< flag indicating global attribute
+#if defined( __netcdf )
 
 !
@@ -3649,5 +3654,4 @@
 !------------------------------------------------------------------------------!
      SUBROUTINE get_variable_1d_int( id, variable_name, var )
-#if defined( __netcdf )
 
        USE pegrid
@@ -3661,4 +3665,5 @@
 
        INTEGER(iwp), DIMENSION(:), INTENT(INOUT) ::  var  !< variable to be read
+#if defined( __netcdf )
 
 !
@@ -3680,5 +3685,4 @@
 !------------------------------------------------------------------------------!
      SUBROUTINE get_variable_1d_real( id, variable_name, var )
-#if defined( __netcdf )
 
        USE pegrid
@@ -3692,4 +3696,5 @@
 
        REAL(wp), DIMENSION(:), INTENT(INOUT) ::  var  !< variable to be read
+#if defined( __netcdf )
 
 !
@@ -3712,5 +3717,4 @@
 !------------------------------------------------------------------------------! 
     SUBROUTINE get_variable_2d_real( id, variable_name, i, var )
-#if defined( __netcdf )
 
        USE indices
@@ -3726,4 +3730,5 @@
 
        REAL(wp), DIMENSION(nys:nyn), INTENT(INOUT) ::  var  !< variable to be read
+#if defined( __netcdf )
 !
 !--    Inquire variable id
@@ -3746,5 +3751,4 @@
 !------------------------------------------------------------------------------!
     SUBROUTINE get_variable_2d_int32( id, variable_name, i, var )
-#if defined( __netcdf )
 
        USE indices
@@ -3759,4 +3763,5 @@
        INTEGER(iwp)                  ::  id_var          !< variable id
        INTEGER(iwp), DIMENSION(nys:nyn), INTENT(INOUT) ::  var  !< variable to be read
+#if defined( __netcdf )
 !
 !--    Inquire variable id
@@ -3779,5 +3784,4 @@
 !------------------------------------------------------------------------------!
     SUBROUTINE get_variable_2d_int8( id, variable_name, i, var )
-#if defined( __netcdf )
 
        USE indices
@@ -3792,4 +3796,5 @@
        INTEGER(iwp)                  ::  id_var          !< variable id
        INTEGER(KIND=1), DIMENSION(nys:nyn), INTENT(INOUT) ::  var  !< variable to be read
+#if defined( __netcdf )
 !
 !--    Inquire variable id
@@ -3811,5 +3816,4 @@
 !------------------------------------------------------------------------------!
     SUBROUTINE get_variable_3d_int8( id, variable_name, i, j, var )
-#if defined( __netcdf )
 
        USE indices
@@ -3829,4 +3833,5 @@
 
        INTEGER( KIND = 1 ), DIMENSION(nzb:nzt+1), INTENT(INOUT) ::  var  !< variable to be read
+#if defined( __netcdf )
 
 !
@@ -3855,5 +3860,4 @@
 !------------------------------------------------------------------------------!
     SUBROUTINE get_variable_3d_real( id, variable_name, i, j, var )
-#if defined( __netcdf )
 
        USE indices
@@ -3873,4 +3877,5 @@
 
        REAL(wp), DIMENSION(:), INTENT(INOUT) ::  var     !< variable to be read
+#if defined( __netcdf )
 
 !
@@ -3900,5 +3905,4 @@
 !------------------------------------------------------------------------------!
     SUBROUTINE get_variable_4d_real( id, variable_name, i, j, var, n3, n4 )
-#if defined( __netcdf )
 
        USE indices
@@ -3919,4 +3923,5 @@
 
        REAL(wp), DIMENSION(:,:), INTENT(INOUT) ::  var     !< variable to be read
+#if defined( __netcdf )
 
 !
@@ -3942,5 +3947,4 @@
     SUBROUTINE get_variable_bc( id, variable_name, t_start,                    &
                                 i2_s, count_2, i3_s, count_3,  var )
-#if defined( __netcdf )
 
        USE indices
@@ -3960,4 +3964,5 @@
 
        REAL(wp), DIMENSION(:), INTENT(INOUT) ::  var     !< input variable 
+#if defined( __netcdf )
 
 !
@@ -3982,5 +3987,4 @@
 !------------------------------------------------------------------------------!
     SUBROUTINE inquire_num_variables( id, num_vars )
-#if defined( __netcdf )
 
        USE indices
@@ -3991,4 +3995,5 @@
        INTEGER(iwp), INTENT(IN)      ::  id              !< file id
        INTEGER(iwp), INTENT(INOUT)   ::  num_vars        !< number of variables in a file
+#if defined( __netcdf )
 
        nc_stat = NF90_INQUIRE( id, NVARIABLES = num_vars )
@@ -4005,5 +4010,4 @@
 !------------------------------------------------------------------------------!
     SUBROUTINE inquire_variable_names( id, var_names )
-#if defined( __netcdf )
 
        USE indices
@@ -4017,4 +4021,5 @@
        INTEGER(iwp)                                  ::  num_vars    !< number of variables (unused return parameter)
        INTEGER(iwp), DIMENSION(:), ALLOCATABLE       ::  varids      !< dummy array to strore variable ids temporarily
+#if defined( __netcdf )
 
        ALLOCATE( varids(1:SIZE(var_names)) )
@@ -4037,5 +4042,4 @@
 !------------------------------------------------------------------------------!
     SUBROUTINE handle_error( routine_name, errno )
-#if defined( __netcdf )
 
        USE control_parameters,                                                 &
@@ -4048,4 +4052,5 @@
 
        INTEGER(iwp) ::  errno
+#if defined( __netcdf )
 
        IF ( nc_stat /= NF90_NOERR )  THEN
