Ejemplo n.º 1
0
class DataType(Serializable):
    """
    Parameters that describe binary data components contained in the product.
    """

    _fields = ('SampleType', 'NumCPHDChannels', 'NumBytesVBP', 'ArraySize')
    _required = ('SampleType', 'NumBytesVBP', 'ArraySize')
    _collections_tags = {'ArraySize': {'array': False, 'child_tag': 'ArraySize'}}
    # descriptors
    SampleType = _StringEnumDescriptor(
        'SampleType', ("RE32F_IM32F", "RE16I_IM16I", "RE08I_IM08I"), _required, strict=True,
        docstring="Indicates the PHD sample format of the PHD array(s). All arrays "
                  "have the sample type. Real and imaginary components stored in adjacent "
                  "bytes, real component stored first.")  # type: str
    NumBytesVBP = _IntegerDescriptor(
        'NumBytesVBP', _required, strict=DEFAULT_STRICT, bounds=(1, None),
        docstring='Number of bytes per set of Vector Based Parameters.')  # type: int
    ArraySize = _SerializableListDescriptor(
        'ArraySize', ArraySizeType, _collections_tags, _required, strict=DEFAULT_STRICT,
        docstring='CPHD array size parameters.')  # type: List[ArraySizeType]

    def __init__(self, SampleType=None, NumBytesVBP=None, ArraySize=None, **kwargs):
        """

        Parameters
        ----------
        SampleType : str
        NumBytesVBP : int
        ArraySize : List[ArraySizeType]
        kwargs
        """

        if '_xml_ns' in kwargs:
            self._xml_ns = kwargs['_xml_ns']
        if '_xml_ns_key' in kwargs:
            self._xml_ns_key = kwargs['_xml_ns_key']
        self.SampleType = SampleType
        self.NumBytesVBP = NumBytesVBP
        self.ArraySize = ArraySize
        super(DataType, self).__init__(**kwargs)

    @property
    def NumCPHDChannels(self):
        """
        int: The number of CPHD channels.
        """

        if self.ArraySize is None:
            return 0
        return len(self.ArraySize)
Ejemplo n.º 2
0
class PositionalAccuracyType(Serializable):
    """
    Describes the horizontal and vertical point and regional information for the DED.
    """

    _fields = ('NumRegions', 'AbsoluteAccuracy', 'PointToPointAccuracy')
    _required = ('NumRegions', 'AbsoluteAccuracy', 'PointToPointAccuracy')
    # Descriptor
    NumRegions = _IntegerDescriptor(
        'NumRegions',
        _required,
        strict=DEFAULT_STRICT,
        docstring='Number of positional accuracy regions.')  # type: int
    AbsoluteAccuracy = _SerializableDescriptor(
        'AbsoluteAccuracy',
        AccuracyType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='')  # type: AccuracyType
    PointToPointAccuracy = _SerializableDescriptor(
        'PointToPointAccuracy',
        AccuracyType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='')  # type: AccuracyType

    def __init__(self,
                 NumRegions=None,
                 AbsoluteAccuracy=None,
                 PointToPointAccuracy=None,
                 **kwargs):
        """

        Parameters
        ----------
        NumRegions : int
        AbsoluteAccuracy : AccuracyType
        PointToPointAccuracy : AccuracyType
        kwargs
        """

        if '_xml_ns' in kwargs:
            self._xml_ns = kwargs['_xml_ns']
        if '_xml_ns_key' in kwargs:
            self._xml_ns_key = kwargs['_xml_ns_key']
        self.NumRegions = NumRegions
        self.AbsoluteAccuracy = AbsoluteAccuracy
        self.PointToPointAccuracy = PointToPointAccuracy
        super(PositionalAccuracyType, self).__init__(**kwargs)
Ejemplo n.º 3
0
class NonInteractiveProcessingType(Serializable):
    """
    The non-interactive processing information.
    """

    _fields = ('ProductGenerationOptions', 'RRDS', 'band')
    _required = ('ProductGenerationOptions', 'RRDS', 'band')
    _set_as_attribute = ('band', )
    # Descriptor
    ProductGenerationOptions = _SerializableDescriptor(
        'ProductGenerationOptions',
        ProductGenerationOptionsType,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Performs several key actions on an image to prepare it for necessary additional processing to '
        'achieve the desired output product.'
    )  # type: ProductGenerationOptionsType
    RRDS = _SerializableDescriptor(
        'RRDS',
        RRDSType,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Creates a set of sub-sampled versions of an image to provide processing chains '
        'with quick access to lower magnification values for faster computation '
        'speeds and performance.')  # type: RRDSType
    band = _IntegerDescriptor(
        'band',
        _required,
        strict=DEFAULT_STRICT,
        docstring='The image band to which this applies.')  # type: int

    def __init__(self,
                 ProductGenerationOptions=None,
                 RRDS=None,
                 band=1,
                 **kwargs):
        if '_xml_ns' in kwargs:
            self._xml_ns = kwargs['_xml_ns']
        if '_xml_ns_key' in kwargs:
            self._xml_ns_key = kwargs['_xml_ns_key']
        self.ProductGenerationOptions = ProductGenerationOptions
        self.RRDS = RRDS
        self.band = band
        super(NonInteractiveProcessingType, self).__init__(**kwargs)
Ejemplo n.º 4
0
class PerVectorParameterF8(Serializable):
    _fields = ('Offset', 'Size', 'Format')
    _required = ('Offset', )
    # descriptors
    Offset = _IntegerDescriptor('Offset',
                                _required,
                                strict=DEFAULT_STRICT,
                                bounds=(0, None),
                                docstring='The offset value.')  # type: int

    def __init__(self, Offset=None, **kwargs):
        """

        Parameters
        ----------
        Offset : int
        kwargs
        """

        if '_xml_ns' in kwargs:
            self._xml_ns = kwargs['_xml_ns']
        if '_xml_ns_key' in kwargs:
            self._xml_ns_key = kwargs['_xml_ns_key']
        self.Offset = Offset
        super(PerVectorParameterF8, self).__init__(**kwargs)

    @property
    def Size(self):
        """
        int: The size of the vector, constant value 1 here.
        """

        return 1

    @property
    def Format(self):
        """
        str: The format of the vector data, constant value 'F8' here.
        """

        return 'F8'
Ejemplo n.º 5
0
class DynamicRangeAdjustmentType(Serializable):
    """
    The dynamic range adjustment (DRA) parameters.
    """
    _fields = ('AlgorithmType', 'BandStatsSource', 'DRAParameters',
               'DRAOverrides')
    _required = (
        'AlgorithmType',
        'BandStatsSource',
    )
    # Descriptor
    AlgorithmType = _StringEnumDescriptor(
        'AlgorithmType', ('AUTO', 'MANUAL', 'NONE'),
        _required,
        strict=DEFAULT_STRICT,
        default_value='NONE',
        docstring='Algorithm used for dynamic range adjustment.')  # type: str
    BandStatsSource = _IntegerDescriptor('BandStatsSource',
                                         _required,
                                         strict=DEFAULT_STRICT,
                                         docstring='')  # type: int
    DRAParameters = _SerializableDescriptor(
        'DRAParameters',
        DRAParametersType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='The dynamic range adjustment parameters.'
    )  # type: DRAParametersType
    DRAOverrides = _SerializableDescriptor(
        'DRAOverrides',
        DRAOverridesType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='The dynamic range adjustment overrides.'
    )  # type: DRAOverridesType

    def __init__(self,
                 AlgorithmType='NONE',
                 BandStatsSource=None,
                 DRAParameters=None,
                 DRAOverrides=None,
                 **kwargs):
        """

        Parameters
        ----------
        AlgorithmType : str
        BandStatsSource : int
        DRAParameters : DRAParametersType
        DRAOverrides : DRAOverridesType
        kwargs
        """

        if '_xml_ns' in kwargs:
            self._xml_ns = kwargs['_xml_ns']
        if '_xml_ns_key' in kwargs:
            self._xml_ns_key = kwargs['_xml_ns_key']
        self.AlgorithmType = AlgorithmType
        self.BandStatsSource = BandStatsSource
        self.DRAParameters = DRAParameters
        self.DRAOverrides = DRAOverrides
        super(DynamicRangeAdjustmentType, self).__init__(**kwargs)
Ejemplo n.º 6
0
class CPHDHeader(CPHDHeaderBase):
    _fields = ('XML_DATA_SIZE', 'XML_BYTE_OFFSET', 'VB_DATA_SIZE',
               'VB_BYTE_OFFSET', 'CPHD_DATA_SIZE', 'CPHD_BYTE_OFFSET',
               'CLASSIFICATION', 'RELEASE_INFO')
    _required = ('XML_DATA_SIZE', 'XML_BYTE_OFFSET', 'VB_DATA_SIZE',
                 'VB_BYTE_OFFSET', 'CPHD_DATA_SIZE', 'CPHD_BYTE_OFFSET')
    # descriptor
    XML_DATA_SIZE = _IntegerDescriptor(
        'XML_DATA_SIZE',
        _required,
        strict=True,
        docstring=
        'Size of the XML Metadata in bytes. Does not include the 2 bytes '
        'of the section terminator.')  # type: int
    XML_BYTE_OFFSET = _IntegerDescriptor(
        'XML_BYTE_OFFSET',
        _required,
        strict=True,
        docstring='Offset to the first byte of the XML Metadata in bytes.'
    )  # type: int
    VB_DATA_SIZE = _IntegerDescriptor(
        'VB_DATA_SIZE',
        _required,
        strict=True,
        docstring='Size of the Vector Based Metadata in bytes.')  # type: int
    VB_BYTE_OFFSET = _IntegerDescriptor(
        'VB_BYTE_OFFSET',
        _required,
        strict=True,
        docstring=
        'Offset to the first byte of the Vector Based Metadata in bytes.'
    )  # type: int
    CPHD_DATA_SIZE = _IntegerDescriptor(
        'CPHD_DATA_SIZE',
        _required,
        strict=True,
        docstring='Size of the Compensated PHD arrays in bytes.')  # type: int
    CPHD_BYTE_OFFSET = _IntegerDescriptor(
        'CPHD_BYTE_OFFSET',
        _required,
        strict=True,
        docstring='Offset to the first byte of the CPHD data in bytes.'
    )  # type: int
    CLASSIFICATION = _StringDescriptor(
        'CLASSIFICATION',
        _required,
        strict=True,
        default_value='UNCLASSIFIED',
        docstring=
        'Product classification information that is the human-readable banner.'
    )  # type: str
    RELEASE_INFO = _StringDescriptor(
        'RELEASE_INFO',
        _required,
        strict=True,
        default_value='UNRESTRICTED',
        docstring='Product release information.')  # type: str

    def __init__(self,
                 XML_DATA_SIZE=None,
                 XML_BYTE_OFFSET=None,
                 VB_DATA_SIZE=None,
                 VB_BYTE_OFFSET=None,
                 CPHD_DATA_SIZE=None,
                 CPHD_BYTE_OFFSET=None,
                 CLASSIFICATION='UNCLASSIFIED',
                 RELEASE_INFO='UNRESTRICTED'):
        self.XML_DATA_SIZE = XML_DATA_SIZE
        self.XML_BYTE_OFFSET = XML_BYTE_OFFSET
        self.VB_DATA_SIZE = VB_DATA_SIZE
        self.VB_BYTE_OFFSET = VB_BYTE_OFFSET
        self.CPHD_DATA_SIZE = CPHD_DATA_SIZE
        self.CPHD_BYTE_OFFSET = CPHD_BYTE_OFFSET
        self.CLASSIFICATION = CLASSIFICATION
        self.RELEASE_INFO = RELEASE_INFO
        super(CPHDHeader, self).__init__()
Ejemplo n.º 7
0
class CPHDHeader(CPHDHeaderBase):
    _fields = (
        'XML_BLOCK_SIZE', 'XML_BLOCK_BYTE_OFFSET', 'SUPPORT_BLOCK_SIZE', 'SUPPORT_BLOCK_BYTE_OFFSET',
        'PVP_BLOCK_SIZE', 'PVP_BLOCK_BYTE_OFFSET', 'SIGNAL_BLOCK_SIZE', 'SIGNAL_BLOCK_BYTE_OFFSET',
        'CLASSIFICATION', 'RELEASE_INFO')
    _required = (
        'XML_BLOCK_SIZE', 'XML_BLOCK_BYTE_OFFSET', 'PVP_BLOCK_SIZE', 'PVP_BLOCK_BYTE_OFFSET',
        'SIGNAL_BLOCK_SIZE', 'SIGNAL_BLOCK_BYTE_OFFSET', 'CLASSIFICATION', 'RELEASE_INFO')
    # descriptor
    XML_BLOCK_SIZE = _IntegerDescriptor(
        'XML_BLOCK_SIZE', _required, strict=True,
        docstring='ize of the XML instance that describes the product in bytes. '
                  'Size does NOT include the 2 bytes of the section terminator.')  # type: int
    XML_BLOCK_BYTE_OFFSET = _IntegerDescriptor(
        'XML_BLOCK_BYTE_OFFSET', _required, strict=True,
        docstring='Offset to the first byte of the XML block in bytes.')  # type: int
    SUPPORT_BLOCK_SIZE = _IntegerDescriptor(
        'SUPPORT_BLOCK_SIZE', _required, strict=True,
        docstring='Size of the Support block in bytes. Note - If the Support block is omitted, this '
                  'is not included.')  # type: int
    SUPPORT_BLOCK_BYTE_OFFSET = _IntegerDescriptor(
        'SUPPORT_BLOCK_BYTE_OFFSET', _required, strict=True,
        docstring='Offset to the first byte of the Support block in bytes. Note - If the Support '
                  'block is omitted, this is not included.')  # type: int
    PVP_BLOCK_SIZE = _IntegerDescriptor(
        'PVP_BLOCK_SIZE', _required, strict=True,
        docstring='Size of the PVP block in bytes.')  # type: int
    PVP_BLOCK_BYTE_OFFSET = _IntegerDescriptor(
        'PVP_BLOCK_BYTE_OFFSET', _required, strict=True,
        docstring='Offset to the first byte of the PVP block in bytes.')  # type: int
    SIGNAL_BLOCK_SIZE = _IntegerDescriptor(
        'SIGNAL_BLOCK_SIZE', _required, strict=True,
        docstring='Size of the Signal block in bytes.')  # type: int
    SIGNAL_BLOCK_BYTE_OFFSET = _IntegerDescriptor(
        'SIGNAL_BLOCK_BYTE_OFFSET', _required, strict=True,
        docstring='Offset to the first byte of the Signal block in bytes.')  # type: int
    CLASSIFICATION = _StringDescriptor(
        'CLASSIFICATION', _required, strict=True, default_value='UNCLASSIFIED',
        docstring='Product classification information that is human-readable.')  # type: str
    RELEASE_INFO = _StringDescriptor(
        'RELEASE_INFO', _required, strict=True, default_value='UNRESTRICTED',
        docstring='Product release information that is human-readable.')  # type: str

    def __init__(self, XML_BLOCK_SIZE=None, XML_BLOCK_BYTE_OFFSET=None,
                 SUPPORT_BLOCK_SIZE= None, SUPPORT_BLOCK_BYTE_OFFSET=None,
                 PVP_BLOCK_SIZE=None, PVP_BLOCK_BYTE_OFFSET=None,
                 SIGNAL_BLOCK_SIZE=None, SIGNAL_BLOCK_BYTE_OFFSET=None,
                 CLASSIFICATION='UNCLASSIFIED', RELEASE_INFO='UNRESTRICTED'):
        self.XML_BLOCK_SIZE = XML_BLOCK_SIZE
        self.XML_BLOCK_BYTE_OFFSET = XML_BLOCK_BYTE_OFFSET
        self.SUPPORT_BLOCK_SIZE = SUPPORT_BLOCK_SIZE
        self.SUPPORT_BLOCK_BYTE_OFFSET = SUPPORT_BLOCK_BYTE_OFFSET
        self.PVP_BLOCK_SIZE = PVP_BLOCK_SIZE
        self.PVP_BLOCK_BYTE_OFFSET = PVP_BLOCK_BYTE_OFFSET
        self.SIGNAL_BLOCK_SIZE = SIGNAL_BLOCK_SIZE
        self.SIGNAL_BLOCK_BYTE_OFFSET = SIGNAL_BLOCK_BYTE_OFFSET
        self.CLASSIFICATION = CLASSIFICATION
        self.RELEASE_INFO = RELEASE_INFO
        super(CPHDHeader, self).__init__()

    def to_string(self):
        """
        Forms a CPHD file header string (not including the section terminator) from populated attributes.
        """
        return ('CPHD/{}\n'.format(_CPHD_SPECIFICATION_VERSION)
                + ''.join(["{} := {}\n".format(f, getattr(self,f)) for f in self._fields if getattr(self, f) is not None]))
Ejemplo n.º 8
0
class ChannelParametersType(Serializable):
    _fields = ('Identifier', 'RefVectorIndex', 'FXFixed', 'TOAFixed',
               'SRPFixed', 'SignalNormal', 'Polarization', 'FxC', 'FxBW',
               'FxBWNoise', 'TOASaved', 'TOAExtended', 'DwellTimes',
               'ImageArea', 'Antenna', 'TxRcv', 'TgtRefLevel', 'NoiseLevel')
    _required = ('Identifier', 'RefVectorIndex', 'FXFixed', 'TOAFixed',
                 'SRPFixed', 'Polarization', 'FxC', 'FxBW', 'TOASaved',
                 'DwellTimes')
    _numeric_format = {
        'FxC': '0.16G',
        'FxBW': '0.16G',
        'FxBWNoise': '0.16G',
        'TOASaved': '0.16G'
    }
    # descriptors
    Identifier = _StringDescriptor(
        'Identifier',
        _required,
        strict=DEFAULT_STRICT,
        docstring='String that uniquely identifies this CPHD data channel.'
    )  # type: str
    RefVectorIndex = _IntegerDescriptor(
        'RefVectorIndex',
        _required,
        strict=DEFAULT_STRICT,
        bounds=(0, None),
        docstring='Index of the reference vector for the channel.'
    )  # type: int
    FXFixed = _BooleanDescriptor(
        'FXFixed',
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Flag to indicate when a constant FX band is saved for all signal '
        'vectors of the channel.')  # type: bool
    TOAFixed = _BooleanDescriptor(
        'TOAFixed',
        _required,
        strict=DEFAULT_STRICT,
        docstring='Flag to indicate when a constant TOA swath is saved for all '
        'signal vectors of the channel.')  # type: bool
    SRPFixed = _BooleanDescriptor(
        'SRPFixed',
        _required,
        strict=DEFAULT_STRICT,
        docstring='Flag to indicate when a constant SRP position is used all '
        'signal vectors of the channel.')  # type: bool
    SignalNormal = _BooleanDescriptor(
        'SignalNormal',
        _required,
        strict=DEFAULT_STRICT,
        docstring='Flag to indicate when all signal array vectors are normal. '
        'Included if and only if the SIGNAL PVP is also included.'
    )  # type: bool
    Polarization = _SerializableDescriptor(
        'Polarization',
        PolarizationType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='Polarization(s) of the signals that formed the signal '
        'array.')  # type: PolarizationType
    FxC = _FloatDescriptor(
        'FxC',
        _required,
        strict=DEFAULT_STRICT,
        bounds=(0, None),
        docstring=
        'FX center frequency value for saved bandwidth for the channel. '
        'Computed from all vectors of the signal array.')  # type: float
    FxBW = _FloatDescriptor(
        'FxBW',
        _required,
        strict=DEFAULT_STRICT,
        bounds=(0, None),
        docstring='FX band spanned for the saved bandwidth for the channel. '
        'Computed from all vectors of the signal array.')  # type: float
    FxBWNoise = _FloatDescriptor(
        'FxBWNoise',
        _required,
        strict=DEFAULT_STRICT,
        bounds=(0, None),
        docstring=
        'FX signal bandwidth saved that includes noise signal below or '
        'above the retained echo signal bandwidth.')  # type: float
    TOASaved = _FloatDescriptor(
        'TOASaved',
        _required,
        strict=DEFAULT_STRICT,
        bounds=(0, None),
        docstring=
        'TOA swath saved for the full resolution echoes for the channel.'
    )  # type: float
    TOAExtended = _SerializableDescriptor(
        'TOAExtended',
        TOAExtendedType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='TOA extended swath information.'
    )  # type: Union[None, TOAExtendedType]
    DwellTimes = _SerializableDescriptor(
        'DwellTimes',
        DwellTimesType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='COD Time and Dwell Time polynomials over the image area.'
    )  # type: DwellTimesType
    ImageArea = _SerializableDescriptor(
        'ImageArea',
        AreaType,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Image Area for the CPHD channel defined by a rectangle aligned with '
        '(IAX, IAY). May be reduced by the optional '
        'polygon.')  # type: Union[None, AreaType]
    Antenna = _SerializableDescriptor(
        'Antenna',
        AntennaType,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Antenna Phase Center and Antenna Pattern identifiers for the antenna(s) '
        'used to collect and form the signal array data.'
    )  # type: Union[None, AntennaType]
    TxRcv = _SerializableDescriptor(
        'TxRcv',
        TxRcvType,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Parameters to identify the Transmit and Receive parameter sets '
        'used to collect the signal array.')  # type: Union[None, TxRcvType]
    TgtRefLevel = _SerializableDescriptor(
        'TgtRefLevel',
        TgtRefLevelType,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Signal level for an ideal point scatterer located at the SRP for '
        'reference signal vector.')  # type: Union[None, TgtRefLevelType]
    NoiseLevel = _SerializableDescriptor(
        'NoiseLevel',
        NoiseLevelType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='Thermal noise level for the reference signal '
        'vector.')  # type: Union[None, NoiseLevelType]

    def __init__(self,
                 Identifier=None,
                 RefVectorIndex=None,
                 FXFixed=None,
                 TOAFixed=None,
                 SRPFixed=None,
                 SignalNormal=None,
                 Polarization=None,
                 FxC=None,
                 FxBW=None,
                 FxBWNoise=None,
                 TOASaved=None,
                 TOAExtended=None,
                 DwellTimes=None,
                 ImageArea=None,
                 Antenna=None,
                 TxRcv=None,
                 TgtRefLevel=None,
                 NoiseLevel=None,
                 **kwargs):
        """

        Parameters
        ----------
        Identifier : str
        RefVectorIndex : int
        FXFixed : bool
        TOAFixed : bool
        SRPFixed : bool
        SignalNormal : None|bool
        Polarization : PolarizationType
        FxC : float
        FxBW : float
        FxBWNoise : None|float
        TOASaved : float
        TOAExtended : None|TOAExtendedType
        DwellTimes : DwellTimesType
        ImageArea : None|AreaType
        Antenna : None|AntennaType
        TxRcv : None|TxRcvType
        TgtRefLevel : None|TgtRefLevelType
        NoiseLevel : None|NoiseLevelType
        kwargs
        """

        if '_xml_ns' in kwargs:
            self._xml_ns = kwargs['_xml_ns']
        if '_xml_ns_key' in kwargs:
            self._xml_ns_key = kwargs['_xml_ns_key']
        self.Identifier = Identifier
        self.RefVectorIndex = RefVectorIndex
        self.FXFixed = FXFixed
        self.TOAFixed = TOAFixed
        self.SRPFixed = SRPFixed
        self.SignalNormal = SignalNormal
        self.Polarization = Polarization
        self.FxC = FxC
        self.FxBW = FxBW
        self.FxBWNoise = FxBWNoise
        self.TOASaved = TOASaved
        self.TOAExtended = TOAExtended
        self.DwellTimes = DwellTimes
        self.ImageArea = ImageArea
        self.Antenna = Antenna
        self.TxRcv = TxRcv
        self.TgtRefLevel = TgtRefLevel
        self.NoiseLevel = NoiseLevel
        super(ChannelParametersType, self).__init__(**kwargs)
Ejemplo n.º 9
0
class ChannelSizeType(Serializable):
    """
    Parameters that define the Channel signal array and PVP array size and location.
    """

    _fields = ('Identifier', 'NumVectors', 'NumSamples',
               'SignalArrayByteOffset', 'PVPArrayByteOffset',
               'CompressedSignalSize')
    _required = ('Identifier', 'NumVectors', 'NumSamples',
                 'SignalArrayByteOffset', 'PVPArrayByteOffset')
    # descriptors
    Identifier = _StringDescriptor(
        'Identifier',
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'String that uniquely identifies the CPHD channel for which the data '
        'applies.')  # type: str
    NumVectors = _IntegerDescriptor(
        'NumVectors',
        _required,
        strict=DEFAULT_STRICT,
        bounds=(1, None),
        docstring='Number of vectors in the signal array.')  # type: int
    NumSamples = _IntegerDescriptor(
        'NumSamples',
        _required,
        strict=DEFAULT_STRICT,
        bounds=(1, None),
        docstring='Number of samples per vector in the signal array.'
    )  # type: int
    SignalArrayByteOffset = _IntegerDescriptor(
        'SignalArrayByteOffset',
        _required,
        strict=DEFAULT_STRICT,
        bounds=(0, None),
        docstring=
        'Signal Array offset from the start of the Signal block (in bytes) to the '
        'start of the Signal Array for the channel.')  # type: int
    PVPArrayByteOffset = _IntegerDescriptor(
        'PVPArrayByteOffset',
        _required,
        strict=DEFAULT_STRICT,
        bounds=(0, None),
        docstring=
        'PVP Array offset from the start of the PVP block (in bytes) to the '
        'start of the PVP Array for the channel.')  # type: int
    CompressedSignalSize = _IntegerDescriptor(
        'CompressedSignalSize',
        _required,
        strict=DEFAULT_STRICT,
        bounds=(1, None),
        docstring=
        'Size (in bytes) of the compressed signal array byte sequence for the data channel. '
        'Parameter included if and only if the signal arrays are stored in '
        'compressed format.')  # type: int

    def __init__(self,
                 Identifier=None,
                 NumVectors=None,
                 NumSamples=None,
                 SignalArrayByteOffset=None,
                 PVPArrayByteOffset=None,
                 CompressedSignalSize=None,
                 **kwargs):
        """

        Parameters
        ----------
        Identifier : str
        NumVectors : int
        NumSamples : int
        SignalArrayByteOffset : int
        PVPArrayByteOffset : int
        CompressedSignalSize : int
        kwargs
        """

        if '_xml_ns' in kwargs:
            self._xml_ns = kwargs['_xml_ns']
        if '_xml_ns_key' in kwargs:
            self._xml_ns_key = kwargs['_xml_ns_key']
        self.Identifier = Identifier
        self.NumVectors = NumVectors
        self.NumSamples = NumSamples
        self.SignalArrayByteOffset = SignalArrayByteOffset
        self.PVPArrayByteOffset = PVPArrayByteOffset
        self.CompressedSignalSize = CompressedSignalSize
        super(ChannelSizeType, self).__init__(**kwargs)
Ejemplo n.º 10
0
class SupportArraySizeType(Serializable):
    """
    Support Array size parameters.
    """

    _fields = ('Identifier', 'NumRows', 'NumCols', 'BytesPerElement',
               'ArrayByteOffset')
    _required = _fields
    # descriptors
    Identifier = _StringDescriptor(
        'Identifier',
        _required,
        strict=DEFAULT_STRICT,
        docstring='Unique string that identifies this support array.'
    )  # type: str
    NumRows = _IntegerDescriptor(
        'NumRows',
        _required,
        strict=DEFAULT_STRICT,
        bounds=(1, None),
        docstring='Number of rows in the array.')  # type: int
    NumCols = _IntegerDescriptor(
        'NumCols',
        _required,
        strict=DEFAULT_STRICT,
        bounds=(1, None),
        docstring='Number of columns per row in the array.')  # type: int
    BytesPerElement = _IntegerDescriptor(
        'BytesPerElement',
        _required,
        strict=DEFAULT_STRICT,
        bounds=(1, None),
        docstring=
        'Indicates the size in bytes of each data element in the support '
        'array. Each element contains 1 or more binary-formatted '
        'components.')  # type: int
    ArrayByteOffset = _IntegerDescriptor(
        'ArrayByteOffset',
        _required,
        strict=DEFAULT_STRICT,
        bounds=(0, None),
        docstring=
        'Array offset from the start of the Support block (in bytes) to '
        'the start of the support array.')  # type: int

    def __init__(self,
                 Identifier=None,
                 NumRows=None,
                 NumCols=None,
                 BytesPerElement=None,
                 ArrayByteOffset=None,
                 **kwargs):
        """

        Parameters
        ----------
        Identifier : str
        NumRows : int
        NumCols : int
        BytesPerElement : int
        ArrayByteOffset : int
        kwargs
        """

        if '_xml_ns' in kwargs:
            self._xml_ns = kwargs['_xml_ns']
        if '_xml_ns_key' in kwargs:
            self._xml_ns_key = kwargs['_xml_ns_key']
        self.Identifier = Identifier
        self.NumRows = NumRows
        self.NumCols = NumCols
        self.BytesPerElement = BytesPerElement
        self.ArrayByteOffset = ArrayByteOffset
        super(SupportArraySizeType, self).__init__(**kwargs)
Ejemplo n.º 11
0
class ProductClassificationType(Serializable):
    """
    The overall classification of the product.
    """
    _fields = ('DESVersion', 'resourceElement', 'createDate', 'compliesWith',
               'ISMCATCESVersion', 'classification', 'ownerProducer',
               'SCIcontrols', 'SARIdentifier', 'disseminationControls',
               'FGIsourceOpen', 'FGIsourceProtected', 'releasableTo',
               'nonICmarkings', 'classifiedBy', 'compilationReason',
               'derivativelyClassifiedBy', 'classificationReason',
               'nonUSControls', 'derivedFrom', 'declassDate', 'declassEvent',
               'declassException', 'typeOfExemptedSource',
               'dateOfExemptedSource', 'SecurityExtensions')
    _required = ('DESVersion', 'createDate', 'classification', 'ownerProducer',
                 'compliesWith', 'ISMCATCESVersion')
    _collections_tags = {
        'SecurityExtensions': {
            'array': False,
            'child_tag': 'SecurityExtension'
        }
    }
    _set_as_attribute = ('DESVersion', 'resourceElement', 'createDate',
                         'compliesWith', 'ISMCATCESVersion', 'classification',
                         'ownerProducer', 'SCIcontrols', 'SARIdentifier',
                         'disseminationControls', 'FGIsourceOpen',
                         'FGIsourceProtected', 'releasableTo', 'nonICmarkings',
                         'classifiedBy', 'compilationReason',
                         'derivativelyClassifiedBy', 'classificationReason',
                         'nonUSControls', 'derivedFrom', 'declassDate',
                         'declassEvent', 'declassException',
                         'typeOfExemptedSource', 'dateOfExemptedSource')
    _child_xml_ns_key = {
        the_field: 'ism'
        for the_field in _fields if the_field != 'SecurityExtensions'
    }
    # Descriptor
    DESVersion = _IntegerDescriptor(
        'DESVersion',
        _required,
        strict=DEFAULT_STRICT,
        default_value=13,
        docstring=
        'The version number of the DES. Should there be multiple specified in an instance document '
        'the one at the root node is the one that will apply to the entire document.'
    )  # type: int
    createDate = _StringDescriptor(
        'createDate',
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'This should be a date of format :code:`YYYY-MM-DD`, but this is not checked.'
    )  # type: str
    compliesWith = _StringDescriptor('compliesWith',
                                     _required,
                                     strict=DEFAULT_STRICT,
                                     default_value='USGov',
                                     docstring='')  # type: Union[None, str]
    ISMCATCESVersion = _StringDescriptor(
        'ISMCATCESVersion',
        _required,
        strict=DEFAULT_STRICT,
        default_value='201903',
        docstring='')  # type: Union[None, str]
    classification = _StringEnumDescriptor('classification',
                                           ('U', 'C', 'R', 'S', 'TS'),
                                           _required,
                                           strict=DEFAULT_STRICT,
                                           docstring='')  # type: str
    ownerProducer = _StringDescriptor(
        'ownerProducer',
        _required,
        strict=DEFAULT_STRICT,  # default_value='USA',
        docstring='')  # type: str
    SCIcontrols = _StringDescriptor('SCIcontrols',
                                    _required,
                                    strict=DEFAULT_STRICT,
                                    docstring='')  # type: Union[None, str]
    SARIdentifier = _StringDescriptor('SARIdentifier',
                                      _required,
                                      strict=DEFAULT_STRICT,
                                      docstring='')  # type: Union[None, str]
    disseminationControls = _StringDescriptor(
        'disseminationControls',
        _required,
        strict=DEFAULT_STRICT,
        docstring='')  # type: Union[None, str]
    FGIsourceOpen = _StringDescriptor('FGIsourceOpen',
                                      _required,
                                      strict=DEFAULT_STRICT,
                                      docstring='')  # type: Union[None, str]
    FGIsourceProtected = _StringDescriptor(
        'FGIsourceProtected', _required, strict=DEFAULT_STRICT,
        docstring='')  # type: Union[None, str]
    releasableTo = _StringDescriptor('releasableTo',
                                     _required,
                                     strict=DEFAULT_STRICT,
                                     docstring='')  # type: Union[None, str]
    nonICmarkings = _StringDescriptor('nonICmarkings',
                                      _required,
                                      strict=DEFAULT_STRICT,
                                      docstring='')  # type: Union[None, str]
    classifiedBy = _StringDescriptor('classifiedBy',
                                     _required,
                                     strict=DEFAULT_STRICT,
                                     docstring='')  # type: Union[None, str]
    compilationReason = _StringDescriptor(
        'compilationReason', _required, strict=DEFAULT_STRICT,
        docstring='')  # type: Union[None, str]
    derivativelyClassifiedBy = _StringDescriptor(
        'derivativelyClassifiedBy',
        _required,
        strict=DEFAULT_STRICT,
        docstring='')  # type: Union[None, str]
    classificationReason = _StringDescriptor(
        'classificationReason', _required, strict=DEFAULT_STRICT,
        docstring='')  # type: Union[None, str]
    nonUSControls = _StringDescriptor('nonUSControls',
                                      _required,
                                      strict=DEFAULT_STRICT,
                                      docstring='')  # type: Union[None, str]
    derivedFrom = _StringDescriptor('derivedFrom',
                                    _required,
                                    strict=DEFAULT_STRICT,
                                    docstring='')  # type: Union[None, str]
    declassDate = _StringDescriptor('declassDate',
                                    _required,
                                    strict=DEFAULT_STRICT,
                                    docstring='')  # type: Union[None, str]
    declassEvent = _StringDescriptor('declassEvent',
                                     _required,
                                     strict=DEFAULT_STRICT,
                                     docstring='')  # type: Union[None, str]
    declassException = _StringDescriptor(
        'declassException', _required, strict=DEFAULT_STRICT,
        docstring='')  # type: Union[None, str]
    typeOfExemptedSource = _StringDescriptor(
        'typeOfExemptedSource', _required, strict=DEFAULT_STRICT,
        docstring='')  # type: Union[None, str]
    dateOfExemptedSource = _StringDescriptor(
        'dateOfExemptedSource', _required, strict=DEFAULT_STRICT,
        docstring='')  # type: Union[None, str]
    SecurityExtensions = _ParametersDescriptor(
        'SecurityExtensions',
        _collections_tags,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Extensible parameters used to support profile-specific needs related to '
        'product security.')  # type: ParametersCollection

    def __init__(self,
                 DESVersion=13,
                 createDate=None,
                 compliesWith='USGov',
                 ISMCATCESVersion='201903',
                 classification='U',
                 ownerProducer='USA',
                 SCIcontrols=None,
                 SARIdentifier=None,
                 disseminationControls=None,
                 FGIsourceOpen=None,
                 FGIsourceProtected=None,
                 releasableTo=None,
                 nonICmarkings=None,
                 classifiedBy=None,
                 compilationReason=None,
                 derivativelyClassifiedBy=None,
                 classificationReason=None,
                 nonUSControls=None,
                 derivedFrom=None,
                 declassDate=None,
                 declassEvent=None,
                 declassException=None,
                 typeOfExemptedSource=None,
                 dateOfExemptedSource=None,
                 SecurityExtensions=None,
                 **kwargs):
        """

        Parameters
        ----------
        DESVersion : int
        createDate : str
        compliesWith : None|str
        ISMCATCESVersion : None|str
        classification : str
        ownerProducer : str
        SCIcontrols : None|str
        SARIdentifier : None|str
        disseminationControls : None|str
        FGIsourceOpen : None|str
        FGIsourceProtected : None|str
        releasableTo : None|str
        nonICmarkings : None|str
        classifiedBy : None|str
        compilationReason : None|str
        derivativelyClassifiedBy : None|str
        classificationReason : None|str
        nonUSControls : None|str
        derivedFrom : None|str
        declassDate : None|str
        declassEvent : None|str
        declassException : None|str
        typeOfExemptedSource : None|str
        dateOfExemptedSource : None|str
        SecurityExtensions : None|ParametersCollection|dict
        kwargs
        """

        if '_xml_ns' in kwargs:
            self._xml_ns = kwargs['_xml_ns']
        if '_xml_ns_key' in kwargs:
            self._xml_ns_key = kwargs['_xml_ns_key']
        self.DESVersion = DESVersion
        self.createDate = createDate
        self.compliesWith = compliesWith
        self.ISMCATCESVersion = ISMCATCESVersion
        self.classification = classification
        self.ownerProducer = ownerProducer
        self.SCIcontrols = SCIcontrols
        self.SARIdentifier = SARIdentifier
        self.disseminationControls = disseminationControls
        self.FGIsourceOpen = FGIsourceOpen
        self.FGIsourceProtected = FGIsourceProtected
        self.releasableTo = releasableTo
        self.nonICmarkings = nonICmarkings
        self.classifiedBy = classifiedBy
        self.compilationReason = compilationReason
        self.derivativelyClassifiedBy = derivativelyClassifiedBy
        self.classificationReason = classificationReason
        self.nonUSControls = nonUSControls
        self.derivedFrom = derivedFrom
        self.declassDate = declassDate
        self.declassEvent = declassEvent
        self.declassException = declassException
        self.typeOfExemptedSource = typeOfExemptedSource
        self.dateOfExemptedSource = dateOfExemptedSource
        self.SecurityExtensions = SecurityExtensions
        super(ProductClassificationType, self).__init__(**kwargs)

    @property
    def resourceElement(self):
        return 'true'

    @classmethod
    def from_sicd(cls, sicd, create_date=None):
        """
        Extract best guess from SICD.

        Parameters
        ----------
        sicd : SICDType
        create_date : str

        Returns
        -------
        ProductClassificationType
        """

        if not isinstance(sicd, SICDType):
            raise TypeError('Requires SICDType instance, got type {}'.format(
                type(sicd)))

        c_str = sicd.CollectionInfo.Classification

        if 'UNCLASS' in c_str.upper():
            clas = 'U'
        elif 'CONFIDENTIAL' in c_str.upper():
            clas = 'C'
        elif 'TOP SECRET' in c_str.upper():
            clas = 'TS'
        elif 'SECRET' in c_str.upper():
            clas = 'S'
        elif 'FOUO' in c_str.upper() or 'RESTRICTED' in c_str.upper():
            clas = 'R'
        else:
            logging.critical(
                'Unclear how to extract classification code for classification string {}. '
                'Should be set appropriately.'.format(c_str))
            clas = None

        if create_date is None:
            create_date = datetime.now().strftime('%Y-%m-%d')

        return cls(classification=clas, createDate=create_date)
Ejemplo n.º 12
0
class GeopositioningType(Serializable):
    """
    Describes the absolute coordinate system to which the data is referenced.
    """
    _fields = ('CoordinateSystemType', 'GeodeticDatum', 'ReferenceEllipsoid',
               'VerticalDatum', 'SoundingDatum', 'FalseOrigin',
               'UTMGridZoneNumber')
    _required = ('CoordinateSystemType', 'GeodeticDatum', 'ReferenceEllipsoid',
                 'VerticalDatum', 'SoundingDatum', 'FalseOrigin')
    # Descriptor
    CoordinateSystemType = _StringEnumDescriptor('CoordinateSystemType',
                                                 ('GGS', 'UTM'),
                                                 _required,
                                                 strict=DEFAULT_STRICT,
                                                 docstring='')  # type: str
    GeodeticDatum = _StringEnumDescriptor(
        'GeodeticDatum', ('World Geodetic System 1984', ),
        _required,
        strict=DEFAULT_STRICT,
        default_value='World Geodetic System 1984',
        docstring='')  # type: str
    ReferenceEllipsoid = _StringEnumDescriptor(
        'ReferenceEllipsoid', ('World Geodetic System 1984', ),
        _required,
        strict=DEFAULT_STRICT,
        default_value='World Geodetic System 1984',
        docstring='')  # type: str
    VerticalDatum = _StringEnumDescriptor('VerticalDatum',
                                          ('Mean Sea Level', ),
                                          _required,
                                          strict=DEFAULT_STRICT,
                                          default_value='Mean Sea Level',
                                          docstring='')  # type: str
    SoundingDatum = _StringEnumDescriptor('SoundingDatum',
                                          ('Mean Sea Level', ),
                                          _required,
                                          strict=DEFAULT_STRICT,
                                          default_value='Mean Sea Level',
                                          docstring='')  # type: str
    FalseOrigin = _IntegerDescriptor(
        'FalseOrigin',
        _required,
        strict=DEFAULT_STRICT,
        docstring='Z values false origin.')  # type: int
    UTMGridZoneNumber = _IntegerDescriptor(
        'UTMGridZoneNumber',
        _required,
        strict=DEFAULT_STRICT,
        docstring='Gride zone number, required for UTM, not include for GCS. '
        '**Values -** `+001` to `+060` (northern hemisphere) and `-001` to `-060` '
        '(southern hemisphere)')  # type: int

    def __init__(self,
                 CoordinateSystemType=None,
                 GeodeticDatum='World Geodetic System 1984',
                 ReferenceEllipsoid='World Geodetic System 1984',
                 VerticalDatum='Mean Sea Level',
                 SoundingDatum='Mean Sea Level',
                 FalseOrigin=None,
                 UTMGridZoneNumber=None,
                 **kwargs):
        """

        Parameters
        ----------
        CoordinateSystemType : str
        GeodeticDatum : str
        ReferenceEllipsoid : str
        VerticalDatum : str
        SoundingDatum : str
        FalseOrigin : int
        UTMGridZoneNumber : None|int
        kwargs
        """

        if '_xml_ns' in kwargs:
            self._xml_ns = kwargs['_xml_ns']
        self.CoordinateSystemType = CoordinateSystemType
        self.GeodeticDatum = GeodeticDatum
        self.ReferenceEllipsoid = ReferenceEllipsoid
        self.VerticalDatum = VerticalDatum
        self.SoundingDatum = SoundingDatum
        self.FalseOrigin = FalseOrigin
        self.UTMGridZoneNumber = UTMGridZoneNumber
        super(GeopositioningType, self).__init__(**kwargs)
Ejemplo n.º 13
0
class DigitalElevationDataType(Serializable):
    """
    This describes any Digital Elevation Data included with the SIDD product.
    """

    _fields = ('GeographicCoordinates', 'Geopositioning', 'PositionalAccuracy',
               'NullValue')
    _required = ('GeographicCoordinates', 'Geopositioning',
                 'PositionalAccuracy')
    # Descriptor
    GeographicCoordinates = _SerializableDescriptor(
        'GeographicCoordinates',
        GeographicCoordinatesType,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Describes the Local Geographic Coordinate system linking row/column to the '
        'absolute geographic coordinate (lat/lon)'
    )  # type: GeographicCoordinatesType
    Geopositioning = _SerializableDescriptor(
        'Geopositioning',
        GeopositioningType,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Describes the absolute coordinate system to which the data is '
        'referenced.')  # type: GeopositioningType
    PositionalAccuracy = _SerializableDescriptor(
        'PositionalAccuracy',
        PositionalAccuracyType,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Describes the horizontal and vertical point and regional information '
        'for the DED.')  # type: PositionalAccuracyType
    NullValue = _IntegerDescriptor(
        'NullValue',
        _required,
        strict=DEFAULT_STRICT,
        docstring='The value in the DEM corresponding to `No Value`.'
    )  # type: Union[None, int]

    def __init__(self,
                 GeographicCoordinates=None,
                 Geopositioning=None,
                 PositionalAccuracy=None,
                 NullValue=None,
                 **kwargs):
        """

        Parameters
        ----------
        GeographicCoordinates : GeographicCoordinatesType
        Geopositioning : GeopositioningType
        PositionalAccuracy : PositionalAccuracyType
        NullValue : int
        kwargs
        """

        if '_xml_ns' in kwargs:
            self._xml_ns = kwargs['_xml_ns']
        if '_xml_ns_key' in kwargs:
            self._xml_ns_key = kwargs['_xml_ns_key']
        self.GeographicCoordinates = GeographicCoordinates
        self.Geopositioning = Geopositioning
        self.PositionalAccuracy = PositionalAccuracy
        self.NullValue = NullValue
        super(DigitalElevationDataType, self).__init__(**kwargs)
Ejemplo n.º 14
0
class CPHDHeader(CPHDHeaderBase):
    _fields = ('XML_BLOCK_SIZE', 'XML_BLOCK_BYTE_OFFSET', 'SUPPORT_BLOCK_SIZE',
               'SUPPORT_BLOCK_BYTE_OFFSET', 'PVP_BLOCK_SIZE',
               'PVP_BLOCK_BYTE_OFFSET', 'SIGNAL_BLOCK_SIZE',
               'SIGNAL_BLOCK_BYTE_OFFSET', 'CLASSIFICATION', 'RELEASE_INFO')
    _required = ('XML_BLOCK_SIZE', 'XML_BLOCK_BYTE_OFFSET', 'PVP_BLOCK_SIZE',
                 'PVP_BLOCK_BYTE_OFFSET', 'SIGNAL_BLOCK_SIZE',
                 'SIGNAL_BLOCK_BYTE_OFFSET', 'CLASSIFICATION', 'RELEASE_INFO')
    # descriptor
    XML_BLOCK_SIZE = _IntegerDescriptor(
        'XML_BLOCK_SIZE',
        _required,
        strict=True,
        docstring='ize of the XML instance that describes the product in bytes. '
        'Size does NOT include the 2 bytes of the section terminator.'
    )  # type: int
    XML_BLOCK_BYTE_OFFSET = _IntegerDescriptor(
        'XML_BLOCK_BYTE_OFFSET',
        _required,
        strict=True,
        docstring='Offset to the first byte of the XML block in bytes.'
    )  # type: int
    SUPPORT_BLOCK_SIZE = _IntegerDescriptor(
        'SUPPORT_BLOCK_SIZE',
        _required,
        strict=True,
        docstring=
        'Size of the Support block in bytes. Note - If the Support block is omitted, this '
        'is not included.')  # type: int
    SUPPORT_BLOCK_BYTE_OFFSET = _IntegerDescriptor(
        'SUPPORT_BLOCK_BYTE_OFFSET',
        _required,
        strict=True,
        docstring=
        'Offset to the first byte of the Support block in bytes. Note - If the Support '
        'block is omitted, this is not included.')  # type: int
    PVP_BLOCK_SIZE = _IntegerDescriptor(
        'PVP_BLOCK_SIZE',
        _required,
        strict=True,
        docstring='Size of the PVP block in bytes.')  # type: int
    PVP_BLOCK_BYTE_OFFSET = _IntegerDescriptor(
        'PVP_BLOCK_BYTE_OFFSET',
        _required,
        strict=True,
        docstring='Offset to the first byte of the PVP block in bytes.'
    )  # type: int
    SIGNAL_BLOCK_SIZE = _IntegerDescriptor(
        'SIGNAL_BLOCK_SIZE',
        _required,
        strict=True,
        docstring='Size of the Signal block in bytes.')  # type: int
    SIGNAL_BLOCK_BYTE_OFFSET = _IntegerDescriptor(
        'SIGNAL_BLOCK_BYTE_OFFSET',
        _required,
        strict=True,
        docstring='Offset to the first byte of the Signal block in bytes.'
    )  # type: int
    CLASSIFICATION = _StringDescriptor(
        'CLASSIFICATION',
        _required,
        strict=True,
        default_value='UNCLASSIFIED',
        docstring='Product classification information that is human-readable.'
    )  # type: str
    RELEASE_INFO = _StringDescriptor(
        'RELEASE_INFO',
        _required,
        strict=True,
        default_value='UNRESTRICTED',
        docstring='Product release information that is human-readable.'
    )  # type: str

    def __init__(self,
                 XML_BLOCK_SIZE=None,
                 XML_BLOCK_BYTE_OFFSET=None,
                 SUPPORT_BLOCK_SIZE=None,
                 SUPPORT_BLOCK_BYTE_OFFSET=None,
                 PVP_BLOCK_SIZE=None,
                 PVP_BLOCK_BYTE_OFFSET=None,
                 SIGNAL_BLOCK_SIZE=None,
                 SIGNAL_BLOCK_BYTE_OFFSET=None,
                 CLASSIFICATION='UNCLASSIFIED',
                 RELEASE_INFO='UNRESTRICTED'):
        self.XML_BLOCK_SIZE = XML_BLOCK_SIZE
        self.XML_BLOCK_BYTE_OFFSET = XML_BLOCK_BYTE_OFFSET
        self.SUPPORT_BLOCK_SIZE = SUPPORT_BLOCK_SIZE
        self.SUPPORT_BLOCK_BYTE_OFFSET = SUPPORT_BLOCK_BYTE_OFFSET
        self.PVP_BLOCK_SIZE = PVP_BLOCK_SIZE
        self.PVP_BLOCK_BYTE_OFFSET = PVP_BLOCK_BYTE_OFFSET
        self.SIGNAL_BLOCK_SIZE = SIGNAL_BLOCK_SIZE
        self.SIGNAL_BLOCK_BYTE_OFFSET = SIGNAL_BLOCK_BYTE_OFFSET
        self.CLASSIFICATION = CLASSIFICATION
        self.RELEASE_INFO = RELEASE_INFO
        super(CPHDHeader, self).__init__()
Ejemplo n.º 15
0
class InteractiveProcessingType(Serializable):
    """
    The interactive processing information.
    """
    _fields = ('GeometricTransform', 'SharpnessEnhancement',
               'ColorSpaceTransform', 'DynamicRangeAdjustment',
               'TonalTransferCurve', 'band')
    _required = ('GeometricTransform', 'SharpnessEnhancement',
                 'DynamicRangeAdjustment', 'band')
    _set_as_attribute = ('band', )
    # Descriptor
    GeometricTransform = _SerializableDescriptor(
        'GeometricTransform',
        GeometricTransformType,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'The geometric transform element is used to perform various geometric distortions '
        'to each band of image data. These distortions include image '
        'chipping, scaling, rotation, shearing, etc.'
    )  # type: GeometricTransformType
    SharpnessEnhancement = _SerializableDescriptor(
        'SharpnessEnhancement',
        SharpnessEnhancementType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='Sharpness enhancement.')  # type: SharpnessEnhancementType
    ColorSpaceTransform = _SerializableDescriptor(
        'ColorSpaceTransform',
        ColorSpaceTransformType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='Color space transform.')  # type: ColorSpaceTransformType
    DynamicRangeAdjustment = _SerializableDescriptor(
        'DynamicRangeAdjustment',
        DynamicRangeAdjustmentType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='Specifies the recommended ELT DRA overrides.'
    )  # type: DynamicRangeAdjustmentType
    TonalTransferCurve = _SerializableDescriptor(
        'TonalTransferCurve',
        NewLookupTableType,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        "The 1-D LUT element uses one or more 1-D LUTs to stretch or compress tone data "
        "in valorous regions within a digital image's dynamic range. 1-D LUT can be "
        "implemented using a Tonal Transfer Curve (TTC). There are 12 families of TTCs "
        "- Range = [0, 11]. There are 64 members for each "
        "family - Range=[0, 63].")  # type: NewLookupTableType
    band = _IntegerDescriptor(
        'band',
        _required,
        strict=DEFAULT_STRICT,
        docstring='The image band to which this applies.')

    def __init__(self,
                 GeometricTransform=None,
                 SharpnessEnhancement=None,
                 ColorSpaceTransform=None,
                 DynamicRangeAdjustment=None,
                 band=1,
                 **kwargs):
        if '_xml_ns' in kwargs:
            self._xml_ns = kwargs['_xml_ns']
        if '_xml_ns_key' in kwargs:
            self._xml_ns_key = kwargs['_xml_ns_key']
        self.GeometricTransform = GeometricTransform
        self.SharpnessEnhancement = SharpnessEnhancement
        self.ColorSpaceTransform = ColorSpaceTransform
        self.DynamicRangeAdjustment = DynamicRangeAdjustment
        self.band = band
        super(InteractiveProcessingType, self).__init__(**kwargs)
Ejemplo n.º 16
0
class DataType(Serializable):
    """
    Parameters that describe binary data components contained in the product.
    """

    _fields = ('SignalArrayFormat', 'NumBytesPVP', 'NumCPHDChannels',
               'SignalCompressionID', 'Channels', 'NumSupportArrays',
               'SupportArrays')
    _required = ('SignalArrayFormat', 'NumBytesPVP', 'Channels')
    _collections_tags = {
        'Channels': {
            'array': False,
            'child_tag': 'Channel'
        },
        'SupportArrays': {
            'array': False,
            'child_tag': 'SupportArray'
        }
    }
    # descriptors
    SignalArrayFormat = _StringEnumDescriptor(
        'SignalArrayFormat', ('CI2', 'CI4', 'CF8'),
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Signal Array sample binary format of the CPHD signal arrays in standard '
        '(i.e. uncompressed) format, where `CI2` denotes a 1 byte signed integer '
        "parameter, 2's complement format, and 2 Bytes Per Sample; `CI4` denotes "
        "a 2 byte signed integer parameter, 2's complement format, and "
        "4 Bytes Per Sample; `CF8` denotes a 4 byte floating point parameter, and "
        "8 Bytes Per Sample.")  # type: str
    NumBytesPVP = _IntegerDescriptor(
        'NumBytesPVP',
        _required,
        strict=DEFAULT_STRICT,
        bounds=(0, None),
        docstring=
        'Number of bytes per set of Per Vector Parameters, where there is '
        'one set of PVPs for each CPHD signal vector')  # type: int
    SignalCompressionID = _StringDescriptor(
        'SignalCompressionID',
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Parameter that indicates the signal arrays are in compressed format. Value '
        'identifies the method of decompression. Parameter included if and only if '
        'the signal arrays are in compressed format.')  # type: str
    Channels = _SerializableListDescriptor(
        'Channels',
        ChannelSizeType,
        _collections_tags,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Parameters that define the Channel signal array and PVP array size '
        'and location.')  # type: List[ChannelSizeType]
    SupportArrays = _SerializableListDescriptor(
        'SupportArrays',
        SupportArraySizeType,
        _collections_tags,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Support Array size parameters. Branch repeated for each binary support array. '
        'Support Array referenced by its unique Support Array '
        'identifier.')  # type: List[SupportArraySizeType]

    def __init__(self,
                 SignalArrayFormat=None,
                 NumBytesPVP=None,
                 SignalCompressionID=None,
                 Channels=None,
                 SupportArrays=None,
                 **kwargs):
        """

        Parameters
        ----------
        SignalArrayFormat : str
        NumBytesPVP : int
        SignalCompressionID : None|str
        Channels : List[ChannelSizeType]
        SupportArrays : None|List[SupportArraySizeType]
        kwargs
        """

        if '_xml_ns' in kwargs:
            self._xml_ns = kwargs['_xml_ns']
        if '_xml_ns_key' in kwargs:
            self._xml_ns_key = kwargs['_xml_ns_key']
        self.SignalArrayFormat = SignalArrayFormat
        self.NumBytesPVP = NumBytesPVP
        self.SignalCompressionID = SignalCompressionID
        self.Channels = Channels
        self.SupportArrays = SupportArrays
        super(DataType, self).__init__(**kwargs)

    @property
    def NumSupportArrays(self):
        """
        int: The number of support arrays.
        """

        if self.SupportArrays is None:
            return 0
        else:
            return len(self.SupportArrays)

    @property
    def NumCPHDChannels(self):
        """
        int: The number of CPHD channels.
        """

        if self.Channels is None:
            return 0
        else:
            return len(self.Channels)
Ejemplo n.º 17
0
class ProductDisplayType(Serializable):
    """

    """
    _fields = ('PixelType', 'NumBands', 'DefaultBandDisplay',
               'NonInteractiveProcessing', 'InteractiveProcessing',
               'DisplayExtensions')
    _required = ('PixelType', 'NumBands', 'NonInteractiveProcessing',
                 'InteractiveProcessing')
    _collections_tags = {
        'NonInteractiveProcessing': {
            'array': False,
            'child_tag': 'NonInteractiveProcessing'
        },
        'InteractiveProcessing': {
            'array': False,
            'child_tag': 'InteractiveProcessing'
        },
        'DisplayExtensions': {
            'array': False,
            'child_tag': 'DisplayExtension'
        }
    }

    # Descriptors
    PixelType = _StringEnumDescriptor(
        'PixelType', ('MONO8I', 'MONO8LU', 'MONO16I', 'RGBL8U', 'RGB24I'),
        _required,
        strict=DEFAULT_STRICT,
        docstring='Enumeration of the pixel type. Definition in '
        'Design and Exploitation document.')  # type: str
    NumBands = _IntegerDescriptor(
        'NumBands',
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Number of bands contained in the image. Populate with the number of bands '
        'present after remapping. For example an 8-bit RGB image (RGBLU), this will '
        'be 3.')  # type: int
    DefaultBandDisplay = _IntegerDescriptor(
        'DefaultBandDisplay',
        _required,
        strict=DEFAULT_STRICT,
        docstring='Indicates which band to display by default. '
        'Valid range = 1 to NumBands.')  # type: int
    NonInteractiveProcessing = _SerializableListDescriptor(
        'NonInteractiveProcessing',
        NonInteractiveProcessingType,
        _collections_tags,
        _required,
        strict=DEFAULT_STRICT,
        docstring='Non-interactive processing details.'
    )  # type: List[NonInteractiveProcessingType]
    InteractiveProcessing = _SerializableListDescriptor(
        'InteractiveProcessing',
        InteractiveProcessingType,
        _collections_tags,
        _required,
        strict=DEFAULT_STRICT,
        docstring='Interactive processing details.'
    )  # type: List[InteractiveProcessingType]
    DisplayExtensions = _ParametersDescriptor(
        'DisplayExtensions',
        _collections_tags,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Optional extensible parameters used to support profile-specific needs related to '
        'product display. Predefined filter types.'
    )  # type: ParametersCollection

    def __init__(self,
                 PixelType=None,
                 NumBands=1,
                 DefaultBandDisplay=None,
                 NonInteractiveProcessing=None,
                 InteractiveProcessing=None,
                 DisplayExtensions=None,
                 **kwargs):
        """

        Parameters
        ----------
        PixelType : PixelTypeType
        NumBands : int
        DefaultBandDisplay : int|None
        NonInteractiveProcessing : List[NonInteractiveProcessingType]
        InteractiveProcessing : List[InteractiveProcessingType]
        DisplayExtensions : ParametersCollection|dict
        kwargs
        """

        if '_xml_ns' in kwargs:
            self._xml_ns = kwargs['_xml_ns']
        if '_xml_ns_key' in kwargs:
            self._xml_ns_key = kwargs['_xml_ns_key']
        self.PixelType = PixelType
        self.NumBands = NumBands
        self.DefaultBandDisplay = DefaultBandDisplay
        self.NonInteractiveProcessing = NonInteractiveProcessing
        self.InteractiveProcessing = InteractiveProcessing
        self.DisplayExtensions = DisplayExtensions
        super(ProductDisplayType, self).__init__(**kwargs)
Ejemplo n.º 18
0
class GlobalType(Serializable):
    """
    The Global type definition.
    """

    _fields = (
        'DomainType', 'PhaseSGN', 'RefFreqIndex', 'CollectStart',
        'CollectDuration', 'TxTime1', 'TxTime2', 'ImageArea')
    _required = (
        'DomainType', 'PhaseSGN', 'CollectStart', 'CollectDuration',
        'TxTime1', 'TxTime2', 'ImageArea')
    _numeric_format = {
        'CollectDuration': '0.16G', 'TxTime1': '0.16G', 'TxTime2': '0.16G'}
    # descriptors
    DomainType = _StringEnumDescriptor(
        'DomainType', ('FX', 'TOA'), _required, strict=DEFAULT_STRICT,
        docstring='Indicates the domain represented by the sample dimension of the '
                  'CPHD signal array(s), where "FX" denotes Transmit Frequency, and '
                  '"TOA" denotes Difference in Time of Arrival')  # type: str
    PhaseSGN = _IntegerEnumDescriptor(
        'PhaseSGN', (-1, 1), _required, strict=DEFAULT_STRICT,
        docstring='Phase SGN applied to compute target signal phase as a function of '
                  r'target :math:`\Delta TOA^{TGT}`. Target phase in cycles. '
                  r'For simple phase model :math:`Phase(fx) = SGN \times fx \times \Delta TOA^{TGT}` '
                  r'In TOA domain, phase of the mainlobe peak '
                  r':math:`Phase(\Delta TOA^{TGT}) = SGN \times fx_C \times \Delta TOA^{TGT}`'
                  '.')  # type: int
    RefFreqIndex = _IntegerDescriptor(
        'RefFreqIndex', _required, strict=DEFAULT_STRICT,
        docstring='Indicates if the RF frequency values are expressed as offsets from '
                  'a reference frequency (RefFreq).')  # type: Union[None, int]
    CollectStart = _DateTimeDescriptor(
        'CollectStart', _required, strict=DEFAULT_STRICT, numpy_datetime_units='us',
        docstring='Collection Start date and time (UTC). Time reference used for times '
                  'measured from collection start (i.e. slow time t = 0). For bistatic '
                  'collections, the time is the transmit platform collection '
                  'start time. The default display precision is microseconds, but this '
                  'does not that accuracy in value.')  # type: numpy.datetime64
    CollectDuration = _FloatDescriptor(
        'CollectDuration', _required, strict=DEFAULT_STRICT,
        docstring='The duration of the collection, in seconds.')  # type: float
    TxTime1 = _FloatDescriptor(
        'TxTime1', _required, strict=DEFAULT_STRICT, bounds=(0, None),
        docstring='Earliest TxTime value for any signal vector in the product. '
                  'Time relative to Collection Start in seconds.')  # type: float
    TxTime2 = _FloatDescriptor(
        'TxTime2', _required, strict=DEFAULT_STRICT, bounds=(0, None),
        docstring='Latest TxTime value for any signal vector in the product. '
                  'Time relative to Collection Start in seconds.')  # type: float
    ImageArea = _SerializableDescriptor(
        'ImageArea', ImageAreaType, _required, strict=DEFAULT_STRICT,
        docstring='Parameters describing the ground area covered by this '
                  'product.')  # type: ImageAreaType

    def __init__(self, DomainType=None, PhaseSGN=None, RefFreqIndex=None, CollectStart=None,
                 CollectDuration=None, TxTime1=None, TxTime2=None, ImageArea=None, **kwargs):
        """

        Parameters
        ----------
        DomainType : str
        PhaseSGN : int
        RefFreqIndex : None|int
        CollectStart : numpy.datetime64|datetime.datetime|str
        CollectDuration : float
        TxTime1 : float
        TxTime2 : float
        ImageArea : ImageAreaType
        kwargs
        """

        if '_xml_ns' in kwargs:
            self._xml_ns = kwargs['_xml_ns']
        if '_xml_ns_key' in kwargs:
            self._xml_ns_key = kwargs['_xml_ns_key']
        self.DomainType = DomainType
        self.PhaseSGN = PhaseSGN
        self.RefFreqIndex = RefFreqIndex
        self.CollectStart = CollectStart
        self.CollectDuration = CollectDuration
        self.TxTime1 = TxTime1
        self.TxTime2 = TxTime2
        self.ImageArea = ImageArea
        super(GlobalType, self).__init__(**kwargs)
Ejemplo n.º 19
0
class SegmentType(Serializable):
    """
    Rectangle segment.
    """

    _fields = ('Identifier', 'StartLine', 'StartSample', 'EndLine',
               'EndSample', 'SegmentPolygon')
    _required = ('Identifier', 'StartLine', 'StartSample', 'EndLine',
                 'EndSample')
    _collections_tags = {'SegmentPolygon': {'array': True, 'child_tag': 'SV'}}
    # descriptors
    Identifier = _StringDescriptor(
        'Identifier',
        _required,
        strict=DEFAULT_STRICT,
        docstring='String that uniquely identifies the Image Segment.'
    )  # type: str
    StartLine = _IntegerDescriptor(
        'StartLine',
        _required,
        strict=DEFAULT_STRICT,
        docstring='Start line of the segment.')  # type: int
    StartSample = _IntegerDescriptor(
        'StartSample',
        _required,
        strict=DEFAULT_STRICT,
        docstring='Start sample of the segment.')  # type: int
    EndLine = _IntegerDescriptor(
        'EndLine',
        _required,
        strict=DEFAULT_STRICT,
        docstring='End line of the segment.')  # type: int
    EndSample = _IntegerDescriptor(
        'EndSample',
        _required,
        strict=DEFAULT_STRICT,
        docstring='End sample of the segment.')  # type: int
    SegmentPolygon = _SerializableArrayDescriptor(
        'SegmentPolygon',
        LSVertexType,
        _collections_tags,
        _required,
        strict=DEFAULT_STRICT,
        minimum_length=3,
        docstring='Polygon that describes a portion of the segment '
        'rectangle.')  # type: Union[SerializableArray, List[LSVertexType]]

    def __init__(self,
                 Identifier=None,
                 StartLine=None,
                 StartSample=None,
                 EndLine=None,
                 EndSample=None,
                 SegmentPolygon=None,
                 **kwargs):
        """

        Parameters
        ----------
        Identifier : str
        StartLine : int
        StartSample : int
        EndLine : int
        EndSample : int
        SegmentPolygon : SerializableArray|List[LSVertexType]|numpy.ndarray|list|tuple
        kwargs
        """

        if '_xml_ns' in kwargs:
            self._xml_ns = kwargs['_xml_ns']
        if '_xml_ns_key' in kwargs:
            self._xml_ns_key = kwargs['_xml_ns_key']
        self.Identifier = Identifier
        self.StartLine = StartLine
        self.StartSample = StartSample
        self.EndLine = EndLine
        self.EndSample = EndSample
        self.SegmentPolygon = SegmentPolygon
        super(SegmentType, self).__init__(**kwargs)
Ejemplo n.º 20
0
class ParametersType(Serializable):
    """
    Channel dependent parameters.
    """

    _fields = (
        'SRP_Index', 'NomTOARateSF', 'FxCtrNom', 'BWSavedNom', 'TOASavedNom',
        'TxAnt_Index', 'RcvAnt_Index', 'TWAnt_Index')
    _required = (
        'SRP_Index', 'NomTOARateSF', 'FxCtrNom', 'BWSavedNom', 'TOASavedNom')
    _numeric_format = {
        'NomTOARateSF': '0.16G', 'FxCtrNom': '0.16G', 'BWSavedNom': '0.16G',
        'TOASavedNom': '0.16G'}
    # descriptors
    SRP_Index = _IntegerDescriptor(
        'SRP_Index', _required, strict=DEFAULT_STRICT,
        docstring='Index to identify the SRP position function used for the '
                  'channel.')  # type: int
    NomTOARateSF = _FloatDescriptor(
        'NomTOARateSF', _required, strict=DEFAULT_STRICT,
        docstring='Scale factor to indicate the fraction of the Doppler spectrum '
                  'that is clear.')  # type: float
    FxCtrNom = _FloatDescriptor(
        'FxCtrNom', _required, strict=DEFAULT_STRICT,
        docstring='Nominal center transmit frequency associated with the channel (Hz). '
                  'For DomainType = TOA, FxCtrNom is the center frequency for all '
                  'vectors.')  # type: float
    BWSavedNom = _FloatDescriptor(
        'BWSavedNom', _required, strict=DEFAULT_STRICT,
        docstring='Nominal transmit bandwidth associated with the channel (Hz). '
                  'For DomainType = TOA, BWSavedNom is the bandwidth saved for all '
                  'vectors.')  # type: float
    TOASavedNom = _FloatDescriptor(
        'TOASavedNom', _required, strict=DEFAULT_STRICT,
        docstring='Nominal span in TOA saved for the channel. For DomainType = FX, '
                  'TOASavedNom is the bandwidth saved for all '
                  'vectors.')  # type: float
    TxAnt_Index = _IntegerDescriptor(
        'TxAnt_Index', _required, strict=DEFAULT_STRICT,
        docstring='Indicates the Transmit Antenna pattern for data collected to form '
                  'the CPHD channel.')  # type: Union[None, int]
    RcvAnt_Index = _IntegerDescriptor(
        'RcvAnt_Index', _required, strict=DEFAULT_STRICT,
        docstring='Indicates the Receive Antenna pattern for data collected to form '
                  'the CPHD channel.')  # type: Union[None, int]
    TWAnt_Index = _IntegerDescriptor(
        'TWAnt_Index', _required, strict=DEFAULT_STRICT,
        docstring='Indicates the T wo-way Antenna pattern for data collected to form '
                  'the CPHD channel.')  # type: Union[None, int]

    def __init__(self, SRP_Index=None, NomTOARateSF=None, FxCtrNom=None, BWSavedNom=None,
                 TOASavedNom=None, TxAnt_Index=None, RcvAnt_Index=None, TWAnt_Index=None,
                 **kwargs):
        """

        Parameters
        ----------
        SRP_Index : int
        NomTOARateSF : float
        FxCtrNom : float
        BWSavedNom : float
        TOASavedNom : float
        TxAnt_Index : None|int
        RcvAnt_Index : None|int
        TWAnt_Index : None|int
        kwargs
        """

        if '_xml_ns' in kwargs:
            self._xml_ns = kwargs['_xml_ns']
        if '_xml_ns_key' in kwargs:
            self._xml_ns_key = kwargs['_xml_ns_key']
        self.SRP_Index = SRP_Index
        self.NomTOARateSF = NomTOARateSF
        self.FxCtrNom = FxCtrNom
        self.BWSavedNom = BWSavedNom
        self.TOASavedNom = TOASavedNom
        self.TxAnt_Index = TxAnt_Index
        self.RcvAnt_Index = RcvAnt_Index
        self.TWAnt_Index = TWAnt_Index
        super(ParametersType, self).__init__(**kwargs)