io.isis_serial_number — Generate ISIS3 Compliant Serial Numbers

The io.isis_serial_number, using translation tables loaded using the io.io_db module supports generation of ISIS3 compliant serial numbers. These are necessary when creating ISIS3 compliant control networks.

New in version 0.1.0.

class plio.io.isis_serial_number.SerialNumberDecoder(grammar=None, quantity_cls=None)[source]

A PVL Decoder class to handle cube label parsing for the purpose of creating a valid ISIS serial number. Inherits from the PVLDecoder in planetarypy’s pvl module.

decode_simple_value(value: str)[source]

Returns a Python object based on value, assuming that value can be decoded as a PVL Simple Value:

<Simple-Value> ::= (<Numeric> | <String>)

Modified from https://pvl.readthedocs.io/en/stable/_modules/pvl/decoder.html#PVLDecoder.decode_simple_value
Modification entails stripping datetime from list of functions.
decode_unquoted_string(value: str)str[source]

Returns a Python str if value can be decoded as an unquoted string, based on this decoder’s grammar. Raises a ValueError otherwise.

Modified from: https://pvl.readthedocs.io/en/stable/_modules/pvl/decoder.html#PVLDecoder.decode_unquoted_string Modification entails removal of decode_datetime call

plio.io.isis_serial_number.generate_serial_number(label)[source]

Generate an ISIS compatible serial number using the ISIS team’s translation files

Parameters

label (dict or str) – A PVLModule object (dict) or string PATH to a file containing a PVL header

Returns

The ISIS compatible serial number

Return type

str

plio.io.isis_serial_number.get_isis_translation(label)[source]

Compute the ISIS serial number for a given image using the input cube or the label extracted from the cube.

Parameters

label (dict or str) – A PVL dict object or file name to extract the PVL object from

Returns

translation – A PVLModule object containing the extracted translation file

Return type

dict

class plio.io.io_db.StringToMission(key, value)[source]

Table mapping for the ISIS mission name cleaner table

class plio.io.io_db.Translations(mission, instrument, translation)[source]

Table mapping for the ISIS Translation file table

plio.io.io_db.setup_db_session(db)[source]

Add a database session object to the root namespace

Parameters

db (str) – Database name

Returns

A SQLAlchemy session object

Return type

object