예제 #1
0
class PolarizationType(Serializable):
    """
    Polarization(s) of the signals that formed the signal array.
    """

    _fields = ('TxPol', 'RcvPol')
    _required = _fields
    # descriptors
    TxPol = _StringEnumDescriptor(
        'TxPol',
        POLARIZATION_TYPE,
        _required,
        strict=DEFAULT_STRICT,
        docstring='Transmitted signal polarization for the channel.'
    )  # type: str
    RcvPol = _StringEnumDescriptor(
        'RcvPol',
        POLARIZATION_TYPE,
        _required,
        strict=DEFAULT_STRICT,
        docstring='Receive polarization for the channel.')  # type: str

    def __init__(self, TxPol=None, RcvPol=None, **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.TxPol = TxPol
        self.RcvPol = RcvPol
        super(PolarizationType, self).__init__(**kwargs)
예제 #2
0
class ProcTxRcvPolarizationType(Serializable):
    """
    The processed transmit/receive polarization.
    """
    _fields = ('TxPolarizationProc', 'RcvPolarizationProc')
    _required = ('TxPolarizationProc', 'RcvPolarizationProc')
    # Descriptor
    TxPolarizationProc = _StringEnumDescriptor(
        'TxPolarizationProc',
        POLARIZATION1_VALUES,
        _required,
        strict=DEFAULT_STRICT,
        docstring='Transmit polarization type.')  # type: str
    RcvPolarizationProc = _StringEnumDescriptor(
        'RcvPolarizationProc',
        POLARIZATION1_VALUES,
        _required,
        strict=DEFAULT_STRICT,
        docstring='Receive polarization type.')  # type: str

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

        Parameters
        ----------
        TxPolarizationProc : str
        RcvPolarizationProc : str
        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.TxPolarizationProc = TxPolarizationProc
        self.RcvPolarizationProc = RcvPolarizationProc
        super(ProcTxRcvPolarizationType, self).__init__(**kwargs)

    @classmethod
    def from_sicd_value(cls, str_in):
        """
        Construct from the sicd style tx/rcv polarization string.

        Parameters
        ----------
        str_in : str

        Returns
        -------
        ProcTxRcvPolarizationType
        """

        tx, rcv = _extract_sicd_tx_rcv_pol(str_in)
        return cls(TxPolarizationProc=tx, RcvPolarizationProc=rcv)
예제 #3
0
class TxRcvPolarizationType(Serializable):
    """
    The transmit/receive polarization information.
    """

    _fields = ('TxPolarization', 'RcvPolarization', 'RcvPolarizationOffset')
    _required = ('TxPolarization', 'RcvPolarization')
    _numeric_format = {'RcvPolarizationOffset': '0.16G'}
    # Descriptor
    TxPolarization = _StringEnumDescriptor(
        'TxPolarization', POLARIZATION1_VALUES, _required, strict=DEFAULT_STRICT,
        docstring='Transmit polarization type.')  # type: str
    RcvPolarization = _StringEnumDescriptor(
        'RcvPolarization', POLARIZATION1_VALUES, _required, strict=DEFAULT_STRICT,
        docstring='Receive polarization type.')  # type: str
    RcvPolarizationOffset = _FloatModularDescriptor(
        'RcvPolarizationOffset', 180.0, _required, strict=DEFAULT_STRICT,
        docstring='Angle offset for the receive polarization defined at aperture center.')  # type: float

    def __init__(self, TxPolarization=None, RcvPolarization=None, RcvPolarizationOffset=None, **kwargs):
        """

        Parameters
        ----------
        TxPolarization : str
        RcvPolarization : str
        RcvPolarizationOffset : None|float
        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.TxPolarization = TxPolarization
        self.RcvPolarization = RcvPolarization
        self.RcvPolarizationOffset = RcvPolarizationOffset
        super(TxRcvPolarizationType, self).__init__(**kwargs)

    @classmethod
    def from_sicd_value(cls, str_in):
        """
        Construct from the sicd style tx/rcv polarization string.

        Parameters
        ----------
        str_in : str

        Returns
        -------
        TxRcvPolarizationType
        """

        tx, rcv = _extract_sicd_tx_rcv_pol(str_in)
        return cls(TxPolarization=tx, RcvPolarization=rcv)
예제 #4
0
class TropoParametersType(Serializable):
    """
    Parameters used to compute the propagation delay due to the troposphere.
    """

    _fields = ('N0', 'RefHeight')
    _required = _fields
    _numeric_format = {'No': '0.16G'}
    # descriptors
    N0 = _FloatDescriptor(
        'N0', _required, strict=DEFAULT_STRICT, bounds=(0, None),
        docstring='Refractivity value of the troposphere for the imaged scene used '
                  'to form the product (dimensionless). Value at the IARP '
                  'location.')  # type: float
    RefHeight = _StringEnumDescriptor(
        'RefHeight', ('IARP', 'ZERO'), _required, strict=DEFAULT_STRICT,
        docstring='Reference Height for the `N0` value.')  # type: str

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

        Parameters
        ----------
        N0 : float
        RefHeight : str
        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.N0 = N0
        self.RefHeight = RefHeight
        super(TropoParametersType, self).__init__(**kwargs)
예제 #5
0
파일: Display.py 프로젝트: LordHui/sarpy
class RRDSType(Serializable):
    """
    RRDS type.
    """

    _fields = ('DownsamplingMethod', 'AntiAlias', 'Interpolation')
    _required = ('DownsamplingMethod', )
    # Descriptor
    DownsamplingMethod = _StringEnumDescriptor(
        'DownsamplingMethod', ('DECIMATE', 'MAX PIXEL', 'AVERAGE',
                               'NEAREST NEIGHBOR', 'BILINEAR', 'LAGRANGE'),
        _required,
        strict=DEFAULT_STRICT,
        docstring='Algorithm used to perform RRDS downsampling')  # type: str
    AntiAlias = _SerializableDescriptor(
        'AntiAlias',
        FilterType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='The anti-aliasing filter. Should only be included if '
        '`DownsamplingMethod= "DECIMATE"`')  # type: FilterType
    Interpolation = _SerializableDescriptor(
        'Interpolation',
        FilterType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='The interpolation filter. Should only be included if '
        '`DownsamplingMethod= "DECIMATE"`')  # type: FilterType

    def __init__(self,
                 DownsamplingMethod=None,
                 AntiAlias=None,
                 Interpolation=None,
                 **kwargs):
        """

        Parameters
        ----------
        DownsamplingMethod : str
        AntiAlias : None|FilterType
        Interpolation : None|FilterType
        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.DownsamplingMethod = DownsamplingMethod
        self.AntiAlias = AntiAlias
        self.Interpolation = Interpolation
        super(RRDSType, self).__init__(**kwargs)
예제 #6
0
파일: Data.py 프로젝트: nyulacska/sarpy
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)
예제 #7
0
class IAZArrayType(SupportArrayCore):
    """
    Array of scene surface heights expressed in image coordinate IAZ values (meters).
    Grid coordinates are image area coordinates (IAX, IAY).
    """

    _fields = ('Identifier', 'ElementFormat', 'X0', 'Y0', 'XSS', 'YSS',
               'NODATA')
    _required = ('Identifier', 'ElementFormat', 'X0', 'Y0', 'XSS', 'YSS')
    # descriptors
    ElementFormat = _StringEnumDescriptor(
        'ElementFormat', ('IAZ=F4;', ),
        _required,
        strict=DEFAULT_STRICT,
        default_value='IAZ=F4;',
        docstring='The data element format.')  # type: str

    def __init__(self,
                 Identifier=None,
                 ElementFormat='IAZ=F4;',
                 X0=None,
                 Y0=None,
                 XSS=None,
                 YSS=None,
                 NODATA=None,
                 **kwargs):
        """

        Parameters
        ----------
        Identifier : str
        ElementFormat : str
        X0 : float
        Y0 : float
        XSS : float
        YSS : float
        NODATA : str
        kwargs
        """

        super(IAZArrayType, self).__init__(Identifier=Identifier,
                                           ElementFormat=ElementFormat,
                                           X0=X0,
                                           Y0=Y0,
                                           XSS=XSS,
                                           YSS=YSS,
                                           NODATA=NODATA,
                                           **kwargs)
예제 #8
0
class AntGainPhaseType(SupportArrayCore):
    """
    Antenna array with values are antenna gain and phase expressed in dB and
    cycles. Array coordinates are direction cosines with respect to the
    ACF (DCX, DCY).
    """

    _fields = ('Identifier', 'ElementFormat', 'X0', 'Y0', 'XSS', 'YSS',
               'NODATA')
    _required = ('Identifier', 'ElementFormat', 'X0', 'Y0', 'XSS', 'YSS')
    # descriptors
    ElementFormat = _StringEnumDescriptor(
        'ElementFormat', ('Gain=F4;Phase=F4;', ),
        _required,
        strict=DEFAULT_STRICT,
        default_value='Gain=F4;Phase=F4;',
        docstring='The data element format.')  # type: str

    def __init__(self,
                 Identifier=None,
                 ElementFormat='Gain=F4;Phase=F4;',
                 X0=None,
                 Y0=None,
                 XSS=None,
                 YSS=None,
                 NODATA=None,
                 **kwargs):
        """

        Parameters
        ----------
        Identifier : str
        X0 : float
        Y0 : float
        XSS : float
        YSS : float
        NODATA : str
        kwargs
        """

        super(AntGainPhaseType, self).__init__(Identifier=Identifier,
                                               ElementFormat=ElementFormat,
                                               X0=X0,
                                               Y0=Y0,
                                               XSS=XSS,
                                               YSS=YSS,
                                               NODATA=NODATA,
                                               **kwargs)
예제 #9
0
class PredefinedFilterType(Serializable):
    """
    The predefined filter type.
    """
    _fields = ('DatabaseName', 'FilterFamily', 'FilterMember')
    _required = ()
    # Descriptor
    DatabaseName = _StringEnumDescriptor(
        'DatabaseName', ('BILINEAR', 'CUBIC', 'LAGRANGE', 'NEAREST NEIGHBOR'),
        _required,
        strict=DEFAULT_STRICT,
        docstring='The filter name.')  # type: str
    FilterFamily = _IntegerDescriptor(
        'FilterFamily',
        _required,
        strict=DEFAULT_STRICT,
        docstring='The filter family number.')  # type: int
    FilterMember = _IntegerDescriptor(
        'FilterMember',
        _required,
        strict=DEFAULT_STRICT,
        docstring='The filter member number.')  # type: int

    def __init__(self,
                 DatabaseName=None,
                 FilterFamily=None,
                 FilterMember=None,
                 **kwargs):
        """

        Parameters
        ----------
        DatabaseName : None|str
        FilterFamily : None|int
        FilterMember : 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.DatabaseName = DatabaseName
        self.FilterFamily = FilterFamily
        self.FilterMember = FilterMember
        super(PredefinedFilterType, self).__init__(**kwargs)
예제 #10
0
파일: Display.py 프로젝트: LordHui/sarpy
class BandEqualizationType(Serializable):
    """

    """
    _fields = ('Algorithm', 'BandLUTs')
    _required = ('Algorithm', 'BandLUTs')
    _collections_tags = {'BandLUTs': {'array': True, 'child_tag': 'BandLUT'}}
    # Descriptor
    Algorithm = _StringEnumDescriptor(
        'Algorithm', ('LUT 1D', ),
        _required,
        strict=DEFAULT_STRICT,
        default_value='LUT 1D',
        docstring='The algorithm type.')  # type: str
    BandLUTs = _SerializableArrayDescriptor(
        'BandLUTs',
        BandLUTType,
        _collections_tags,
        _required,
        strict=DEFAULT_STRICT,
        array_extension=BandLUTArray,
        docstring='')  # type: Union[BandLUTArray, List[BandLUTType]]

    def __init__(self, Algorithm='LUT 1D', BandLUTs=None, **kwargs):
        """

        Parameters
        ----------
        Algorithm : str
            `LUT 1D` is currently the only allowed value.
        BandLUTs : BandLUTArray|List[BandLUTType]
        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.Algorithm = Algorithm
        self.BandLUTs = BandLUTs
        super(BandEqualizationType, self).__init__(**kwargs)
예제 #11
0
class FilterKernelType(Serializable):
    """
    The filter kernel parameters. Provides the specifics for **either** a predefined or custom
    filter kernel.
    """

    _fields = ('Predefined', 'Custom')
    _required = ()
    _choice = ({'required': True, 'collection': ('Predefined', 'Custom')}, )
    # Descriptor
    Predefined = _SerializableDescriptor(
        'Predefined',
        PredefinedFilterType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='')  # type: PredefinedFilterType
    Custom = _StringEnumDescriptor('Custom', ('GENERAL', 'FILTER BANK'),
                                   _required,
                                   strict=DEFAULT_STRICT,
                                   docstring='')  # type: str

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

        Parameters
        ----------
        Predefined : None|PredefinedFilterType
        Custom : None|str
        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.Predefined = Predefined
        self.Custom = Custom
        super(FilterKernelType, self).__init__(**kwargs)
예제 #12
0
파일: Display.py 프로젝트: LordHui/sarpy
class OrientationType(Serializable):
    """
    Parameters describing the default orientation of the product.
    """

    _fields = ('ShadowDirection', )
    _required = _fields
    # Descriptor
    ShadowDirection = _StringEnumDescriptor(
        'ShadowDirection', ('UP', 'DOWN', 'LEFT', 'RIGHT', 'ARBITRARY'),
        _required,
        strict=DEFAULT_STRICT,
        default_value='DOWN',
        docstring='Describes the shadow direction relative to the '
        'pixels in the file.')  # type: str

    def __init__(self, ShadowDirection='DOWN', **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.ShadowDirection = ShadowDirection
        super(OrientationType, self).__init__(**kwargs)
예제 #13
0
class GlobalType(Serializable):
    """
    The Global type definition.
    """

    _fields = (
        'DomainType', 'SGN', 'Timeline', 'FxBand', 'TOASwath', 'TropoParameters', 'IonoParameters')
    _required = ('DomainType', 'SGN', 'Timeline', 'FxBand', 'TOASwath')
    # 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
    SGN = _IntegerEnumDescriptor(
        'SGN', (-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
    Timeline = _SerializableDescriptor(
        'Timeline', TimelineType, _required, strict=DEFAULT_STRICT,
        docstring='Parameters that describe the collection times for the data contained '
                  'in the product')  # type: TimelineType
    FxBand = _SerializableDescriptor(
        'FxBand', FxBandType, _required, strict=DEFAULT_STRICT,
        docstring='Parameters that describe the FX frequency limits for the signal array(s) '
                  'contained in the product.')  # type: FxBandType
    TOASwath = _SerializableDescriptor(
        'TOASwath', TOASwathType, _required, strict=DEFAULT_STRICT,
        docstring='Parameters that describe the time-of-arrival (TOA) swath limits for the '
                  'signal array(s) contained in the product.')  # type: TOASwathType
    TropoParameters = _SerializableDescriptor(
        'TropoParameters', TropoParametersType, _required, strict=DEFAULT_STRICT,
        docstring='Parameters used to compute the propagation delay due to the '
                  'troposphere.')  # type: Union[None, TropoParametersType]
    IonoParameters = _SerializableDescriptor(
        'IonoParameters', IonoParametersType, _required, strict=DEFAULT_STRICT,
        docstring='Parameters used to compute propagation effects due to the '
                  'ionosphere.')  # type: Union[None, IonoParametersType]

    def __init__(self, DomainType=None, SGN=None, Timeline=None, FxBand=None, TOASwath=None,
                 TropoParameters=None, IonoParameters=None, **kwargs):
        """

        Parameters
        ----------
        DomainType : str
        SGN : int
        Timeline : TimelineType
        FxBand : FxBandType|numpy.ndarray|list|tuple
        TOASwath : TOASwathType|numpy.ndarray|list|tuple
        TropoParameters : None|TropoParametersType
        IonoParameters : None|IonoParametersType
        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.SGN = SGN
        self.Timeline = Timeline
        self.FxBand = FxBand
        self.TOASwath = TOASwath
        self.TropoParameters = TropoParameters
        self.IonoParameters = IonoParameters
        super(GlobalType, self).__init__(**kwargs)
예제 #14
0
class TxWFParametersType(Serializable):
    """
    Parameters that describe a Transmit Waveform.
    """

    _fields = ('Identifier', 'PulseLength', 'RFBandwidth', 'FreqCenter',
               'LFMRate', 'Polarization', 'Power')
    _required = ('Identifier', 'PulseLength', 'RFBandwidth', 'FreqCenter',
                 'Polarization')
    _numeric_format = {
        'PulseLength': '0.16G',
        'RFBandwidth': '0.16G',
        'FreqCenter': '0.16G',
        'LFMRate': '0.16G',
        'Power': '0.16G'
    }
    # descriptors
    Identifier = _StringDescriptor(
        'Identifier',
        _required,
        strict=DEFAULT_STRICT,
        docstring='String that uniquely identifies this Transmit '
        'Waveform.')  # type: str
    PulseLength = _FloatDescriptor('PulseLength',
                                   _required,
                                   strict=DEFAULT_STRICT,
                                   bounds=(0, None),
                                   docstring='Length of transmitted pulse, '
                                   'in seconds.')  # type: float
    RFBandwidth = _FloatDescriptor('RFBandwidth',
                                   _required,
                                   strict=DEFAULT_STRICT,
                                   bounds=(0, None),
                                   docstring='Bandwidth of transmitted pulse, '
                                   'in Hz.')  # type: float
    FreqCenter = _FloatDescriptor(
        'FreqCenter',
        _required,
        strict=DEFAULT_STRICT,
        bounds=(0, None),
        docstring='Center frequency of the transmitted waveform, '
        'in Hz.')  # type: float
    LFMRate = _FloatDescriptor(
        'LFMRate',
        _required,
        strict=DEFAULT_STRICT,
        docstring='Chirp rate of transmitted pulse if LFM, '
        'in Hz/s.')  # type: Union[None, float]
    Polarization = _StringEnumDescriptor(
        'Polarization',
        POLARIZATION_TYPE,
        _required,
        strict=DEFAULT_STRICT,
        docstring='The transmit polarization mode.')  # type: str
    Power = _FloatDescriptor(
        'Power',
        _required,
        strict=DEFAULT_STRICT,
        docstring='Peak transmitted power at the interface to the antenna '
        'in dBW.')  # type: Union[None, float]

    def __init__(self,
                 Identifier=None,
                 PulseLength=None,
                 RFBandwidth=None,
                 FreqCenter=None,
                 LFMRate=None,
                 Polarization=None,
                 Power=None,
                 **kwargs):
        """

        Parameters
        ----------
        Identifier : str
        PulseLength : float
        RFBandwidth : float
        FreqCenter : float
        LFMRate : None|float
        Polarization : str
        Power : None|float
        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.PulseLength = PulseLength
        self.RFBandwidth = RFBandwidth
        self.FreqCenter = FreqCenter
        self.LFMRate = LFMRate
        self.Polarization = Polarization
        self.Power = Power
        super(TxWFParametersType, self).__init__(**kwargs)
예제 #15
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)
예제 #16
0
파일: Display.py 프로젝트: LordHui/sarpy
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)
예제 #17
0
파일: Display.py 프로젝트: LordHui/sarpy
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)
예제 #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)
예제 #19
0
class ReferenceGeometryCore(Serializable):
    """
    The base reference geometry implementation.
    """

    _fields = ('SideOfTrack', 'SlantRange', 'GroundRange', 'DopplerConeAngle',
               'GrazeAngle', 'IncidenceAngle', 'AzimuthAngle')
    _required = _fields
    _numeric_format = {
        'SlantRange': '0.16G',
        'GroundRange': '0.16G',
        'DopplerConeAngle': '0.16G',
        'GrazeAngle': '0.16G',
        'IncidenceAngle': '0.16G',
        'AzimuthAngle': '0.16G'
    }
    # descriptors
    SideOfTrack = _StringEnumDescriptor(
        'SideOfTrack', ('L', 'R'),
        _required,
        strict=DEFAULT_STRICT,
        docstring='Side of Track parameter for the collection.')  # type: str
    SlantRange = _FloatDescriptor(
        'SlantRange',
        _required,
        strict=DEFAULT_STRICT,
        bounds=(0, None),
        docstring='Slant range from the ARP to the SRP.')  # type: float
    GroundRange = _FloatDescriptor(
        'GroundRange',
        _required,
        strict=DEFAULT_STRICT,
        bounds=(0, None),
        docstring='Ground range from the ARP to the SRP.')  # type: float
    DopplerConeAngle = _FloatDescriptor(
        'DopplerConeAngle',
        _required,
        strict=DEFAULT_STRICT,
        bounds=(0, 180),
        docstring='Doppler Cone Angle between ARP velocity and deg SRP Line of '
        'Sight (LOS).')  # type: float
    GrazeAngle = _FloatDescriptor(
        'GrazeAngle',
        _required,
        strict=DEFAULT_STRICT,
        bounds=(0, 90),
        docstring=
        'Grazing angle for the ARP to SRP LOS and the deg Earth Tangent '
        'Plane (ETP) at the SRP.')  # type: float
    IncidenceAngle = _FloatDescriptor(
        'IncidenceAngle',
        _required,
        strict=DEFAULT_STRICT,
        bounds=(0, 90),
        docstring='Incidence angle for the ARP to SRP LOS and the Earth Tangent '
        'Plane (ETP) at the SRP.')  # type: float
    AzimuthAngle = _FloatDescriptor(
        'AzimuthAngle',
        _required,
        strict=DEFAULT_STRICT,
        bounds=(0, 360),
        docstring='Angle from north to the line from the SRP to the ARP ETP '
        'Nadir (i.e. North to +GPX). Measured clockwise from North '
        'toward East.')  # type: float

    def __init__(self,
                 SideOfTrack=None,
                 SlantRange=None,
                 GroundRange=None,
                 DopplerConeAngle=None,
                 GrazeAngle=None,
                 IncidenceAngle=None,
                 AzimuthAngle=None,
                 **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.SideOfTrack = SideOfTrack
        self.SlantRange = SlantRange
        self.GroundRange = GroundRange
        self.DopplerConeAngle = DopplerConeAngle
        self.GrazeAngle = GrazeAngle
        self.IncidenceAngle = IncidenceAngle
        self.AzimuthAngle = AzimuthAngle
        super(ReferenceGeometryCore, self).__init__(**kwargs)

    @property
    def look(self):
        """
        int: An integer version of `SideOfTrack`:

            * None if `SideOfTrack` is not defined

            * -1 if SideOfTrack == 'R'

            * 1 if SideOftrack == 'L'
        """

        if self.SideOfTrack is None:
            return None
        return -1 if self.SideOfTrack == 'R' else 1
예제 #20
0
class GeoDataType(Serializable):
    """
    Container specifying the image coverage area in geographic coordinates.

    .. Note: The SICD.GeoData class is an extension of this class. Implementation remain
        separate to allow the possibility of different functionality.
    """

    _fields = ('EarthModel', 'ImageCorners', 'ValidData')
    _required = ('EarthModel', 'ImageCorners', 'ValidData')
    _collections_tags = {
        'ValidData': {
            'array': True,
            'child_tag': 'Vertex'
        },
        'ImageCorners': {
            'array': True,
            'child_tag': 'ICP'
        }
    }
    _numeric_format = {'ImageCorners': '0.16G', 'ValidData': '0.16G'}
    # other class variables
    _EARTH_MODEL_VALUES = ('WGS_84', )
    # descriptors
    EarthModel = _StringEnumDescriptor(
        'EarthModel',
        _EARTH_MODEL_VALUES,
        _required,
        strict=True,
        default_value='WGS_84',
        docstring=
        'Identifies the earth model used for latitude, longitude and height parameters. '
        'All height values are *Height Above The Ellipsoid '
        '(HAE)*.'.format(_EARTH_MODEL_VALUES))  # type: str
    ImageCorners = _SerializableCPArrayDescriptor(
        'ImageCorners',
        LatLonCornerStringType,
        _collections_tags,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'The geographic image corner points array. Image corners points projected to the '
        'ground/surface level. Points may be projected to the same height as the SCP if ground/surface '
        'height data is not available. The corner positions are approximate geographic locations and '
        'not intended for analytical '
        'use.'
    )  # type: Union[SerializableCPArray, List[LatLonCornerStringType]]
    ValidData = _SerializableArrayDescriptor(
        'ValidData',
        LatLonArrayElementType,
        _collections_tags,
        _required,
        strict=DEFAULT_STRICT,
        minimum_length=3,
        docstring=
        'The full image array includes both valid data and some zero filled pixels. Simple convex '
        'polygon enclosed the valid data (may include some zero filled pixels for simplification). '
        'Vertices in clockwise order.'
    )  # type: Union[SerializableArray, List[LatLonArrayElementType]]

    def __init__(self,
                 EarthModel='WGS_84',
                 ImageCorners=None,
                 ValidData=None,
                 GeoInfos=None,
                 **kwargs):
        """

        Parameters
        ----------
        EarthModel : str
        ImageCorners : SerializableCPArray|List[LatLonCornerStringType]|numpy.ndarray|list|tuple
        ValidData : SerializableArray|List[LatLonArrayElementType]|numpy.ndarray|list|tuple
        GeoInfos : List[GeoInfoType]
        kwargs : dict
        """

        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.EarthModel = EarthModel
        self.ImageCorners = ImageCorners
        self.ValidData = ValidData

        self._GeoInfos = []
        if GeoInfos is None:
            pass
        elif isinstance(GeoInfos, GeoInfoType):
            self.setGeoInfo(GeoInfos)
        elif isinstance(GeoInfos, (list, tuple)):
            for el in GeoInfos:
                self.setGeoInfo(el)
        else:
            raise ('GeoInfos got unexpected type {}'.format(type(GeoInfos)))
        super(GeoDataType, self).__init__(**kwargs)

    @property
    def GeoInfos(self):
        """
        List[GeoInfoType]: list of GeoInfos.
        """

        return self._GeoInfos

    def getGeoInfo(self, key):
        """
        Get the GeoInfo(s) with name attribute == `key`

        Parameters
        ----------
        key : str

        Returns
        -------
        List[GeoInfoType]
        """

        return [entry for entry in self._GeoInfos if entry.name == key]

    def setGeoInfo(self, value):
        """
        Add the given GeoInfo to the GeoInfos list.

        Parameters
        ----------
        value : GeoInfoType

        Returns
        -------
        None
        """

        if isinstance(value, ElementTree.Element):
            gi_key = self._child_xml_ns_key.get('GeoInfos', self._xml_ns_key)
            value = GeoInfoType.from_node(value, self._xml_ns, ns_key=gi_key)
        elif isinstance(value, dict):
            value = GeoInfoType.from_dict(value)

        if isinstance(value, GeoInfoType):
            self._GeoInfos.append(value)
        else:
            raise TypeError(
                'Trying to set GeoInfo element with unexpected type {}'.format(
                    type(value)))

    @classmethod
    def from_node(cls, node, xml_ns, ns_key=None, kwargs=None):
        if kwargs is None:
            kwargs = OrderedDict()
        gkey = cls._child_xml_ns_key.get('GeoInfos', ns_key)
        kwargs['GeoInfos'] = _find_children(node, 'GeoInfo', xml_ns, gkey)
        return super(GeoDataType, cls).from_node(node,
                                                 xml_ns,
                                                 ns_key=ns_key,
                                                 kwargs=kwargs)

    def to_node(self,
                doc,
                tag,
                ns_key=None,
                parent=None,
                check_validity=False,
                strict=DEFAULT_STRICT,
                exclude=()):
        node = super(GeoDataType, self).to_node(doc,
                                                tag,
                                                ns_key=ns_key,
                                                parent=parent,
                                                check_validity=check_validity,
                                                strict=strict,
                                                exclude=exclude)
        # slap on the GeoInfo children
        for entry in self._GeoInfos:
            entry.to_node(doc,
                          'GeoInfo',
                          ns_key=ns_key,
                          parent=node,
                          strict=strict)
        return node

    def to_dict(self, check_validity=False, strict=DEFAULT_STRICT, exclude=()):
        out = super(GeoDataType, self).to_dict(check_validity=check_validity,
                                               strict=strict,
                                               exclude=exclude)
        # slap on the GeoInfo children
        if len(self.GeoInfos) > 0:
            out['GeoInfos'] = [
                entry.to_dict(check_validity=check_validity, strict=strict)
                for entry in self._GeoInfos
            ]
        return out
예제 #21
0
파일: Display.py 프로젝트: nyulacska/sarpy
class ProductDisplayType(Serializable):
    """

    """
    _fields = ('PixelType', 'RemapInformation', 'MagnificationMethod',
               'DecimationMethod', 'DRAHistogramOverrides',
               'MonitorCompensationApplied', 'DisplayExtensions')
    _required = ('PixelType', )
    _collections_tags = {
        '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
    RemapInformation = _SerializableDescriptor(
        'RemapInformation',
        RemapChoiceType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='Information regarding the encoding of the pixel data. '
        'Used for 8-bit pixel types.')  # type: Union[None, RemapChoiceType]
    MagnificationMethod = _StringEnumDescriptor(
        'MagnificationMethod', ('NEAREST_NEIGHBOR', 'BILINEAR', 'LAGRANGE'),
        _required,
        strict=DEFAULT_STRICT,
        docstring='Recommended ELT magnification method for this data.'
    )  # type: Union[None, str]
    DecimationMethod = _StringEnumDescriptor(
        'DecimationMethod',
        ('NEAREST_NEIGHBOR', 'BILINEAR', 'BRIGHTEST_PIXEL', 'LAGRANGE'),
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Recommended ELT decimation method for this data. Also used as default for '
        'reduced resolution dataset generation (if applicable).'
    )  # type: Union[None, str]
    DRAHistogramOverrides = _SerializableDescriptor(
        'DRAHistogramOverrides',
        DRAHistogramOverridesType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='Recommended ELT DRA overrides.'
    )  # type: Union[None, DRAHistogramOverridesType]
    MonitorCompensationApplied = _SerializableDescriptor(
        'MonitorCompensationApplied',
        MonitorCompensationAppliedType,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Describes monitor compensation that may have been applied to the product '
        'during processing.'
    )  # type: Union[None, MonitorCompensationAppliedType]
    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: Union[None, ParametersCollection]

    def __init__(self,
                 PixelType=None,
                 RemapInformation=None,
                 MagnificationMethod=None,
                 DecimationMethod=None,
                 DRAHistogramOverrides=None,
                 MonitorCompensationApplied=None,
                 DisplayExtensions=None,
                 **kwargs):
        """

        Parameters
        ----------
        PixelType : PixelTypeType
        RemapInformation : None|RemapChoiceType
        MagnificationMethod : None|str
        DecimationMethod : None|str
        DRAHistogramOverrides : None|DRAHistogramOverridesType
        MonitorCompensationApplied : None|MonitorCompensationAppliedType
        DisplayExtensions : 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.PixelType = PixelType
        self.RemapInformation = RemapInformation
        self.MagnificationMethod = MagnificationMethod
        self.DecimationMethod = DecimationMethod
        self.DRAHistogramOverrides = DRAHistogramOverrides
        self.MonitorCompensationApplied = MonitorCompensationApplied
        self.DisplayExtensions = DisplayExtensions
        super(ProductDisplayType, self).__init__(**kwargs)
예제 #22
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)
예제 #23
0
class MeasurementType(Serializable):
    """
    Geometric SAR information required for measurement/geolocation.
    """

    _fields = ('PolynomialProjection', 'GeographicProjection',
               'PlaneProjection', 'CylindricalProjection', 'PixelFootprint',
               'ARPFlag', 'ARPPoly', 'ValidData')
    _required = ('PixelFootprint', 'ARPPoly', 'ValidData')
    _collections_tags = {'ValidData': {'array': True, 'child_tag': 'Vertex'}}
    _numeric_format = {'ValidData': '0.16G'}
    _choice = ({
        'required':
        False,
        'collection': ('PolynomialProjection', 'GeographicProjection',
                       'PlaneProjection', 'CylindricalProjection')
    }, )
    # Descriptor
    PolynomialProjection = _SerializableDescriptor(
        'PolynomialProjection',
        PolynomialProjectionType,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Polynomial pixel to ground. Should only used for sensor systems where the radar '
        'geometry parameters are not recorded.'
    )  # type: Union[None, PolynomialProjectionType]
    GeographicProjection = _SerializableDescriptor(
        'GeographicProjection',
        GeographicProjectionType,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Geographic mapping of the pixel grid referred to as GGD in the '
        'Design and Exploitation document.'
    )  # type: Union[None, GeographicProjectionType]
    PlaneProjection = _SerializableDescriptor(
        'PlaneProjection',
        PlaneProjectionType,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Planar representation of the pixel grid referred to as PGD in the '
        'Design and Exploitation document.'
    )  # type: Union[None, PlaneProjectionType]
    CylindricalProjection = _SerializableDescriptor(
        'CylindricalProjection',
        CylindricalProjectionType,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Cylindrical mapping of the pixel grid referred to as CGD in the '
        'Design and Exploitation document.'
    )  # type: Union[None, CylindricalProjectionType]
    PixelFootprint = _SerializableDescriptor(
        'PixelFootprint',
        RowColIntType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='Size of the image in pixels.')  # type: RowColIntType
    ARPFlag = _StringEnumDescriptor(
        'ARPFlag', ('REALTIME', 'PREDICTED', 'POST PROCESSED'),
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Flag indicating whether ARP polynomial is based on the best available (`collect time` or '
        '`predicted`) ephemeris.')  # type: Union[None, str]
    ARPPoly = _SerializableDescriptor('ARPPoly',
                                      XYZPolyType,
                                      _required,
                                      strict=DEFAULT_STRICT,
                                      docstring='')  # type: XYZPolyType
    ValidData = _SerializableArrayDescriptor(
        'ValidData',
        RowColArrayElement,
        _collections_tags,
        _required,
        strict=DEFAULT_STRICT,
        minimum_length=3,
        docstring=
        'Indicates the full image includes both valid data and some zero filled pixels. '
        'Simple polygon encloses the valid data (may include some zero filled pixels for simplification). '
        'Vertices in clockwise order.'
    )  # type: Union[SerializableArray, List[RowColArrayElement]]

    def __init__(self,
                 PolynomialProjection=None,
                 GeographicProjection=None,
                 PlaneProjection=None,
                 CylindricalProjection=None,
                 PixelFootprint=None,
                 ARPFlag=None,
                 ARPPoly=None,
                 ValidData=None,
                 **kwargs):
        """

        Parameters
        ----------
        PolynomialProjection : PolynomialProjectionType
        GeographicProjection : GeographicProjectionType
        PlaneProjection : PlaneProjectionType
        CylindricalProjection : CylindricalProjectionType
        PixelFootprint : RowColIntType|numpy.ndarray|list|tuple
        ARPFlag : str
        ARPPoly : XYZPolyType|numpy.ndarray|list|tuple
        ValidData : SerializableArray|List[RowColArrayElement]|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.PolynomialProjection = PolynomialProjection
        self.GeographicProjection = GeographicProjection
        self.PlaneProjection = PlaneProjection
        self.CylindricalProjection = CylindricalProjection
        self.PixelFootprint = PixelFootprint
        self.ARPFlag = ARPFlag
        self.ARPPoly = ARPPoly
        self.ValidData = ValidData
        super(MeasurementType, self).__init__(**kwargs)

    @property
    def ProjectionType(self):
        """str: *READ ONLY* Identifies the specific image projection type supplied."""
        for attribute in self._choice[0]['collection']:
            if getattr(self, attribute) is not None:
                return attribute
        return None
예제 #24
0
class RcvParametersType(Serializable):
    """
    Parameters that describe a Receive configuration.
    """

    _fields = ('Identifier', 'WindowLength', 'SampleRate', 'IFFilterBW',
               'FreqCenter', 'LFMRate', 'Polarization', 'PathGain')
    _required = ('Identifier', 'WindowLength', 'SampleRate', 'IFFilterBW',
                 'FreqCenter', 'Polarization')
    _numeric_format = {
        'WindowLength': '0.16G',
        'SampleRate': '0.16G',
        'IFFilterBW': '0.16G',
        'FreqCenter': '0.16G',
        'LFMRate': '0.16G',
        'PathGain': '0.16G'
    }
    # descriptors
    Identifier = _StringDescriptor(
        'Identifier',
        _required,
        strict=DEFAULT_STRICT,
        docstring='String that uniquely identifies this Receive '
        'configuration.')  # type: str
    WindowLength = _FloatDescriptor(
        'WindowLength',
        _required,
        strict=DEFAULT_STRICT,
        bounds=(0, None),
        docstring='Length of the receive window, in seconds.')  # type: float
    SampleRate = _FloatDescriptor(
        'SampleRate',
        _required,
        strict=DEFAULT_STRICT,
        bounds=(0, None),
        docstring='Rate at which the signal in the receive window is sampled, '
        'in Hz.')  # type: float
    IFFilterBW = _FloatDescriptor(
        'IFFilterBW',
        _required,
        strict=DEFAULT_STRICT,
        bounds=(0, None),
        docstring='Bandwidth of the anti-aliasing filter prior to '
        'sampling.')  # type: float
    FreqCenter = _FloatDescriptor(
        'FreqCenter',
        _required,
        strict=DEFAULT_STRICT,
        bounds=(0, None),
        docstring='Center frequency of the demodulation signal, '
        'in Hz.')  # type: float
    LFMRate = _FloatDescriptor(
        'LFMRate',
        _required,
        strict=DEFAULT_STRICT,
        docstring='Chirp rate of the demodulation signal if LFM, '
        'in Hz/s.')  # type: Union[None, float]
    Polarization = _StringEnumDescriptor(
        'Polarization',
        POLARIZATION_TYPE,
        _required,
        strict=DEFAULT_STRICT,
        docstring='The receive polarization mode.')  # type: str
    PathGain = _FloatDescriptor(
        'PathGain',
        _required,
        strict=DEFAULT_STRICT,
        docstring='Receiver gain from the antenna interface to the ADC, '
        'in dB.')  # type: Union[None, float]

    def __init__(self,
                 Identifier=None,
                 WindowLength=None,
                 SampleRate=None,
                 IFFilterBW=None,
                 FreqCenter=None,
                 LFMRate=None,
                 Polarization=None,
                 PathGain=None,
                 **kwargs):
        """

        Parameters
        ----------
        Identifier : str
        WindowLength : float
        SampleRate : float
        IFFilterBW : float
        FreqCenter : float
        LFMRate : None|float
        Polarization : str
        PathGain : None|float
        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.WindowLength = WindowLength
        self.SampleRate = SampleRate
        self.IFFilterBW = IFFilterBW
        self.FreqCenter = FreqCenter
        self.LFMRate = LFMRate
        self.Polarization = Polarization
        self.PathGain = PathGain
        super(RcvParametersType, self).__init__(**kwargs)
예제 #25
0
class FilterType(Serializable):
    """
    Filter parameters for a variety of purposes. Provides **either** the filter bank or
    filter kernel parameters.
    """

    _fields = ('FilterName', 'FilterKernel', 'FilterBank', 'Operation')
    _required = ('FilterName', 'Operation')
    _choice = ({
        'required': True,
        'collection': ('FilterKernel', 'FilterBank')
    }, )
    # Descriptor
    FilterName = _StringDescriptor(
        'FilterName',
        _required,
        strict=DEFAULT_STRICT,
        docstring='The name of the filter.')  # type : str
    FilterKernel = _SerializableDescriptor(
        'FilterKernel',
        FilterKernelType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='The filter kernel.')  # type: FilterKernelType
    FilterBank = _SerializableDescriptor(
        'FilterBank',
        FilterBankType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='The filter bank.')  # type: FilterBankType
    Operation = _StringEnumDescriptor('Operation',
                                      ('CONVOLUTION', 'CORRELATION'),
                                      _required,
                                      strict=DEFAULT_STRICT,
                                      docstring='')  # type: str

    def __init__(self,
                 FilterName=None,
                 FilterKernel=None,
                 FilterBank=None,
                 Operation=None,
                 **kwargs):
        """

        Parameters
        ----------
        FilterName : str
        FilterKernel : None|FilterKernelType
        FilterBank : None|FilterBankType
        Operation : str
        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.FilterName = FilterName
        self.FilterKernel = FilterKernel
        self.FilterBank = FilterBank
        self.Operation = Operation
        super(FilterType, self).__init__(**kwargs)
예제 #26
0
파일: Display.py 프로젝트: LordHui/sarpy
class ColorManagementModuleType(Serializable):
    """
    Parameters describing the Color Management Module (CMM).
    """

    _fields = ('RenderingIntent', 'SourceProfile', 'DisplayProfile',
               'ICCProfile')
    _required = _fields
    # Descriptor
    RenderingIntent = _StringEnumDescriptor(
        'RenderingIntent',
        ('PERCEPTUAL', 'SATURATION', 'RELATIVE INTENT', 'ABSOLUTE INTENT'),
        _required,
        strict=DEFAULT_STRICT,
        default_value='PERCEPTUAL',
        docstring='The rendering intent for this color management.'
    )  # type: str
    SourceProfile = _StringDescriptor(
        'SourceProfile',
        _required,
        strict=DEFAULT_STRICT,
        docstring='Name of sensor profile in ICC Profile database.'
    )  # type: str
    DisplayProfile = _StringDescriptor(
        'DisplayProfile',
        _required,
        strict=DEFAULT_STRICT,
        docstring='Name of display profile in ICC Profile database.'
    )  # type: str
    ICCProfile = _StringDescriptor(
        'ICCProfile',
        _required,
        strict=DEFAULT_STRICT,
        docstring='Valid ICC profile signature.')  # type: str

    def __init__(self,
                 RenderingIntent='PERCEPTUAL',
                 SourceProfile=None,
                 DisplayProfile=None,
                 ICCProfile=None,
                 **kwargs):
        """

        Parameters
        ----------
        RenderingIntent : str
        SourceProfile : str
        DisplayProfile : str
        ICCProfile : str
        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.RenderingIntent = RenderingIntent
        self.SourceProfile = SourceProfile
        self.DisplayProfile = DisplayProfile
        self.ICCProfile = ICCProfile
        super(ColorManagementModuleType, self).__init__(**kwargs)
예제 #27
0
class SceneCoordinatesType(Serializable):
    """
    Parameters that define geographic coordinates for in the imaged scene.
    """

    _fields = ('EarthModel', 'IARP', 'ReferenceSurface', 'ImageArea',
               'ImageAreaCornerPoints', 'ExtendedArea', 'ImageGrid')
    _required = ('EarthModel', 'IARP', 'ReferenceSurface', 'ImageArea',
                 'ImageAreaCornerPoints')
    _collections_tags = {
        'ImageAreaCornerPoints': {
            'array': True,
            'child_tag': 'IACP'
        }
    }
    # descriptors
    EarthModel = _StringEnumDescriptor(
        'EarthModel', ('WGS_84', ),
        _required,
        strict=DEFAULT_STRICT,
        default_value='WGS_84',
        docstring=
        'Specifies the earth model used for specifying geodetic coordinates. All heights are '
        'Height Above the Ellipsoid (HAE) unless specifically '
        'noted.')  # type: str
    IARP = _SerializableDescriptor(
        'IARP',
        IARPType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='Image Area Reference Point (IARP). The IARP is the origin of '
        'the Image Area Coordinate system.')  # type: IARPType
    ReferenceSurface = _SerializableDescriptor(
        'ReferenceSurface',
        ReferenceSurfaceType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='Parameters that define the Reference Surface used for the '
        'product.')  # type: ReferenceSurfaceType
    ImageArea = _SerializableDescriptor(
        'ImageArea',
        AreaType,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Image Area is defined by a rectangle aligned with Image Area coordinates (IAX, IAY). '
        'May be reduced by the optional polygon.')  # type: AreaType
    ImageAreaCornerPoints = _SerializableCPArrayDescriptor(
        'ImageAreaCornerPoints',
        LatLonCornerType,
        _collections_tags,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Image Area Corner Points (IACPs) that bound the full resolution '
        'image area.'
    )  # type: Union[SerializableCPArray, List[LatLonCornerType]]
    ExtendedArea = _SerializableDescriptor(
        'ExtendedArea',
        AreaType,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Extended Area is defined by a rectangle aligned with Image Area coordinates '
        '(IAX, IAY). May be reduced by the optional polygon.'
    )  # type: Union[None, AreaType]
    ImageGrid = _SerializableDescriptor(
        'ImageGrid',
        ImageGridType,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Parameters that describe a geo-referenced image grid for image data '
        'products that may be formed from the CPHD signal '
        'array(s).')  # type: ImageGridType

    def __init__(self,
                 EarthModel='WGS_84',
                 IARP=None,
                 ReferenceSurface=None,
                 ImageArea=None,
                 ImageAreaCornerPoints=None,
                 ExtendedArea=None,
                 ImageGrid=None,
                 **kwargs):
        """

        Parameters
        ----------
        EarthModel : None|str
        IARP : IARPType
        ReferenceSurface : ReferenceSurfaceType
        ImageArea : AreaType
        ImageAreaCornerPoints : SerializableCPArray|List[LatLonCornerType]|numpy.ndarray|list|tuple
        ExtendedArea : None|AreaType
        ImageGrid : None|ImageGridType
        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.EarthModel = EarthModel
        self.IARP = IARP
        self.ReferenceSurface = ReferenceSurface
        self.ImageArea = ImageArea
        self.ImageAreaCornerPoints = ImageAreaCornerPoints
        self.ExtendedArea = ExtendedArea
        self.ImageGrid = ImageGrid
        super(SceneCoordinatesType, self).__init__(**kwargs)
예제 #28
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)