EnumConverter

class ccsdspy.converters.EnumConverter(replace_dict)[source]

Bases: Converter

Post-processing conversion for applying dictionary replacement of integers to strings.

If during conversion a value is encountered which does not have a corresponding key in the replacement dictionary, then a :py:class:`~ccsdspy.converters.EnumConverterMissingKey exception will be thrown.

Initialize a EnumConverter.

Parameters:
replace_dictdict of int to string

Replacement dictionary mapping integer values to string values

Raises:
TypeError

Either one of the keys of the replacement dictionary is not an integer, or one of the values is not a string.

Methods Summary

convert(field_array)

Apply the enum replacement conversion.

Methods Documentation

convert(field_array)[source]

Apply the enum replacement conversion.

Parameters:
field_arrayNumPy array

decoded packet field values, must have at least one dimension

Returns:
convertedNumPy array

converted form of the decoded packet field values