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: object)[source]

Bases: object

Class 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 (object) – NPB execution Setup object

add(element)[source]

Add a Collection to the Bundle.

check_times()[source]

Check the correctness of the bundle times.

copy_to_bundle()[source]

Copy files from staging_directory to the bundle_directory.

files_in_staging()[source]

Lists all the files in the staging area.

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 (object) – optional Bundle object for tests

Returns:

Archive history dictionary

Return type:

dict

set_bundle_lid()[source]

Set the Bundle LID.

set_bundle_vid()[source]

Set the Bundle VID.

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.

write_readme()[source]

Write the readme product if it does not exist.

pds.naif_pds4_bundler.classes.collection module

Collection Class amd Child Classes Implementation.

class pds.naif_pds4_bundler.classes.collection.Collection(type: str, setup: object, bundle: object)[source]

Bases: object

Class to generate a PDS4 Collection.

Parameters:
  • type (str) – Collection type: kernels, documents or miscellaneous

  • setup (object) – Setup Object

  • bundle (object) – Bundle Object to which the Collection belongs to

add(element)[source]

Add a Product to the Collection.

Parameters:

element (object) – Product to add to Collection

set_collection_lid()[source]

Set the Bundle LID.

set_collection_vid()[source]

Set the Bundle VID.

In general Collection versions are not equal to the release number. If the collection has been updated we obtain the increased version, but if it has not been updated we use the previous version.

Given the case thatt he version cannot be determined: if it is the SPICE kernels collection assume is the same version as the bundle, otherwise we set it to 1.

class pds.naif_pds4_bundler.classes.collection.DocumentCollection(setup: object, bundle: object)[source]

Bases: Collection

Collection child class to generate a PDS3 or PDS4 Document Collection.

Parameters:
  • setup (object) – NPB execution setup object

  • bundle (object) – Bundle object

get_pds3_documents()[source]

Collects the updated PDS3 documents for the increment.

class pds.naif_pds4_bundler.classes.collection.MiscellaneousCollection(setup: object, bundle: object, list: object)[source]

Bases: Collection

Collection child class to generate a PDS4 Document Collection.

Parameters:
  • setup (object) – NPB execution setup object

  • bundle (object) – Bundle object

  • list (object) – Kernel List object

report()[source]

Report the Collection generation step.

class pds.naif_pds4_bundler.classes.collection.SpiceKernelsCollection(setup: object, bundle: object, list: object)[source]

Bases: Collection

Collection child class to generate a PDS4 SPICE Kernels Collection.

Parameters:
  • setup (object) – NPB execution setup object

  • bundle (object) – Bundle object

  • list (object) – Kernel List object

determine_meta_kernels()[source]

Determine the name of the Meta-kernel(s) to be generated.

Returns:

Dictionary of meta-kernels to be generated. The keys list the meta-kernels and the values whether if they are provided by the user or not.

Return type:

dictionary.

set_increment_times()[source]

Determine the archive increment start and finish times.

This is done based on the identification of the coverage of a given SPK or CK kernel. Alternatively it can be provided as a parameter of the execution.

type

Collection type (str).

validate()[source]

Validate the SPICE Kernels collection.

The SPICE Kernels collection validation performs the following checks:

  • check that all the kernels from the kernel list are present

  • check that all the kernels have been labeled

  • display the key elements of the labels for the user to do a visual inspection. The key elements are: logical_identifier, version_id, title, description, start_date_time, stop_date_time, file_name, file_size, md5_checksum, object_length, kernel_type, and encoding_type.

pds.naif_pds4_bundler.classes.label module

PDS Label Class and Child Classes Implementation.

class pds.naif_pds4_bundler.classes.label.BundlePDS4Label(setup: object, readme: object)[source]

Bases: PDSLabel

PDS Label child class to generate a PDS4 Bundle Label.

Parameters:
  • setup (object) – NPB execution Setup object

  • readme – Readme product

Rype readme:

object

get_mission_reference_type()[source]

Get mission reference type.

Returns:

Literally bundle_to_investigation

Return type:

str

get_target_reference_type()[source]

Get target reference type.

Returns:

Literally bundle_to_target

Return type:

str

class pds.naif_pds4_bundler.classes.label.ChecksumPDS3Label(setup, product)[source]

Bases: PDSLabel

PDS Label child class to generate a PDS3 Checksum Label.

Parameters:
  • setup (object) – NPB execution Setup object

  • product (object) – Checksum product to label

class pds.naif_pds4_bundler.classes.label.ChecksumPDS4Label(setup: object, product: object)[source]

Bases: PDSLabel

PDS Label child class to generate a PDS4 Checksum Label.

Parameters:
  • setup (object) – NPB execution Setup object

  • product (object) – Checksum product to label

class pds.naif_pds4_bundler.classes.label.DocumentPDS4Label(setup: object, collection: object, inventory: object)[source]

Bases: PDSLabel

PDS Label child class to generate a PDS4 Document Label.

Parameters:
  • setup (object) – NPB execution Setup object

  • collection (object) – Collection to label

  • inventory (object) – Inventory Product of the Collection

class pds.naif_pds4_bundler.classes.label.InventoryPDS3Label(mission: object, collection: object, inventory: object)[source]

Bases: PDSLabel

PDS Label child class to generate a PDS3 Index Label.

Parameters:
  • setup (object) – NPB execution Setup object

  • collection – Index Collection

  • inventory (object) – Index Product

class pds.naif_pds4_bundler.classes.label.InventoryPDS4Label(setup: object, collection: object, inventory: object)[source]

Bases: PDSLabel

PDS Label child class to generate a PDS4 Collection Inventory Label.

Parameters:
  • setup (object) – NPB execution Setup object

  • collection – Collection to label

  • inventory (object) – Inventory Product of the Collection

get_mission_reference_type()[source]

Get mission reference type.

Returns:

Literally collection_to_investigation

Return type:

str

get_target_reference_type()[source]

Get target reference type.

Returns:

Literally collection_to_target

Return type:

str

class pds.naif_pds4_bundler.classes.label.MetaKernelPDS4Label(setup: object, product: object)[source]

Bases: PDSLabel

PDS Label child class to generate a PDS4 SPICE Kernel MK Label.

Parameters:
  • setup (object) – NPB execution Setup object

  • product (object) – MK product to label

get_kernel_internal_references()[source]

Get the MK label internal references.

Returns:

PDS4 formatted Kernel list used by the label for internal references.

Return type:

str

class pds.naif_pds4_bundler.classes.label.OrbnumFilePDS4Label(setup: object, product: object)[source]

Bases: PDSLabel

PDS Label child class to generate a PDS4 Orbit Number File Label.

Parameters:
  • setup (object) – NPB execution Setup object

  • product (object) – ORBNUM product to label

field_template(name, number, location, type, length, format, description, unit, blanks)[source]

For a label provide all the parameters required for an ORBNUM field character.

Parameters:
  • name (str) – Name field

  • number (str) – Number field

  • location (str) – Location field

  • type (str) – Type field

  • length (str) – Length field

  • format (str) – Format field

  • description (str) – Description field

  • unit (str) – Unit field

  • blanks (str) – Blank space missing constant indication

Returns:

Field Character for ORBNUM PDS4 label

Return type:

str

get_table_character_description()[source]

Get The description of the Table Character.

Returns:

Table Character description

Rytpe:

str

get_table_character_fields()[source]

Get the Table Character fields.

Returns:

Table Character fields

Rytpe:

str

class pds.naif_pds4_bundler.classes.label.PDSLabel(setup: object, product: object)[source]

Bases: object

Class to generate a PDS Label.

Parameters:
  • setup (object) – NPB execution Setup object

  • product (object) – Product to be labeled

compare()[source]

Compare the Label with another label.

The product label is compared to a similar label. The label with which the generated label is compared to is determined by the first criteria that is met from the following list:

  • find a different version of the same label

  • find the label of a product of the same kind (e.g.: same kernel type)

  • use a label of a product of the same kind from INSIGHT available from the NPB package.

get_mission_reference_type()[source]

Get the mission reference type.

Returns:

Mission_Reference_Type value for PDS4 label

Return type:

str

get_missions()[source]

Get the label mission from the context products.

Returns:

List of missions to be included in the label

Return type:

list

get_observers()[source]

Get the label observers from the context products.

Returns:

List of Observers to be included in the label

Return type:

list

get_target_reference_type()[source]

Get the target reference type.

Returns:

Target_Reference_Type value for PDS4 label

Return type:

str

get_targets()[source]

Get the label targets from the context products.

Returns:

List of Targets to be included in the label

Return type:

list

write_label()[source]

Write the Label.

class pds.naif_pds4_bundler.classes.label.SpiceKernelPDS3Label(mission, product)[source]

Bases: PDSLabel

PDS Label child class to generate a PDS3 SPICE Kernel Label.

format_description(description)[source]

Format the SPICE kernel description appropriately.

The first line goes from character 33 to 78. Successive lines go from character 1 to 78. Last line has a blank space after the full stop.

Returns:

Formatted label description

Return type:

str

insert_binary_label()[source]

Insert or update a label in a binary kernel.

The routine inserts the label in the kernel comment.

insert_text_label()[source]

Insert or update a label in a text kernel.

The routine inserts the label, after the first line containing the kernel architecture specification and removes extra empty lines at the end of the kernel file.

set_kernel_ids(product)[source]

Set the SPICE Kernel ID field of the label.

set_sclk_times(product, system='UTC')[source]

Calculates the SCLK times for PDS3 labels.

class pds.naif_pds4_bundler.classes.label.SpiceKernelPDS4Label(setup: object, product: object)[source]

Bases: PDSLabel

PDS Label child class to generate a non-MK PDS4 SPICE Kernel Label.

Parameters:
  • setup (object) – NPB execution Setup object

  • product (object) – SPICE Kernel product to be labeled

pds.naif_pds4_bundler.classes.list module

List Class and Child Class Implementation.

class pds.naif_pds4_bundler.classes.list.KernelList(setup: object)[source]

Bases: List

List child class to generate the Kernel List.

Parameters:

setup (object) – NPB execution setup object

add(kernel)[source]

Add SPICE kernel or ORBNUM file to the list.

Parameters:

kernel (str) – 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 WARNING or ERROR messages.

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_config()[source]

Extract the Kernel List information from the configuration file.

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, and DESCRIPTION entries.

  • check list against plan

  • check that list for duplicate files

  • check that all files listed in the list are on the kernels_directory

  • check that the files are not in the bundle_directory

  • display all the MAKLABL_OPTIONS used

  • check that all the MAKLBL_OPTIONS are in the template for PDS3

  • check that the list has no duplicates

  • check that the list has no bad characters

  • if the -d DIFF --diff DIFF argument 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_directory as 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, and DESCRIPTION entries

  • check all the MAKLABL_OPTIONS used

  • check that the list has no duplicates

write_complete_list()[source]

Write the complete Kernel List using the former ones.

write_list()[source]

Write the Kernel List product.

The list is not an archival product but an NPB by-product, therefore it is not generated by any of the product classes.

write_plan()[source]

Write the Release Plan if not provided.

Returns:

True if a release plan has been generated, False if it has been provided as input

Return type:

bool

class pds.naif_pds4_bundler.classes.list.List(setup: object)[source]

Bases: object

Class to generate the List.

Parameters:

setup (object) – NPB execution setup object

add(element)[source]

Add file to the list.

Parameters:

element (str) – SPICE Kernel product or ORBNUM product to be added to the list

pds.naif_pds4_bundler.classes.log module

Log Class Implementation.

class pds.naif_pds4_bundler.classes.log.Log(setup: object, args: object)[source]

Bases: object

Log class to write and output NPB’s log.

Parameters:
  • args (object) – Parameter arguments from NPB’s main function.

  • version (str) – NPB version.

start()[source]

Start the generation of the log for the execution.

stop()[source]

Write log, file list, and checksum registry files when NPB stops.

pds.naif_pds4_bundler.classes.log.error_message(message, setup=False)[source]

Function to signal a NPB error message.

The File List and Checksum Registry files are also written.

Parameters:
  • message (str) – Error message

  • setup (object) – Setup object, if provided a file will be written

pds.naif_pds4_bundler.classes.object module

Dummy Class Implementation.

class pds.naif_pds4_bundler.classes.object.Object[source]

Bases: object

Dummy Class.

pds.naif_pds4_bundler.classes.product module

Product Class and Child Classes Implementation.

class pds.naif_pds4_bundler.classes.product.ChecksumProduct(setup: object, collection: object, add_previous_checksum: bool = True)[source]

Bases: Product

Product child class to generate a Checksum Product.

Parameters:
  • setup (object) – NPB execution setup object

  • collection (object) – Miscellaneous Collection

  • add_previous_checksum (bool) – True if there is a previous checksum file to be added, False otherwise

compare()[source]

Compare the Checksum with the previous Checksum file.

The Checksum file is compared with the previous version.

generate(history=False)[source]

Write and label the Checksum file.

Parameters:

history (bool) – True if the checksum will be generated with the archive history, False otherwise

read_current_product(add_previous_checksum=True)[source]

Reads the current checksum file.

Reads the current checksum file, determines the version of the new checksum file, and adds the checksum file itself and its label.

Parameters:

add_previous_checksum (bool) – True if there is a previous checksum file to be added, False otherwise

set_coverage()[source]

Determine the coverage of the Checksum file.

set_product_lid()[source]

Set Product LID.

set_product_vid()[source]

Set Product VID.

write_product(history=False, set_coverage=False)[source]

Write the Checksum file and determine its start and stop time.

This method can also be used to determine the start and stop time of the checksum file, necessary to determine these times for the miscellaneous collection before the checksum is actually written.

Parameters:
  • history (dict) – Archive History

  • set_coverage (bool) – Determines the start and stop of the checksum file if set to True, False otherwise

Returns:

class pds.naif_pds4_bundler.classes.product.InventoryProduct(setup: object, collection: object)[source]

Bases: Product

Product child Class that defines a Collection Inventory product.

Parameters:
  • setup (object) – NPB execution setup object

  • collection (object) – Collection that the inventory product belongs to

compare()[source]

Compare the Inventory Product with another Inventory.

The Inventory Product is compared with the previous version and if it does not exist with the sample INSIGHT inventory product.

set_product_lid()[source]

Set the Product LID.

set_product_vid()[source]

Set the Product VID.

validate_pds3()[source]

Validate the PDS3 Index.

The Inventory is validated by checking that all the products listed are present in the archive and comparing the index file with the previous one.

validate_pds4()[source]

Validate the PDS4 Inventory Product.

The Inventory is validated by checking that all the products listed are present in the archive.

write_pds3_index_product()[source]

This method uses the previous index file to generate the new one.

There is a NAIF Perl script that will generate an index file from a kernel list file. Please contact the NAIF if you are interested in such script.

write_pds4_collection_product()[source]

Write the PDS4 Collection product.

write_product()[source]

Write and validate the Collection inventory.

class pds.naif_pds4_bundler.classes.product.MetaKernelProduct(setup: object, kernel: object, spice_kernels_collection: object, user_input: object = False)[source]

Bases: Product

Product child class Meta-Kernel.

Parameters:
  • setup (object) – NPB execution setup object

  • kernel (str) – Meta-kernel path

  • spice_kernels_collection (object) – SPICE Kernel Collection

  • user_input (bool) – Indicates whether if the meta-kernel is provided by the user

check_version()[source]

Check if the provided Meta-kernel version is correct.

compare()[source]

Compare the Meta-kernel with the previous version.

The MK is compared with a previous version of the MK. If no prior MK is found, the new MK is compared to NPB’s MK template.

coverage()[source]

Determine Meta-kernel coverage.

Meta-kernel coverage is determined by:

  • for whole mission meta-kernels start_date_time and stop_date_time are set to the coverage provided by spacecraft SPK, CKs, or to other dates at the discretion of the archive producer. These other dates might be required for missions whose SPks and CKs do not explicitly cover the dates required by the archive, e.g.: a lander mission with a fixed position provided by an SPK with extended coverage

  • for yearly mission meta-kernels start_date_time and stop_date_time are set to the coverage from Jan 1 00:00 of the year to either the end of coverage provided by spacecraft SPK or CKs, or the end of the year (whichever is earlier)

get_description()[source]

Obtain the kernel product description information.

set_product_lid()[source]

Set the Meta-kernel LID.

set_product_vid()[source]

Set the Meta-kernel VID.

If the meta-kernel has been automatically generated as indicated in the configuration file, it has a version attribute, otherwise it does not and its version number must be equal to the expected VID.

validate()[source]

Perform a basic validation of the Meta-kernel.

The validation consists of:

  • load the kernel with the SPICE API FURNSH

  • count the loaded kernels with SPICE API KTOTAL

  • compare the number of kernels in the kernel pool with the length of the MK collection list attribute

  • check that line lengths are less than 80 characters

write_product()[source]

Write the Meta-kernel.

class pds.naif_pds4_bundler.classes.product.OrbnumFileProduct(setup: object, name: object, collection: object, spice_kernels_collection: object)[source]

Bases: Product

Product child class ORBNUM File.

Parameters:
  • setup (object) – NPB execution setup object

  • name (str) – ORBNUM file path

  • collection (object) – Miscellaneous Collection that contains the ORBNUM product

  • spice_kernels_collection (object) – SPICE Kernel Collection

coverage()[source]

Determine the coverage of the ORNBUM file.

The coverage of the ORBNUM file can be determined in three different ways:

  • If there is a one to one correspondence with an SPK file, the SPK file can be provided with the <kernel> tag. The tag can be a path to a specific kernel that does not have to be part of the increment, a pattern of a kernel present in the increment or a pattern of a kernel present in the final directory of the archive.

  • If there is a quasi one to one correspondence with an SPK file with a given cutoff time prior to the end of the SPK file, the SPK file can be provided with the <kernel> tag. The tag can be a path to a specific kernel that does not have to be part of the increment, a pattern of a kernel present in the increment or a pattern of a kernel present in the final directory of the archive. Currently, the only cutoff pattern available is the boundary of the previous day of the SPK coverage stop time.

  • A user can provide a look-up table with this file, as follows:

    <lookup_table>
       <file name="maven_orb_rec_210101_210401_v1.orb">
          <start>2021-01-01T00:00:00.000Z</start>
          <finish>2021-04-01T01:00:00.000Z</finish>
       </file>
    </lookup_table>
    

    Note that in this particular case the first three and last three lines of the orbnum files would have provided:

    Event UTC PERI
    ====================
    2021 JAN 01 00:14:15
    2021 JAN 01 03:50:43
    2021 JAN 01 07:27:09
    (...)
    2021 MAR 31 15:00:05
    2021 MAR 31 18:36:29
    2021 MAR 31 22:12:54
    
  • If nothing is provided NPB will provide the coverage based on the event time of the first orbit and the opposite event time of the last orbit.

event_mapping(event)[source]

Maps the event keyword to the event name/description.

Parameters:

event (str) – ORBNUM event key

Returns:

ORBNUM event description

Return type:

str

get_description()[source]

Write the ORBNUM table character description.

Write the ORBNUM product description information based on the orbit determination event and the PCK kernel used.

Returns:

ORBNUM file description for label.

Return type:

str

get_header_length()[source]

Read an ORBNUM file and return the length of the header in bytes.

Returns:

ORBNUM file header length

Return type:

str

get_params(header)[source]

Obtain the parameters present in the ORBNUM file.

Currently, there are 11 orbital parameters available:

No. The orbit number of a descending node event.

Event UTC The UTC time of that event.

Event SCLK The SCLK time of the event.

OP-Event UTC The UTC time of the opposite event.

Sub Sol Lon Sub-solar planetodetic longitude at event time (DEGS).

Sub Sol Lat Sub-solar planetodetic latitude at event time (DEGS).

Sub SC Lon Sub-target planetodetic longitude (DEGS).

Sub SC Lat Sub-target planetodetic latitude (DEGS).

Alt Altitude of the target above the observer body at event time (KM).

Inc Inclination of the vehicle orbit plane at event time (DEGS).

Ecc Eccentricity of the target orbit about the primary body at event time (DEGS),

Lon Node Longitude of the ascending node of the orbit plane at event time (DEGS).

Arg Per Argument of periapsis of the orbit plane at event time (DEGS).

Sol Dist Solar distance from target at event time (KM).

Semi Axis Semi-major axis of the target’s orbit at event time (KM).

Parameters:

header (list) – ORBNUM file header line

get_sample_record()[source]

Read an orbnum file and return one record sample.

This sample (one data line) will be used to determine the format of each parameter of the orbnum file. The sample is re-processed in such a way that it contains no spaces for the UTC dates.

Returns:

sample record line

Return type:

str

opposite_event_mapping(event)[source]

Maps the event keyword to the opposite event keyword.

Parameters:

event (str) – ORBNUM event key

Returns:

ORBNUM opposite event keyword

Return type:

str

read_header()[source]

Read and process an ORBNUM file header.

Defines the record_fixed_length attribute that provides the length of a record.

Returns:

ORBNUM header line

Return type:

str

read_records()[source]

Read and interpret the records of an ORBNUM file.

Read an orbnum file and set the number of records attribute, the length of the records attribute, determine which lines have blank records and, perform simple checks of the records.

Returns:

number of records of ORBNUM file

Return type:

str

set_event_detection_key(header)[source]

Obtain the ORBNUM event detection key.

The event detection key is a string identifying which geometric event signifies the start of an orbit. The possible events are:

APO signals a search for apoapsis

PERI signals a search for periapsis

A-NODE signals a search for passage through the ascending node

D-NODE signals a search for passage through the descending node

MINLAT signals a search for the time of minimum planetocentric latitude

MAXLAT signals a search for the time of maximum planetocentric latitude

MINZ signals a search for the time of the minimum value of the Z (Cartesian) coordinate

MAXZ signals a search for the time of the maximum value of the Z (Cartesian) coordinate

Parameters:

header (list) – ORBNUM file header line

set_params(header)[source]

Define the parameters’ template dictionary.

Parameters:

header (list) – ORBNUM file header line

set_previous_orbnum()[source]

Determine the previous version of the ORBNUM file.

For some cases, more than one orbit number file may exist for a given SPK, with only one file having the same name as the SPK and other files having a version token appended to the SPK name. It is also possible that a version token is always present. This method finds the latest version of such an orbnum file in the final area.

NPB assumes that the version pattern of the orbnum file name follows the REGEX pattern:

_[vV][0-9]*[.]

E.g.:

(...)_v01.orb
(...)_V9999.nrb
(...)_v1.orb

This method provides values to the _previous_orbnum and _orbnum_version protected attributes, both are strings.

set_product_lid()[source]

Set the Product LID.

set_product_vid()[source]

Set the Product VID.

table_character_description()[source]

Write the ORBNUM table character description.

Write the orbnum table character description information determination event and the PCK kernel used.

utc_blanks_to_dashes(sample_record)[source]

Reformat UTC strings in the ORBNUM file.

Re-process the UTC string fields of an ORBNUM sample row to remove blank spaces.

Parameters:

sample_record (str) – sample row with UTC string with blank spaces

Returns:

sample row with UTC string with dashes

Return type:

str

class pds.naif_pds4_bundler.classes.product.PDS3DocumentProduct(setup: object, path: str)[source]

Bases: Product

Product child class that represents a PDS3 Document Product.

Parameters:
  • setup (object) – NPB execution setup object

  • path (str) – PDS3 Document path

validate()[source]

Try to validate the PDS3 document.

The outcome of the validation is an INFO or a WARNING log message.

class pds.naif_pds4_bundler.classes.product.Product[source]

Bases: object

Parent Class that defines a generic archive product (or file).

Assigns value to the common attributes for all Products: file size, creation time and date, and file extension.

get_mission_and_observer_and_target()[source]

Read the configuration to extract the missions, observers and the targets.

Returns:

missions and observers and targets

Return type:

tuple

class pds.naif_pds4_bundler.classes.product.ReadmeProduct(setup: object, bundle: object)[source]

Bases: Product

Product child class to generate the Readme Product.

Parameters:
  • setup (object) – NPB execution setup object

  • bundle (object) – Bundle that contains the Readme Product

write_product()[source]

Write the Readme product.

class pds.naif_pds4_bundler.classes.product.SpiceKernelProduct(setup: Setup, name: str, collection: object)[source]

Bases: Product

Product child Class that defines a SPICE Kernel file archive product.

Parameters:
  • setup (object) – NPB run Setup Object

  • name (str) – SPICE Kernel filename

  • collection (Object) – SPICE Kernel collection that will be a container of the SPICE Kernel Product Object

ck_kernel_ids()[source]

Extract IDs from CK.

Returns:

List of IDs present in the CK

Return type:

list

coverage()[source]

Determine the product coverage.

ik_kernel_ids()[source]

Extract IDs from IK.

Returns:

List of IDs present in the IK

Return type:

list

product_lid()[source]

Determine product logical identifier (LID).

Returns:

product LID

Return type:

str

product_vid()[source]

Determine product logical identifier (VID).

Returns:

product VID

Return type:

str

read_description()[source]

Read the kernel list to return the description.

The generated kernel list file must be used because it contains the description.

Returns:

Kernel Description from the Kernel List

Return type:

str

read_maklabel_options()[source]

Read the kernel list to return the MAKLABEL_OPTIONS.

The generated kernel list file must be used because it contains the MAKLABEL_OPTIONS.

Returns:

MAKLABEL_OPTIONS from kernel list

Return type:

str

class pds.naif_pds4_bundler.classes.product.SpicedsProduct(setup: object, collection: object)[source]

Bases: object

Product child class to process the SPICEDS file.

Parameters:
  • setup (object) – NPB execution setup object

  • collection (object) – Collection that the inventory product belongs to

check_cr()[source]

Determine whether if <CR> has to be added to the SPICEDS.

check_product()[source]

Check if the SPICEDS product needs to be generated.

Returns:

True if the SPICEDS products needs to be generated, False otherwise

Return type:

bool

compare()[source]

Compare the SPICEDS Product with another SPICEDS.

The SPICEDS Product is compared with the previous version and if it does not exist with the sample INSIGHT SPICEDS product.

set_product_lid()[source]

Set the Product LID.

set_product_vid()[source]

Set the Product VID.

pds.naif_pds4_bundler.classes.setup module

Setup Class Implementation.

class pds.naif_pds4_bundler.classes.setup.Setup(args: Object, version: str)[source]

Bases: object

Class that parses and processes the NPB XML configuration file.

Parameters:
  • args (object) – 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

information_model_setup()[source]

Setup and check PDS4 Information Model related things.

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.

set_release()[source]

Determine the Bundle release number.

write_checksum_registry()[source]

Write the run by-product Checksum Record.

write_file_list()[source]

Write the run by-product File List.

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 –-skip-context-validation            -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.skip-context-validation = true
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.