pds.naif_pds4_bundler.classes package
Submodules
pds.naif_pds4_bundler.classes.bundle module
Bundle Class Implementation.
- class pds.naif_pds4_bundler.classes.bundle.Bundle(setup)[source]
Bases:
objectClass to generate the PDS4 Bundle structure.
The class construction will generate the top level directory structure for a PDS4 bundle or a PDS3 data set.
- Parameters:
setup – NPB execution Setup
- get_history(object)[source]
This method builds the “Archive History”.
The “Archive history” is obtained by extracting the previous releases and the Collections that correspond to each release from the Bundle labels. The other products’ information is extracted from the collection inventories.
The archive history is then provided as a dictionary with releases as keys and each key contains a list of files for that release.
The method checks whether if there is any duplicated element.
- Parameters:
object – optional Bundle object for tests
- Returns:
Archive history dictionary
- Return type:
dict
- validate()[source]
Validate the Bundle.
The two implemented steps are to check checksum files against the updated bundle history and checking the bundle times.
- validate_history()[source]
Validate the bundle updated history with the checksum files.
This method validates all the archive Checksum files with the “Archive History”. The “Archive history” is obtained by extracting the previous releases and the Collections that correspond to each release from the Bundle labels. The other products’ information is extracted from the collection inventories.
The archive history is then provided as a dictionary with releases as keys and each key contains a list of files for that release.
The validation is performed by comparing each release entry of the dictionary with the release checksum file
checksum_v???.tab.In parallel the method writes in the execution log the complete bundle release history, providing an ordered list of files released for each release number.
pds.naif_pds4_bundler.classes.collection module
pds.naif_pds4_bundler.classes.label module
pds.naif_pds4_bundler.classes.list module
Implementation of the Kernel List class.
- class pds.naif_pds4_bundler.classes.list.KernelList(setup)[source]
Bases:
objectClass to generate a Kernel List.
- Parameters:
setup – NPB execution setup object
- add(kernel: str) None[source]
Add SPICE kernel or OrbNum file to the list.
- Parameters:
kernel – SPICE kernel or OrbNum file added to the list
- check_products()[source]
Check the SPICE kernel and ORBNUM products from the kernel list.
The products present in the Kernel List –whether if generated by NPB or provided by the user– will be checked and if issues are found they will be reported as
WARNINGorERRORmessages.The checks performed to the products are the following:
identify if a SPICE kernel is present in multiple kernel directories
check End of Line character for text SPICE kernels and ORBNUM files.
check text SPICE kernels and ORBNUM files for non-ASCII characters.
check if text SPICE kernels have more than 80 characters per line.
validate kernel architecture
check endianness and permissions of binary kernels
- read_list(kerlist)[source]
Read the Kernel List.
Note that the format that the kernel list has to follow is very strict, including no whitespace at the end of each line and Line-feed EOL.
- Parameters:
kerlist (str) – Kernel List path
- read_plan(plan)[source]
Read Release Plan from the main module input.
- Parameters:
plan (str) – Release Plan name
- validate()[source]
Validation of the Kernel List.
The validation of the Kernel List performs the following checks:
check that the list has the same number of
FILE,MAKLABEL_OPTIONS, andDESCRIPTIONentries.check list against plan
check that list for duplicate files
check that all files listed in the list are on the
kernels_directorycheck that the files are not in the
bundle_directorydisplay all the
MAKLABL_OPTIONSusedcheck that all the
MAKLBL_OPTIONSare in the template for PDS3check that the list has no duplicates
check that the list has no bad characters
if the
-d DIFF --diff DIFFargument is used, compare the kernel list with the kernel list of the previous release -if avaialble.
- validate_complete()[source]
Validation of the complete Kernel List.
The complete Kernel List is generated by NPB by merging all the available Kernel List files. These kernel list files must be located in the
working_directoryas specified by the NPB configuration.In principle all the kernels that have ever been added to the archive should be present.
The validation of the complete Kernel List performs the following checks:
check that the list has the same number of
FILE,MAKLABEL_OPTIONS, andDESCRIPTIONentriescheck all the
MAKLABL_OPTIONSusedcheck that the list has no duplicates
pds.naif_pds4_bundler.classes.log module
Log Class Implementation.
- class pds.naif_pds4_bundler.classes.log.Log(setup: Setup, args: PipelineArgs)[source]
Bases:
objectLog class to write and output NPB’s log.
- Parameters:
setup – Setup object from NPB’s main function.
args – Command line arguments from NPB’s main function.
- pds.naif_pds4_bundler.classes.log.error_message(message: str, setup: Setup | None = None) None[source]
Signal a NPB error and write run artifacts.
- Side effects:
Writes file list and checksum registry if setup is provided
Removes template files
Clears SPICE kernel pool
Raises RuntimeError
- Parameters:
message – Error message
setup – Optional Setup object for writing artifacts
- Raises:
RuntimeError – always, with the provided error message.
pds.naif_pds4_bundler.classes.object module
Dummy Class Implementation.
pds.naif_pds4_bundler.classes.product module
pds.naif_pds4_bundler.classes.setup module
Setup Class Implementation.
- class pds.naif_pds4_bundler.classes.setup.Setup(args, version: str)[source]
Bases:
objectClass that parses and processes the NPB XML configuration file.
- Parameters:
args – Parameters arguments from NPB main function
version (str) – NPB version
- add_checksum(path, checksum)[source]
Add checksum to Checksum record.
Adds a MD5sum entry with the product it corresponds to for the run by-product Checksum record file.
- Parameters:
path (str) – File path for checksum
checksum (str) – Checksum value for checksum
- add_file(file)[source]
Add file fo Product List.
Adds a product to the run by-product Product List.
- Parameters:
file (str) – Product to be added
- check_configuration()[source]
Performs the following checks to the loaded configuration items:
IM, Line Feed, and Date Time format NAIF recommendations
Archive increment start and finish times
Transform relative to absolute paths
Existence of kernel directories
IM, XML model, and Schema Location coherence
Check existence of templates according to the IM
Meta-kernel configuration
Presence of uppercase characters in the kernel list configuration
- clear_run(debug=False)[source]
Clears the files generated by a previous run.
Clears the files generated by a previous run when specified with the clear argument and the kernel list of the previous run.
Please note that newly created directories will not be erased.
- Parameters:
debug (bool) – If True, the by-product files are not cleaned up. This is useful when testing
- load_kernels()[source]
Loads the kernels required to run NPB.
Note that kernels that are not required might be loaded as well, but given that the required memory is not much, we stay on the safe side by loading additional kernels.
- write_validate_config()[source]
Write a PDS validate tool configuration file.
NPB will write a PDS validate tool configuration file for convenience of the user. The following validate example command for ExoMars2016:
$ validate -v 1 -t em16/em16_spice -R pds4.bundle -x working/PDS4_PDS_1B00.xsd -S working/PDS4_PDS_1B00.sch -–strict-field-checks -r working/em16_release_03.validate
Would be equivalent to the following resulting Validate configuration file:
# Run the PDS validate tool where the NPB working directory resides: # $ validate -c working/em16_release_03.config.validate validate.target = em16/em16_spice validate.verbose = 1 validate.rule = pds4.bundle validate.schema = working/PDS4_PDS_1B00.xsd validate.schematron = working/PDS4_PDS_1B00.sch validate.strictFieldChecks = true validate.report = working/em16_release_03.validate_report
If there is an issue during the generation of this file –e.g.: no internet connection– the process will silently fail but the NPB run will be successful.
Module contents
NAIF PDS4 Bundle Classes Namespace.
The NPB Classes implement the main functionalities of the pipeline.