Exemplo n.º 1
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)
Exemplo n.º 2
0
class BandEqualizationType(Serializable):
    """

    """
    _fields = ('Algorithm', 'BandLUTs')
    _required = ('Algorithm', 'BandLUTs')
    _collections_tags = {'BandLUTs': {'array': True, 'child_tag': 'BandLUT'}}
    # Descriptor
    Algorithm = StringEnumDescriptor(
        'Algorithm', ('1DLUT', ), _required, strict=DEFAULT_STRICT, default_value='1DLUT',
        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='1DLUT', BandLUTs=None, **kwargs):
        """

        Parameters
        ----------
        Algorithm : str
            `1DLUT` 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)
Exemplo n.º 3
0
class NoiseLevelType_(Serializable):
    """
    Noise level structure.
    """

    _fields = ('NoiseLevelType', 'NoisePoly')
    _required = _fields
    # class variables
    _NOISE_LEVEL_TYPE_VALUES = ('ABSOLUTE', 'RELATIVE')
    # descriptors
    NoiseLevelType = StringEnumDescriptor(
        'NoiseLevelType',
        _NOISE_LEVEL_TYPE_VALUES,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Indicates that the noise power polynomial yields either absolute power level or power '
        'level relative to the *SCP* pixel location.')  # type: str
    NoisePoly = SerializableDescriptor(
        'NoisePoly',
        Poly2DType,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Polynomial coefficients that yield thermal noise power *(in dB)* in a pixel as a function of '
        'image row coordinate *(variable 1)* and column coordinate *(variable 2)*.'
    )  # type: Poly2DType

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

        Parameters
        ----------
        NoiseLevelType : str
        NoisePoly : Poly2DType|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.NoiseLevelType = NoiseLevelType
        self.NoisePoly = NoisePoly
        super(NoiseLevelType_, self).__init__(**kwargs)
        self._derive_noise_level()

    def _derive_noise_level(self):
        if self.NoiseLevelType is not None:
            return
        if self.NoisePoly is None:
            return  # nothing to be done

        scp_val = self.NoisePoly.Coefs[0, 0]  # the value at SCP
        if scp_val == 1:
            # the relative noise levels should be 1 at SCP
            self.NoiseLevelType = 'RELATIVE'
        else:
            # it seems safe that it's not absolute, in this case?
            self.NoiseLevelType = 'ABSOLUTE'
Exemplo n.º 4
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)
Exemplo n.º 5
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)
Exemplo n.º 6
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)
Exemplo n.º 7
0
class ChanParametersType(Serializable):
    """
    Transmit receive sequence step details.
    """

    _fields = ('TxRcvPolarization', 'RcvAPCIndex', 'index')
    _required = ('TxRcvPolarization', 'index', )
    _set_as_attribute = ('index', )
    # descriptors
    TxRcvPolarization = StringEnumDescriptor(
        'TxRcvPolarization', DUAL_POLARIZATION_VALUES, _required, strict=DEFAULT_STRICT,
        docstring='Combined Transmit and Receive signal polarization for the channel.')  # type: str
    RcvAPCIndex = IntegerDescriptor(
        'RcvAPCIndex', _required, strict=DEFAULT_STRICT,
        docstring='Index of the Receive Aperture Phase Center (Rcv APC). Only include if Receive APC position '
                  'polynomial(s) are included.')  # type: int
    index = IntegerDescriptor(
        'index', _required, strict=DEFAULT_STRICT, docstring='The parameter index')  # type: int

    def __init__(self, TxRcvPolarization=None, RcvAPCIndex=None, index=None, **kwargs):
        """

        Parameters
        ----------
        TxRcvPolarization : str
        RcvAPCIndex : int
        index : int
        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.TxRcvPolarization = TxRcvPolarization
        self.RcvAPCIndex = RcvAPCIndex
        self.index = index
        super(ChanParametersType, self).__init__(**kwargs)

    def get_transmit_polarization(self):
        if self.TxRcvPolarization is None:
            return None
        elif self.TxRcvPolarization in ['OTHER', 'UNKNOWN']:
            return 'OTHER'
        else:
            return self.TxRcvPolarization.split(':')[0]

    def permits_version_1_1(self):
        """
        Does this value permit storage in SICD version 1.1?

        Returns
        -------
        bool
        """

        return is_polstring_version1(self.TxRcvPolarization)
Exemplo n.º 8
0
class RadarModeType(Serializable):
    """
    Radar mode type container class
    """

    _fields = ('ModeType', 'ModeID')
    _required = ('ModeType', )
    # other class variable
    _MODE_TYPE_VALUES = ('SPOTLIGHT', 'STRIPMAP', 'DYNAMIC STRIPMAP', 'SCANSAR')
    # descriptors
    ModeType = StringEnumDescriptor(
        'ModeType', _MODE_TYPE_VALUES, _required, strict=True,
        docstring="The Radar imaging mode.")  # type: str
    ModeID = StringDescriptor(
        'ModeID', _required, strict=DEFAULT_STRICT,
        docstring='Radar imaging mode per Program Specific Implementation Document.')  # type: str

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

        Parameters
        ----------
        ModeID : str
        ModeType : str
        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.ModeID, self.ModeType = ModeID, ModeType
        super(RadarModeType, self).__init__(**kwargs)

    def get_mode_abbreviation(self):
        """
        Get the mode abbreviation for the suggested name.

        Returns
        -------
        str
        """

        mode = self.ModeType
        if mode is None:
            return 'UN'
        elif mode == 'SPOTLIGHT':
            return 'SL'
        elif mode == 'STRIPMAP':
            return 'ST'
        elif mode == 'DYNAMIC STRIPMAP':
            return 'DS'
        elif mode == 'SCANSAR':
            return 'SS'
        else:
            return 'UN'
Exemplo n.º 9
0
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)
Exemplo n.º 10
0
class SARImagingType(Serializable):
    """
    The SAR Imaging parameters
    """

    _fields = ('TxLFMFixed', 'TxPol', 'DwellTimes', 'TxAntenna', 'ImageArea')
    _required = ('TxPol', 'DwellTimes')
    # descriptors
    TxLFMFixed = BooleanDescriptor(
        'TxLFMFixed', _required, strict=DEFAULT_STRICT,
        docstring='Flag to indicate the same transmit LFM waveform is used for all pulses.'
                  ' vectors of the channel.')  # type: Union[None, bool]
    TxPol = StringEnumDescriptor(
        'TxPol', POLARIZATION_TYPE, _required, strict=DEFAULT_STRICT,
        docstring='Transmitted signal polarization for the channel.')  # type: str
    DwellTimes = SerializableDescriptor(
        'DwellTimes', DwellTimesType, _required, strict=DEFAULT_STRICT,
        docstring='COD Time and Dwell Time polynomials over the image area.')  # type: DwellTimesType
    TxAntenna = SerializableDescriptor(
        'TxAntenna', TxAntennaType, _required, strict=DEFAULT_STRICT,
        docstring='Antenna Phase Center and Antenna Pattern identifiers for the transmit antenna'
                  ' used to illuminate the imaged area.')  # type: Union[None, TxAntennaType]
    ImageArea = SerializableDescriptor(
        'ImageArea', AreaType, _required, strict=DEFAULT_STRICT,
        docstring='SAR Image Area for the channel defined by a rectangle aligned with (IAX, IAY).'
                  ' May be reduced by the optional polygon.')  # type: Union[None, AreaType]

    def __init__(self, TxLFMFixed=None, TxPol=None, DwellTimes=None, TxAntenna=None,
                 ImageArea=None, **kwargs):
        """

        Parameters
        ----------
        TxLFMFixed : None|bool
        TxPol : PolarizationType
        DwellTimes : DwellTimesType
        TxAntenna : None|TxAntennaType
        ImageArea : None|AreaType
        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.TxLFMFixed = TxLFMFixed
        self.TxPol = TxPol
        self.DwellTimes = DwellTimes
        self.TxAntenna = TxAntenna
        self.ImageArea = ImageArea
        super(SARImagingType, self).__init__(**kwargs)
Exemplo n.º 11
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)
Exemplo n.º 12
0
class TxStepType(Serializable):
    """
    Transmit sequence step details.
    """

    _fields = ('WFIndex', 'TxPolarization', 'index')
    _required = ('index', )
    _set_as_attribute = ('index', )
    # descriptors
    WFIndex = IntegerDescriptor(
        'WFIndex',
        _required,
        strict=DEFAULT_STRICT,
        docstring='The waveform number for this step.')  # type: int
    TxPolarization = StringEnumDescriptor(
        'TxPolarization',
        POLARIZATION2_VALUES,
        _required,
        strict=DEFAULT_STRICT,
        docstring='Transmit signal polarization for this step.')  # type: str
    index = IntegerDescriptor('index',
                              _required,
                              strict=DEFAULT_STRICT,
                              docstring='The step index')  # type: int

    def __init__(self,
                 WFIndex=None,
                 TxPolarization=None,
                 index=None,
                 **kwargs):
        """

        Parameters
        ----------
        WFIndex : int
        TxPolarization : str
        index : 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.WFIndex = WFIndex
        self.TxPolarization = TxPolarization
        self.index = index
        super(TxStepType, self).__init__(**kwargs)
Exemplo n.º 13
0
class LabelSourceType(Serializable):
    _fields = ('SourceType', 'SourceID', 'Description')
    _required = ('SourceType', )
    SourceType = StringEnumDescriptor(
        'SourceType', {
            'Ground Truth', 'Analyst Truth', 'Algorithm Truth', 'Other',
            'Unknown'
        },
        _required,
        docstring='The source type of the labeling effort')  # type: str
    SourceID = StringDescriptor(
        'SourceID',
        _required,
        docstring='The "ID" of the labeling source. '
        'This should be populated following program guidance.'
    )  # type: Optional[str]
    Description = StringDescriptor(
        'Description',
        _required,
        docstring='A description of the labeling source'
    )  # type: Optional[str]

    def __init__(self,
                 SourceType='Unknown',
                 SourceID=None,
                 Description=None,
                 **kwargs):
        """
        Parameters
        ----------
        SourceType : str
        SourceID : None|str
        Description : None|str
        kwargs
            Other keyword arguments
        """

        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.SourceType = SourceType
        self.SourceID = SourceID
        self.Description = Description
        super(LabelSourceType, self).__init__(**kwargs)
Exemplo n.º 14
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)
Exemplo n.º 15
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)
Exemplo n.º 16
0
class ColorManagementModuleType(Serializable):
    """
    Parameters describing the Color Management Module (CMM).
    """

    _fields = ('RenderingIntent', 'SourceProfile', 'DisplayProfile', 'ICCProfile')
    _required = ('RenderingIntent', 'SourceProfile')
    # Descriptor
    RenderingIntent = StringEnumDescriptor(
        'RenderingIntent', ('PERCEPTUAL', 'SATURATION', 'RELATIVE', 'ABSOLUTE'),
        _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)
Exemplo n.º 17
0
class TropoParametersType(Serializable):
    """
    Parameters used to compute the propagation delay due to the troposphere.
    """

    _fields = ('N0', 'RefHeight')
    _required = _fields
    _numeric_format = {'N0': FLOAT_FORMAT}
    # 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)
Exemplo n.º 18
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)
Exemplo n.º 19
0
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)
Exemplo n.º 20
0
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', 'RGB8LU', '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)
Exemplo n.º 21
0
class CollectionInfoType(Serializable):
    """General information about the collection."""
    _collections_tags = {
        'Parameters': {'array': False, 'child_tag': 'Parameter'},
        'CountryCodes': {'array': False, 'child_tag': 'CountryCode'},
    }
    _fields = (
        'CollectorName', 'IlluminatorName', 'CoreName', 'CollectType',
        'RadarMode', 'Classification', 'CountryCodes', 'Parameters')
    _required = ('CollectorName', 'CoreName', 'RadarMode', 'Classification')
    # other class variable
    _COLLECT_TYPE_VALUES = ('MONOSTATIC', 'BISTATIC')
    # descriptors
    CollectorName = StringDescriptor(
        'CollectorName', _required, strict=DEFAULT_STRICT,
        docstring='Radar platform identifier. For Bistatic collections, list the Receive platform.')  # type: str
    IlluminatorName = StringDescriptor(
        'IlluminatorName', _required, strict=DEFAULT_STRICT,
        docstring='Radar platform identifier that provided the illumination. For Bistatic collections, '
                  'list the transmit platform.')  # type: str
    CoreName = StringDescriptor(
        'CoreName', _required, strict=DEFAULT_STRICT,
        docstring='Collection and imaging data set identifier. Uniquely identifies imaging collections per '
                  'Program Specific Implementation Doc.')  # type: str
    CollectType = StringEnumDescriptor(
        'CollectType', _COLLECT_TYPE_VALUES, _required,
        docstring="Collection type identifier. Monostatic collections include single platform collections with "
                  "unique transmit and receive apertures.")  # type: str
    RadarMode = SerializableDescriptor(
        'RadarMode', RadarModeType, _required, strict=DEFAULT_STRICT,
        docstring='The radar mode.')  # type: RadarModeType
    Classification = StringDescriptor(
        'Classification', _required, strict=DEFAULT_STRICT, default_value='UNCLASSIFIED',
        docstring='Contains the human-readable banner. Contains classification, file control and handling, '
                  'file releasing, and/or proprietary markings. Specified per Program Specific '
                  'Implementation Document.')  # type: str
    CountryCodes = StringListDescriptor(
        'CountryCodes', _required, strict=DEFAULT_STRICT,
        docstring="List of country codes for region covered by the image.")  # type: List[str]
    Parameters = ParametersDescriptor(
        'Parameters', _collections_tags, _required, strict=DEFAULT_STRICT,
        docstring='Free form parameters object collection.')  # type: ParametersCollection

    def __init__(self, CollectorName=None, IlluminatorName=None, CoreName=None, CollectType=None,
                 RadarMode=None, Classification="UNCLASSIFIED", CountryCodes=None, Parameters=None, **kwargs):
        """

        Parameters
        ----------
        CollectorName : str
        IlluminatorName : str
        CoreName : str
        CollectType : str
        RadarMode : RadarModeType
        Classification : str
        CountryCodes : list|str
        Parameters : ParametersCollection|dict
        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.CollectorName, self.IlluminatorName = CollectorName, IlluminatorName
        self.CoreName, self.CollectType = CoreName, CollectType
        self.RadarMode = RadarMode
        self.Classification = Classification
        self.CountryCodes, self.Parameters = CountryCodes, Parameters
        super(CollectionInfoType, self).__init__(**kwargs)
Exemplo n.º 22
0
class PosVelErrType(Serializable):
    """
    Position and velocity error statistics for the radar platform.
    """

    _fields = ('Frame', 'P1', 'P2', 'P3', 'V1', 'V2', 'V3', 'CorrCoefs', 'PositionDecorr')
    _required = ('Frame', 'P1', 'P2', 'P3', 'V1', 'V2', 'V3')
    _numeric_format = {'P1': '0.16G', 'P2': '0.16G', 'P3': '0.16G', 'V1': '0.16G', 'V2': '0.16G', 'V3': '0.16G'}
    # class variables
    _FRAME_VALUES = ('ECF', 'RIC_ECF', 'RIC_ECI')
    # descriptors
    Frame = StringEnumDescriptor(
        'Frame', _FRAME_VALUES, _required, strict=True,
        docstring='Coordinate frame used for expressing P,V errors statistics. Note: '
                  '*RIC = Radial, In-Track, Cross-Track*, where radial is defined to be from earth center through '
                  'the platform position.')  # type: str
    P1 = FloatDescriptor(
        'P1', _required, strict=DEFAULT_STRICT, docstring='Position coordinate 1 standard deviation.')  # type: float
    P2 = FloatDescriptor(
        'P2', _required, strict=DEFAULT_STRICT, docstring='Position coordinate 2 standard deviation.')  # type: float
    P3 = FloatDescriptor(
        'P3', _required, strict=DEFAULT_STRICT, docstring='Position coordinate 3 standard deviation.')  # type: float
    V1 = FloatDescriptor(
        'V1', _required, strict=DEFAULT_STRICT, docstring='Velocity coordinate 1 standard deviation.')  # type: float
    V2 = FloatDescriptor(
        'V2', _required, strict=DEFAULT_STRICT, docstring='Velocity coordinate 2 standard deviation.')  # type: float
    V3 = FloatDescriptor(
        'V3', _required, strict=DEFAULT_STRICT, docstring='Velocity coordinate 3 standard deviation.')  # type: float
    CorrCoefs = SerializableDescriptor(
        'CorrCoefs', CorrCoefsType, _required, strict=DEFAULT_STRICT,
        docstring='Correlation Coefficient parameters.')  # type: CorrCoefsType
    PositionDecorr = SerializableDescriptor(
        'PositionDecorr', ErrorDecorrFuncType, _required, strict=DEFAULT_STRICT,
        docstring='Platform position error decorrelation function.')  # type: ErrorDecorrFuncType

    def __init__(self, Frame=None, P1=None, P2=None, P3=None, V1=None, V2=None, V3=None,
                 CorrCoefs=None, PositionDecorr=None, **kwargs):
        """

        Parameters
        ----------
        Frame : str
        P1 : float
        P2 : float
        P3 : float
        V1 : float
        V2 : float
        V3 : float
        CorrCoefs : CorrCoefsType
        PositionDecorr : ErrorDecorrFuncType
        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.Frame = Frame
        self.P1, self.P2, self.P3 = P1, P2, P3
        self.V1, self.V2, self.V3 = V1, V2, V3
        self.CorrCoefs, self.PositionDecorr = CorrCoefs, PositionDecorr
        super(PosVelErrType, self).__init__(**kwargs)
Exemplo n.º 23
0
class TxRcvPolarizationType(Serializable):
    """
    The transmit/receive polarization information.
    """

    _fields = ('TxPolarization', 'RcvPolarization', 'RcvPolarizationOffset')
    _required = ('TxPolarization', 'RcvPolarization')
    _numeric_format = {'RcvPolarizationOffset': FLOAT_FORMAT}
    # 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)
Exemplo n.º 24
0
class ImageInfoType(Serializable):
    _fields = ('DataFilename', 'ClassificationMarkings', 'Filetype',
               'DataCheckSum', 'DataSize', 'DataPlane', 'DataDomain',
               'DataType', 'BitsPerSample', 'DataFormat', 'DataByteOrder',
               'NumPixels', 'ImageCollectionDate', 'ZuluOffset',
               'SensorReferencePoint', 'SensorCalibrationFactor',
               'DataCalibrated', 'Resolution', 'PixelSpacing', 'WeightingType',
               'OverSamplingFactor', 'IPRWidth3dB', 'ImageQualityDescription',
               'ImageHeading', 'ImageCorners', 'SlantPlane', 'GroundPlane',
               'SceneCenterReferenceLine', 'ProjectionPerturbation')
    _required = ('DataFilename', 'ClassificationMarkings', 'DataCheckSum',
                 'DataPlane', 'DataDomain', 'DataType', 'DataFormat',
                 'NumPixels', 'ImageCollectionDate', 'SensorReferencePoint',
                 'DataCalibrated', 'Resolution', 'PixelSpacing',
                 'WeightingType', 'ImageCorners')
    _numeric_format = {
        'ImageHeading': '0.17G',
        'SensorCalibrationFactor': '0.17G',
        'SceneCenterReferenceLine': '0.17G',
    }
    # descriptors
    DataFilename = StringDescriptor(
        'DataFilename',
        _required,
        docstring='The base file name to which this information pertains'
    )  # type: str
    ClassificationMarkings = SerializableDescriptor(
        'ClassificationMarkings',
        ClassificationMarkingsType,
        _required,
        docstring='The classification information'
    )  # type: ClassificationMarkingsType
    Filetype = StringDescriptor(
        'Filetype', _required,
        docstring='The image file type')  # type: Optional[str]
    DataCheckSum = StringDescriptor(
        'DataCheckSum',
        _required,
        docstring='The 32 character (hexidecimal digest) MD5 checksum of the '
        'full image file')  # type: str
    DataSize = IntegerDescriptor(
        'DataSize', _required,
        docstring='The image size in bytes')  # type: Optional[int]
    DataPlane = StringEnumDescriptor('DataPlane', {'Slant', 'Ground'},
                                     _required,
                                     default_value='Slant',
                                     docstring='The image plane.')  # type: str
    DataDomain = StringEnumDescriptor(
        'DataDomain',
        {
            'Image',
        },
        _required,  # todo: values
        docstring='The image data domain')  # type: str
    DataType = StringEnumDescriptor(
        'DataType', {'Magnitude/Phase', 'In-phase/Quadrature'},
        _required,
        docstring='The image data type')  # type: str
    BitsPerSample = IntegerDescriptor(
        'BitsPerSample', _required,
        docstring='The number of bits per sample')  # type: Optional[int]
    DataFormat = StringDescriptor(
        'DataFormat', _required,
        docstring='The image data format')  # type: str
    DataByteOrder = StringEnumDescriptor(
        'DataByteOrder', {'Big-Endian', 'Little-Endian'},
        _required,
        docstring='The image data byte order.')  # type: Optional[str]
    NumPixels = SerializableDescriptor(
        'NumPixels',
        NumPixelsType,
        _required,
        docstring='The number of image pixels')  # type: NumPixelsType
    ImageCollectionDate = DateTimeDescriptor(
        'ImageCollectionDate',
        _required,
        docstring='The date/time of the image collection in UTC'
    )  # type: Optional[numpy.datetime64]
    ZuluOffset = StringDescriptor(
        'ZuluOffset', _required,
        docstring='The local time offset from UTC')  # type: Optional[str]
    SensorReferencePoint = StringEnumDescriptor(
        'DataPlane', {'Left', 'Right', 'Top', 'Bottom'},
        _required,
        docstring='Description of the sensor location relative to the scene.'
    )  # type: Optional[str]
    SensorCalibrationFactor = FloatDescriptor(
        'SensorCalibrationFactor',
        _required,
        docstring=
        'Multiplicative factor used to scale raw image data to the return '
        'of a calibrated reference reflector or active source'
    )  # type: Optional[float]
    DataCalibrated = BooleanDescriptor(
        'DataCalibrated', _required,
        docstring='Has the data been calibrated?')  # type: bool
    Resolution = SerializableDescriptor(
        'Resolution',
        RangeCrossRangeType,
        _required,
        docstring='Resolution (intrinsic) of the sensor system/mode in meters.'
    )  # type: RangeCrossRangeType
    PixelSpacing = SerializableDescriptor(
        'PixelSpacing',
        RangeCrossRangeType,
        _required,
        docstring='Pixel spacing of the image in meters.'
    )  # type: RangeCrossRangeType
    WeightingType = SerializableDescriptor(
        'WeightingType',
        StringRangeCrossRangeType,
        _required,
        docstring='Weighting function applied to the image during formation.'
    )  # type: StringRangeCrossRangeType
    OverSamplingFactor = SerializableDescriptor(
        'OverSamplingFactor',
        RangeCrossRangeType,
        _required,
        docstring='The factor by which the pixel space is oversampled.'
    )  # type: Optional[RangeCrossRangeType]
    IPRWidth3dB = SerializableDescriptor(
        'IPRWidth3dB',
        RangeCrossRangeType,
        _required,
        docstring='The 3 dB system impulse response with, in meters'
    )  # type: Optional[RangeCrossRangeType]
    ImageQualityDescription = StringDescriptor(
        'ImageQualityDescription',
        _required,
        docstring='General description of image quality'
    )  # type: Optional[str]
    ImageHeading = FloatDescriptor(
        'ImageHeading',
        _required,
        docstring='Image heading relative to True North, in degrees'
    )  # type: Optional[float]
    ImageCorners = SerializableDescriptor(
        'ImageCorners',
        ImageCornerType,
        _required,
        docstring='The image corners')  # type: ImageCornerType
    SlantPlane = SerializableDescriptor(
        'SlantPlane',
        PixelSpacingType,
        _required,
        docstring='The slant plane pixel spacing'
    )  # type: Optional[PixelSpacingType]
    GroundPlane = SerializableDescriptor(
        'GroundPlane',
        PixelSpacingType,
        _required,
        docstring='The ground plane pixel spacing'
    )  # type: Optional[PixelSpacingType]
    SceneCenterReferenceLine = FloatDescriptor(
        'SceneCenterReferenceLine',
        _required,
        docstring='The ideal line (heading) at the intersection of the radar '
        'line-of-sight with the horizontal reference plane '
        'created by the forward motion of the aircraft, '
        'in degrees')  # type: Optional[float]
    ProjectionPerturbation = SerializableDescriptor(
        'ProjectionPerturbation',
        ProjectionPerturbationType,
        _required,
        docstring='')  # type: Optional[ProjectionPerturbationType]

    def __init__(self,
                 DataFilename=None,
                 ClassificationMarkings=None,
                 FileType=None,
                 DataCheckSum=None,
                 DataSize=None,
                 DataPlane='Slant',
                 DataDomain=None,
                 DataType=None,
                 BitsPerSample=None,
                 DataFormat=None,
                 DataByteOrder=None,
                 NumPixels=None,
                 ImageCollectionDate=None,
                 ZuluOffset=None,
                 SensorReferencePoint=None,
                 SensorCalibrationFactor=None,
                 DataCalibrated=None,
                 Resolution=None,
                 PixelSpacing=None,
                 WeightingType=None,
                 OverSamplingFactor=None,
                 IPRWidth3dB=None,
                 ImageQualityDescription=None,
                 ImageHeading=None,
                 ImageCorners=None,
                 SlantPlane=None,
                 GroundPlane=None,
                 SceneCenterReferenceLine=None,
                 ProjectionPerturbation=None,
                 **kwargs):
        """
        Parameters
        ----------
        DataFilename : str
        ClassificationMarkings : ClassificationMarkingsType
        FileType : str
        DataCheckSum : str
        DataSize : int
        DataPlane : str
        DataDomain : None|str
        DataType : None|str
        BitsPerSample : None|int
        DataFormat : None|str
        DataByteOrder : None|str
        NumPixels : NumPixelsType|numpy.ndarray|list|tuple
        ImageCollectionDate : numpy.datetime64|datetime|date|str
        ZuluOffset : None|str
        SensorReferencePoint : None|str
        SensorCalibrationFactor : None|float
        DataCalibrated : bool
        Resolution : RangeCrossRangeType|numpy.ndarray|list|tuple
        PixelSpacing : RangeCrossRangeType|numpy.ndarray|list|tuple
        WeightingType : StringRangeCrossRangeType
        OverSamplingFactor : None|RangeCrossRangeType
        IPRWidth3dB : None|RangeCrossRangeType|numpy.ndarray|list|tuple
        ImageQualityDescription : None|str
        ImageHeading : None|float
        ImageCorners : ImageCornerType
        SlantPlane : None|PixelSpacingType
        GroundPlane : None|PixelSpacingType
        SceneCenterReferenceLine : None|float
        ProjectionPerturbation : None|ProjectionPerturbationType
        kwargs
            Other keyword arguments
        """

        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.DataFilename = DataFilename

        if ClassificationMarkings is None:
            self.ClassificationMarkings = ClassificationMarkingsType()
        else:
            self.ClassificationMarkings = ClassificationMarkings

        self.Filetype = FileType
        self.DataCheckSum = DataCheckSum
        self.DataSize = DataSize
        self.DataPlane = DataPlane
        self.DataDomain = DataDomain
        self.DataType = DataType

        self.BitsPerSample = BitsPerSample
        self.DataFormat = DataFormat
        self.DataByteOrder = DataByteOrder
        self.NumPixels = NumPixels
        self.ImageCollectionDate = ImageCollectionDate
        self.ZuluOffset = ZuluOffset

        self.SensorReferencePoint = SensorReferencePoint
        self.SensorCalibrationFactor = SensorCalibrationFactor
        self.DataCalibrated = DataCalibrated
        self.Resolution = Resolution
        self.PixelSpacing = PixelSpacing
        self.WeightingType = WeightingType
        self.OverSamplingFactor = OverSamplingFactor
        self.IPRWidth3dB = IPRWidth3dB

        self.ImageQualityDescription = ImageQualityDescription
        self.ImageHeading = ImageHeading
        self.ImageCorners = ImageCorners
        self.SlantPlane = SlantPlane
        self.GroundPlane = GroundPlane
        self.SceneCenterReferenceLine = SceneCenterReferenceLine
        self.ProjectionPerturbation = ProjectionPerturbation
        super(ImageInfoType, self).__init__(**kwargs)

    @classmethod
    def from_sicd(cls,
                  sicd,
                  base_file_name,
                  file_type='NITF02.10',
                  md5_checksum=None):
        """
        Construct the ImageInfo from the sicd object and given image file name.

        Parameters
        ----------
        sicd : SICDType
        base_file_name : str
        file_type : str
            The file type. This should probably always be NITF02.10 for now.
        md5_checksum : None|str
            The md5 checksum of the full image file.

        Returns
        -------
        ImageInfoType
        """

        pixel_type = sicd.ImageData.PixelType
        if pixel_type == 'RE32F_IM32F':
            data_type = 'In-phase/Quadrature'
            bits_per_sample = 32
            data_format = 'float'
        elif pixel_type == 'RE16I_IM16I':
            data_type = 'In-phase/Quadrature'
            bits_per_sample = 16
            data_format = 'integer'
        elif pixel_type == 'AMP8I_PHS8I':
            data_type = 'Magnitude/Phase'
            bits_per_sample = 8
            data_format = 'unsigned integer'
        else:
            raise ValueError('Unhandled')

        data_cal = sicd.Radiometric is not None

        icps = ImageCornerType(UpperLeft=sicd.GeoData.ImageCorners.FRFC,
                               UpperRight=sicd.GeoData.ImageCorners.FRLC,
                               LowerRight=sicd.GeoData.ImageCorners.LRLC,
                               LowerLeft=sicd.GeoData.ImageCorners.LRFC)

        if sicd.Grid.ImagePlane == 'SLANT':
            data_plane = 'Slant'
        elif sicd.Grid.ImagePlane == 'Ground':
            data_plane = 'Ground'
        else:
            data_plane = None

        has_perturb = False
        proj_perturb = None
        coa = sicd.coa_projection
        if coa is not None:
            delta_arp = coa.delta_arp
            if numpy.any(delta_arp != 0):
                has_perturb = True
            else:
                delta_arp = None

            delta_varp = coa.delta_varp
            if numpy.any(delta_varp != 0):
                has_perturb = True
            else:
                delta_varp = None

            delta_range = coa.delta_range
            if delta_range != 0:
                has_perturb = True
            else:
                delta_range = None

            if has_perturb:
                proj_perturb = ProjectionPerturbationType(
                    CoordinateFrame='ECF',
                    DeltaArp=delta_arp,
                    DeltaVarp=delta_varp,
                    DeltaRange=delta_range)

        return ImageInfoType(
            DataFilename=base_file_name,
            ClassificationMarkings=ClassificationMarkingsType(
                Classification=sicd.CollectionInfo.Classification),
            FileType=file_type,
            DataCheckSum=md5_checksum,
            DataPlane=data_plane,
            DataType=data_type,
            DataCalibrated=data_cal,
            BitsPerSample=bits_per_sample,
            DataDomain='Image',
            DataFormat=data_format,
            DataByteOrder='Big-Endian',
            NumPixels=(sicd.ImageData.NumRows, sicd.ImageData.NumCols),
            ImageCollectionDate=sicd.Timeline.CollectStart,
            SensorReferencePoint='Top',
            Resolution=(sicd.Grid.Row.ImpRespWid, sicd.Grid.Col.ImpRespWid),
            PixelSpacing=(sicd.Grid.Row.SS, sicd.Grid.Col.SS),
            WeightingType=StringRangeCrossRangeType(
                Range=sicd.Grid.Row.WgtType.WindowName,
                CrossRange=sicd.Grid.Col.WgtType.WindowName),
            ImageHeading=sicd.SCPCOA.AzimAng,
            ImageCorners=icps,
            ProjectionPerturbation=proj_perturb)
Exemplo n.º 25
0
class ImageDataType(Serializable):
    """The image pixel data."""
    _collections_tags = {
        'AmpTable': {
            'array': True,
            'child_tag': 'Amplitude'
        },
        'ValidData': {
            'array': True,
            'child_tag': 'Vertex'
        },
    }
    _fields = ('PixelType', 'AmpTable', 'NumRows', 'NumCols', 'FirstRow',
               'FirstCol', 'FullImage', 'SCPPixel', 'ValidData')
    _required = ('PixelType', 'NumRows', 'NumCols', 'FirstRow', 'FirstCol',
                 'FullImage', 'SCPPixel')
    _numeric_format = {'AmpTable': FLOAT_FORMAT}
    _PIXEL_TYPE_VALUES = ("RE32F_IM32F", "RE16I_IM16I", "AMP8I_PHS8I")
    # descriptors
    PixelType = StringEnumDescriptor(
        'PixelType',
        _PIXEL_TYPE_VALUES,
        _required,
        strict=True,
        docstring=
        "The PixelType attribute which specifies the interpretation of the file data."
    )  # type: str
    AmpTable = FloatArrayDescriptor(
        'AmpTable',
        _collections_tags,
        _required,
        strict=DEFAULT_STRICT,
        minimum_length=256,
        maximum_length=256,
        docstring="The amplitude look-up table. This is required if "
        "`PixelType == 'AMP8I_PHS8I'`")  # type: numpy.ndarray
    NumRows = IntegerDescriptor(
        'NumRows',
        _required,
        strict=True,
        docstring='The number of Rows in the product. May include zero rows.'
    )  # type: int
    NumCols = IntegerDescriptor(
        'NumCols',
        _required,
        strict=True,
        docstring='The number of Columns in the product. May include zero rows.'
    )  # type: int
    FirstRow = IntegerDescriptor(
        'FirstRow',
        _required,
        strict=DEFAULT_STRICT,
        docstring='Global row index of the first row in the product. '
        'Equal to 0 in full image product.')  # type: int
    FirstCol = IntegerDescriptor(
        'FirstCol',
        _required,
        strict=DEFAULT_STRICT,
        docstring='Global column index of the first column in the product. '
        'Equal to 0 in full image product.')  # type: int
    FullImage = SerializableDescriptor(
        'FullImage',
        FullImageType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='Original full image product.')  # type: FullImageType
    SCPPixel = SerializableDescriptor(
        'SCPPixel',
        RowColType,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Scene Center Point pixel global row and column index. Should be located near the '
        'center of the full image.')  # type: RowColType
    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,
                 PixelType=None,
                 AmpTable=None,
                 NumRows=None,
                 NumCols=None,
                 FirstRow=None,
                 FirstCol=None,
                 FullImage=None,
                 SCPPixel=None,
                 ValidData=None,
                 **kwargs):
        """

        Parameters
        ----------
        PixelType : str
        AmpTable : numpy.ndarray|list|tuple
        NumRows : int
        NumCols : int
        FirstRow : int
        FirstCol : int
        FullImage : FullImageType|numpy.ndarray|list|tuple
        SCPPixel : RowColType|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.PixelType = PixelType
        self.AmpTable = AmpTable
        self.NumRows, self.NumCols = NumRows, NumCols
        self.FirstRow, self.FirstCol = FirstRow, FirstCol
        self.FullImage = FullImage
        self.SCPPixel = SCPPixel
        self.ValidData = ValidData
        super(ImageDataType, self).__init__(**kwargs)

    def _check_valid_data(self):
        if self.ValidData is None:
            return True
        if len(self.ValidData) < 2:
            return True

        value = True
        valid_data = self.ValidData.get_array(dtype='float64')
        lin_ring = LinearRing(coordinates=valid_data)
        area = lin_ring.get_area()
        if area == 0:
            self.log_validity_error('ValidData encloses no area.')
            value = False
        elif area > 0:
            self.log_validity_error(
                "ValidData must be traversed in clockwise direction.")
            value = False
        for i, entry in enumerate(valid_data):
            if not (
                (self.FirstRow <= entry[0] <= self.FirstRow + self.NumRows) and
                (self.FirstCol <= entry[1] <= self.FirstCol + self.NumCols)):
                self.log_validity_warning(
                    'ValidData entry {} is not contained in the image bounds'.
                    format(i))
                value = False
        return value

    def _basic_validity_check(self):
        condition = super(ImageDataType, self)._basic_validity_check()
        if (self.PixelType == 'AMP8I_PHS8I') and (self.AmpTable is None):
            self.log_validity_error(
                "We have `PixelType='AMP8I_PHS8I'` and `AmpTable` is not defined for ImageDataType."
            )
            condition = False
        if (self.PixelType != 'AMP8I_PHS8I') and (self.AmpTable is not None):
            self.log_validity_error(
                "We have `PixelType != 'AMP8I_PHS8I'` and `AmpTable` is defined for ImageDataType."
            )
            condition = False
        if (self.ValidData is not None) and (len(self.ValidData) < 3):
            self.log_validity_error(
                "We have `ValidData` defined with fewer than 3 entries.")
            condition = False
        condition &= self._check_valid_data()
        return condition

    def get_valid_vertex_data(self, dtype=numpy.int64):
        """
        Gets an array of `[row, col]` indices defining the valid data. If this is not viable, then `None`
        will be returned.

        Parameters
        ----------
        dtype : object
            the data type for the array

        Returns
        -------
        numpy.ndarray|None
        """

        if self.ValidData is None:
            return None
        out = numpy.zeros((self.ValidData.size, 2), dtype=dtype)
        for i, entry in enumerate(self.ValidData):
            out[i, :] = entry.get_array(dtype=dtype)
        return out

    def get_full_vertex_data(self, dtype=numpy.int64):
        """
        Gets an array of `[row, col]` indices defining the full vertex data. If this is not viable, then `None`
        will be returned.

        Parameters
        ----------
        dtype : object
            the data type for the array

        Returns
        -------
        numpy.ndarray|None
        """

        if self.NumRows is None or self.NumCols is None:
            return None
        return numpy.array(
            [[0, 0], [0, self.NumCols - 1],
             [self.NumRows - 1, self.NumCols - 1], [self.NumRows - 1, 0]],
            dtype=dtype)

    def get_pixel_size(self) -> int:
        """
        Gets the size per pixel, in bytes.

        Returns
        -------
        int
        """

        if self.PixelType == "RE32F_IM32F":
            return 8
        elif self.PixelType == "RE16I_IM16I":
            return 4
        elif self.PixelType == "AMP8I_PHS8I":
            return 2
        else:
            raise ValueError('Got unhandled pixel type `{}`'.format(
                self.PixelType))
Exemplo n.º 26
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', 'RGB8LU', '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)

    def get_pixel_size(self) -> int:
        """
        Gets the raw size per pixel, in bytes.

        Returns
        -------
        int
        """

        if self.PixelType == 'MONO8I':
            return 1
        elif self.PixelType == 'MONO8LU':
            return 1
        elif self.PixelType == 'MONO16I':
            return 2
        elif self.PixelType == 'RGB8LU':
            return 1
        elif self.PixelType == 'RGB24I':
            return 3
        else:
            raise ValueError('Got unhandled pixel type `{}`'.format(
                self.PixelType))
Exemplo n.º 27
0
class RMAType(Serializable):
    """Parameters included when the image is formed using the Range Migration Algorithm."""
    _fields = ('RMAlgoType', 'ImageType', 'RMAT', 'RMCR', 'INCA')
    _required = ('RMAlgoType', 'ImageType')
    _choice = ({'required': True, 'collection': ('RMAT', 'RMCR', 'INCA')}, )
    # class variables
    _RM_ALGO_TYPE_VALUES = ('OMEGA_K', 'CSA', 'RG_DOP')
    # descriptors
    RMAlgoType = StringEnumDescriptor('RMAlgoType',
                                      _RM_ALGO_TYPE_VALUES,
                                      _required,
                                      strict=DEFAULT_STRICT,
                                      docstring=r"""
        Identifies the type of migration algorithm used:

        * `OMEGA_K` - Algorithms that employ Stolt interpolation of the Kxt dimension. :math:`Kx = \sqrt{Kf^2 - Ky^2}`

        * `CSA` - Wave number algorithm that process two-dimensional chirp signals.

        * `RG_DOP` - Range-Doppler algorithms that employ *RCMC* in the compressed range domain.

        """)  # type: str
    RMAT = SerializableDescriptor(
        'RMAT',
        RMRefType,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Parameters for *RMA with Along Track (RMAT)* motion compensation.'
    )  # type: RMRefType
    RMCR = SerializableDescriptor(
        'RMCR',
        RMRefType,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Parameters for *RMA with Cross Range (RMCR)* motion compensation.'
    )  # type: RMRefType
    INCA = SerializableDescriptor(
        'INCA',
        INCAType,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Parameters for *Imaging Near Closest Approach (INCA)* image description.'
    )  # type: INCAType

    def __init__(self,
                 RMAlgoType=None,
                 RMAT=None,
                 RMCR=None,
                 INCA=None,
                 **kwargs):
        """

        Parameters
        ----------
        RMAlgoType : str
        RMAT : RMRefType
        RMCR : RMRefType
        INCA : INCAType
        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.RMAlgoType = RMAlgoType
        self.RMAT = RMAT
        self.RMCR = RMCR
        self.INCA = INCA
        super(RMAType, self).__init__(**kwargs)

    @property
    def ImageType(self):  # type: () -> Union[None, str]
        """
        str: READ ONLY attribute. Identifies the specific RM image type / metadata type supplied. This is determined by
        returning the (first) attribute among `'RMAT', 'RMCR', 'INCA'` which is populated. `None` will be returned if
        none of them are populated.
        """

        for attribute in self._choice[0]['collection']:
            if getattr(self, attribute) is not None:
                return attribute
        return None

    def _derive_parameters(self, SCPCOA, Position, RadarCollection,
                           ImageFormation):
        """
        Expected to be called from SICD parent.

        Parameters
        ----------
        SCPCOA : sarpy.io.complex.sicd_elements.SCPCOA.SCPCOAType
        Position : sarpy.io.complex.sicd_elements.Position.PositionType
        RadarCollection : sarpy.io.complex.sicd_elements.RadarCollection.RadarCollectionType
        ImageFormation : sarpy.io.complex.sicd_elements.ImageFormation.ImageFormationType

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

        if SCPCOA is None:
            return

        scp = None if SCPCOA.ARPPos is None else SCPCOA.ARPPos.get_array()

        im_type = self.ImageType
        if im_type in ['RMAT', 'RMCR']:
            rm_ref = getattr(self, im_type)  # type: RMRefType
            if rm_ref.PosRef is None and SCPCOA.ARPPos is not None:
                rm_ref.PosRef = SCPCOA.ARPPos.copy()
            if rm_ref.VelRef is None and SCPCOA.ARPVel is not None:
                rm_ref.VelRef = SCPCOA.ARPVel.copy()
            if scp is not None and rm_ref.PosRef is not None and rm_ref.VelRef is not None:
                pos_ref = rm_ref.PosRef.get_array()
                vel_ref = rm_ref.VelRef.get_array()
                uvel_ref = vel_ref / norm(vel_ref)
                ulos = (scp - pos_ref
                        )  # it absolutely could be that scp = pos_ref
                ulos_norm = norm(ulos)
                if ulos_norm > 0:
                    ulos /= ulos_norm
                    if rm_ref.DopConeAngRef is None:
                        rm_ref.DopConeAngRef = numpy.rad2deg(
                            numpy.arccos(numpy.dot(uvel_ref, ulos)))
        elif im_type == 'INCA':
            if scp is not None and self.INCA.TimeCAPoly is not None and \
                    Position is not None and Position.ARPPoly is not None:
                t_zero = self.INCA.TimeCAPoly.Coefs[0]
                ca_pos = Position.ARPPoly(t_zero)
                if self.INCA.R_CA_SCP is None:
                    self.INCA.R_CA_SCP = norm(ca_pos - scp)
            if self.INCA.FreqZero is None:
                self.INCA.FreqZero = _get_center_frequency(
                    RadarCollection, ImageFormation)

    def _apply_reference_frequency(self, reference_frequency):
        """
        If the reference frequency is used, adjust the necessary fields accordingly.
        Expected to be called by SICD parent.

        Parameters
        ----------
        reference_frequency : float
            The reference frequency.

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

        if self.INCA is not None:
            # noinspection PyProtectedMember
            self.INCA._apply_reference_frequency(reference_frequency)
Exemplo n.º 28
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
Exemplo n.º 29
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)
Exemplo n.º 30
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