Index: /palm/trunk/SOURCE/netcdf_interface_mod.f90
===================================================================
--- /palm/trunk/SOURCE/netcdf_interface_mod.f90	(revision 4045)
+++ /palm/trunk/SOURCE/netcdf_interface_mod.f90	(revision 4046)
@@ -25,52 +25,55 @@
 ! -----------------
 ! $Id$
+! removal of special treatment for usm_define_netcdf_grid call
+! 
+! 4039 2019-06-18 10:32:41Z suehring
 ! Rename subroutines in module for diagnostic quantities
-! 
+!
 ! 4029 2019-06-14 14:04:35Z raasch
 ! netcdf variable NF90_NOFILL is used as argument instead of "1" in calls to NF90_DEF_VAR_FILL
-! 
+!
 ! 3995 2019-05-22 18:59:54Z suehring
 ! output of turbulence intensity added
-! 
+!
 ! 3994 2019-05-22 18:08:09Z suehring
 ! remove origin time from time unit, compose origin_time_string within
 ! subroutine netcdf_create_global_atts
-! 
+!
 ! 3954 2019-05-06 12:49:42Z gronemeier
 ! bugfix: corrected format for date_time_string
-! 
+!
 ! 3953 2019-05-06 12:11:55Z gronemeier
 ! bugfix: set origin_time and starting point of time coordinate according to
 !         day_of_year_init and time_utc_init
-! 
+!
 ! 3942 2019-04-30 13:08:30Z kanani
 ! Add specifier to netcdf_handle_error to simplify identification of attribute
 ! causing the error
-! 
+!
 ! 3766 2019-02-26 16:23:41Z raasch
 ! bugfix in im_define_netcdf_grid argument list
-! 
+!
 ! 3745 2019-02-15 18:57:56Z suehring
 ! Add indoor model
-! 
+!
 ! 3744 2019-02-15 18:38:58Z suehring
 ! Bugfix: - initialize return values to ensure they are set before returning
 !           (routine define_geo_coordinates)
 !         - change order of dimensions for some variables
-! 
+!
 ! 3727 2019-02-08 14:52:10Z gronemeier
 ! make several routines publicly available
-! 
+!
 ! 3701 2019-01-26 18:57:21Z knoop
 ! Statement added to prevent compiler warning about unused variable
-! 
+!
 ! 3655 2019-01-07 16:51:22Z knoop
-! Move the control parameter "salsa" from salsa_mod to control_parameters 
+! Move the control parameter "salsa" from salsa_mod to control_parameters
 ! (M. Kurppa)
-! 
+!
 ! 3582 2018-11-29 19:16:36Z suehring
 ! dom_dwd_user, Schrempf:
 ! Remove uv exposure model code, this is now part of biometeorology_mod
-! 
+!
 ! 3529 2018-11-15 21:03:15Z gronemeier
 ! - set time units
@@ -79,15 +82,15 @@
 ! - move definition of UTM and geographic coordinates into subroutine
 ! - change fill_value
-! 
+!
 ! 3525 2018-11-14 16:06:14Z kanani
 ! Changes related to clean-up of biometeorology (dom_dwd_user)
-! 
+!
 ! 3485 2018-11-03 17:09:40Z gronemeier
 ! Write geographic coordinates as global attributes to file.
-! 
+!
 ! 3467 2018-10-30 19:05:21Z suehring
 ! - Salsa implemented
 ! - Bugfix convert_utm_to...
-! 
+!
 ! 3464 2018-10-30 18:08:55Z kanani
 ! - Add variable crs to output files
@@ -95,76 +98,76 @@
 ! - Add latitude/longitude coordinates. For 3d and xy output, lon and lat are
 !   only written if parallel output is used.
-! 
+!
 ! 3459 2018-10-30 15:04:11Z gronemeier
 ! Adjustment of biometeorology calls
-! 
+!
 ! 3435 2018-10-26 18:25:44Z gronemeier
 ! Bugfix: corrected order of calls to define_netcdf_grid for masked output
 ! Add vertical dimensions to masked output in case of terrain-following output
-! 
+!
 ! 3421 2018-10-24 18:39:32Z gronemeier
 ! Bugfix: move ocean output variables to ocean_mod
 ! Renamed output variables
 ! Add UTM coordinates to mask, 3d, xy, xz, yz output
-! 
+!
 ! 3337 2018-10-12 15:17:09Z kanani
 ! (from branch resler)
 ! Add biometeorology
-! 
+!
 ! 3294 2018-10-01 02:37:10Z raasch
 ! changes concerning modularization of ocean option
-! 
+!
 ! 3274 2018-09-24 15:42:55Z knoop
 ! Modularization of all bulk cloud physics code components
-! 
+!
 ! 3241 2018-09-12 15:02:00Z raasch
 ! unused variables removed
-! 
+!
 ! 3235 2018-09-07 14:06:15Z sward
 ! Changed MAS output dimension id_dim_agtnum to be of defined size and no longer
 ! unlimited. Also changed some MAS output variables to be of type float
-! 
+!
 ! 3198 2018-08-15 09:23:10Z sward
 ! Redefined MAS limited time dimension to fit usage of multi_agent_system_end
-! 
+!
 ! 3187 2018-07-31 10:32:34Z sward
 ! Changed agent output to precision NF90_DOUBLE
-! 
+!
 ! 3165 2018-07-24 13:12:42Z sward
 ! Added agent ID output
-! 
+!
 ! 3159 2018-07-20 11:20:01Z sward
 ! Added multi agent system
-! 
+!
 ! 3049 2018-05-29 13:52:36Z Giersch
 ! Error messages revised
-! 
+!
 ! 3045 2018-05-28 07:55:41Z Giersch
 ! Error messages revised, code adjusted to PALMs coding standards, CASE pt_ext
 ! pt_new disabled, comment revised
-! 
+!
 ! 3004 2018-04-27 12:33:25Z Giersch
 ! .NOT. found in if-query added to account for variables found in tcm
-! 
+!
 ! 2964 2018-04-12 16:04:03Z Giersch
 ! Calculation of fixed number of output time levels for parallel netcdf output
 ! has been moved completely to check_parameters
-! 
+!
 ! 2932 2018-03-26 09:39:22Z maronga
 ! Renamed inipar to initialization_parameters.
-! 
+!
 ! 2817 2018-02-19 16:32:21Z knoop
 ! Preliminary gust module interface implemented
-! 
+!
 ! 2769 2018-01-25 09:22:24Z raasch
 ! bugfix for calculating number of required output time levels in case of output
 ! at the beginning of a restart run
-! 
+!
 ! 2766 2018-01-22 17:17:47Z kanani
 ! Removed preprocessor directive __chem
-! 
+!
 ! 2746 2018-01-15 12:06:04Z suehring
 ! Move flag plant canopy to modules
-! 
+!
 ! 2718 2018-01-02 08:49:38Z maronga
 ! Corrected "Former revisions" section
@@ -181,31 +184,31 @@
 ! upper bounds of cross section and 3d output changed from nx+1,ny+1 to nx,ny
 ! no output of ghost layer data any more
-! 
+!
 ! 2302 2017-07-03 14:07:20Z suehring
 ! Reading of 3D topography using NetCDF data type NC_BYTE
-! 
+!
 ! 2292 2017-06-20 09:51:42Z schwenkel
-! Implementation of new microphysic scheme: cloud_scheme = 'morrison' 
-! includes two more prognostic equations for cloud drop concentration (nc)  
-! and cloud water content (qc). 
-! 
+! Implementation of new microphysic scheme: cloud_scheme = 'morrison'
+! includes two more prognostic equations for cloud drop concentration (nc)
+! and cloud water content (qc).
+!
 ! 2270 2017-06-09 12:18:47Z maronga
 ! Removed 2 timeseries (shf_eb + qsws_eb). Removed _eb suffixes
-! 
+!
 ! 2265 2017-06-08 16:58:28Z schwenkel
 ! Unused variables removed.
-! 
+!
 ! 2239 2017-06-01 12:04:51Z suehring
 ! Bugfix xy-output of land-surface variables
-! 
+!
 ! 2233 2017-05-30 18:08:54Z suehring
 !
 ! 2232 2017-05-30 17:47:52Z suehring
 ! Adjustments to new topography and surface concept
-! 
+!
 ! Topograpyh height arrays (zu_s_inner, zw_w_inner) are defined locally, output
-! only if parallel netcdf. 
-!
-! Build interface for topography input: 
+! only if parallel netcdf.
+!
+! Build interface for topography input:
 ! - open file in read-only mode
 ! - read global attributes
@@ -216,5 +219,5 @@
 ! 2209 2017-04-19 09:34:46Z kanani
 ! Added support for plant canopy model output
-! 
+!
 ! 2189 2017-03-21 09:29:52Z raasch
 ! bugfix: rho renamed rho_ocean for the cross section output
@@ -226,45 +229,45 @@
 ! 2040 2016-10-26 16:58:09Z gronemeier
 ! Increased number of possible statistic_regions to 99
-! 
+!
 ! 2037 2016-10-26 11:15:40Z knoop
 ! Anelastic approximation implemented
-! 
+!
 ! 2031 2016-10-21 15:11:58Z knoop
 ! renamed variable rho to rho_ocean
-! 
+!
 ! 2011 2016-09-19 17:29:57Z kanani
 ! Flag urban_surface is now defined in module control_parameters,
 ! changed prefix for urban surface model output to "usm_",
 ! introduced control parameter varnamelength for LEN of trimvar.
-! 
+!
 ! 2007 2016-08-24 15:47:17Z kanani
-! Added support for new urban surface model (temporary modifications of 
+! Added support for new urban surface model (temporary modifications of
 ! SELECT CASE ( ) necessary, see variable trimvar),
 ! increased DIMENSION of do2d_unit, do3d_unit, id_var_do2d, id_var_do3d,
 ! increased LEN of char_cross_profiles, var_list, var_list_old
-! 
+!
 ! 2000 2016-08-20 18:09:15Z knoop
 ! Forced header and separation lines into 80 columns
-! 
+!
 ! 1990 2016-08-12 09:54:36Z gronemeier
 ! Bugfix: variable list was not written for time series output
-! 
+!
 ! 1980 2016-07-29 15:51:57Z suehring
 ! Bugfix, in order to steer user-defined output, setting flag found explicitly
 ! to .F.
-! 
+!
 ! 1976 2016-07-27 13:28:04Z maronga
-! Removed remaining 2D land surface quantities. Definition of radiation 
+! Removed remaining 2D land surface quantities. Definition of radiation
 ! quantities is now done directly in the respective module
-! 
+!
 ! 1972 2016-07-26 07:52:02Z maronga
 ! Bugfix: wrong units for lsm quantities.
 ! Definition of grids for land surface quantities is now done directly in the
 ! respective module.
-! 
+!
 ! 1960 2016-07-12 16:34:24Z suehring
-! Additional labels and units for timeseries output of passive scalar-related 
+! Additional labels and units for timeseries output of passive scalar-related
 ! quantities
-! 
+!
 ! 1957 2016-07-07 10:43:48Z suehring
 ! flight module added
@@ -272,6 +275,6 @@
 ! 1850 2016-04-08 13:29:27Z maronga
 ! Module renamed
-! 
-! 
+!
+!
 ! 1833 2016-04-07 14:23:03Z raasch
 ! spectrum renamed spectra_mod
@@ -289,20 +292,20 @@
 ! 1745 2016-02-05 13:06:51Z gronemeier
 ! Bugfix: recalculating ntdim_3d, ntdim_2d_xy/xz/yz when checking the
-!         extensibility of an existing file (only when using parallel NetCDF). 
-! 
+!         extensibility of an existing file (only when using parallel NetCDF).
+!
 ! 1691 2015-10-26 16:17:44Z maronga
-! Added output of radiative heating rates for RRTMG. Corrected output of 
+! Added output of radiative heating rates for RRTMG. Corrected output of
 ! radiative fluxes
-! 
+!
 ! 1682 2015-10-07 23:56:08Z knoop
-! Code annotations made doxygen readable 
-! 
+! Code annotations made doxygen readable
+!
 ! 1596 2015-05-21 09:34:28Z gronemeier
 ! Bugfix in masked data output. Read 'zu_3d' when trying to extend masked data
-! 
+!
 ! 1551 2015-03-03 14:18:16Z maronga
 ! Added support for land surface model and radiation model output. In the course
 ! of this action a new vertical grid zs (soil) was introduced.
-! 
+!
 ! 1353 2014-04-08 15:21:23Z heinze
 ! REAL constants provided with KIND-attribute
@@ -346,5 +349,5 @@
 ! 992 2012-09-05 15:08:26Z hoffmann
 ! Removal of the informative messages PA0352 and PA0353.
-!  
+!
 ! 983 2012-08-21 14:17:57Z hoffmann
 ! Bugfix in cross_profiles.
@@ -355,5 +358,5 @@
 ! 959 2012-07-24 13:13:41Z hoffmann
 ! Bugfix in cross_profiles. It is not allowed to arrange more than 100
-! profiles with cross_profiles. 
+! profiles with cross_profiles.
 !
 ! 951 2012-07-19 14:22:52Z hoffmann
@@ -460,5 +463,5 @@
              'rad_net      ', 'rad_lw_in    ', 'rad_lw_out   ',                &
              'rad_sw_in    ', 'rad_sw_out   ', 'rrtm_aldif   ',                &
-             'rrtm_aldir   ', 'rrtm_asdif   ', 'rrtm_asdir   ',                &                                               
+             'rrtm_aldir   ', 'rrtm_asdif   ', 'rrtm_asdir   ',                &
              ( 'unknown      ', i9 = 1, dots_max-40 ) /)
 
@@ -566,15 +569,15 @@
     INTEGER(iwp), DIMENSION(11)  ::  nc_precision
     INTEGER(iwp), DIMENSION(dopr_norm_num) ::  id_var_norm_dopr
-    
+
     INTEGER(iwp), DIMENSION(fl_max) ::  id_dim_x_fl, id_dim_y_fl, id_dim_z_fl
     INTEGER(iwp), DIMENSION(fl_max) ::  id_var_x_fl, id_var_y_fl, id_var_z_fl
-    
+
     CHARACTER (LEN=20), DIMENSION(fl_max*var_fl_max) :: dofl_label
-    CHARACTER (LEN=20), DIMENSION(fl_max*var_fl_max) :: dofl_unit 
+    CHARACTER (LEN=20), DIMENSION(fl_max*var_fl_max) :: dofl_unit
     CHARACTER (LEN=20), DIMENSION(fl_max) :: dofl_dim_label_x
     CHARACTER (LEN=20), DIMENSION(fl_max) :: dofl_dim_label_y
     CHARACTER (LEN=20), DIMENSION(fl_max) :: dofl_dim_label_z
 
-    INTEGER(iwp), DIMENSION(fl_max*var_fl_max) :: id_var_dofl    
+    INTEGER(iwp), DIMENSION(fl_max*var_fl_max) :: id_var_dofl
 
     INTEGER(iwp), DIMENSION(dopts_num,0:10) ::  id_var_dopts
@@ -668,5 +671,5 @@
 
  SUBROUTINE netcdf_define_header( callmode, extend, av )
- 
+
 #if defined( __netcdf )
 
@@ -678,5 +681,5 @@
 
     USE chemistry_model_mod,                                                   &
-        ONLY:  chem_define_netcdf_grid 
+        ONLY:  chem_define_netcdf_grid
 
     USE basic_constants_and_equations_mod,                                     &
@@ -702,6 +705,6 @@
                urban_surface
 
-    USE diagnostic_output_quantities_mod,                                      & 
-        ONLY:  doq_define_netcdf_grid           
+    USE diagnostic_output_quantities_mod,                                      &
+        ONLY:  doq_define_netcdf_grid
 
     USE grid_variables,                                                        &
@@ -718,5 +721,5 @@
     USE indoor_model_mod,                                                      &
         ONLY: im_define_netcdf_grid
-    
+
     USE land_surface_model_mod,                                                &
         ONLY: lsm_define_netcdf_grid, nzb_soil, nzt_soil, nzs, zs
@@ -737,8 +740,8 @@
 
     USE radiation_model_mod,                                                   &
-        ONLY: radiation, radiation_define_netcdf_grid      
-     
+        ONLY: radiation, radiation_define_netcdf_grid
+
     USE salsa_mod,                                                             &
-        ONLY:  salsa_define_netcdf_grid            
+        ONLY:  salsa_define_netcdf_grid
 
     USE spectra_mod,                                                           &
@@ -894,5 +897,5 @@
              CASE DEFAULT
                 WRITE ( message_string, * ) 'unknown variable in ' //          &
-                                  'initialization_parameters ',                & 
+                                  'initialization_parameters ',                &
                                   'assignment: netcdf_precision(', i, ')="',   &
                                             TRIM( netcdf_precision(i) ),'"'
@@ -945,6 +948,6 @@
 
 !
-!-- Select the mode to be processed. Possibilities are 3d, ma (mask), xy, xz, 
-!-- yz, pr (profiles), ps (particle timeseries), fl (flight data), ts 
+!-- Select the mode to be processed. Possibilities are 3d, ma (mask), xy, xz,
+!-- yz, pr (profiles), ps (particle timeseries), fl (flight data), ts
 !-- (timeseries) or sp (spectra)
     SELECT CASE ( mode )
@@ -953,5 +956,5 @@
 
 !
-!--       decompose actual parameter file_id (=formal parameter av) into 
+!--       decompose actual parameter file_id (=formal parameter av) into
 !--       mid and av
           file_id = av
@@ -1087,5 +1090,5 @@
                                      'meters', 'zu(nzb_s_inner)', 488, 489,    &
                                      490 )
-!             
+!
 !--          Define zwwi = zw(nzb_w_inner)
              CALL netcdf_create_var( id_set_mask(mid,av),                      &
@@ -1095,6 +1098,6 @@
                                      'meters', 'zw(nzb_w_inner)', 491, 492,    &
                                      493 )
-          ENDIF             
- 
+          ENDIF
+
           IF ( land_surface )  THEN
 !
@@ -1115,11 +1118,6 @@
 
           DO WHILE ( domask(mid,av,i)(1:1) /= ' ' )
-!
-!--          Temporary solution to account for data output within the new urban 
-!--          surface model (urban_surface_mod.f90), see also SELECT CASE ( trimvar )
+
              trimvar = TRIM( domask(mid,av,i) )
-             IF ( urban_surface  .AND.  trimvar(1:4) == 'usm_' )  THEN
-                trimvar = 'usm_output'
-             ENDIF
 !
 !--          Check for the grid
@@ -1157,69 +1155,54 @@
                    grid_z = 'zw'
 
-!             
-!--             Block of urban surface model outputs
-                CASE ( 'usm_output' )
-
-                   CALL usm_define_netcdf_grid( domask( mid,av,i), found,      &
-                                                        grid_x, grid_y, grid_z )
 
                 CASE DEFAULT
 !
-!--                Check for quantities defined in other modules                                                        
-                   CALL tcm_define_netcdf_grid( domask( mid,av,i), found,      &
-                                                        grid_x, grid_y, grid_z )
+!--                Check for quantities defined in other modules
+                   CALL tcm_define_netcdf_grid( trimvar, found, grid_x, grid_y, grid_z )
 
                    IF ( .NOT. found  .AND.  air_chemistry )  THEN
-                      CALL chem_define_netcdf_grid( domask(mid,av,i), found,   &
-                                                    grid_x, grid_y, grid_z )
+                      CALL chem_define_netcdf_grid( trimvar, found, grid_x, grid_y, grid_z )
                    ENDIF
 
                    IF ( .NOT. found )                                          &
-                      CALL doq_define_netcdf_grid( domask(mid,av,i), found,    &
-                                                   grid_x, grid_y, grid_z )
-                   
+                      CALL doq_define_netcdf_grid( trimvar, found, grid_x, grid_y, grid_z )
+
                    IF ( .NOT. found  .AND.  gust_module_enabled )  THEN
-                      CALL gust_define_netcdf_grid( domask(mid,av,i), found,   &
-                                                    grid_x, grid_y, grid_z )
+                      CALL gust_define_netcdf_grid( trimvar, found, grid_x, grid_y, grid_z )
                    ENDIF
 
-                   IF ( land_surface )  THEN
-                      CALL lsm_define_netcdf_grid( domask(mid,av,i), found,    &
-                                                   grid_x, grid_y, grid_z )
+                   IF ( .NOT. found  .AND. land_surface )  THEN
+                      CALL lsm_define_netcdf_grid( trimvar, found, grid_x, grid_y, grid_z )
                    ENDIF
 
                    IF ( .NOT. found  .AND.  ocean_mode )  THEN
-                      CALL ocean_define_netcdf_grid( domask(mid,av,i), found,  &
-                                                     grid_x, grid_y, grid_z )
+                      CALL ocean_define_netcdf_grid( trimvar, found, grid_x, grid_y, grid_z )
                    ENDIF
 
                    IF ( .NOT. found  .AND.  plant_canopy )  THEN
-                      CALL pcm_define_netcdf_grid( domask(mid,av,i), found,    &
-                                                   grid_x, grid_y, grid_z )
+                      CALL pcm_define_netcdf_grid( trimvar, found, grid_x, grid_y, grid_z )
                    ENDIF
 
                    IF ( .NOT. found  .AND.  radiation )  THEN
-                      CALL radiation_define_netcdf_grid( domask(mid,av,i),     &
-                                                         found, grid_x, grid_y,&
-                                                         grid_z )
+                      CALL radiation_define_netcdf_grid( trimvar, found, grid_x, grid_y, grid_z )
                    ENDIF
 !
 !--                Check for SALSA quantities
                    IF ( .NOT. found  .AND.  salsa )  THEN
-                      CALL salsa_define_netcdf_grid( domask(mid,av,i), found,  &
-                                                     grid_x, grid_y, grid_z )
-                   ENDIF                                   
+                      CALL salsa_define_netcdf_grid( trimvar, found, grid_x, grid_y, grid_z )
+                   ENDIF
+
+                   IF ( .NOT. found  .AND.  urban_surface )  THEN
+                      CALL usm_define_netcdf_grid( trimvar, found, grid_x, grid_y, grid_z )
+                   ENDIF
 !
 !--                Now check for user-defined quantities
                    IF ( .NOT. found  .AND.  user_module_enabled )  THEN
-                      CALL user_define_netcdf_grid( domask(mid,av,i), found,   &
-                                                    grid_x, grid_y, grid_z )
+                      CALL user_define_netcdf_grid( trimvar, found, grid_x, grid_y, grid_z )
                    ENDIF
-                                                 
+
                    IF ( .NOT. found )  THEN
-                      WRITE ( message_string, * ) 'no grid defined for',       &
-                           ' variable ', TRIM( domask(mid,av,i) )
-                      CALL message( 'define_netcdf_header', 'PA0244', 0, 1, 0, &
-                                    6, 0 )
+                      WRITE ( message_string, * ) 'no grid defined for variable ', TRIM( trimvar )
+                      CALL message( 'define_netcdf_header', 'PA0244', 0, 1, 0, 6, 0 )
                    ENDIF
 
@@ -1329,13 +1312,13 @@
              ALLOCATE( netcdf_data(mask_size(mid,1)) )
              DO  k = 0, 2
-!            
+!
 !--             Scalar grid points
                 IF ( k == 0 )  THEN
                    shift_x = 0.5
-!            
+!
 !--             u grid points
                 ELSEIF ( k == 1 )  THEN
                    shift_x = 0.0
-!            
+!
 !--             v grid points
                 ELSEIF ( k == 2 )  THEN
@@ -1392,13 +1375,13 @@
 
              DO  k = 0, 2
-!            
+!
 !--            Scalar grid points
                IF ( k == 0 )  THEN
                   shift_x = 0.5 ; shift_y = 0.5
-!            
+!
 !--            u grid points
                ELSEIF ( k == 1 )  THEN
                   shift_x = 0.0 ; shift_y = 0.5
-!            
+!
 !--            v grid points
                ELSEIF ( k == 2 )  THEN
@@ -1428,5 +1411,5 @@
                   ENDDO
                ENDDO
-             
+
                nc_stat = NF90_PUT_VAR( id_set_mask(mid,av), &
                                        id_var_nutm_mask(k,mid,av), &
@@ -1435,5 +1418,5 @@
                                                   mask_size(mid,2) /) )
                CALL netcdf_handle_error( 'netcdf_define_header', 556 )
-             
+
              ENDDO
              DEALLOCATE( netcdf_data_2d )
@@ -1447,13 +1430,13 @@
 
           DO  k = 0, 2
-!               
+!
 !--          Scalar grid points
              IF ( k == 0 )  THEN
                 shift_x = 0.5 ; shift_y = 0.5
-!               
+!
 !--          u grid points
              ELSEIF ( k == 1 )  THEN
                 shift_x = 0.0 ; shift_y = 0.5
-!               
+!
 !--          v grid points
              ELSEIF ( k == 2 )  THEN
@@ -1590,5 +1573,5 @@
 
 !
-!--       decompose actual parameter file_id (=formal parameter av) into 
+!--       decompose actual parameter file_id (=formal parameter av) into
 !--       mid and av
           file_id = av
@@ -1714,8 +1697,8 @@
 !
 !--       Update the title attribute on file
-!--       In order to avoid 'data mode' errors if updated attributes are larger 
-!--       than their original size, NF90_PUT_ATT is called in 'define mode' 
-!--       enclosed by NF90_REDEF and NF90_ENDDEF calls. This implies a possible 
-!--       performance loss due to data copying; an alternative strategy would be 
+!--       In order to avoid 'data mode' errors if updated attributes are larger
+!--       than their original size, NF90_PUT_ATT is called in 'define mode'
+!--       enclosed by NF90_REDEF and NF90_ENDDEF calls. This implies a possible
+!--       performance loss due to data copying; an alternative strategy would be
 !--       to ensure equal attribute size in a job chain. Maybe revise later.
           IF ( av == 0 )  THEN
@@ -1839,5 +1822,5 @@
                                      id_var_zusi_3d(av), 'meters',             &
                                      'zu(nzb_s_inner)', 413, 414, 415 )
-!             
+!
 !--          Define zwwi = zw(nzb_w_inner)
              CALL netcdf_create_var( id_set_3d(av), (/ id_dim_x_3d(av),        &
@@ -1846,5 +1829,5 @@
                                      'zw(nzb_w_inner)', 416, 417, 418 )
 
-          ENDIF             
+          ENDIF
 
           IF ( land_surface )  THEN
@@ -1866,5 +1849,5 @@
           DO WHILE ( do3d(av,i)(1:1) /= ' ' )
 !
-!--          Temporary solution to account for data output within the new urban 
+!--          Temporary solution to account for data output within the new urban
 !--          surface model (urban_surface_mod.f90), see also SELECT CASE ( trimvar )
              trimvar = TRIM( do3d(av,i) )
@@ -1907,6 +1890,6 @@
                    grid_z = 'zw'
 
-!             
-!--             Block of urban surface model outputs   
+!
+!--             Block of urban surface model outputs
                 CASE ( 'usm_output' )
                    CALL usm_define_netcdf_grid( do3d(av,i), found, &
@@ -1952,6 +1935,6 @@
                    ENDIF
 !
-!--                Check for indoor model quantities                   
-                   IF ( .NOT. found .AND. indoor_model ) THEN 
+!--                Check for indoor model quantities
+                   IF ( .NOT. found .AND. indoor_model ) THEN
                       CALL im_define_netcdf_grid( do3d(av,i), found,           &
                                                   grid_x, grid_y, grid_z )
@@ -1966,5 +1949,5 @@
 
 !
-!--                Check for chemistry quantities                   
+!--                Check for chemistry quantities
                    IF ( .NOT. found  .AND.  air_chemistry )  THEN
                       CALL chem_define_netcdf_grid( do3d(av,i), found,         &
@@ -1977,6 +1960,6 @@
                       CALL salsa_define_netcdf_grid( do3d(av,i), found, grid_x,&
                                                      grid_y, grid_z )
-                   ENDIF                 
-!                   
+                   ENDIF
+!
 !--                Check for user-defined quantities
                    IF ( .NOT. found  .AND.  user_module_enabled )  THEN
@@ -1984,9 +1967,9 @@
                                                     grid_y, grid_z )
                    ENDIF
-                   
+
                    IF ( .NOT. found )                                          &
                       CALL doq_define_netcdf_grid( do3d(av,i), found, grid_x,  &
                                                    grid_y, grid_z        )
-                                                 
+
                    IF ( .NOT. found )  THEN
                       WRITE ( message_string, * ) 'no grid defined for varia', &
@@ -2133,23 +2116,23 @@
                 ALLOCATE( netcdf_data(0:nx) )
                 DO  k = 0, 2
-!               
+!
 !--                Scalar grid points
                    IF ( k == 0 )  THEN
                       shift_x = 0.5
-!               
+!
 !--                u grid points
                    ELSEIF ( k == 1 )  THEN
                       shift_x = 0.0
-!               
+!
 !--                v grid points
                    ELSEIF ( k == 2 )  THEN
                       shift_x = 0.5
                    ENDIF
-                
+
                    DO  i = 0, nx
                      netcdf_data(i) = init_model%origin_x            &
                                     + cos_ra * ( i + shift_x ) * dx
                    ENDDO
-                
+
                    nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_eutm_3d(k,av),&
                                            netcdf_data, start = (/ 1 /),   &
@@ -2196,20 +2179,20 @@
                 cos_ra = COS( init_model%rotation_angle * pi / 180.0_wp )
                 sin_ra = SIN( init_model%rotation_angle * pi / 180.0_wp )
-                
+
                 DO  k = 0, 2
-!               
+!
 !--               Scalar grid points
                   IF ( k == 0 )  THEN
                      shift_x = 0.5 ; shift_y = 0.5
-!               
+!
 !--               u grid points
                   ELSEIF ( k == 1 )  THEN
                      shift_x = 0.0 ; shift_y = 0.5
-!               
+!
 !--               v grid points
                   ELSEIF ( k == 2 )  THEN
                      shift_x = 0.5 ; shift_y = 0.0
                   ENDIF
-                
+
                   DO  j = 0, ny
                      DO  i = 0, nx
@@ -2219,10 +2202,10 @@
                      ENDDO
                   ENDDO
-                
+
                   nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_eutm_3d(k,av),  &
                                           netcdf_data_2d, start = (/ 1, 1 /),   &
                                           count = (/ nx+1, ny+1 /) )
                   CALL netcdf_handle_error( 'netcdf_define_header', 555 )
-                
+
                   DO  j = 0, ny
                      DO  i = 0, nx
@@ -2232,10 +2215,10 @@
                      ENDDO
                   ENDDO
-                
+
                   nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_nutm_3d(k,av),  &
                                           netcdf_data_2d, start = (/ 1, 1 /),   &
                                           count = (/ nx+1, ny+1 /) )
                   CALL netcdf_handle_error( 'netcdf_define_header', 556 )
-                
+
                 ENDDO
                 DEALLOCATE( netcdf_data_2d )
@@ -2274,13 +2257,13 @@
 
              DO  k = 0, 2
-!               
+!
 !--             Scalar grid points
                 IF ( k == 0 )  THEN
                    shift_x = 0.5 ; shift_y = 0.5
-!               
+!
 !--             u grid points
                 ELSEIF ( k == 1 )  THEN
                    shift_x = 0.0 ; shift_y = 0.5
-!               
+!
 !--             v grid points
                 ELSEIF ( k == 2 )  THEN
@@ -2534,8 +2517,8 @@
 !
 !--       Update the title attribute on file
-!--       In order to avoid 'data mode' errors if updated attributes are larger 
-!--       than their original size, NF90_PUT_ATT is called in 'define mode' 
-!--       enclosed by NF90_REDEF and NF90_ENDDEF calls. This implies a possible 
-!--       performance loss due to data copying; an alternative strategy would be 
+!--       In order to avoid 'data mode' errors if updated attributes are larger
+!--       than their original size, NF90_PUT_ATT is called in 'define mode'
+!--       enclosed by NF90_REDEF and NF90_ENDDEF calls. This implies a possible
+!--       performance loss due to data copying; an alternative strategy would be
 !--       to ensure equal attribute size. Maybe revise later.
           IF ( av == 0 )  THEN
@@ -2631,5 +2614,5 @@
 !        CASE ( 'ag_ext' )
 ! !+?agent extend output for restart runs has to be adapted
-! 
+!
 ! !
 ! !--       Get the id of the time coordinate (unlimited coordinate) and its
@@ -2639,14 +2622,14 @@
 !           nc_stat = NF90_INQ_VARID( id_set_agt, 'time', id_var_time_agt )
 !           CALL netcdf_handle_error( 'netcdf_define_header', 343 )
-! 
+!
 !           nc_stat = NF90_INQUIRE_VARIABLE( id_set_agt, id_var_time_agt, &
 !                                            dimids = id_dim_time_old )
 !           CALL netcdf_handle_error( 'netcdf_define_header', 344 )
 !           id_dim_time_agt = id_dim_time_old(1)
-! 
+!
 !           nc_stat = NF90_INQUIRE_DIMENSION( id_set_agt, id_dim_time_agt, &
 !                                             len = agt_time_count )
 !           CALL netcdf_handle_error( 'netcdf_define_header', 345 )
-! 
+!
 !           nc_stat = NF90_GET_VAR( id_set_agt, id_var_time_agt,  &
 !                                   last_time_coordinate,         &
@@ -2654,5 +2637,5 @@
 !                                   count = (/ 1 /) )
 !           CALL netcdf_handle_error( 'netcdf_define_header', 346 )
-! 
+!
 !           IF ( last_time_coordinate(1) >= simulated_time )  THEN
 !              message_string = 'netCDF file for agents ' //                  &
@@ -2668,5 +2651,5 @@
 !              RETURN
 !           ENDIF
-! 
+!
 ! !
 ! !--       Dataset seems to be extendable.
@@ -2675,18 +2658,18 @@
 !                                     id_var_rnoa_agt )
 !           CALL netcdf_handle_error( 'netcdf_define_header', 347 )
-! 
+!
 !           DO  i = 1, 17
-! 
+!
 !              nc_stat = NF90_INQ_VARID( id_set_agt, agt_var_names(i), &
 !                                        id_var_prt(i) )
 !              CALL netcdf_handle_error( 'netcdf_define_header', 348 )
-! 
+!
 !           ENDDO
-! 
+!
 !           message_string = 'netCDF file for particles ' // &
 !                            'from previous run found.' //   &
 !                            '&This file will be extended.'
 !           CALL message( 'define_netcdf_header', 'PA0266', 0, 0, 0, 6, 0 )
-          
+
 
        CASE ( 'xy_new' )
@@ -2830,5 +2813,5 @@
                                      id_var_zusi_xy(av), 'meters',             &
                                      'zu(nzb_s_inner)', 421, 422, 423 )
-!             
+!
 !--          Define zwwi = zw(nzb_w_inner)
              CALL netcdf_create_var( id_set_xy(av), (/ id_dim_x_xy(av),        &
@@ -2935,5 +2918,5 @@
                                                            grid_x, grid_y,     &
                                                            grid_z )
-                         ENDIF                       
+                         ENDIF
 
 !
@@ -2958,5 +2941,5 @@
                                                           grid_z )
                          ENDIF
-                         
+
                          IF ( .NOT. found )                                    &
                             CALL doq_define_netcdf_grid(                       &
@@ -3192,23 +3175,23 @@
                 ALLOCATE( netcdf_data(0:nx) )
                 DO  k = 0, 2
-!               
+!
 !--                Scalar grid points
                    IF ( k == 0 )  THEN
                       shift_x = 0.5
-!               
+!
 !--                u grid points
                    ELSEIF ( k == 1 )  THEN
                       shift_x = 0.0
-!               
+!
 !--                v grid points
                    ELSEIF ( k == 2 )  THEN
                       shift_x = 0.5
                    ENDIF
-                
+
                    DO  i = 0, nx
                      netcdf_data(i) = init_model%origin_x            &
                                     + cos_ra * ( i + shift_x ) * dx
                    ENDDO
-                
+
                    nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_eutm_xy(k,av),&
                                            netcdf_data, start = (/ 1 /),   &
@@ -3255,20 +3238,20 @@
                 cos_ra = COS( init_model%rotation_angle * pi / 180.0_wp )
                 sin_ra = SIN( init_model%rotation_angle * pi / 180.0_wp )
-                
+
                 DO  k = 0, 2
-!               
+!
 !--               Scalar grid points
                   IF ( k == 0 )  THEN
                      shift_x = 0.5 ; shift_y = 0.5
-!               
+!
 !--               u grid points
                   ELSEIF ( k == 1 )  THEN
                      shift_x = 0.0 ; shift_y = 0.5
-!               
+!
 !--               v grid points
                   ELSEIF ( k == 2 )  THEN
                      shift_x = 0.5 ; shift_y = 0.0
                   ENDIF
-                
+
                   DO  j = 0, ny
                      DO  i = 0, nx
@@ -3278,10 +3261,10 @@
                      ENDDO
                   ENDDO
-                
+
                   nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_eutm_xy(k,av),  &
                                           netcdf_data_2d, start = (/ 1, 1 /),   &
                                           count = (/ nx+1, ny+1 /) )
                   CALL netcdf_handle_error( 'netcdf_define_header', 555 )
-                
+
                   DO  j = 0, ny
                      DO  i = 0, nx
@@ -3291,5 +3274,5 @@
                      ENDDO
                   ENDDO
-                
+
                   nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_nutm_xy(k,av),  &
                                           netcdf_data_2d, start = (/ 1, 1 /),   &
@@ -3312,13 +3295,13 @@
 
              DO  k = 0, 2
-!               
+!
 !--             Scalar grid points
                 IF ( k == 0 )  THEN
                    shift_x = 0.5 ; shift_y = 0.5
-!               
+!
 !--             u grid points
                 ELSEIF ( k == 1 )  THEN
                    shift_x = 0.0 ; shift_y = 0.5
-!               
+!
 !--             v grid points
                 ELSEIF ( k == 2 )  THEN
@@ -3357,5 +3340,5 @@
           ENDIF
 !
-!--       In case of non-flat topography write height information. Only for 
+!--       In case of non-flat topography write height information. Only for
 !--       parallel netcdf output.
           IF ( TRIM( topography ) /= 'flat'  .AND.                             &
@@ -3622,8 +3605,8 @@
 !
 !--       Update the title attribute on file
-!--       In order to avoid 'data mode' errors if updated attributes are larger 
-!--       than their original size, NF90_PUT_ATT is called in 'define mode' 
-!--       enclosed by NF90_REDEF and NF90_ENDDEF calls. This implies a possible 
-!--       performance loss due to data copying; an alternative strategy would be 
+!--       In order to avoid 'data mode' errors if updated attributes are larger
+!--       than their original size, NF90_PUT_ATT is called in 'define mode'
+!--       enclosed by NF90_REDEF and NF90_ENDDEF calls. This implies a possible
+!--       performance loss due to data copying; an alternative strategy would be
 !--       to ensure equal attribute size in a job chain. Maybe revise later.
           IF ( av == 0 )  THEN
@@ -3645,5 +3628,5 @@
                            '&This file will be extended.'
           CALL message( 'define_netcdf_header', 'PA0253', 0, 0, 0, 6, 0 )
-          
+
 
        CASE ( 'xz_new' )
@@ -3838,5 +3821,5 @@
                          CALL salsa_define_netcdf_grid( do2d(av,i), found,     &
                                                         grid_x, grid_y, grid_z )
-                      ENDIF                         
+                      ENDIF
 
 !
@@ -3854,5 +3837,5 @@
                                                        grid_z )
                       ENDIF
-                      
+
                       IF ( .NOT. found )                                       &
                          CALL doq_define_netcdf_grid( do2d(av,i), found,       &
@@ -3925,8 +3908,8 @@
 !
 !--                   Test simulations showed that the output of cross sections
-!--                   by all PEs in data_output_2d using NF90_COLLECTIVE is 
+!--                   by all PEs in data_output_2d using NF90_COLLECTIVE is
 !--                   faster than the output by the first row of PEs in
 !--                   x-direction using NF90_INDEPENDENT.
-                      nc_stat = NF90_VAR_PAR_ACCESS( id_set_xz(av),    & 
+                      nc_stat = NF90_VAR_PAR_ACCESS( id_set_xz(av),    &
                                                     id_var_do2d(av,i), &
                                                     NF90_COLLECTIVE )
@@ -4077,23 +4060,23 @@
                 ALLOCATE( netcdf_data(0:nx) )
                 DO  k = 0, 2
-!               
+!
 !--                Scalar grid points
                    IF ( k == 0 )  THEN
                       shift_x = 0.5
-!               
+!
 !--                u grid points
                    ELSEIF ( k == 1 )  THEN
                       shift_x = 0.0
-!               
+!
 !--                v grid points
                    ELSEIF ( k == 2 )  THEN
                       shift_x = 0.5
                    ENDIF
-                
+
                    DO  i = 0, nx
                      netcdf_data(i) = init_model%origin_x            &
                                     + cos_ra * ( i + shift_x ) * dx
                    ENDDO
-                
+
                    nc_stat = NF90_PUT_VAR( id_set_xz(av), id_var_eutm_xz(k,av),&
                                            netcdf_data, start = (/ 1 /),   &
@@ -4144,15 +4127,15 @@
                 cos_ra = COS( init_model%rotation_angle * pi / 180.0_wp )
                 sin_ra = SIN( init_model%rotation_angle * pi / 180.0_wp )
-                
+
                 DO  k = 0, 2
-!               
+!
 !--                Scalar grid points
                    IF ( k == 0 )  THEN
                       shift_x = 0.5 ; shift_y = 0.5
-!                  
+!
 !--                u grid points
                    ELSEIF ( k == 1 )  THEN
                       shift_x = 0.0 ; shift_y = 0.5
-!                  
+!
 !--                v grid points
                    ELSEIF ( k == 2 )  THEN
@@ -4171,10 +4154,10 @@
                       ENDIF
                    ENDDO
-                   
+
                    nc_stat = NF90_PUT_VAR( id_set_xz(av), id_var_eutm_xz(k,av),  &
                                            netcdf_data_2d, start = (/ 1, 1 /),   &
                                            count = (/ nx+1, ns /) )
                    CALL netcdf_handle_error( 'netcdf_define_header', 555 )
-                   
+
                    DO  j = 1, ns
                       IF( section(j,2) == -1 )  THEN
@@ -4188,10 +4171,10 @@
                       ENDIF
                    ENDDO
-                   
+
                    nc_stat = NF90_PUT_VAR( id_set_xz(av), id_var_nutm_xz(k,av),  &
                                            netcdf_data_2d, start = (/ 1, 1 /),   &
                                            count = (/ nx+1, ns /) )
                    CALL netcdf_handle_error( 'netcdf_define_header', 556 )
-                
+
                 ENDDO
                 DEALLOCATE( netcdf_data_2d )
@@ -4205,13 +4188,13 @@
 
              DO  k = 0, 2
-!               
+!
 !--             Scalar grid points
                 IF ( k == 0 )  THEN
                    shift_x = 0.5 ; shift_y = 0.5
-!               
+!
 !--             u grid points
                 ELSEIF ( k == 1 )  THEN
                    shift_x = 0.0 ; shift_y = 0.5
-!               
+!
 !--             v grid points
                 ELSEIF ( k == 2 )  THEN
@@ -4319,5 +4302,5 @@
                               TRIM( var ) // ' from previous run found,' // &
                               '&but this file cannot be extended due to' // &
-                              ' mismatch in number of' //                   & 
+                              ' mismatch in number of' //                   &
                               ' cross sections.' //                         &
                               '&New file is created instead.'
@@ -4465,5 +4448,5 @@
 !
 !--                   Test simulations showed that the output of cross sections
-!--                   by all PEs in data_output_2d using NF90_COLLECTIVE is 
+!--                   by all PEs in data_output_2d using NF90_COLLECTIVE is
 !--                   faster than the output by the first row of PEs in
 !--                   x-direction using NF90_INDEPENDENT.
@@ -4484,8 +4467,8 @@
 !
 !--       Update the title attribute on file
-!--       In order to avoid 'data mode' errors if updated attributes are larger 
-!--       than their original size, NF90_PUT_ATT is called in 'define mode' 
-!--       enclosed by NF90_REDEF and NF90_ENDDEF calls. This implies a possible 
-!--       performance loss due to data copying; an alternative strategy would be 
+!--       In order to avoid 'data mode' errors if updated attributes are larger
+!--       than their original size, NF90_PUT_ATT is called in 'define mode'
+!--       enclosed by NF90_REDEF and NF90_ENDDEF calls. This implies a possible
+!--       performance loss due to data copying; an alternative strategy would be
 !--       to ensure equal attribute size in a job chain. Maybe revise later.
           IF ( av == 0 )  THEN
@@ -4701,5 +4684,5 @@
                          CALL salsa_define_netcdf_grid( do2d(av,i), found,     &
                                                         grid_x, grid_y, grid_z )
-                      ENDIF                           
+                      ENDIF
 !
 !--                   Check for gust module quantities
@@ -4716,5 +4699,5 @@
                                                        grid_z )
                       ENDIF
-                      
+
                       IF ( .NOT. found )                                       &
                          CALL doq_define_netcdf_grid(                          &
@@ -4786,5 +4769,5 @@
 !
 !--                   Test simulations showed that the output of cross sections
-!--                   by all PEs in data_output_2d using NF90_COLLECTIVE is 
+!--                   by all PEs in data_output_2d using NF90_COLLECTIVE is
 !--                   faster than the output by the first row of PEs in
 !--                   y-direction using NF90_INDEPENDENT.
@@ -4927,18 +4910,18 @@
                 ALLOCATE( netcdf_data(1:ns) )
                 DO  k = 0, 2
-!               
+!
 !--                Scalar grid points
                    IF ( k == 0 )  THEN
                       shift_x = 0.5
-!               
+!
 !--                u grid points
                    ELSEIF ( k == 1 )  THEN
                       shift_x = 0.0
-!               
+!
 !--                v grid points
                    ELSEIF ( k == 2 )  THEN
                       shift_x = 0.5
                    ENDIF
-                
+
                    DO  i = 1, ns
                       IF( section(i,3) == -1 )  THEN
@@ -4949,5 +4932,5 @@
                       ENDIF
                    ENDDO
-                
+
                    nc_stat = NF90_PUT_VAR( id_set_yz(av), id_var_eutm_yz(k,av),&
                                            netcdf_data, start = (/ 1 /),   &
@@ -4996,13 +4979,13 @@
 
                 DO  k = 0, 2
-!               
+!
 !--                Scalar grid points
                    IF ( k == 0 )  THEN
                       shift_x = 0.5 ; shift_y = 0.5
-!                  
+!
 !--                u grid points
                    ELSEIF ( k == 1 )  THEN
                       shift_x = 0.0 ; shift_y = 0.5
-!                  
+!
 !--                v grid points
                    ELSEIF ( k == 2 )  THEN
@@ -5021,10 +5004,10 @@
                       ENDDO
                    ENDDO
-                   
+
                    nc_stat = NF90_PUT_VAR( id_set_yz(av), id_var_eutm_yz(k,av),  &
                                            netcdf_data_2d, start = (/ 1, 1 /),   &
                                            count = (/ ns, ny+1 /) )
                    CALL netcdf_handle_error( 'netcdf_define_header', 555 )
-                   
+
                    DO  j = 0, ny
                       DO  i = 1, ns
@@ -5043,5 +5026,5 @@
                                            count = (/ ns, ny+1 /) )
                    CALL netcdf_handle_error( 'netcdf_define_header', 556 )
-                
+
                 ENDDO
                 DEALLOCATE( netcdf_data_2d )
@@ -5055,13 +5038,13 @@
 
              DO  k = 0, 2
-!               
+!
 !--             Scalar grid points
                 IF ( k == 0 )  THEN
                    shift_x = 0.5 ; shift_y = 0.5
-!               
+!
 !--             u grid points
                 ELSEIF ( k == 1 )  THEN
                    shift_x = 0.0 ; shift_y = 0.5
-!               
+!
 !--             v grid points
                 ELSEIF ( k == 2 )  THEN
@@ -5136,5 +5119,5 @@
                               TRIM( var ) // ' from previous run found,' //  &
                               '&but this file cannot be extended due to' //  &
-                              ' variable mismatch.' //                       & 
+                              ' variable mismatch.' //                       &
                               '&New file is created instead.'
              CALL message( 'define_netcdf_header', 'PA0249', 0, 1, 0, 6, 0 )
@@ -5315,5 +5298,5 @@
 !
 !--                   Test simulations showed that the output of cross sections
-!--                   by all PEs in data_output_2d using NF90_COLLECTIVE is 
+!--                   by all PEs in data_output_2d using NF90_COLLECTIVE is
 !--                   faster than the output by the first row of PEs in
 !--                   y-direction using NF90_INDEPENDENT.
@@ -5334,8 +5317,8 @@
 !
 !--       Update the title attribute on file
-!--       In order to avoid 'data mode' errors if updated attributes are larger 
-!--       than their original size, NF90_PUT_ATT is called in 'define mode' 
-!--       enclosed by NF90_REDEF and NF90_ENDDEF calls. This implies a possible 
-!--       performance loss due to data copying; an alternative strategy would be 
+!--       In order to avoid 'data mode' errors if updated attributes are larger
+!--       than their original size, NF90_PUT_ATT is called in 'define mode'
+!--       enclosed by NF90_REDEF and NF90_ENDDEF calls. This implies a possible
+!--       performance loss due to data copying; an alternative strategy would be
 !--       to ensure equal attribute size in a job chain. Maybe revise later.
           IF ( av == 0 )  THEN
@@ -5378,11 +5361,11 @@
 !--       This information can be used by palmplot.
           nc_stat = NF90_PUT_ATT( id_set_pr, NF90_GLOBAL,                     &
-                                  'no_rows',                                  & 
-                                  profile_rows ) 
+                                  'no_rows',                                  &
+                                  profile_rows )
           CALL netcdf_handle_error( 'netcdf_define_header', 519 )
 
           nc_stat = NF90_PUT_ATT( id_set_pr, NF90_GLOBAL,                     &
-                                  'no_columns',                               & 
-                                  profile_columns ) 
+                                  'no_columns',                               &
+                                  profile_columns )
           CALL netcdf_handle_error( 'netcdf_define_header', 520 )
 
@@ -5419,5 +5402,5 @@
           cross_profiles_count = MIN( crmax, k-1 )
 !
-!--       Check if all profiles defined in cross_profiles are defined in 
+!--       Check if all profiles defined in cross_profiles are defined in
 !--       data_output_pr. If not, they will be skipped.
           DO  i = 1, cross_profiles_count
@@ -5456,5 +5439,5 @@
           ENDDO
 !
-!--       Check if all profiles defined in data_output_pr are defined in 
+!--       Check if all profiles defined in data_output_pr are defined in
 !--       cross_profiles. If not, they will be added to cross_profiles.
           DO  i = 1, dopr_n
@@ -5488,6 +5471,6 @@
 
 !
-!--       Writing cross_profiles to netcdf header. This information can be 
-!--       used by palmplot. Each profile is separated by ",", each cross is 
+!--       Writing cross_profiles to netcdf header. This information can be
+!--       used by palmplot. Each profile is separated by ",", each cross is
 !--       separated by ";".
           char_cross_profiles = ';'
@@ -5708,5 +5691,5 @@
           i = 1
           DO  i = 1, dopr_n
- 
+
              IF ( statistic_regions == 0 )  THEN
                 nc_stat = NF90_INQ_VARID( id_set_pr, data_output_pr(i),        &
@@ -5736,8 +5719,8 @@
 !
 !--       Update the title attribute on file
-!--       In order to avoid 'data mode' errors if updated attributes are larger 
-!--       than their original size, NF90_PUT_ATT is called in 'define mode' 
-!--       enclosed by NF90_REDEF and NF90_ENDDEF calls. This implies a possible 
-!--       performance loss due to data copying; an alternative strategy would be 
+!--       In order to avoid 'data mode' errors if updated attributes are larger
+!--       than their original size, NF90_PUT_ATT is called in 'define mode'
+!--       enclosed by NF90_REDEF and NF90_ENDDEF calls. This implies a possible
+!--       performance loss due to data copying; an alternative strategy would be
 !--       to ensure equal attribute size in a job chain. Maybe revise later.
           IF ( averaging_interval_pr == 0.0_wp )  THEN
@@ -5911,5 +5894,5 @@
           i = 1
           DO  i = 1, dots_num
- 
+
              IF ( statistic_regions == 0 )  THEN
                 nc_stat = NF90_INQ_VARID( id_set_ts, dots_label(i), &
@@ -5930,8 +5913,8 @@
 !
 !--       Update the title attribute on file
-!--       In order to avoid 'data mode' errors if updated attributes are larger 
-!--       than their original size, NF90_PUT_ATT is called in 'define mode' 
-!--       enclosed by NF90_REDEF and NF90_ENDDEF calls. This implies a possible 
-!--       performance loss due to data copying; an alternative strategy would be 
+!--       In order to avoid 'data mode' errors if updated attributes are larger
+!--       than their original size, NF90_PUT_ATT is called in 'define mode'
+!--       enclosed by NF90_REDEF and NF90_ENDDEF calls. This implies a possible
+!--       performance loss due to data copying; an alternative strategy would be
 !--       to ensure equal attribute size in a job chain. Maybe revise later.
           nc_stat = NF90_REDEF( id_set_ts )
@@ -6276,5 +6259,5 @@
                               'from previous run found,' //                    &
                               '&but this file cannot be extended becaus' //    &
-                              'e the current output time' //                   &  
+                              'e the current output time' //                   &
                               '&is less or equal than the last output t' //    &
                               'ime on this file.' //                           &
@@ -6312,8 +6295,8 @@
 !
 !--       Update the title attribute on file
-!--       In order to avoid 'data mode' errors if updated attributes are larger 
-!--       than their original size, NF90_PUT_ATT is called in 'define mode' 
-!--       enclosed by NF90_REDEF and NF90_ENDDEF calls. This implies a possible 
-!--       performance loss due to data copying; an alternative strategy would be 
+!--       In order to avoid 'data mode' errors if updated attributes are larger
+!--       than their original size, NF90_PUT_ATT is called in 'define mode'
+!--       enclosed by NF90_REDEF and NF90_ENDDEF calls. This implies a possible
+!--       performance loss due to data copying; an alternative strategy would be
 !--       to ensure equal attribute size in a job chain. Maybe revise later.
           nc_stat = NF90_REDEF( id_set_sp )
@@ -6451,5 +6434,5 @@
 !                           '&This file will be extended.'
 !          CALL message( 'define_netcdf_header', 'PA0266', 0, 0, 0, 6, 0 )
-        
+
 
 
@@ -6609,5 +6592,5 @@
           i = 1
           DO  i = 1, dopts_num
- 
+
              DO  j = 0, number_of_particle_groups
 
@@ -6632,8 +6615,8 @@
 !
 !--       Update the title attribute on file
-!--       In order to avoid 'data mode' errors if updated attributes are larger 
-!--       than their original size, NF90_PUT_ATT is called in 'define mode' 
-!--       enclosed by NF90_REDEF and NF90_ENDDEF calls. This implies a possible 
-!--       performance loss due to data copying; an alternative strategy would be 
+!--       In order to avoid 'data mode' errors if updated attributes are larger
+!--       than their original size, NF90_PUT_ATT is called in 'define mode'
+!--       enclosed by NF90_REDEF and NF90_ENDDEF calls. This implies a possible
+!--       performance loss due to data copying; an alternative strategy would be
 !--       to ensure equal attribute size in a job chain. Maybe revise later.
           nc_stat = NF90_REDEF( id_set_pts )
@@ -6702,5 +6685,5 @@
 
                 k = k + 1
-                
+
              ENDDO
 
@@ -6804,5 +6787,5 @@
 
           DO  i = 1, num_leg * num_var_fl
- 
+
             nc_stat = NF90_INQ_VARID( id_set_fl, dofl_label(i), &
                                        id_var_dofl(i) )
@@ -6813,8 +6796,8 @@
 !
 !--       Update the title attribute on file
-!--       In order to avoid 'data mode' errors if updated attributes are larger 
-!--       than their original size, NF90_PUT_ATT is called in 'define mode' 
-!--       enclosed by NF90_REDEF and NF90_ENDDEF calls. This implies a possible 
-!--       performance loss due to data copying; an alternative strategy would be 
+!--       In order to avoid 'data mode' errors if updated attributes are larger
+!--       than their original size, NF90_PUT_ATT is called in 'define mode'
+!--       enclosed by NF90_REDEF and NF90_ENDDEF calls. This implies a possible
+!--       performance loss due to data copying; an alternative strategy would be
 !--       to ensure equal attribute size in a job chain. Maybe revise later.
           nc_stat = NF90_REDEF( id_set_fl )
@@ -6848,5 +6831,5 @@
 !> for parallel netCDF output support.
 !------------------------------------------------------------------------------!
- 
+
  SUBROUTINE netcdf_create_file( filename , id, parallel, errno )
 #if defined( __netcdf )
@@ -6960,5 +6943,5 @@
 !> Prints out a text message corresponding to the current status.
 !------------------------------------------------------------------------------!
- 
+
  SUBROUTINE netcdf_handle_error( routine_name, errno )
 #if defined( __netcdf )
@@ -7037,5 +7020,5 @@
     CHARACTER(LEN=*), INTENT(IN) ::  var_name
 
-    LOGICAL, OPTIONAL ::  fill  !< indicates setting of _FillValue attribute 
+    LOGICAL, OPTIONAL ::  fill  !< indicates setting of _FillValue attribute
 
     INTEGER, INTENT(IN)  ::  error_no1
@@ -7078,5 +7061,5 @@
 !
 !-- Set _FillValue for all variables, except for dimension variables.
-!-- Set the fill values accordingly to the corresponding output precision. 
+!-- Set the fill values accordingly to the corresponding output precision.
     IF ( PRESENT( fill ) )  THEN
        IF ( var_type == NF90_REAL4 )  THEN
@@ -7383,5 +7366,5 @@
 
     INTEGER(iwp) ::  j   !< loop index
-    
+
     REAL(wp), INTENT(in)  ::  eutm !< easting (UTM)
     REAL(wp), INTENT(out) ::  lat  !< geographic latitude in degree
@@ -7572,5 +7555,5 @@
 
        minute =  INT( second / 60.0_wp, KIND=iwp )
-       
+
        second = second - 60.0_wp * REAL( minute, KIND=wp )
 
