curryer.kernels.writer¶
Kernel writer functions.
@author: Brandon Stone
Attributes¶
Functions¶
|
Write the kernel setup file. |
|
Validate major formatting elements of a text kernel. |
Module Contents¶
- curryer.kernels.writer.logger¶
- curryer.kernels.writer.TEMPLATE_NAMES¶
- curryer.kernels.writer.env¶
- curryer.kernels.writer.write_setup(setup_file, template, configs, mappings=None, overwrite=False, validate=True, parent_dir=None)¶
Write the kernel setup file.
- Parameters:
setup_file (str or file object or None) – File or object to write. If None, return the raw text.
template (str) – Path to a template file for creating the setup_file, or a SPICE kernel type. If a SPICE kernel type, the default template will be used.
configs (dict or dict-like) – Values to write to the setup file. Item “spice_body”: Dict-like structure with “name” (str) and “code” (str or int) items. Used to define the “body” in SPICE.
mappings (dict, optional) – Dict-like structure with “name” (str or list of str) and “code” (int or list of int) items. Used to define the “body” in SPICE ID system.
overwrite (bool, optional) – Option to allow overwriting existing files.
validate (bool, optional) – Validate that the created text follows the kernel file requirements. Default=True. Validation failure will result in a ValueError.
parent_dir (str or Path, optional) – Parent directory to use for non-absolute paths. Default is to use the current working directory.
- Returns:
Raw setup text if setup_file is None.
- Return type:
None or str
- curryer.kernels.writer.validate_text_kernel(kernel, issues=None)¶
Validate major formatting elements of a text kernel.
https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/req/kernel.html
- Parameters:
kernel (str or obj with read attr) – Kernel filename or readable object to validate.
issues (list, optional) – List to append the discovered issues to. Each issue is a tuple string pairs of the reason and the source line.
- Returns:
True if validation passed, otherwise False. See warnings for reasons.
- Return type:
bool