autorino.cfgfiles package

Submodules

autorino.cfgfiles.cfgfile_read module

Created on Thu Dec 1 15:47:05 2022

@author: psakic

autorino.cfgfiles.cfgfile_read._chk_parent_dir(parent_dir, parent_dir_key=None)[source]

Checks if a parent directory exists and translates it with the environment variable first.

This function takes a string representing a directory path. It first translates the directory path with the environment variable. Then, it checks if the translated directory exists. If it does not exist, it raises a FileNotFoundError with a custom error message. If it does exist, it returns None.

This function is an internal function for the read_cfg function.

Will translate it with the environment variable first.

Parameters:
  • parent_dir (str) – A string representing a directory path.

  • parent_dir_key (str, optional) – The dictionnary key representing the parent directory. Default is None.

Raises:

FileNotFoundError – If the translated directory does not exist.

Returns:

If the translated directory exists.

Return type:

None

autorino.cfgfiles.cfgfile_read._device2mda(y_station)[source]

Convert a device block from a configuration file to a MetaData object.

autorino.cfgfiles.cfgfile_read._epoch_range_from_cfg_bloc(epoch_range_dic)[source]

get an EpochRange object from epoch_range dictionary bloc internal function for read_cfg

autorino.cfgfiles.cfgfile_read._get_dir_path(y_step, dir_type='out', check_parent_dir_exist=True)[source]

Constructs a directory path based on the provided parameters.

This function takes a dictionary containing step information,

a directory type, and a flag indicating whether to check if the parent directory exists. It constructs a directory path by joining the parent directory and the structure. If the flag to check the existence of the parent directory is set to True, it checks if the parent directory exists.

Parameters:
  • y_step (dict) – A dictionary containing step information.

  • dir_type (str, optional) – The type of directory to be constructed. Default is ‘out’.

  • check_parent_dir_exist (bool, optional) – A flag indicating whether to check if the parent directory exists. Default is True.

Returns:

A tuple containing the constructed directory path, the parent directory, and the structure.

Return type:

tuple

autorino.cfgfiles.cfgfile_read._is_cfg_bloc_active(ywkf)[source]

Checks if a configuration block is active.

This function takes a dictionary representing a configuration block. It checks if the ‘active’ key is present in the dictionary. If it is, it returns the value of the ‘active’ key. If the ‘active’ key is not present, it assumes the block is active and returns True.

Internal function for read_cfg

Parameters:

ywkf (dict) – A dictionary representing a configuration block.

Returns:

True if the ‘active’ key is present and its value is True, or if the ‘active’ key is not present. False if the ‘active’ key is present and its value is False.

Return type:

bool

autorino.cfgfiles.cfgfile_read.check_from_main(y)[source]

Check if the FROM_MAIN keyword is used in the configuration file.

This function takes a dictionary representing the configuration file. It checks if the ‘FROM_MAIN’ keyword is used in the configuration file. If it is, it returns True. Otherwise, it returns False.

Parameters:

y (dict) – A dictionary representing the configuration file.

Returns:

True if the ‘FROM_MAIN’ keyword is used in the configuration file. False otherwise.

Return type:

bool

Warning

Obsolete since 2025-04 and cfgfile v >= 20.0

autorino.cfgfiles.cfgfile_read.format_dir_path(dir_parent, structure)[source]

Formats a directory path by adding or removing a leading slash.

autorino.cfgfiles.cfgfile_read.get_incl_cfg_paths(y_inp, site_cfg_path)[source]

Generates a list of absolute paths for included configuration files.

This function processes the ‘include’ section of a configuration dictionary, translates the paths using a translator function, and converts them to absolute paths relative to the provided site configuration file path.

Parameters:
  • y_inp (dict) – A dictionary containing the configuration data, including an ‘include’ key with paths to additional configuration files.

  • site_cfg_path (str) – The absolute path to the site configuration file.

Returns:

A list of absolute paths for the included configuration files.

Return type:

list

autorino.cfgfiles.cfgfile_read.get_incl_strategy(strat_str)[source]

Retrieves the merging strategy for configuration files.

This function maps a string representing a merging strategy to the corresponding mergedeep.Strategy enum value. Supported strategies are ‘append’ and ‘replace’.

Parameters:

strat_str (str) – The merging strategy as a string. Valid values are ‘append’ or ‘replace’.

Returns:

The corresponding merging strategy.

Return type:

mergedeep.Strategy

Raises:

ValueError – If the provided strategy string is invalid.

autorino.cfgfiles.cfgfile_read.load_cfg(cfg_path, verbose=True)[source]

Loads quickly one or several configuration files (YAML format) without interpretation.

This function reads a YAML configuration file from the specified path and returns the parsed content.

Parameters:
  • cfg_path (str or list of str) – The path(s) to the configuration file. If a list is provided, the config files are merged

  • verbose (bool)

Returns:

The parsed/merged content of the configuration files.

Return type:

dict

autorino.cfgfiles.cfgfile_read.read_cfg(site_cfg_path, epoch_range=None, include_cfg_paths_xtra=None, verbose=False)[source]

Read and interpret a configuration file (YAML format) and return a list of StepGnss objects to be launched sequentially.

This function takes in a path to a configuration file, an optional EpochRange object, and an optional path to a main configuration file. It reads the configuration file, updates it with the main configuration file if provided, and creates a list of StepGnss objects based on the configuration. The EpochRange object, if provided, will override the epoch ranges given in the configuration file.

Parameters:
  • site_cfg_path (str) – The path to the configuration file. Should be a single file here (no list).

  • epoch_range (EpochRange, optional) – An EpochRange object which will override the epoch ranges given in the configuration file. Default is None.

  • include_cfg_paths_xtra (str or list of str, optional) – The path to the include configuration file. If a list is provided, the include config files are merged. It overrides the files given with the ‘include’ keyword in the site configuration file. Default is None.

  • verbose (bool, optional) – A flag indicating whether to print the configuration

Returns:

  • steps_lis_lis (list) – A list of lists of StepGnss objects to be launched sequentially.

  • steps_dic_dic (dict) – A dictionary of dictionaries of StepGnss.

  • y_use (dict) – The parsed/merged content of the configuration file as dictionary.

autorino.cfgfiles.cfgfile_read.read_cfg_core(y_inp, epoch_range_inp=None)[source]

Reads and interprets session configurations from a dictionary and returns lists and dictionaries of StepGnss objects.

This function processes session configurations, loads metadata if available, and constructs lists and dictionaries of StepGnss objects based on the provided session configurations.

Parameters:
  • y_inp (dict) – A dictionary a site configuration.

  • epoch_range_inp (EpochRange, optional) – An EpochRange object which will override the epoch ranges given in the session configurations. Default is None.

Returns:

  • steps_lis_lis (list) – A list of lists of StepGnss objects to be launched sequentially.

  • steps_dic_dic (dict) – A dictionary of dictionaries of StepGnss objects.

autorino.cfgfiles.cfgfile_read.read_cfg_legacy(y_inp, y_main)[source]

Handles legacy configuration files with the ‘FROM_MAIN’ keyword.

This function processes configuration files with a version less than 20.0, where the ‘FROM_MAIN’ keyword is used to indicate that values should be inherited from a main configuration file. If the main configuration file is not provided or cannot be found, an error is raised.

Parameters:
  • y_inp (dict) – The input configuration dictionary (site-specific configuration).

  • y_main (dict or None) – The main configuration dictionary. If None, the function will check for the presence of the ‘FROM_MAIN’ keyword in the input configuration.

Returns:

The updated configuration dictionary, where values from the main configuration file have been merged into the input configuration.

Return type:

dict

Raises:

FileNotFoundError – If the ‘FROM_MAIN’ keyword is used in the input configuration but no main configuration file is provided.

Warning

Obsolete since 2025-04 and cfgfile v >= 20.0

autorino.cfgfiles.cfgfile_read.run_steps(steps_lis, steps_select_list=None, exclude_steps_select=False, verbose=True, force=False)[source]

Executes the steps in the provided list.

This function takes a list of StepGnss objects, an optional list of selected steps, and an optional boolean flag for printing tables. It iterates over the list of StepGnss objects and executes the ‘download’ or ‘convert’ method depending on the type of the step. If a list of selected steps is provided, only the steps in the list will be executed. If the ‘verbose’ flag is set to True, the tables will be printed during the execution of the steps.

Parameters:
  • steps_lis (Iterable) – A list of StepGnss objects to be executed.

  • steps_select_list (list, optional) – A list of selected steps to be executed. If not provided, all steps in ‘steps_lis’ will be executed. Default is None.

  • exclude_steps_select (bool, optional) – If True the selected steps indicated in step_select_list are excluded. It is the opposite behavior of the regular one using steps_list Default is False.

  • verbose (bool, optional) –

    A flag indicating whether to print the tables during the execution of the steps.

    Default is True.

  • force (bool, optional) – A flag indicating whether to force the execution of the steps. overrides the ‘force’ parameters in the configuration file. Default is False.

Return type:

None

autorino.cfgfiles.cfgfile_read.step_cls_select(step_name)[source]

Selects the appropriate class for a given step name.

This function maps a step name to its corresponding class, which is used to handle specific GNSS processing steps such as ‘download’, ‘convert’, ‘split’, or ‘splice’. If the step name is unknown, a warning is logged, and None is returned.

Parameters:

step_name (str) – The name of the step for which the corresponding class is to be selected.

Returns:

The class corresponding to the given step name, or None if the step name is unknown.

Return type:

class or None

Notes

  • Supported step names and their corresponding classes:
    • ‘download’: arodwl.DownloadGnss

    • ‘convert’: arocnv.ConvertGnss

    • ‘split’: arohdl.SplitGnss

    • ‘splice’: arohdl.SpliceGnss

  • Logs a warning if the step name is not recognized.

autorino.cfgfiles.cfgfile_read.update_w_main_dic(d, u=None, specific_value='FROM_MAIN')[source]

Updates a dictionary with another dictionary.

Warning

Obsolete since 2025-04 and cfgfile v >= 20.0

autorino.cfgfiles.cfgfiles_utils module

Created on 14/01/2025 15:23:34

@author: psakic

autorino.cfgfiles.cfgfiles_utils.feed_template(template_full_path, df_values, outdir, out_fname_prefix)[source]

Feed a Jinja2 template with values from a DataFrame and write the results to files.

Parameters:
  • template_full_path (str) – The full path to the Jinja2 template file.

  • df_values (pandas.DataFrame) – DataFrame containing the values to feed into the template.

  • outdir (str) – The directory where the output files will be written.

  • out_fname_prefix (str) – The prefix for the output file names.

Return type:

None

autorino.cfgfiles.cfgfiles_utils.teqc_args_spliter(linp)[source]

Split TEQC arguments into a dictionary. For OVSG legacy configuration files only.

Parameters:

linp (str) – The string containing TEQC arguments.

Returns:

A dictionary where keys are TEQC options and values are their corresponding arguments.

Return type:

dict