Index: /palm/trunk/SOURCE/data_output_binary_module.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_binary_module.f90	(revision 4407)
+++ /palm/trunk/SOURCE/data_output_binary_module.f90	(revision 4408)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Enable character-array output
+!
+! 4232 2019-09-20 09:34:22Z knoop
 ! Bugfix: INCLUDE "mpif.h" must be placed after IMPLICIT NONE statement
 !
@@ -532,4 +535,5 @@
                file_id, variable_id, bounds_start, value_counts, bounds_origin,        &
                is_global,                                                              &
+               values_char_0d,   values_char_1d,   values_char_2d,   values_char_3d,   &
                values_int8_0d,   values_int8_1d,   values_int8_2d,   values_int8_3d,   &
                values_int16_0d,  values_int16_1d,  values_int16_2d,  values_int16_3d,  &
@@ -544,4 +548,9 @@
 
     CHARACTER(LEN=*), PARAMETER ::  routine_name = 'binary_write_variable'  !< name of this routine
+
+    CHARACTER(LEN=1), POINTER,             INTENT(IN), OPTIONAL                   ::  values_char_0d  !< output variable
+    CHARACTER(LEN=1), POINTER, CONTIGUOUS, INTENT(IN), OPTIONAL, DIMENSION(:)     ::  values_char_1d  !< output variable
+    CHARACTER(LEN=1), POINTER, CONTIGUOUS, INTENT(IN), OPTIONAL, DIMENSION(:,:)   ::  values_char_2d  !< output variable
+    CHARACTER(LEN=1), POINTER, CONTIGUOUS, INTENT(IN), OPTIONAL, DIMENSION(:,:,:) ::  values_char_3d  !< output variable
 
     INTEGER, INTENT(IN)  ::  file_id       !< file ID
@@ -599,6 +608,24 @@
        WRITE( file_id )  bounds_origin
 !
+!--    character output
+       IF ( PRESENT( values_char_0d ) )  THEN
+          output_string = 'char'
+          WRITE( file_id )  output_string
+          WRITE( file_id )  values_char_0d
+       ELSEIF ( PRESENT( values_char_1d ) )  THEN
+          output_string = 'char'
+          WRITE( file_id )  output_string
+          WRITE( file_id )  values_char_1d
+       ELSEIF ( PRESENT( values_char_2d ) )  THEN
+          output_string = 'char'
+          WRITE( file_id )  output_string
+          WRITE( file_id )  values_char_2d
+       ELSEIF ( PRESENT( values_char_3d ) )  THEN
+          output_string = 'char'
+          WRITE( file_id )  output_string
+          WRITE( file_id )  values_char_3d
+!
 !--    8bit integer output
-       IF ( PRESENT( values_int8_0d ) )  THEN
+       ELSEIF ( PRESENT( values_int8_0d ) )  THEN
           output_string = 'int8'
           WRITE( file_id )  output_string
Index: /palm/trunk/SOURCE/data_output_module.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_module.f90	(revision 4407)
+++ /palm/trunk/SOURCE/data_output_module.f90	(revision 4408)
@@ -20,9 +20,12 @@
 ! Current revisions:
 ! ------------------
-!
-!
+! 
+! 
 ! Former revisions:
 ! -----------------
 ! $Id$
+! Enable character-array output
+!
+! 4147 2019-08-07 09:42:31Z gronemeier
 ! corrected indentation according to coding standard
 !
@@ -1533,4 +1536,5 @@
 !--------------------------------------------------------------------------------------------------!
  FUNCTION dom_write_var( file_name, variable_name, bounds_start, bounds_end,         &
+             values_char_0d,   values_char_1d,   values_char_2d,   values_char_3d,   &
              values_int8_0d,   values_int8_1d,   values_int8_2d,   values_int8_3d,   &
              values_int16_0d,  values_int16_1d,  values_int16_2d,  values_int16_3d,  &
@@ -1547,4 +1551,18 @@
 
     CHARACTER(LEN=*), PARAMETER ::  routine_name = 'dom_write_var'  !< name of routine
+
+    CHARACTER(LEN=1), POINTER, INTENT(IN), OPTIONAL                   ::  values_char_0d           !< output variable
+    CHARACTER(LEN=1), POINTER, INTENT(IN), OPTIONAL, DIMENSION(:)     ::  values_char_1d           !< output variable
+    CHARACTER(LEN=1), POINTER, INTENT(IN), OPTIONAL, DIMENSION(:,:)   ::  values_char_2d           !< output variable
+    CHARACTER(LEN=1), POINTER, INTENT(IN), OPTIONAL, DIMENSION(:,:,:) ::  values_char_3d           !< output variable
+
+    CHARACTER(LEN=1), TARGET, ALLOCATABLE, DIMENSION(:)               ::  values_char_1d_resorted  !< resorted output variable
+    CHARACTER(LEN=1), TARGET, ALLOCATABLE, DIMENSION(:,:)             ::  values_char_2d_resorted  !< resorted output variable
+    CHARACTER(LEN=1), TARGET, ALLOCATABLE, DIMENSION(:,:,:)           ::  values_char_3d_resorted  !< resorted output variable
+
+    CHARACTER(LEN=1), POINTER                                         ::  values_char_0d_pointer   !< pointer to resortet array
+    CHARACTER(LEN=1), POINTER, CONTIGUOUS, DIMENSION(:)               ::  values_char_1d_pointer   !< pointer to resortet array
+    CHARACTER(LEN=1), POINTER, CONTIGUOUS, DIMENSION(:,:)             ::  values_char_2d_pointer   !< pointer to resortet array
+    CHARACTER(LEN=1), POINTER, CONTIGUOUS, DIMENSION(:,:,:)           ::  values_char_3d_pointer   !< pointer to resortet array
 
     INTEGER ::  file_id              !< file ID
@@ -1714,6 +1732,64 @@
 !
 !--    Mask and resort variable
+!--    character output
+       IF ( PRESENT( values_char_0d ) )  THEN
+          values_char_0d_pointer => values_char_0d
+       ELSEIF ( PRESENT( values_char_1d ) )  THEN
+          IF ( do_output ) THEN
+             ALLOCATE( values_char_1d_resorted(0:value_counts(1)-1) )
+             !$OMP PARALLEL PRIVATE (i)
+             !$OMP DO
+             DO  i = 0, value_counts(1) - 1
+                values_char_1d_resorted(i) = values_char_1d(masked_indices(1,i))
+             ENDDO
+             !$OMP END PARALLEL
+          ELSE
+             ALLOCATE( values_char_1d_resorted(1) )
+             values_char_1d_resorted = ' '
+          ENDIF
+          values_char_1d_pointer => values_char_1d_resorted
+       ELSEIF ( PRESENT( values_char_2d ) )  THEN
+          IF ( do_output ) THEN
+             ALLOCATE( values_char_2d_resorted(0:value_counts(1)-1, &
+                                               0:value_counts(2)-1) )
+             !$OMP PARALLEL PRIVATE (i,j)
+             !$OMP DO
+             DO  i = 0, value_counts(1) - 1
+                DO  j = 0, value_counts(2) - 1
+                   values_char_2d_resorted(i,j) = values_char_2d(masked_indices(2,j), &
+                                                                 masked_indices(1,i)  )
+                ENDDO
+             ENDDO
+             !$OMP END PARALLEL
+          ELSE
+             ALLOCATE( values_char_2d_resorted(1,1) )
+             values_char_2d_resorted = ' '
+          ENDIF
+          values_char_2d_pointer => values_char_2d_resorted
+       ELSEIF ( PRESENT( values_char_3d ) )  THEN
+          IF ( do_output ) THEN
+             ALLOCATE( values_char_3d_resorted(0:value_counts(1)-1, &
+                                               0:value_counts(2)-1, &
+                                               0:value_counts(3)-1) )
+             !$OMP PARALLEL PRIVATE (i,j,k)
+             !$OMP DO
+             DO  i = 0, value_counts(1) - 1
+                DO  j = 0, value_counts(2) - 1
+                   DO  k = 0, value_counts(3) - 1
+                      values_char_3d_resorted(i,j,k) = values_char_3d(masked_indices(3,k), &
+                                                                      masked_indices(2,j), &
+                                                                      masked_indices(1,i)  )
+                   ENDDO
+                ENDDO
+             ENDDO
+             !$OMP END PARALLEL
+          ELSE
+             ALLOCATE( values_char_3d_resorted(1,1,1) )
+             values_char_3d_resorted = ' '
+          ENDIF
+          values_char_3d_pointer => values_char_3d_resorted
+!
 !--    8bit integer output
-       IF ( PRESENT( values_int8_0d ) )  THEN
+       ELSEIF ( PRESENT( values_int8_0d ) )  THEN
           values_int8_0d_pointer => values_int8_0d
        ELSEIF ( PRESENT( values_int8_1d ) )  THEN
@@ -2139,6 +2215,24 @@
           CASE ( 'binary' )
 !
+!--          character output
+             IF ( PRESENT( values_char_0d ) )  THEN
+                 CALL binary_write_variable( file_id, variable_id,                      &
+                         bounds_start_internal, value_counts, bounds_origin, is_global, &
+                        values_char_0d=values_char_0d_pointer, return_value=output_return_value )
+             ELSEIF ( PRESENT( values_char_1d ) )  THEN
+                CALL binary_write_variable( file_id, variable_id,                      &
+                        bounds_start_internal, value_counts, bounds_origin, is_global, &
+                        values_char_1d=values_char_1d_pointer, return_value=output_return_value )
+             ELSEIF ( PRESENT( values_char_2d ) )  THEN
+                CALL binary_write_variable( file_id, variable_id,                      &
+                        bounds_start_internal, value_counts, bounds_origin, is_global, &
+                        values_char_2d=values_char_2d_pointer, return_value=output_return_value )
+             ELSEIF ( PRESENT( values_char_3d ) )  THEN
+                CALL binary_write_variable( file_id, variable_id,                      &
+                        bounds_start_internal, value_counts, bounds_origin, is_global, &
+                        values_char_3d=values_char_3d_pointer, return_value=output_return_value )
+!
 !--          8bit integer output
-             IF ( PRESENT( values_int8_0d ) )  THEN
+             ELSEIF ( PRESENT( values_int8_0d ) )  THEN
                 CALL binary_write_variable( file_id, variable_id,                      &
                         bounds_start_internal, value_counts, bounds_origin, is_global, &
@@ -2275,6 +2369,24 @@
           CASE ( 'netcdf4-parallel', 'netcdf4-serial' )
 !
+!--          character output
+             IF ( PRESENT( values_char_0d ) )  THEN
+                 CALL netcdf4_write_variable( file_id, variable_id,                     &
+                         bounds_start_internal, value_counts, bounds_origin, is_global, &
+                        values_char_0d=values_char_0d_pointer, return_value=output_return_value )
+             ELSEIF ( PRESENT( values_char_1d ) )  THEN
+                CALL netcdf4_write_variable( file_id, variable_id,                     &
+                        bounds_start_internal, value_counts, bounds_origin, is_global, &
+                        values_char_1d=values_char_1d_pointer, return_value=output_return_value )
+             ELSEIF ( PRESENT( values_char_2d ) )  THEN
+                CALL netcdf4_write_variable( file_id, variable_id,                     &
+                        bounds_start_internal, value_counts, bounds_origin, is_global, &
+                        values_char_2d=values_char_2d_pointer, return_value=output_return_value )
+             ELSEIF ( PRESENT( values_char_3d ) )  THEN
+                CALL netcdf4_write_variable( file_id, variable_id,                     &
+                        bounds_start_internal, value_counts, bounds_origin, is_global, &
+                        values_char_3d=values_char_3d_pointer, return_value=output_return_value )
+!
 !--          8bit integer output
-             IF ( PRESENT( values_int8_0d ) )  THEN
+             ELSEIF ( PRESENT( values_int8_0d ) )  THEN
                 CALL netcdf4_write_variable( file_id, variable_id,                     &
                         bounds_start_internal, value_counts, bounds_origin, is_global, &
Index: /palm/trunk/SOURCE/data_output_netcdf4_module.f90
===================================================================
--- /palm/trunk/SOURCE/data_output_netcdf4_module.f90	(revision 4407)
+++ /palm/trunk/SOURCE/data_output_netcdf4_module.f90	(revision 4408)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Enable character-array output
+!
+! 4232 2019-09-20 09:34:22Z knoop
 ! Bugfix: INCLUDE "mpif.h" must be placed after IMPLICIT NONE statement
 !
@@ -502,4 +505,5 @@
                file_id, variable_id, bounds_start, value_counts, bounds_origin,        &
                is_global,                                                              &
+               values_char_0d,   values_char_1d,   values_char_2d,   values_char_3d,   &
                values_int8_0d,   values_int8_1d,   values_int8_2d,   values_int8_3d,   &
                values_int16_0d,  values_int16_1d,  values_int16_2d,  values_int16_3d,  &
@@ -512,4 +516,9 @@
 
     CHARACTER(LEN=*), PARAMETER ::  routine_name = 'netcdf4_write_variable'  !< name of this routine
+
+    CHARACTER(LEN=1), POINTER,             INTENT(IN), OPTIONAL                   ::  values_char_0d  !< output variable
+    CHARACTER(LEN=1), POINTER, CONTIGUOUS, INTENT(IN), OPTIONAL, DIMENSION(:)     ::  values_char_1d  !< output variable
+    CHARACTER(LEN=1), POINTER, CONTIGUOUS, INTENT(IN), OPTIONAL, DIMENSION(:,:)   ::  values_char_2d  !< output variable
+    CHARACTER(LEN=1), POINTER, CONTIGUOUS, INTENT(IN), OPTIONAL, DIMENSION(:,:,:) ::  values_char_3d  !< output variable
 
     INTEGER              ::  d             !< loop index
@@ -578,7 +587,26 @@
 
        ndims = SIZE( bounds_start )
+
+!
+!--    character output
+       IF ( PRESENT( values_char_0d ) )  THEN
+          nc_stat = NF90_PUT_VAR( file_id, variable_id, (/ values_char_0d /), &
+                                  start = bounds_start - bounds_origin + 1,   &
+                                  count = value_counts )
+       ELSEIF ( PRESENT( values_char_1d ) )  THEN
+          nc_stat = NF90_PUT_VAR( file_id, variable_id, values_char_1d,     &
+                                  start = bounds_start - bounds_origin + 1, &
+                                  count = value_counts )
+       ELSEIF ( PRESENT( values_char_2d ) )  THEN
+          nc_stat = NF90_PUT_VAR( file_id, variable_id, values_char_2d,     &
+                                  start = bounds_start - bounds_origin + 1, &
+                                  count = value_counts )
+       ELSEIF ( PRESENT( values_char_3d ) )  THEN
+          nc_stat = NF90_PUT_VAR( file_id, variable_id, values_char_3d,     &
+                                  start = bounds_start - bounds_origin + 1, &
+                                  count = value_counts )
 !
 !--    8bit integer output
-       IF ( PRESENT( values_int8_0d ) )  THEN
+       ELSEIF ( PRESENT( values_int8_0d ) )  THEN
           nc_stat = NF90_PUT_VAR( file_id, variable_id, (/ values_int8_0d /), &
                                   start = bounds_start - bounds_origin + 1,   &
Index: /palm/trunk/SOURCE/virtual_measurement_mod.f90
===================================================================
--- /palm/trunk/SOURCE/virtual_measurement_mod.f90	(revision 4407)
+++ /palm/trunk/SOURCE/virtual_measurement_mod.f90	(revision 4408)
@@ -25,6 +25,9 @@
 ! -----------------
 ! $Id$
+! write fill_value attribute
+!
+! 4406 2020-02-13 20:06:29Z knoop
 ! Bugix: removed oro_rel wrong loop bounds and removed unnecessary restart method
-! 
+!
 ! 4400 2020-02-10 20:32:41Z suehring
 ! Revision of the module:
@@ -268,5 +271,5 @@
        INTEGER(iwp) ::  start_coord_s = 0   !< start coordinate in NetCDF file for local soil observations
 
-       INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  dim_t !< number observations individual for each trajectory 
+       INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  dim_t !< number observations individual for each trajectory
                                                          !< or station that are no _FillValues
 
@@ -287,5 +290,5 @@
        REAL(wp) ::  fill_nutm                            !< fill value for UTM coordinates in case of missing values
        REAL(wp) ::  fill_zar                             !< fill value for heigth coordinates in case of missing values
-       REAL(wp) ::  fillout = -9999.0                    !< fill value for output in case a observation is taken 
+       REAL(wp) ::  fillout = -9999.0                    !< fill value for output in case a observation is taken
                                                          !< e.g. from inside a building
        REAL(wp) ::  origin_x_obs                         !< origin of the observation in UTM coordiates in x-direction
@@ -306,5 +309,5 @@
 
     ! This need to be generalized
-!     CHARACTER(LEN=10) ::  char_fill = '_FillValue'
+    CHARACTER(LEN=10) ::  char_fill = '_FillValue'                 !< attribute name for fill value
     CHARACTER(LEN=9)  ::  char_long = 'long_name'                  !< attribute name for long_name
     CHARACTER(LEN=13) ::  char_standard = 'standard_name'          !< attribute name for standard_name
@@ -462,5 +465,5 @@
 
  END SUBROUTINE vm_check_parameters
- 
+
 !------------------------------------------------------------------------------!
 ! Description:
@@ -893,5 +896,5 @@
 !
 !-- Allocate flag array. This dummy array is used to identify grid points
-!-- where virtual measurements should be taken. Please note, in order to 
+!-- where virtual measurements should be taken. Please note, in order to
 !-- include also the surrounding grid points of the original coordinate
 !-- ghost points are required.
@@ -1000,6 +1003,6 @@
        ALLOCATE( vmea(l)%var_atts(1:vmea(l)%nmeas) )
 !
-!--    Store the variable names in a data structures, which assigns further 
-!--    attributes to this name. Further, for data output reasons, create a 
+!--    Store the variable names in a data structures, which assigns further
+!--    attributes to this name. Further, for data output reasons, create a
 !--    string of output variables, which will be written into the attribute
 !--    data_content.
@@ -1014,5 +1017,5 @@
 !--    define the grid-index space on each subdomain where virtual measurements
 !--    should be taken. Note, the entire coordinate array (on the entire model
-!--    domain) won't be stored as this would exceed memory requirements, 
+!--    domain) won't be stored as this would exceed memory requirements,
 !--    particularly for trajectories.
        IF ( vmea(l)%nmeas > 0 )  THEN
@@ -1344,5 +1347,5 @@
     DEALLOCATE( meas_flag )
 !
-!-- Close input file for virtual measurements. 
+!-- Close input file for virtual measurements.
     CALL close_input_file( pids_id )
 !
@@ -1398,5 +1401,5 @@
 !-- Note, start coordinates are initialized with zero for sake of simplicity
 !-- in summation. However, in NetCDF the start coordinates must be >= 1,
-!-- so that a one needs to be added at the end. 
+!-- so that a one needs to be added at the end.
     DO  l = 1, vmea_general%nvm
        DO  n  = 0, myid - 1
@@ -2237,8 +2240,8 @@
                                       value = TRIM( vmea(l)%var_atts(n)%coordinates ) )
 
-!           return_value = dom_def_att( vmea(l)%nc_filename,                     &
-!                                       variable_name = variable_name,           &
-!                                       attribute_name = char_fill,              &
-!                                       value = vmea(l)%var_atts(n)%fill_value )
+          return_value = dom_def_att( vmea(l)%nc_filename,                     &
+                                      variable_name = variable_name,           &
+                                      attribute_name = char_fill,              &
+                                      value = REAL( vmea(l)%var_atts(n)%fill_value, KIND=4 ) )
 
        ENDDO  ! loop over variables per site
@@ -2345,5 +2348,5 @@
           DEALLOCATE( output_values_1d_target )
 !
-!--       In case of sampled soil quantities, output also the respective 
+!--       In case of sampled soil quantities, output also the respective
 !--       coordinate arrays.
           IF ( vmea(l)%soil_sampling )  THEN
@@ -2412,5 +2415,5 @@
 !
 !--          Write the stations name
-             
+
           ENDIF
 
@@ -2910,5 +2913,5 @@
 !                     i = MERGE( vmea(l)%i(m), nxl, vmea(l)%i(m) > nxl )
 !                     i = MERGE( i           , nxr, i            < nxr )
-! 
+!
 !                     DO  mm = surf_lsm_h%start_index(j,i),                      &
 !                              surf_lsm_h%end_index(j,i)
