示例#1
0
class GeographicCoordinateSystemType(Serializable):
    """

    """
    _fields = ('Csname', 'Datum', 'PrimeMeridian', 'AngularUnit', 'LinearUnit')
    _required = ('Csname', 'Datum', 'PrimeMeridian', 'AngularUnit')
    # Descriptor
    Csname = _StringDescriptor('Csname',
                               _required,
                               strict=DEFAULT_STRICT,
                               docstring='')  # type: str
    Datum = _SerializableDescriptor('Datum',
                                    DatumType,
                                    _required,
                                    strict=DEFAULT_STRICT,
                                    docstring='')  # type: DatumType
    PrimeMeridian = _SerializableDescriptor(
        'PrimeMeridian',
        PrimeMeridianType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='')  # type: PrimeMeridianType
    AngularUnit = _StringDescriptor('AngularUnit',
                                    _required,
                                    strict=DEFAULT_STRICT,
                                    docstring='')  # type: str
    LinearUnit = _StringDescriptor('LinearUnit',
                                   _required,
                                   strict=DEFAULT_STRICT,
                                   docstring='')  # type: str

    def __init__(self,
                 Csname=None,
                 Datum=None,
                 PrimeMeridian=None,
                 AngularUnit=None,
                 LinearUnit=None,
                 **kwargs):
        """

        Parameters
        ----------
        Csname : str
        Datum : DatumType
        PrimeMeridian : PrimeMeridianType
        AngularUnit : str
        LinearUnit : 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.Csname = Csname
        self.Datum = Datum
        self.PrimeMeridian = PrimeMeridian
        self.AngularUnit = AngularUnit
        self.LinearUnit = LinearUnit
        super(GeographicCoordinateSystemType, self).__init__(**kwargs)
示例#2
0
class ProcessorInformationType(Serializable):
    """
    Details regarding the processor.
    """
    _fields = ('Application', 'ProcessingDateTime', 'Site', 'Profile')
    _required = ('Application', 'ProcessingDateTime', 'Site')
    # descriptors
    Application = _StringDescriptor(
        'Application',
        _required,
        strict=DEFAULT_STRICT,
        docstring='Name and version of the application used to create the image.'
    )  # type: str
    ProcessingDateTime = _DateTimeDescriptor(
        'ProcessingDateTime',
        _required,
        strict=DEFAULT_STRICT,
        numpy_datetime_units='us',
        docstring=
        'Date and time the image creation application processed the image (UTC).'
    )  # type: numpy.datetime64
    Site = _StringDescriptor(
        'Site',
        _required,
        strict=DEFAULT_STRICT,
        docstring='The creation site of this SICD product.')  # type: str
    Profile = _StringDescriptor(
        'Profile',
        _required,
        strict=DEFAULT_STRICT,
        docstring='Identifies what profile was used to create this SICD product.'
    )  # type: str

    def __init__(self,
                 Application=None,
                 ProcessingDateTime=None,
                 Site=None,
                 Profile=None,
                 **kwargs):
        """

        Parameters
        ----------
        Application : str
        ProcessingDateTime : numpy.datetime64|datetime|date|str
        Site : str
        Profile : 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.Application = Application
        self.ProcessingDateTime = ProcessingDateTime
        self.Site = Site
        self.Profile = Profile
        super(ProcessorInformationType, self).__init__(**kwargs)
示例#3
0
class UserDefinedPVPType(Serializable):
    """
    A user defined PVP structure.
    """

    _fields = ('Name', 'Offset', 'Size', 'Format')
    _required = _fields
    # descriptors
    Name = _StringDescriptor('Name',
                             _required,
                             strict=DEFAULT_STRICT,
                             docstring='')  # type: str
    Offset = _IntegerDescriptor('Offset',
                                _required,
                                strict=DEFAULT_STRICT,
                                bounds=(0, None),
                                docstring='')  # type: int
    Size = _IntegerDescriptor('Size',
                              _required,
                              strict=DEFAULT_STRICT,
                              bounds=(1, None),
                              docstring='')  # type: int
    Format = _StringDescriptor('Format',
                               _required,
                               strict=DEFAULT_STRICT,
                               docstring='')  # type: str

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

        Parameters
        ----------
        Name : str
        Offset : int
        Size : int
        Format : 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.Name = Name
        self.Offset = Offset
        self.Size = Size
        self.Format = Format
        super(UserDefinedPVPType, self).__init__(**kwargs)
示例#4
0
class GainPhaseArrayType(Serializable):
    """
    Parameters that identify 2-D sampled Gain & Phase patterns at single
    frequency value.
    """

    _fields = ('Freq', 'ArrayId', 'ElementId')
    _required = ('Freq', 'ArrayId')
    # descriptors
    Freq = _FloatDescriptor(
        'Freq',
        _required,
        strict=DEFAULT_STRICT,
        bounds=(0, None),
        docstring='Frequency value for which the sampled Array and Element '
        'pattern(s) are provided, in Hz.')  # type: float
    ArrayId = _StringDescriptor(
        'ArrayId',
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Support array identifier of the sampled gain/phase of the array '
        'at ref Frequency.')  # type: str
    ElementId = _StringDescriptor(
        'ElementId',
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Support array identifier of the sampled gain/phase of the element '
        'at ref frequency.')  # type: str

    def __init__(self, Freq=None, ArrayId=None, ElementId=None, **kwargs):
        """

        Parameters
        ----------
        Freq : float
        ArrayId : str
        ElementId : 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.Freq = Freq
        self.ArrayId = ArrayId
        self.ElementId = ElementId
        super(GainPhaseArrayType, self).__init__(**kwargs)
示例#5
0
class ParameterType(Serializable):
    """
    The parameter type.
    """

    _fields = ('ParameterName', 'Value')
    _required = _fields
    _numeric_format = {'Value': '0.16G'}
    # Descriptor
    ParameterName = _StringDescriptor(
        'ParameterName', _required, strict=DEFAULT_STRICT,
        docstring='')  # type: str
    Value = _FloatDescriptor(
        'Value', _required, strict=DEFAULT_STRICT,
        docstring='')  # type: float

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

        Parameters
        ----------
        ParameterName : str
        Value : 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.ParameterName = ParameterName
        self.Value = Value
        super(ParameterType, self).__init__(**kwargs)
示例#6
0
class ProjectionType(Serializable):
    """
    The projection type.
    """

    _fields = ('ProjectionName', )
    _required = ('ProjectionName', )
    # Descriptor
    ProjectionName = _StringDescriptor(
        'ProjectionName', _required, strict=DEFAULT_STRICT,
        docstring='')  # type: str

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

        Parameters
        ----------
        ProjectionName : 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.ProjectionName = ProjectionName
        super(ProjectionType, self).__init__(**kwargs)
示例#7
0
class PrimeMeridianType(Serializable):
    """
    The prime meridian location.
    """

    _fields = ('Name', 'Longitude')
    _required = _fields
    _numeric_format = {'Longitude': '0.16G'}
    # Descriptor
    Name = _StringDescriptor(
        'Name', _required, strict=DEFAULT_STRICT,
        docstring='')  # type: str
    Longitude = _FloatDescriptor(
        'Longitude', _required, strict=DEFAULT_STRICT,
        docstring='')  # type: float

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

        Parameters
        ----------
        Name : str
        Longitude : 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.Name = Name
        self.Longitude = Longitude
        super(PrimeMeridianType, self).__init__(**kwargs)
示例#8
0
class AntPhaseCenterType(Serializable):
    """
    Parameters that describe each Antenna Phase Center (APC).
    """

    _fields = ('Identifier', 'ACFId', 'APCXYZ')
    _required = _fields
    # descriptors
    Identifier = _StringDescriptor(
        'Identifier',
        _required,
        strict=DEFAULT_STRICT,
        docstring='String that uniquely identifies this APC.')  # type: str
    ACFId = _StringDescriptor(
        'ACFId',
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Identifier of Antenna Coordinate Frame used for computing the '
        'antenna gain and phase patterns.')  # type: str
    APCXYZ = _SerializableDescriptor(
        'APCXYZ',
        XYZType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='The APC location in the ACF XYZ coordinate '
        'frame.')  # type: XYZType

    def __init__(self, Identifier=None, ACFId=None, APCXYZ=None, **kwargs):
        """

        Parameters
        ----------
        Identifier : str
        ACFId : str
        APCXYZ : XYZType|numpy.ndarray|list|tuple
        kwargs
        """

        if '_xml_ns' in kwargs:
            self._xml_ns = kwargs['_xml_ns']
        if '_xml_ns_key' in kwargs:
            self._xml_ns_key = kwargs['_xml_ns_key']
        self.Identifier = Identifier
        self.ACFId = ACFId
        self.APCXYZ = APCXYZ
        super(AntPhaseCenterType, self).__init__(**kwargs)
示例#9
0
class ProjectedCoordinateSystemType(Serializable):
    """

    """
    _fields = ('Csname', 'GeographicCoordinateSystem', 'Projection', 'Parameter', 'LinearUnit')
    _required = ('Csname', 'GeographicCoordinateSystem', 'Projection', 'LinearUnit')
    # Descriptor
    Csname = _StringDescriptor(
        'Csname', _required, strict=DEFAULT_STRICT,
        docstring='')  # type: str
    GeographicCoordinateSystem = _SerializableDescriptor(
        'GeographicCoordinateSystem', GeographicCoordinateSystemType, _required, strict=DEFAULT_STRICT,
        docstring='')  # type: GeographicCoordinateSystemType
    Projection = _SerializableDescriptor(
        'Projection', ProjectionType, _required, strict=DEFAULT_STRICT,
        docstring='')  # type: ProjectionType
    Parameter = _SerializableDescriptor(
        'Parameter', ParameterType, _required, strict=DEFAULT_STRICT,
        docstring='')  # type: Union[None, ParameterType]
    LinearUnit = _StringDescriptor(
        'LinearUnit', _required, strict=DEFAULT_STRICT,
        docstring='')  # type: str

    def __init__(self, Csname=None, GeographicCoordinateSystem=None, Projection=None, Parameter=None,
                 LinearUnit=None, **kwargs):
        """

        Parameters
        ----------
        Csname : str
        GeographicCoordinateSystem : GeographicCoordinateSystemType
        Projection : ProjectionType
        Parameter : None|ParameterType
        LinearUnit : 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.Csname = Csname
        self.GeographicCoordinateSystem = GeographicCoordinateSystem
        self.Projection = Projection
        self.Parameter = Parameter
        self.LinearUnit = LinearUnit
        super(ProjectedCoordinateSystemType, self).__init__(**kwargs)
示例#10
0
class CollectionIDType(CollectionInfoType):
    """
    The CollectionID type definition.
    """

    _fields = ('CollectorName', 'IlluminatorName', 'CoreName', 'CollectType',
               'RadarMode', 'Classification', 'ReleaseInfo', 'Parameters',
               'CountryCodes')
    _required = ('CollectorName', 'CoreName', 'RadarMode', 'Classification',
                 'ReleaseInfo')
    # descriptors
    ReleaseInfo = _StringDescriptor(
        'ReleaseInfo',
        _required,
        strict=DEFAULT_STRICT,
        default_value='UNRESTRICTED',
        docstring='The product release information.')  # type: str

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

        Parameters
        ----------
        CollectorName : str
        IlluminatorName : str
        CoreName : str
        CollectType : str
        RadarMode : RadarModeType
        Classification : str
        ReleaseInfo : 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.ReleaseInfo = ReleaseInfo
        super(CollectionIDType, self).__init__(CollectorName=CollectorName,
                                               IlluminatorName=IlluminatorName,
                                               CoreName=CoreName,
                                               CollectType=CollectType,
                                               RadarMode=RadarMode,
                                               Classification=Classification,
                                               CountryCodes=CountryCodes,
                                               Parameters=Parameters,
                                               **kwargs)
示例#11
0
文件: Data.py 项目: nyulacska/sarpy
class SupportArraySizeType(Serializable):
    """
    Support Array size parameters.
    """

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

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

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

        if '_xml_ns' in kwargs:
            self._xml_ns = kwargs['_xml_ns']
        if '_xml_ns_key' in kwargs:
            self._xml_ns_key = kwargs['_xml_ns_key']
        self.Identifier = Identifier
        self.NumRows = NumRows
        self.NumCols = NumCols
        self.BytesPerElement = BytesPerElement
        self.ArrayByteOffset = ArrayByteOffset
        super(SupportArraySizeType, self).__init__(**kwargs)

    def calculate_size(self):
        """
        Calculates the size of the support array in bytes as described by the contained fields.
        """
        return self.BytesPerElement * self.NumRows * self.NumCols
示例#12
0
class AntCoordFrameType(Serializable):
    """
    Unit vectors that describe the orientation of an Antenna Coordinate Frame
    (ACF) as function of time.
    """

    _fields = ('Identifier', 'XAxisPoly', 'YAxisPoly')
    _required = _fields
    # descriptors
    Identifier = _StringDescriptor(
        'Identifier',
        _required,
        strict=DEFAULT_STRICT,
        docstring='String that uniquely identifies this ACF.')  # type: str
    XAxisPoly = _SerializableDescriptor(
        'XAxisPoly',
        XYZPolyType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='Antenna X-Axis unit vector in ECF coordinates as a function '
        'of time.')  # type: XYZPolyType
    YAxisPoly = _SerializableDescriptor(
        'YAxisPoly',
        XYZPolyType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='Antenna Y-Axis unit vector in ECF coordinates as a function '
        'of time.')  # type: XYZPolyType

    def __init__(self,
                 Identifier=None,
                 XAxisPoly=None,
                 YAxisPoly=None,
                 **kwargs):
        """

        Parameters
        ----------
        Identifier : str
        XAxisPoly : XYZPolyType
        YAxisPoly : XYZPolyType
        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.XAxisPoly = XAxisPoly
        self.YAxisPoly = YAxisPoly
        super(AntCoordFrameType, self).__init__(**kwargs)
示例#13
0
class ReferencePointType(Serializable):
    """
    A reference point.
    """

    _fields = ('ECEF', 'Point', 'name')
    _required = ('ECEF', 'Point')
    _set_as_attribute = ('name', )
    _child_xml_ns_key = {'ECEF': 'sicommon', 'Point': 'sicommon'}
    # Descriptor
    ECEF = _SerializableDescriptor(
        'ECEF',
        XYZType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='The ECEF coordinates of the reference point.'
    )  # type: XYZType
    Point = _SerializableDescriptor(
        'Point',
        RowColDoubleType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='The pixel coordinates of the reference point.'
    )  # type: RowColDoubleType
    name = _StringDescriptor(
        'name',
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Used for implementation specific signifier for the reference point.'
    )  # type: Union[None, str]

    def __init__(self, ECEF=None, Point=None, name=None, **kwargs):
        """

        Parameters
        ----------
        ECEF : XYZType|numpy.ndarray|list|tuple
        Point : RowColDoubleType|numpy.ndarray|list|tuple
        name : 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.ECEF = ECEF
        self.Point = Point
        self.name = name
        super(ReferencePointType, self).__init__(**kwargs)
示例#14
0
class DwellTimesType(Serializable):
    """
    COD Time and Dwell Time polynomials over the image area.
    """

    _fields = ('CODId', 'DwellId')
    _required = _fields
    # descriptors
    CODId = _StringDescriptor(
        'CODId',
        _required,
        strict=DEFAULT_STRICT,
        docstring='Identifier of the Center of Dwell Time polynomial that maps '
        'reference surface position to COD time.')  # type: str
    DwellId = _StringDescriptor(
        'DwellId',
        _required,
        strict=DEFAULT_STRICT,
        docstring='Identifier of the Dwell Time polynomial that maps reference '
        'surface position to dwell time.')  # type: str

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

        Parameters
        ----------
        CODId : str
        DwellId : 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.CODId = CODId
        self.DwellId = DwellId
        super(DwellTimesType, self).__init__(**kwargs)
示例#15
0
class AnnotationType(Serializable):
    """
    The annotation type.
    """

    _fields = ('Identifier', 'SpatialReferenceSystem', 'Objects')
    _required = ('Identifier', 'Objects')
    _collections_tags = {'Objects': {'array': False, 'child_tag': 'Object'}}
    # Descriptor
    Identifier = _StringDescriptor('Identifier',
                                   _required,
                                   strict=DEFAULT_STRICT,
                                   docstring='')  # type: str
    SpatialReferenceSystem = _SerializableDescriptor(
        'SpatialReferenceSystem',
        ReferenceSystemType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='')  # type: Union[None, ReferenceSystemType]
    Objects = _SerializableListDescriptor(
        'Objects',
        AnnotationObjectType,
        _collections_tags,
        _required,
        strict=DEFAULT_STRICT,
        docstring='')  # type: List[AnnotationObjectType]

    def __init__(self,
                 Identifier=None,
                 SpatialReferenceSystem=None,
                 Objects=None,
                 **kwargs):
        """

        Parameters
        ----------
        Identifier : str
        SpatialReferenceSystem : None|ReferenceSystemType
        Objects : List[AnnotationObjectType]
        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.SpatialReferenceSystem = SpatialReferenceSystem
        self.Objects = Objects
        super(AnnotationType, self).__init__(**kwargs)
示例#16
0
class PredefinedLookupType(Serializable):
    """
    The predefined lookup table type. Allows for reference **either** by name, or family/member id number.
    """
    _fields = ('DatabaseName', 'RemapFamily', 'RemapMember')
    _required = ()
    # Descriptor
    DatabaseName = _StringDescriptor(
        'DatabaseName',
        _required,
        strict=DEFAULT_STRICT,
        docstring='Database name of LUT to use.')  # type: str
    RemapFamily = _IntegerDescriptor(
        'RemapFamily',
        _required,
        strict=DEFAULT_STRICT,
        docstring='The lookup family number.')  # type: int
    RemapMember = _IntegerDescriptor(
        'RemapMember',
        _required,
        strict=DEFAULT_STRICT,
        docstring='The lookup member number.')  # type: int

    def __init__(self,
                 DatabaseName=None,
                 RemapFamily=None,
                 RemapMember=None,
                 **kwargs):
        """

        Parameters
        ----------
        DatabaseName : None|str
        RemapFamily : None|int
        RemapMember : 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.RemapFamily = RemapFamily
        self.RemapMember = RemapMember
        super(PredefinedLookupType, self).__init__(**kwargs)
示例#17
0
class NewLookupTableType(Serializable):
    """
    The lookup table. Allows **either** a reference to a prefined lookup table, or
    custom lookup table array.
    """

    _fields = ('LUTName', 'Predefined', 'Custom')
    _required = ('LUTName', )
    _choice = ({'required': True, 'collection': ('Predefined', 'Custom')}, )
    # Descriptor
    LUTName = _StringDescriptor('LUTName',
                                _required,
                                strict=DEFAULT_STRICT,
                                docstring='The lookup table name')  # type: str
    Predefined = _SerializableDescriptor(
        'Predefined',
        PredefinedLookupType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='')  # type: PredefinedLookupType
    Custom = _SerializableDescriptor('Custom',
                                     CustomLookupType,
                                     _required,
                                     strict=DEFAULT_STRICT,
                                     docstring='')  # type: CustomLookupType

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

        Parameters
        ----------
        LUTName : str
        Predefined : None|PredefinedLookupType
        Custom : None|CustomLookupType
        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.LUTName = LUTName
        self.Predefined = Predefined
        self.Custom = Custom
        super(NewLookupTableType, self).__init__(**kwargs)
示例#18
0
class SpheroidType(Serializable):
    """

    """
    _fields = ('SpheroidName', 'SemiMajorAxis', 'InverseFlattening')
    _required = _fields
    _numeric_format = {'SemiMajorAxis': '0.16G', 'InverseFlattening': '0.16G'}
    # Descriptor
    SpheroidName = _StringDescriptor('SpheroidName',
                                     _required,
                                     strict=DEFAULT_STRICT,
                                     docstring='')  # type: str
    SemiMajorAxis = _FloatDescriptor('SemiMajorAxis',
                                     _required,
                                     strict=DEFAULT_STRICT,
                                     docstring='')  # type: float
    InverseFlattening = _FloatDescriptor('InverseFlattening',
                                         _required,
                                         strict=DEFAULT_STRICT,
                                         docstring='')  # type: float

    def __init__(self,
                 SpheroidName=None,
                 SemiMajorAxis=None,
                 InverseFlattening=None,
                 **kwargs):
        """

        Parameters
        ----------
        SpheroidName : str
        SemiMajorAxis : float
        InverseFlattening : 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.SpheroidName = SpheroidName
        self.SemiMajorAxis = SemiMajorAxis
        self.InverseFlattening = InverseFlattening
        super(SpheroidType, self).__init__(**kwargs)
示例#19
0
class GeographicInformationType(Serializable):
    """
    Geographic information.
    """

    _fields = ('CountryCodes', 'SecurityInfo', 'GeographicInfoExtensions')
    _required = ()
    _collections_tags = {
        'CountryCodes': {'array': False, 'child_tag': 'CountryCode'},
        'GeographicInfoExtensions': {'array': False, 'child_tag': 'GeographicInfoExtension'}}
    # descriptors
    CountryCodes = _StringListDescriptor(
        'CountryCodes', _required, strict=DEFAULT_STRICT,
        docstring="List of country codes for region covered by the image.")  # type: List[str]
    SecurityInfo = _StringDescriptor(
        'SecurityInfo', _required, strict=DEFAULT_STRICT,
        docstring='Specifies classification level or special handling designators '
                  'for this geographic region.')  # type: Union[None, str]
    GeographicInfoExtensions = _ParametersDescriptor(
        'GeographicInfoExtensions', _collections_tags, _required, strict=DEFAULT_STRICT,
        docstring='Implementation specific geographic information.')  # type: ParametersCollection

    def __init__(self, CountryCodes=None, SecurityInfo=None, GeographicInfoExtensions=None, **kwargs):
        """

        Parameters
        ----------
        CountryCodes : None|List[str]
        SecurityInfo : None|str
        GeographicInfoExtensions : None|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.CountryCodes = CountryCodes
        self.SecurityInfo = SecurityInfo
        self.GeographicInfoExtensions = GeographicInfoExtensions
        super(GeographicInformationType, self).__init__(**kwargs)
示例#20
0
class CODTimeType(Serializable):
    """
    Center of Dwell (COD) time polynomial object.
    """

    _fields = ('Identifier', 'CODTimePoly')
    _required = _fields
    # descriptors
    Identifier = _StringDescriptor(
        'Identifier',
        _required,
        strict=DEFAULT_STRICT,
        docstring='String that uniquely identifies this COD Time '
        'polynomial.')  # type: str
    CODTimePoly = _SerializableDescriptor(
        'CODTimePoly',
        Poly2DType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='The polynomial.')  # type: Poly2DType

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

        Parameters
        ----------
        Identifier : str
        CODTimePoly : 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.Identifier = Identifier
        self.CODTimePoly = CODTimePoly
        super(CODTimeType, self).__init__(**kwargs)
示例#21
0
class CPHDHeader(CPHDHeaderBase):
    _fields = ('XML_DATA_SIZE', 'XML_BYTE_OFFSET', 'VB_DATA_SIZE',
               'VB_BYTE_OFFSET', 'CPHD_DATA_SIZE', 'CPHD_BYTE_OFFSET',
               'CLASSIFICATION', 'RELEASE_INFO')
    _required = ('XML_DATA_SIZE', 'XML_BYTE_OFFSET', 'VB_DATA_SIZE',
                 'VB_BYTE_OFFSET', 'CPHD_DATA_SIZE', 'CPHD_BYTE_OFFSET')
    # descriptor
    XML_DATA_SIZE = _IntegerDescriptor(
        'XML_DATA_SIZE',
        _required,
        strict=True,
        docstring=
        'Size of the XML Metadata in bytes. Does not include the 2 bytes '
        'of the section terminator.')  # type: int
    XML_BYTE_OFFSET = _IntegerDescriptor(
        'XML_BYTE_OFFSET',
        _required,
        strict=True,
        docstring='Offset to the first byte of the XML Metadata in bytes.'
    )  # type: int
    VB_DATA_SIZE = _IntegerDescriptor(
        'VB_DATA_SIZE',
        _required,
        strict=True,
        docstring='Size of the Vector Based Metadata in bytes.')  # type: int
    VB_BYTE_OFFSET = _IntegerDescriptor(
        'VB_BYTE_OFFSET',
        _required,
        strict=True,
        docstring=
        'Offset to the first byte of the Vector Based Metadata in bytes.'
    )  # type: int
    CPHD_DATA_SIZE = _IntegerDescriptor(
        'CPHD_DATA_SIZE',
        _required,
        strict=True,
        docstring='Size of the Compensated PHD arrays in bytes.')  # type: int
    CPHD_BYTE_OFFSET = _IntegerDescriptor(
        'CPHD_BYTE_OFFSET',
        _required,
        strict=True,
        docstring='Offset to the first byte of the CPHD data in bytes.'
    )  # type: int
    CLASSIFICATION = _StringDescriptor(
        'CLASSIFICATION',
        _required,
        strict=True,
        default_value='UNCLASSIFIED',
        docstring=
        'Product classification information that is the human-readable banner.'
    )  # type: str
    RELEASE_INFO = _StringDescriptor(
        'RELEASE_INFO',
        _required,
        strict=True,
        default_value='UNRESTRICTED',
        docstring='Product release information.')  # type: str

    def __init__(self,
                 XML_DATA_SIZE=None,
                 XML_BYTE_OFFSET=None,
                 VB_DATA_SIZE=None,
                 VB_BYTE_OFFSET=None,
                 CPHD_DATA_SIZE=None,
                 CPHD_BYTE_OFFSET=None,
                 CLASSIFICATION='UNCLASSIFIED',
                 RELEASE_INFO='UNRESTRICTED'):
        self.XML_DATA_SIZE = XML_DATA_SIZE
        self.XML_BYTE_OFFSET = XML_BYTE_OFFSET
        self.VB_DATA_SIZE = VB_DATA_SIZE
        self.VB_BYTE_OFFSET = VB_BYTE_OFFSET
        self.CPHD_DATA_SIZE = CPHD_DATA_SIZE
        self.CPHD_BYTE_OFFSET = CPHD_BYTE_OFFSET
        self.CLASSIFICATION = CLASSIFICATION
        self.RELEASE_INFO = RELEASE_INFO
        super(CPHDHeader, self).__init__()
示例#22
0
class CollectionType(Serializable):
    """
    Metadata regarding one of the input collections.
    """
    _fields = ('Information', 'Geometry', 'Phenomenology', 'identifier')
    _required = ('Information', 'identifier')
    _set_as_attribute = ('identifier', )
    # Descriptor
    Information = _SerializableDescriptor(
        'Information',
        ExploitationFeaturesCollectionInformationType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='General collection information.'
    )  # type: ExploitationFeaturesCollectionInformationType
    Geometry = _SerializableDescriptor(
        'Geometry',
        ExploitationFeaturesCollectionGeometryType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='Key geometry parameters independent of product '
        'processing.'
    )  # type: Union[None, ExploitationFeaturesCollectionGeometryType]
    Phenomenology = _SerializableDescriptor(
        'Phenomenology',
        ExploitationFeaturesCollectionPhenomenologyType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='Phenomenology related to both the geometry and the final '
        'product processing.'
    )  # type: Union[None, ExploitationFeaturesCollectionPhenomenologyType]
    identifier = _StringDescriptor(
        'identifier',
        _required,
        strict=DEFAULT_STRICT,
        docstring='The exploitation feature identifier.')  # type: str

    def __init__(self,
                 Information=None,
                 Geometry=None,
                 Phenomenology=None,
                 identifier=None,
                 **kwargs):
        """

        Parameters
        ----------
        Information : ExploitationFeaturesCollectionInformationType
        Geometry : None|ExploitationFeaturesCollectionGeometryType
        Phenomenology : None|ExploitationFeaturesCollectionPhenomenologyType
        identifier : 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.Information = Information
        self.Geometry = Geometry
        self.Phenomenology = Phenomenology
        self.identifier = identifier
        super(CollectionType, self).__init__(**kwargs)

    @classmethod
    def from_calculator(cls, calculator, sicd):
        """
        Create from an ExploitationCalculator object.

        Parameters
        ----------
        calculator : ExploitationCalculator
        sicd : SICDType

        Returns
        -------
        CollectionType
        """

        if not isinstance(calculator, ExploitationCalculator):
            raise TypeError(
                'Requires input which is an instance of ExploitationCalculator, got type {}'
                .format(type(calculator)))

        return cls(
            identifier=sicd.CollectionInfo.CoreName,
            Information=ExploitationFeaturesCollectionInformationType.
            from_sicd(sicd),
            Geometry=ExploitationFeaturesCollectionGeometryType.
            from_calculator(calculator),
            Phenomenology=ExploitationFeaturesCollectionPhenomenologyType.
            from_calculator(calculator))
示例#23
0
class SegmentType(Serializable):
    """
    Rectangle segment.
    """

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

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

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

        if '_xml_ns' in kwargs:
            self._xml_ns = kwargs['_xml_ns']
        if '_xml_ns_key' in kwargs:
            self._xml_ns_key = kwargs['_xml_ns_key']
        self.Identifier = Identifier
        self.StartLine = StartLine
        self.StartSample = StartSample
        self.EndLine = EndLine
        self.EndSample = EndSample
        self.SegmentPolygon = SegmentPolygon
        super(SegmentType, self).__init__(**kwargs)
示例#24
0
class CreationInfoType(Serializable):
    """
    Parameters that provide general information about the CPHD product generation.
    """

    _fields = ('Application', 'DateTime', 'Site', 'Parameters')
    _required = ('DateTime', )
    _collections_tags = {
        'Parameters': {
            'array': False,
            'child_tag': 'Parameter'
        }
    }
    # descriptors
    Application = _StringDescriptor(
        'Application',
        _required,
        strict=DEFAULT_STRICT,
        docstring='Name and version of the application used to create the CPHD.'
    )  # type: str
    DateTime = _DateTimeDescriptor(
        'DateTime',
        _required,
        strict=DEFAULT_STRICT,
        numpy_datetime_units='us',
        docstring=
        'Date and time the image creation application processed the image (UTC).'
    )  # type: numpy.datetime64
    Site = _StringDescriptor(
        'Site',
        _required,
        strict=DEFAULT_STRICT,
        docstring='The creation site of this CPHD product.')  # type: str
    Parameters = _ParametersDescriptor(
        'Parameters',
        _collections_tags,
        _required,
        strict=DEFAULT_STRICT,
        docstring='Additional parameters.'
    )  # type: Union[None, ParametersCollection]

    def __init__(self,
                 Application=None,
                 DateTime=None,
                 Site=None,
                 Parameters=None,
                 **kwargs):
        """

        Parameters
        ----------
        Application : str
        DateTime : numpy.datetime64|datetime|date|str
        Site : str
        Profile : str
        Parameters : 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.Application = Application
        self.DateTime = DateTime
        self.Site = Site
        self.Parameters = Parameters
        super(CreationInfoType, self).__init__(**kwargs)
示例#25
0
class AddedSupportArrayType(SupportArrayCore):
    """
    Additional arrays (two-dimensional), where the content and format and units
    of each element are user defined.
    """

    _fields = ('Identifier', 'ElementFormat', 'X0', 'Y0', 'XSS', 'YSS',
               'NODATA', 'XUnits', 'YUnits', 'ZUnits', 'Parameters')
    _required = ('Identifier', 'ElementFormat', 'X0', 'Y0', 'XSS', 'YSS',
                 'XUnits', 'YUnits', 'ZUnits')
    _collections_tags = {
        'Parameters': {
            'array': False,
            'child_tag': 'Parameter'
        }
    }
    # descriptors
    XUnits = _StringDescriptor('XUnits',
                               _required,
                               strict=DEFAULT_STRICT,
                               docstring='The X units.')  # type: str
    YUnits = _StringDescriptor('YUnits',
                               _required,
                               strict=DEFAULT_STRICT,
                               docstring='The Y units.')  # type: str
    ZUnits = _StringDescriptor('ZUnits',
                               _required,
                               strict=DEFAULT_STRICT,
                               docstring='The Z units.')  # type: str
    Parameters = _ParametersDescriptor(
        'Parameters',
        _collections_tags,
        _required,
        strict=DEFAULT_STRICT,
        docstring='Other necessary free-form parameters.'
    )  # type: Union[None, ParametersCollection]

    def __init__(self,
                 Identifier=None,
                 ElementFormat=None,
                 X0=None,
                 Y0=None,
                 XSS=None,
                 YSS=None,
                 NODATA=None,
                 XUnits=None,
                 YUnits=None,
                 ZUnits=None,
                 Parameters=None,
                 **kwargs):
        """

        Parameters
        ----------
        Identifier : str
        ElementFormat : str
        X0 : float
        Y0 : float
        XSS : float
        YSS : float
        NODATA : str
        XUnits : str
        YUnits : str
        ZUnits : str
        Parameters : 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.XUnits = XUnits
        self.YUnits = YUnits
        self.ZUnits = ZUnits
        self.Parameters = Parameters
        super(AddedSupportArrayType,
              self).__init__(Identifier=Identifier,
                             ElementFormat=ElementFormat,
                             X0=X0,
                             Y0=Y0,
                             XSS=XSS,
                             YSS=YSS,
                             NODATA=NODATA,
                             **kwargs)
示例#26
0
class SupportArrayCore(Serializable):
    """
    The support array base case.
    """

    _fields = ('Identifier', 'ElementFormat', 'X0', 'Y0', 'XSS', 'YSS',
               'NODATA')
    _required = ('Identifier', 'ElementFormat', 'X0', 'Y0', 'XSS', 'YSS')
    _numeric_format = {
        'X0': '0.16G',
        'Y0': '0.16G',
        'XSS': '0.16G',
        'YSS': '0.16G'
    }
    # descriptors
    Identifier = _StringDescriptor(
        'Identifier',
        _required,
        strict=DEFAULT_STRICT,
        docstring='The support array identifier.')  # type: str
    ElementFormat = _StringDescriptor(
        'ElementFormat',
        _required,
        strict=DEFAULT_STRICT,
        docstring='The data element format.')  # type: str
    X0 = _FloatDescriptor('X0', _required, strict=DEFAULT_STRICT,
                          docstring='')  # type: float
    Y0 = _FloatDescriptor('Y0', _required, strict=DEFAULT_STRICT,
                          docstring='')  # type: float
    XSS = _FloatDescriptor('XSS',
                           _required,
                           strict=DEFAULT_STRICT,
                           bounds=(0, None),
                           docstring='')  # type: float
    YSS = _FloatDescriptor('YSS',
                           _required,
                           strict=DEFAULT_STRICT,
                           bounds=(0, None),
                           docstring='')  # type: float

    def __init__(self,
                 Identifier=None,
                 ElementFormat=None,
                 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 : None|str
        kwargs
        """

        self._NODATA = None
        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.ElementFormat = ElementFormat
        self.X0 = X0
        self.Y0 = Y0
        self.XSS = XSS
        self.YSS = YSS
        self.NODATA = NODATA
        super(SupportArrayCore, self).__init__(**kwargs)

    @property
    def NODATA(self):
        """
        None|str: The no data hex string value.
        """

        return self._NODATA

    @NODATA.setter
    def NODATA(self, value):
        if value is None:
            self._NODATA = None
            return

        if isinstance(value, ElementTree.Element):
            value = _get_node_value(value)

        if isinstance(value, string_types):
            self._NODATA = value
        elif isinstance(value, bytes):
            self._NODATA = value.decode('utf-8')
        elif isinstance(value, int):
            raise NotImplementedError
        elif isinstance(value, float):
            raise NotImplementedError
        else:
            raise TypeError('Got unexpected type {}'.format(type(value)))

    def get_nodata_as_int(self):
        """
        Get the no data value as an integer value.

        Returns
        -------
        None|int
        """

        if self._NODATA is None:
            return None

        raise NotImplementedError

    def get_nodata_as_float(self):
        """
        Gets the no data value as a floating point value.

        Returns
        -------
        None|float
        """

        if self._NODATA is None:
            return None

        raise NotImplementedError

    def get_numpy_format(self):
        """
        Convert the element format to a numpy dtype (including endianness) and depth.

        Returns
        -------
        numpy.dtype, int
        """

        return homogeneous_dtype(self.ElementFormat, return_length=True)
示例#27
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)
示例#28
0
class ProductInfoType(Serializable):
    """
    Parameters that provide general information about the CPHD product and/or the
    derived products that may be created from it.
    """

    _fields = ('Profile', 'CreationInfos', 'Parameters')
    _required = ()
    _collections_tags = {
        'CreationInfos': {
            'array': False,
            'child_tag': 'CreationInfo'
        },
        'Parameters': {
            'array': False,
            'child_tag': 'Parameter'
        }
    }
    # descriptors
    Profile = _StringDescriptor(
        'Profile',
        _required,
        strict=DEFAULT_STRICT,
        docstring='Identifies what profile was used to create this CPHD product.'
    )  # type: str
    CreationInfos = _SerializableListDescriptor(
        'CreationInfos',
        CreationInfoType,
        _collections_tags,
        _required,
        strict=DEFAULT_STRICT,
        docstring='Parameters that provide general information about the CPHD '
        'product generation.')  # type: Union[None, List[CreationInfoType]]
    Parameters = _ParametersDescriptor(
        'Parameters',
        _collections_tags,
        _required,
        strict=DEFAULT_STRICT,
        docstring='Additional parameters.'
    )  # type: Union[None, ParametersCollection]

    def __init__(self,
                 Profile=None,
                 CreationInfos=None,
                 Parameters=None,
                 **kwargs):
        """

        Parameters
        ----------
        Profile : str
        CreationInfos : None|List[CreationInfoType]
        Parameters : 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.Profile = Profile
        self.CreationInfos = CreationInfos
        self.Parameters = Parameters
        super(ProductInfoType, self).__init__(**kwargs)
示例#29
0
class ImageGridType(Serializable):
    """
    Parameters that describe a geo-referenced image grid for image data products
    that may be formed from the CPHD signal array(s).
    """

    _fields = ('Identifier', 'IARPLocation', 'IAXExtent', 'IAYExtent',
               'SegmentList')
    _required = ('IARPLocation', 'IAXExtent', 'IAYExtent')
    _collections_tags = {
        'SegmentList': {
            'array': True,
            'child_tag': 'Segemnt'
        }
    }
    # descriptors
    Identifier = _StringDescriptor(
        'Identifier',
        _required,
        strict=DEFAULT_STRICT,
        docstring='String that uniquely identifies the Image Grid.'
    )  # type: Union[None, str]
    IARPLocation = _SerializableDescriptor(
        'IARPLocation',
        LSType,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'IARP grid location. Grid locations indexed by (line, sample) or (L,S). '
        'Image grid line and sample are pixel-centered indices.'
    )  # type: LSType
    IAXExtent = _SerializableDescriptor(
        'IAXExtent',
        IAXExtentType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='Increasing line index is in the +IAX direction.'
    )  # type: IAXExtentType
    IAYExtent = _SerializableDescriptor(
        'IAYExtent',
        IAYExtentType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='Increasing sample index is in the +IAY direction.'
    )  # type: IAYExtentType
    SegmentList = _SerializableArrayDescriptor(
        'SegmentList',
        SegmentType,
        _collections_tags,
        _required,
        strict=DEFAULT_STRICT,
        array_extension=SegmentListType,
        docstring='List of image grid segments defined relative to the image '
        'grid.')  # type: Union[SegmentListType, List[SegmentType]]

    def __init__(self,
                 Identifier=None,
                 IARPLocation=None,
                 IAXExtent=None,
                 IAYExtent=None,
                 SegmentList=None,
                 **kwargs):
        """

        Parameters
        ----------
        Identifier : None|str
        IARPLocation : LSType
        IAXExtent : IAXExtentType
        IAYExtent : IAYExtentType
        SegmentList : SegmentListType|List[SegmentType]|numpy.array|list|tuple
        kwargs
        """

        if '_xml_ns' in kwargs:
            self._xml_ns = kwargs['_xml_ns']
        if '_xml_ns_key' in kwargs:
            self._xml_ns_key = kwargs['_xml_ns_key']
        self.Identifier = Identifier
        self.IARPLocation = IARPLocation
        self.IAXExtent = IAXExtent
        self.IAYExtent = IAYExtent
        self.SegmentList = SegmentList
        super(ImageGridType, self).__init__(**kwargs)
示例#30
0
class ExploitationFeaturesCollectionInformationType(Serializable):
    """
    General collection information.
    """

    _fields = ('SensorName', 'RadarMode', 'CollectionDateTime',
               'LocalDateTime', 'CollectionDuration', 'Resolution', 'InputROI',
               'Polarizations')
    _required = ('SensorName', 'RadarMode', 'CollectionDateTime',
                 'CollectionDuration')
    _collections_tags = {
        'Polarizations': {
            'array': False,
            'child_tag': 'Polarization'
        }
    }
    _numeric_format = {'CollectionDuration': '0.16G'}
    # Descriptor
    SensorName = _StringDescriptor('SensorName',
                                   _required,
                                   strict=DEFAULT_STRICT,
                                   docstring='The name of the sensor.')  # str
    RadarMode = _SerializableDescriptor(
        'RadarMode',
        RadarModeType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='Radar collection mode.')  # type: RadarModeType
    CollectionDateTime = _DateTimeDescriptor(
        'CollectionDateTime',
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Collection date and time defined in Coordinated Universal Time (UTC). The seconds '
        'should be followed by a Z to indicate UTC.')  # type: numpy.datetime64
    CollectionDuration = _FloatDescriptor(
        'CollectionDuration',
        _required,
        strict=DEFAULT_STRICT,
        docstring='The duration of the collection (units = seconds).'
    )  # type: float
    Resolution = _SerializableDescriptor(
        'Resolution',
        RangeAzimuthType,
        _required,
        strict=DEFAULT_STRICT,
        docstring=
        'Uniformly-weighted resolution (range and azimuth) processed in '
        'the slant plane.')  # type: Union[None, RangeAzimuthType]
    InputROI = _SerializableDescriptor(
        'InputROI',
        InputROIType,
        _required,
        strict=DEFAULT_STRICT,
        docstring='ROI representing portion of input data used to make '
        'this product.')  # type: Union[None, InputROIType]
    Polarizations = _SerializableListDescriptor(
        'Polarizations',
        TxRcvPolarizationType,
        _collections_tags,
        _required,
        strict=DEFAULT_STRICT,
        docstring='Transmit and receive polarization(s).'
    )  # type: Union[None, List[TxRcvPolarizationType]]

    def __init__(self,
                 SensorName=None,
                 RadarMode=None,
                 CollectionDateTime=None,
                 LocalDateTime=None,
                 CollectionDuration=None,
                 Resolution=None,
                 Polarizations=None,
                 **kwargs):
        """

        Parameters
        ----------
        SensorName : str
        RadarMode : RadarModeType
        CollectionDateTime : numpy.datetime64|datetime.datetime|datetime.date|str
        LocalDateTime : None|str|datetime.datetime
        CollectionDuration : float
        Resolution : None|RangeAzimuthType|numpy.ndarray|list|tuple
        Polarizations : None|List[TxRcvPolarizationType]
        kwargs
        """

        self._local_date_time = None
        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.SensorName = SensorName
        self.RadarMode = RadarMode
        self.CollectionDateTime = CollectionDateTime
        self.CollectionDuration = CollectionDuration
        self.LocalDateTime = LocalDateTime
        self.Resolution = Resolution
        self.Polarizations = Polarizations
        super(ExploitationFeaturesCollectionInformationType,
              self).__init__(**kwargs)

    @property
    def LocalDateTime(self):
        """None|str:  The local date/time string of the collection. *Optional.*"""
        return self._local_date_time

    @LocalDateTime.setter
    def LocalDateTime(
            self,
            value):  # type: (Union[None, str, datetime.datetime]) -> None
        if value is None:
            self._local_date_time = None
            return
        elif isinstance(value, datetime.datetime):
            value = value.isoformat('T')

        if isinstance(value, string_types):
            self._local_date_time = value
        else:
            logging.error(
                'Attribute LocalDateTime of class ExploitationFeaturesCollectionInformationType '
                'requires a datetime.datetime or string. Got unsupported type {}. '
                'Setting value to None.'.format(type(value)))
            self._local_date_time = None

    @classmethod
    def from_sicd(cls, sicd):
        """
        Construct from a sicd element.

        Parameters
        ----------
        sicd : SICDType

        Returns
        -------
        ExploitationFeaturesCollectionInformationType
        """

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

        polarizations = [
            TxRcvPolarizationType.from_sicd_value(entry.TxRcvPolarization)
            for entry in sicd.RadarCollection.RcvChannels
        ]

        return cls(
            SensorName=sicd.CollectionInfo.CollectorName,
            RadarMode=RadarModeType(**sicd.CollectionInfo.RadarMode.to_dict()),
            CollectionDateTime=sicd.Timeline.CollectStart,
            CollectionDuration=sicd.Timeline.CollectDuration,
            Resolution=(sicd.Grid.Row.SS, sicd.Grid.Col.SS),
            Polarizations=polarizations)