Index: /palm/trunk/SCRIPTS/palm_cvd
===================================================================
--- /palm/trunk/SCRIPTS/palm_cvd	(revision 4662)
+++ /palm/trunk/SCRIPTS/palm_cvd	(revision 4663)
@@ -21,13 +21,13 @@
 # Current revisions:
 # -----------------
-# 
-# 
+#
+#
 # Former revisions:
 # -----------------
 # $Id$
+# bugfix in non_measurable_vars; ignore station_h if featureType is trajectory
+#
+# 4400 2020-02-10 20:32:41Z suehring
 # Initial revision
-# 
-# 
-# $
 #
 # Description:
@@ -60,21 +60,21 @@
 
    # Definition of global configuration parameters
-   global global_acronym     
-   global global_author      
-   global global_campaign    
-   global global_comment     
-   global global_contact     
+   global global_acronym
+   global global_author
+   global global_campaign
+   global global_comment
+   global global_contact
    global global_data_content
    global global_dependencies
-   global global_institution 
-   global global_keywords    
-   global global_location    
-   global global_references  
-   global global_site        
-   global global_source      
+   global global_institution
+   global global_keywords
+   global global_location
+   global global_references
+   global global_site
+   global global_source
    global global_palm_version
-   global data_path          
-   global output_path        
-   global output_filename    
+   global data_path
+   global output_path
+   global output_filename
    global number_positions
    global input_from_observations
@@ -108,5 +108,5 @@
    # Check if configuration files exists and quit otherwise
    input_config = ".cvd.config.default"
-   for i in range(1,len(sys.argv)): 
+   for i in range(1,len(sys.argv)):
       input_config = str(sys.argv[i])
 
@@ -120,5 +120,5 @@
 
    config.read(input_config)
-   
+
    for section in range( 0, len( config.sections() ) ):
 
@@ -155,5 +155,5 @@
          output_filename = config.get( current_section, 'output_filename' )
 
-      # Read customized coordinates where virtual measurements shall be taken, 
+      # Read customized coordinates where virtual measurements shall be taken,
       # as well as the variables that should be sampled.
       elif ( current_section == 'custom_positions' ):
@@ -209,5 +209,5 @@
                        'vrs', 'x', 'y', 'z', 'lon', 'lat', 'ntime', 'station', 'traj', \
                        'E_UTM', 'N_UTM', 'height_above_origin', 'station_h', \
-                       'traj_name', 'height', 'band_pm_size', 'bands_pm', 'bands_pm_size_bounds' \
+                       'traj_name', 'height', 'band_pm_size', 'bands_pm', 'bands_pm_size_bounds', \
                        'bands_pm_size', 'ancillary_detected_layer' ]
 
@@ -216,5 +216,5 @@
 dims_out             = [ name_eutm, name_nutm, name_hao, name_z, name_station_h ]
 
-# Define list of attributes which need to be of type float. In the data set this is not 
+# Define list of attributes which need to be of type float. In the data set this is not
 # necessarily guranteed.
 atts_float           = [ 'origin_x', 'origin_y', 'origin_z', 'origin_lon', 'origin_lat', 'rotation_angle' ]
@@ -256,6 +256,6 @@
 
 
-# Check if observational data is available. This case, 
-# obtain an alphabetically sorted list of input data. List is sorted 
+# Check if observational data is available. This case,
+# obtain an alphabetically sorted list of input data. List is sorted
 # just for the sake of clarity in the resulting setup file.
 if ( input_from_observations == True ):
@@ -369,11 +369,11 @@
          for var in ncfile_in.variables.keys():
             if ( var in dims_out ):
-               # Create a variable and write it to file after it is read. In order to 
-               # avoid fill values in the dimensions, these are converted to zero 
+               # Create a variable and write it to file after it is read. In order to
+               # avoid fill values in the dimensions, these are converted to zero
                # before written to file. Depending on the featureType of the measurement,
-               # the array shape is different. For more informations, please see 
+               # the array shape is different. For more informations, please see
                # [UC]2 data standard.
                # Timeseries
-               if ( feature == name_ts  ): 
+               if ( feature == name_ts  ):
                   temp_ts = ncfile_out.createVariable( var + str(num_vmeas), float, \
                                                        name_station + str(num_vmeas))
@@ -382,8 +382,11 @@
                # Trajectories
                elif ( feature == name_traj ):
-                  temp_traj = ncfile_out.createVariable( var + str(num_vmeas), float, \
-                                                         ( name_traj_dim + str(num_vmeas), \
-                                                           name_ntime + str(num_vmeas) ) )
-                  temp_traj[:,:] = np.nan_to_num( ncfile_in.variables[var][:,:] )
+                  # @note: If there are files where station_h is present although featureType is
+                  #        trajectory, station_h must not be read.
+                  if var != name_station_h:
+                     temp_traj = ncfile_out.createVariable( var + str(num_vmeas), float, \
+                                                            ( name_traj_dim + str(num_vmeas), \
+                                                              name_ntime + str(num_vmeas) ) )
+                     temp_traj[:,:] = np.nan_to_num( ncfile_in.variables[var][:,:] )
 
                # TimeseriesProfiles
@@ -411,5 +414,5 @@
       ncfile_in.close()
 
-      # Set flag to indicate that for this specific site dimensions have been 
+      # Set flag to indicate that for this specific site dimensions have been
       # already created and attributes are already set.
       if ( create_metadata_for_site[sites.index( site )] != "Done" ):
@@ -507,5 +510,5 @@
             measured_variables.append(var)
 
-         # Check if given variables are already in the default variables. 
+         # Check if given variables are already in the default variables.
          # If not, extend.
          for var in custom_vars:
@@ -549,3 +552,2 @@
 
 quit()
-
