Changeset 4663 for palm


Ignore:
Timestamp:
Sep 2, 2020 2:54:09 PM (4 years ago)
Author:
gronemeier
Message:

bugfix in non_measurable_vars; ignore station_h if featureType is trajectory (palm_cvd)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SCRIPTS/palm_cvd

    r4400 r4663  
    2121# Current revisions:
    2222# -----------------
    23 # 
    24 # 
     23#
     24#
    2525# Former revisions:
    2626# -----------------
    2727# $Id$
     28# bugfix in non_measurable_vars; ignore station_h if featureType is trajectory
     29#
     30# 4400 2020-02-10 20:32:41Z suehring
    2831# Initial revision
    29 #
    30 #
    31 # $
    3232#
    3333# Description:
     
    6060
    6161   # Definition of global configuration parameters
    62    global global_acronym     
    63    global global_author     
    64    global global_campaign   
    65    global global_comment     
    66    global global_contact     
     62   global global_acronym
     63   global global_author
     64   global global_campaign
     65   global global_comment
     66   global global_contact
    6767   global global_data_content
    6868   global global_dependencies
    69    global global_institution 
    70    global global_keywords   
    71    global global_location   
    72    global global_references 
    73    global global_site       
    74    global global_source     
     69   global global_institution
     70   global global_keywords
     71   global global_location
     72   global global_references
     73   global global_site
     74   global global_source
    7575   global global_palm_version
    76    global data_path         
    77    global output_path       
    78    global output_filename   
     76   global data_path
     77   global output_path
     78   global output_filename
    7979   global number_positions
    8080   global input_from_observations
     
    108108   # Check if configuration files exists and quit otherwise
    109109   input_config = ".cvd.config.default"
    110    for i in range(1,len(sys.argv)): 
     110   for i in range(1,len(sys.argv)):
    111111      input_config = str(sys.argv[i])
    112112
     
    120120
    121121   config.read(input_config)
    122    
     122
    123123   for section in range( 0, len( config.sections() ) ):
    124124
     
    155155         output_filename = config.get( current_section, 'output_filename' )
    156156
    157       # Read customized coordinates where virtual measurements shall be taken, 
     157      # Read customized coordinates where virtual measurements shall be taken,
    158158      # as well as the variables that should be sampled.
    159159      elif ( current_section == 'custom_positions' ):
     
    209209                       'vrs', 'x', 'y', 'z', 'lon', 'lat', 'ntime', 'station', 'traj', \
    210210                       'E_UTM', 'N_UTM', 'height_above_origin', 'station_h', \
    211                        'traj_name', 'height', 'band_pm_size', 'bands_pm', 'bands_pm_size_bounds' \
     211                       'traj_name', 'height', 'band_pm_size', 'bands_pm', 'bands_pm_size_bounds', \
    212212                       'bands_pm_size', 'ancillary_detected_layer' ]
    213213
     
    216216dims_out             = [ name_eutm, name_nutm, name_hao, name_z, name_station_h ]
    217217
    218 # Define list of attributes which need to be of type float. In the data set this is not 
     218# Define list of attributes which need to be of type float. In the data set this is not
    219219# necessarily guranteed.
    220220atts_float           = [ 'origin_x', 'origin_y', 'origin_z', 'origin_lon', 'origin_lat', 'rotation_angle' ]
     
    256256
    257257
    258 # Check if observational data is available. This case, 
    259 # obtain an alphabetically sorted list of input data. List is sorted 
     258# Check if observational data is available. This case,
     259# obtain an alphabetically sorted list of input data. List is sorted
    260260# just for the sake of clarity in the resulting setup file.
    261261if ( input_from_observations == True ):
     
    369369         for var in ncfile_in.variables.keys():
    370370            if ( var in dims_out ):
    371                # Create a variable and write it to file after it is read. In order to 
    372                # avoid fill values in the dimensions, these are converted to zero 
     371               # Create a variable and write it to file after it is read. In order to
     372               # avoid fill values in the dimensions, these are converted to zero
    373373               # before written to file. Depending on the featureType of the measurement,
    374                # the array shape is different. For more informations, please see 
     374               # the array shape is different. For more informations, please see
    375375               # [UC]2 data standard.
    376376               # Timeseries
    377                if ( feature == name_ts  ): 
     377               if ( feature == name_ts  ):
    378378                  temp_ts = ncfile_out.createVariable( var + str(num_vmeas), float, \
    379379                                                       name_station + str(num_vmeas))
     
    382382               # Trajectories
    383383               elif ( feature == name_traj ):
    384                   temp_traj = ncfile_out.createVariable( var + str(num_vmeas), float, \
    385                                                          ( name_traj_dim + str(num_vmeas), \
    386                                                            name_ntime + str(num_vmeas) ) )
    387                   temp_traj[:,:] = np.nan_to_num( ncfile_in.variables[var][:,:] )
     384                  # @note: If there are files where station_h is present although featureType is
     385                  #        trajectory, station_h must not be read.
     386                  if var != name_station_h:
     387                     temp_traj = ncfile_out.createVariable( var + str(num_vmeas), float, \
     388                                                            ( name_traj_dim + str(num_vmeas), \
     389                                                              name_ntime + str(num_vmeas) ) )
     390                     temp_traj[:,:] = np.nan_to_num( ncfile_in.variables[var][:,:] )
    388391
    389392               # TimeseriesProfiles
     
    411414      ncfile_in.close()
    412415
    413       # Set flag to indicate that for this specific site dimensions have been 
     416      # Set flag to indicate that for this specific site dimensions have been
    414417      # already created and attributes are already set.
    415418      if ( create_metadata_for_site[sites.index( site )] != "Done" ):
     
    507510            measured_variables.append(var)
    508511
    509          # Check if given variables are already in the default variables. 
     512         # Check if given variables are already in the default variables.
    510513         # If not, extend.
    511514         for var in custom_vars:
     
    549552
    550553quit()
    551 
Note: See TracChangeset for help on using the changeset viewer.