How to use the sarpy.io.complex.sicd_elements.base.Serializable function in sarpy

To help you get started, we’ve selected a few sarpy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ngageoint / sarpy / sarpy / io / complex / sicd_elements / CollectionInfo.py View on Github external
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'


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', 'Parameters', 'CountryCodes')
    _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(
github ngageoint / sarpy / sarpy / io / complex / sicd_elements / ImageFormation.py View on Github external
----------
        DistortCorrectApplied : bool
        Distortion : DistortionType
        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.DistortCorrectApplied = DistortCorrectApplied
        self.Distortion = Distortion
        super(PolarizationCalibrationType, self).__init__(**kwargs)


class ImageFormationType(Serializable):
    """The image formation process parameters."""
    _fields = (
        'RcvChanProc', 'TxRcvPolarizationProc', 'TStartProc', 'TEndProc', 'TxFrequencyProc', 'SegmentIdentifier',
        'ImageFormAlgo', 'STBeamComp', 'ImageBeamComp', 'AzAutofocus', 'RgAutofocus', 'Processings',
        'PolarizationCalibration')
    _required = (
        'RcvChanProc', 'TxRcvPolarizationProc', 'TStartProc', 'TEndProc', 'TxFrequencyProc',
        'ImageFormAlgo', 'STBeamComp', 'ImageBeamComp', 'AzAutofocus', 'RgAutofocus')
    _collections_tags = {'Processings': {'array': False, 'child_tag': 'Processing'}}
    _numeric_format = {'TStartProc': '0.16G', 'EndProc': '0.16G'}
    # class variables
    _IMG_FORM_ALGO_VALUES = ('PFA', 'RMA', 'RGAZCOMP', 'OTHER')
    _ST_BEAM_COMP_VALUES = ('NO', 'GLOBAL', 'SV')
    _IMG_BEAM_COMP_VALUES = ('NO', 'SV')
    _AZ_AUTOFOCUS_VALUES = _ST_BEAM_COMP_VALUES
    _RG_AUTOFOCUS_VALUES = _ST_BEAM_COMP_VALUES
github ngageoint / sarpy / sarpy / io / complex / sicd_elements / base.py View on Github external
def serialize_plain(node, field, val, format_function, the_xml_ns_key):
            # may be called not at top level - if object array or list is present
            prim_tag = '{}:{}'.format(the_xml_ns_key, field) if the_xml_ns_key is not None else field
            if isinstance(val, (Serializable, SerializableArray)):
                val.to_node(doc, field, ns_key=the_xml_ns_key, parent=node,
                            check_validity=check_validity, strict=strict)
            elif isinstance(val, ParametersCollection):
                val.to_node(doc, ns_key=the_xml_ns_key, parent=node, check_validity=check_validity, strict=strict)
            elif isinstance(val, bool):  # this must come before int, where it would evaluate as true
                _create_text_node(doc, prim_tag, 'true' if val else 'false', parent=node)
            elif isinstance(val, string_types):
                _create_text_node(doc, prim_tag, val, parent=node)
            elif isinstance(val, integer_types):
                _create_text_node(doc, prim_tag, format_function(val), parent=node)
            elif isinstance(val, float):
                _create_text_node(doc, prim_tag, format_function(val), parent=node)
            elif isinstance(val, numpy.datetime64):
                out2 = str(val)
                out2 = out2 + 'Z' if out2[-1] != 'Z' else out2
                _create_text_node(doc, prim_tag, out2, parent=node)
github ngageoint / sarpy / sarpy / io / product / sidd2_elements / DigitalElevationData.py View on Github external
AbsoluteAccuracy : AccuracyType
        PointToPointAccuracy : AccuracyType
        kwargs
        """

        if '_xml_ns' in kwargs:
            self._xml_ns = kwargs['_xml_ns']
        if '_xml_ns_key' in kwargs:
            self._xml_ns_key = kwargs['_xml_ns_key']
        self.NumRegions = NumRegions
        self.AbsoluteAccuracy = AbsoluteAccuracy
        self.PointToPointAccuracy = PointToPointAccuracy
        super(PositionalAccuracyType, self).__init__(**kwargs)


class DigitalElevationDataType(Serializable):
    """
    This describes any Digital Elevation Data included with the SIDD product.
    """

    _fields = ('GeographicCoordinates', 'Geopositioning', 'PositionalAccuracy', 'NullValue')
    _required = ('GeographicCoordinates', 'Geopositioning', 'PositionalAccuracy')
    # Descriptor
    GeographicCoordinates = _SerializableDescriptor(
        'GeographicCoordinates', GeographicCoordinatesType, _required, strict=DEFAULT_STRICT,
        docstring='Describes the Local Geographic Coordinate system linking row/column to the '
                  'absolute geographic coordinate (lat/lon)')  # type: GeographicCoordinatesType
    Geopositioning = _SerializableDescriptor(
        'Geopositioning', GeopositioningType, _required, strict=DEFAULT_STRICT,
        docstring='Describes the absolute coordinate system to which the data is '
                  'referenced.')  # type: GeopositioningType
    PositionalAccuracy = _SerializableDescriptor(
github ngageoint / sarpy / sarpy / io / product / sidd2_elements / Display.py View on Github external
AsymmetricPixelCorrection = _SerializableDescriptor(
        'AsymmetricPixelCorrection', FilterType, _required, strict=DEFAULT_STRICT,
        docstring='The asymmetric pixel correction.')  # type: FilterType

    def __init__(self, BandEqualization=None, ModularTransferFunctionRestoration=None, DataRemapping=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.BandEqualization = BandEqualization
        self.ModularTransferFunctionRestoration = ModularTransferFunctionRestoration
        self.DataRemapping = DataRemapping
        super(ProductGenerationOptionsType, self).__init__(**kwargs)


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
github ngageoint / sarpy / sarpy / io / phase_history / cphd1_elements / ErrorParameters.py View on Github external
RcvPlatform : PlatformType
        AddedParameters : 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.TxPlatform = TxPlatform
        self.RcvPlatform = RcvPlatform
        self.AddedParameters = AddedParameters
        super(BistaticType, self).__init__(**kwargs)


class ErrorParametersType(Serializable):
    """
    Parameters that describe the statistics of errors in measured or estimated
    parameters that describe the collection.
    """

    _fields = ('Monostatic', 'Bistatic')
    _required = ()
    _choice = ({'required': True, 'collection': _fields}, )

    # descriptors
    Monostatic = _SerializableDescriptor(
        'Monostatic', MonostaticType, _required, strict=DEFAULT_STRICT,
        docstring='The monstatic parameters.')  # type: Union[None, MonostaticType]
    Bistatic = _SerializableDescriptor(
        'Bistatic', BistaticType, _required, strict=DEFAULT_STRICT,
        docstring='The bistatic parameters.')  # type: Union[None, BistaticType]
github ngageoint / sarpy / sarpy / io / complex / sicd_elements / RadarCollection.py View on Github external
TxPolarization : str
        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.WFIndex = WFIndex
        self.TxPolarization = TxPolarization
        self.index = index
        super(TxStepType, self).__init__(**kwargs)


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(
github ngageoint / sarpy / sarpy / io / product / sidd2_elements / Measurement.py View on Github external
ReferencePoint : ReferencePointType
        SampleSpacing : RowColDoubleType|numpy.ndarray|list|tuple
        TimeCOAPoly : 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']
        super(MeasurableProjectionType, self).__init__(ReferencePoint=ReferencePoint, **kwargs)
        self.SampleSpacing = SampleSpacing
        self.TimeCOAPoly = TimeCOAPoly


class ProductPlaneType(Serializable):
    """
    Plane definition for the product.
    """

    _fields = ('RowUnitVector', 'ColUnitVector')
    _required = _fields
    # Descriptor
    RowUnitVector = _UnitVectorDescriptor(
        'RowUnitVector', XYZType, _required, strict=DEFAULT_STRICT,
        docstring='Unit vector of the plane defined to be aligned in the increasing row direction '
                  'of the product. (Defined as Rpgd in Design and Exploitation document)')  # type: XYZType
    ColUnitVector = _UnitVectorDescriptor(
        'ColUnitVector', XYZType, _required, strict=DEFAULT_STRICT,
        docstring='Unit vector of the plane defined to be aligned in the increasing column direction '
                  'of the product. (Defined as Cpgd in Design and Exploitation document)')  # type: XYZType
github ngageoint / sarpy / sarpy / io / phase_history / cphd1_elements / Dwell.py View on Github external
----------
        Identifier : str
        DwellTimePoly : 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.DwellTimePoly = DwellTimePoly
        super(DwellTimeType, self).__init__(**kwargs)


class DwellType(Serializable):
    """
    Parameters that specify the dwell time supported by the signal arrays
    contained in the CPHD product.
    """

    _fields = ('NumCODTimes', 'CODTimes', 'NumDwellTimes', 'DwellTimes')
    _required = ('CODTimes', 'DwellTimes')
    _collections_tags = {
        'CODTimes': {'array': False, 'child_tag': 'CODTime'},
        'DwellTimes': {'array': False, 'child_tag': 'DwellTime'}}
    # descriptors
    CODTimes = _SerializableListDescriptor(
        'CODTimes', CODTimeType, _collections_tags, _required, strict=DEFAULT_STRICT,
        docstring='The Center of Dwell (COD) time polynomials.')  # type: List[CODTimeType]
    DwellTimes = _SerializableListDescriptor(
        'DwellTimes', DwellTimeType, _collections_tags, _required, strict=DEFAULT_STRICT,
github ngageoint / sarpy / sarpy / io / complex / sicd_elements / GeoData.py View on Github external
"""
        Gets the center coordinate abbreviation for the suggested name.

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

        llh = self.LLH
        lat = int(numpy.round(llh.Lat))
        lon = int(numpy.round(llh.Lon))
        return '{0:02d}'.format(abs(lat)) + ('N' if lat >= 0 else 'S') + \
            '{0:03d}'.format(abs(lon)) + ('E' if lon >= 0 else 'W')


class GeoDataType(Serializable):
    """Container specifying the image coverage area in geographic coordinates."""
    _fields = ('EarthModel', 'SCP', 'ImageCorners', 'ValidData')
    _required = ('EarthModel', 'SCP', 'ImageCorners')
    _collections_tags = {
        'ValidData': {'array': True, 'child_tag': 'Vertex'},
        'ImageCorners': {'array': True, 'child_tag': 'ICP'},
    }
    # other class variables
    _EARTH_MODEL_VALUES = ('WGS_84', )
    # descriptors
    EarthModel = _StringEnumDescriptor(
        'EarthModel', _EARTH_MODEL_VALUES, _required, strict=True, default_value='WGS_84',
        docstring='The Earth Model.'.format(_EARTH_MODEL_VALUES))  # type: str
    SCP = _SerializableDescriptor(
        'SCP', SCPType, _required, strict=DEFAULT_STRICT,
        docstring='The Scene Center Point *(SCP)* in full (global) image. This is the '