Index: /palm/trunk/SOURCE/biometeorology_mod.f90
===================================================================
--- /palm/trunk/SOURCE/biometeorology_mod.f90	(revision 4805)
+++ /palm/trunk/SOURCE/biometeorology_mod.f90	(revision 4806)
@@ -21,5 +21,5 @@
 ! Current revisions:
 ! ------------------
-!
+! Add checks for setup of UV exposure (only workaround!); corrected formatting errors.
 !
 ! Former revisions:
@@ -34,5 +34,5 @@
 ! Enable restart via mpi-IO. Therefore, allocated array mrt_av_grid as 3D array instead of an
 ! 1D array.
-! 
+!
 ! 4577 2020-06-25 09:53:58Z raasch
 ! further re-formatting concerning Fortran parameter variables
@@ -147,8 +147,10 @@
 !> @todo uv_vitd3dose-->new output type necessary (cumulative)
 !> @todo consider upwelling radiation in UV
+!> @todo re-design module to work with PALM's module interface and reduce number of workarounds
 !>
 !> @note nothing now
 !>
-!> @bug  no known bugs by now
+!> @bug  checks for proper parameter settings and required input data are missing. Currently
+!<       implemented only by a workaround!
 !--------------------------------------------------------------------------------------------------!
  MODULE biometeorology_mod
@@ -164,9 +166,15 @@
 
     USE control_parameters,                                                                        &
-        ONLY:  average_count_3d, biometeorology,                                                   &
+        ONLY:  average_count_3d,                                                                   &
+               biometeorology,                                                                     &
                debug_output,                                                                       &
-               dz, dz_stretch_factor,                                                              &
-               dz_stretch_level, humidity, initializing_actions, nz_do3d,                          &
-               restart_data_format_output, surface_pressure
+               dz,                                                                                 &
+               dz_stretch_factor,                                                                  &
+               dz_stretch_level,                                                                   &
+               humidity,                                                                           &
+               initializing_actions, message_string,                                               &
+               nz_do3d,                                                                            &
+               restart_data_format_output,                                                         &
+               surface_pressure
 
     USE grid_variables,                                                                            &
@@ -180,6 +188,12 @@
 
     USE netcdf_data_input_mod,                                                                     &
-        ONLY: building_obstruction_f, netcdf_data_input_uvem, uvem_integration_f,                  &
-              uvem_irradiance_f, uvem_projarea_f, uvem_radiance_f
+        ONLY: building_obstruction_f,                                                              &
+              input_file_uvem,                                                                     &
+              input_pids_uvem,                                                                     &
+              netcdf_data_input_uvem,                                                              &
+              uvem_integration_f,                                                                  &
+              uvem_irradiance_f,                                                                   &
+              uvem_projarea_f,                                                                     &
+              uvem_radiance_f
 
     USE palm_date_time_mod,                                                                        &
@@ -741,5 +755,5 @@
 
 !
-!--     No averaging for UVEM SINce we are calculating a dose (only sum is calculated and saved to
+!--     No averaging for UVEM since we are calculating a dose (only sum is calculated and saved to
 !--     av.nc file)
         END SELECT
@@ -777,5 +791,5 @@
 !--    Arrays for time-averaged thermal indices are also allocated here because they are not running
 !--    through the standard averaging procedure in bio_3d_data_averaging as the values of the
-!--    averaged thermal indices are derived in a SINgle step based on priorly averaged arrays (see
+!--    averaged thermal indices are derived in a single step based on priorly averaged arrays (see
 !--    bio_calculate_thermal_index_maps).
        CASE ( 'bio_mrt', 'bio_mrt*' )
@@ -843,9 +857,9 @@
 
        CASE ( 'uvem_vitd3*' )
-!           IF ( .NOT. uv_exposure )  THEN
-!              message_string = 'output of "' // TRIM( var ) // '" requi' //                       &
-!                       'res a namelist &uvexposure_par'
-!              CALL message( 'uvem_check_data_output', 'UV0001', 1, 2, 0, 6, 0 )
-!           ENDIF
+          IF ( .NOT. uv_exposure )  THEN
+             message_string = 'output of "' // TRIM( var ) // '" requires uv_exposure = .TRUE.' // &
+                              '&in namelist "biometeorology_parameters"'
+             CALL message( 'uvem_check_data_output', 'PA0512', 1, 2, 0, 6, 0 )
+          ENDIF
           IF ( k == 0  .OR.  data_output(i)(ilen-2:ilen) /= '_xy' )  THEN
              message_string = 'illegal value for data_output: "' //                                &
@@ -861,9 +875,9 @@
 
        CASE ( 'uvem_vitd3dose*' )
-!           IF (  .NOT.  uv_exposure )  THEN
-!              message_string = 'output of "' // TRIM( var ) // '" requi' //     &
-!                       'res  a namelist &uvexposure_par'
-!              CALL message( 'uvem_check_data_output', 'UV0001', 1, 2, 0, 6, 0 )
-!           ENDIF
+          IF (  .NOT.  uv_exposure )  THEN
+             message_string = 'output of "' // TRIM( var ) // '" requires uv_exposure = .TRUE.' // &
+                              '&in namelist "biometeorology_parameters"'
+             CALL message( 'uvem_check_data_output', 'PA0512', 1, 2, 0, 6, 0 )
+          ENDIF
           IF ( k == 0  .OR.  data_output(i)(ilen-2:ilen) /= '_xy' )  THEN
              message_string = 'illegal value for data_output: "' //                                &
@@ -922,4 +936,39 @@
     IMPLICIT NONE
 
+!
+!-- Check settings for UV exposure part
+    IF ( uv_exposure )  THEN
+
+!
+!--    Input file not present
+       IF ( .NOT. input_pids_uvem )  THEN
+          WRITE( message_string, * ) 'uv_exposure = .TRUE. but input file "' //                    &
+                                     TRIM( input_file_uvem ) // '" is not present.&' //            &
+                                     'Calculating UV exposure impossible.'
+          CALL message( 'bio_check_parameters', 'PA0513', 1, 2, 0, 6, 0 )
+       ELSE
+
+!
+!--       Required variables not given in input file
+          IF ( .NOT. uvem_integration_f%from_file  .OR.  .NOT. uvem_irradiance_f%from_file  .OR.   &
+               .NOT. uvem_projarea_f%from_file  .OR.  .NOT. uvem_radiance_f%from_file )  THEN
+             WRITE( message_string, * ) 'uv_exposure = .TRUE. but one or more required input ' //  &
+                                        'varaibles are not present in file "' //                   &
+                                        TRIM( input_file_uvem ) // '".&' //                        &
+                                        'Calculating UV exposure impossible.'
+             CALL message( 'bio_check_parameters', 'PA0514', 1, 2, 0, 6, 0 )
+          ENDIF
+
+!
+!--       Obstruction requested but not given
+          IF ( consider_obstructions  .AND.  .NOT. building_obstruction_f%from_file )  THEN
+             WRITE( message_string, * ) 'consider_obstructions = .TRUE. but varaible ' //          &
+                                        '"obstruction" is not present in file "' //                &
+                                        TRIM( input_file_uvem ) // '".&' //                        &
+                                        'Calculating UV exposure impossible.'
+             CALL message( 'bio_check_parameters', 'PA0515', 1, 2, 0, 6, 0 )
+          ENDIF
+       ENDIF
+    ENDIF
 
  END SUBROUTINE bio_check_parameters
@@ -1288,4 +1337,10 @@
     IF ( uv_exposure )  CALL netcdf_data_input_uvem
 
+!
+!-- Check parameters
+!-- WARNING This is a WORKAROUND! Due to the design of the module, checks are called at this point
+!-- rather than within module_interface_check_parameters.
+    CALL bio_check_parameters
+
     IF ( debug_output )  CALL debug_message( 'bio_init', 'end' )
 
@@ -1896,5 +1951,5 @@
 
     REAL(wp), INTENT ( IN )  ::  age     !< Age of agent                     (y)
-    REAL(wp), INTENT ( IN )  ::  dt      !< Time past SINce last calculation (s)
+    REAL(wp), INTENT ( IN )  ::  dt      !< Time past since last calculation (s)
     REAL(wp), INTENT ( IN )  ::  height  !< Height of agent                  (m)
     REAL(wp), INTENT ( IN )  ::  pair    !< Air pressure                     (hPa)
@@ -2615,5 +2670,5 @@
           ELSE
 !
-!--          Never get here in x_ridder: SINgularity in y
+!--          Never get here in x_ridder: singularity in y
              nerr    = -1_iwp
              clo_res = x_ridder
@@ -4325,5 +4380,5 @@
 
     USE control_parameters,                                                                        &
-       ONLY:  latitude, longitude, time_SINce_reference_point
+       ONLY:  latitude, longitude, time_since_reference_point
 
     IMPLICIT NONE
@@ -4345,5 +4400,5 @@
 
 
-    CALL get_date_time( time_SINce_reference_point, day_of_year = day_of_year,                     &
+    CALL get_date_time( time_since_reference_point, day_of_year = day_of_year,                     &
                         second_of_day = second_of_day )
     dtor = pi / 180.0_wp
Index: /palm/trunk/SOURCE/netcdf_data_input_mod.f90
===================================================================
--- /palm/trunk/SOURCE/netcdf_data_input_mod.f90	(revision 4805)
+++ /palm/trunk/SOURCE/netcdf_data_input_mod.f90	(revision 4806)
@@ -19,5 +19,6 @@
 ! Current revisions:
 ! -----------------
-!
+! Deactivated reading of building_obstruction_full due to improper implementation (conflicts with
+! building_obstruction_f and it is also not used anywhere else in the code).
 !
 ! Former revisions:
@@ -628,5 +629,5 @@
 !-- Define 3D variables of type NC_BYTE
     TYPE(int_3d_8bit)  ::  building_obstruction_f    !< input variable for building obstruction
-    TYPE(int_3d_8bit)  ::  building_obstruction_full !< input variable for building obstruction
+    ! TYPE(int_3d_8bit)  ::  building_obstruction_full !< input variable for building obstruction
 !
 !-- Define 2D variables of type NC_INT
@@ -2094,14 +2095,16 @@
 !
 !--    Read building obstruction
-       IF ( check_existence( var_names, 'obstruction' ) )  THEN
-          building_obstruction_full%from_file = .TRUE.
-!
-!--       Input 3D uvem building obstruction
-          ALLOCATE( building_obstruction_full%var_3d(0:44,0:2,0:2) )
-          CALL get_variable( id_uvem, 'obstruction', building_obstruction_full%var_3d, 0, 2, 0, 2, &
-                             0, 44 )
-       ELSE
-          building_obstruction_full%from_file = .FALSE.
-       ENDIF
+!      @bug This part is deactivated due to improper implementation: conflicts with
+!           building_obstruction_f and it is also not used anywhere else in the code
+!        IF ( check_existence( var_names, 'obstruction' ) )  THEN
+!           building_obstruction_full%from_file = .TRUE.
+! !
+! !--       Input 3D uvem building obstruction
+!           ALLOCATE( building_obstruction_full%var_3d(0:44,0:2,0:2) )
+!           CALL get_variable( id_uvem, 'obstruction', building_obstruction_full%var_3d, &
+!                              0, 2, 0, 2, 0, 44 )
+!        ELSE
+!           building_obstruction_full%from_file = .FALSE.
+!        ENDIF
 !
        IF ( check_existence( var_names, 'obstruction' ) )  THEN
