The Main CPHD 1.0 object¶
The Compensated Phase History Data 1.0.1 definition.
- class sarpy.io.phase_history.cphd1_elements.CPHD.CPHDType(CollectionID=None, Global=None, SceneCoordinates=None, Data=None, Channel=None, PVP=None, SupportArray=None, Dwell=None, ReferenceGeometry=None, Antenna=None, TxRcv=None, ErrorParameters=None, ProductInfo=None, GeoInfo=None, MatchInfo=None, **kwargs)¶
Bases:
Serializable
The Compensated Phase History Data definition.
- CollectionID: CollectionIDType¶
General information about the collection. Required.
- Type:
- Global: GlobalType¶
Global parameters that apply to metadata components and CPHD signal arrays. Required.
- Type:
- SceneCoordinates: SceneCoordinatesType¶
Parameters that define geographic coordinates for in the imaged scene. Required.
- Type:
- Data: DataType¶
Parameters that describe binary data components contained in the product. Required.
- Type:
- Channel: ChannelType¶
Parameters that describe the data channels contained in the product. Required.
- Type:
- copy()¶
Create a deep copy.
- classmethod from_dict(input_dict)¶
For json deserialization, from dict instance.
- Parameters:
input_dict (dict) – Appropriate parameters dict instance for deserialization
- Return type:
Corresponding class instance
- is_valid(recursive=False, stack=False)¶
Returns the validity of this object according to the schema. This is done by inspecting that all required fields (i.e. entries of _required) are not None.
- Parameters:
recursive (bool) – True if we recursively check that child are also valid. This may result in verbose (i.e. noisy) logging.
stack (bool) – Print a recursive error message?
- Returns:
condition for validity of this element
- Return type:
bool
- log_validity_error(msg)¶
Log a validity check error message.
- Parameters:
msg (str) –
- log_validity_info(msg)¶
Log a validation info message.
- Parameters:
msg (str) –
- log_validity_warning(msg)¶
Log a validity check warning message.
- Parameters:
msg (str) –
- set_numeric_format(attribute, format_string)¶
Sets the numeric format string for the given attribute.
- Parameters:
attribute (str) – attribute for which the format applies - must be in _fields.
format_string (str) – format string to be applied
- Return type:
None
- PVP: PVPType¶
Structure specifying the Per Vector parameters provided for each channel of a given product. Required.
- Type:
- SupportArray: None | SupportArrayType¶
Parameters that describe the binary support array(s) content and grid coordinates. Optional.
- Type:
- Dwell: DwellType¶
Parameters that specify the dwell time supported by the signal arrays contained in the CPHD product. Required.
- Type:
- ReferenceGeometry: ReferenceGeometryType¶
Parameters that describe the collection geometry for the reference vector of the reference channel. Required.
- Type:
- Antenna: None | AntennaType¶
Parameters that describe the transmit and receive antennas used to collect the signal array(s). Optional.
- Type:
- TxRcv: None | TxRcvType¶
Parameters that describe the transmitted waveform(s) and receiver configurations used in the collection. Optional.
- Type:
- ErrorParameters: None | ErrorParametersType¶
Parameters that describe the statistics of errors in measured or estimated parameters that describe the collection. Optional.
- Type:
- ProductInfo: None | ProductInfoType¶
Parameters that provide general information about the CPHD product and/or the derived products that may be created from it. Optional.
- Type:
- MatchInfo: None | MatchInfoType¶
Information about other collections that are matched to the collection from which this CPHD product was generated. Optional.
- Type:
- property GeoInfo¶
Parameters that describe a geographic feature.
- Type:
List[GeoInfoType]
- getGeoInfo(key)¶
Get GeoInfo(s) with name attribute == key.
- Parameters:
key (str) –
- Return type:
List[GeoInfoType]
- addGeoInfo(value)¶
Add the given GeoInfo to the GeoInfo list.
- Parameters:
value (GeoInfoType) –
- Return type:
None
- classmethod from_node(node, xml_ns, ns_key=None, kwargs=None)¶
For XML deserialization.
- Parameters:
node (ElementTree.Element) – dom element for serialized class instance
xml_ns (None|dict) – The xml namespace dictionary.
ns_key (None|str) – The xml namespace key. If xml_ns is None, then this is ignored. If None and xml_ns is not None, then the string default will be used. This will be recursively passed down, unless overridden by an entry of the cls._child_xml_ns_key dictionary.
kwargs (None|dict) – None or dictionary of previously serialized attributes. For use in inheritance call, when certain attributes require specific deserialization.
- Return type:
Corresponding class instance
- to_node(doc, tag, ns_key=None, parent=None, check_validity=False, strict=False, exclude=())¶
For XML serialization, to a dom element.
- Parameters:
doc (ElementTree.ElementTree) – The xml Document
tag (None|str) – The tag name. Defaults to the value of self._tag and then the class name if unspecified.
ns_key (None|str) – The namespace prefix. This will be recursively passed down, unless overridden by an entry in the _child_xml_ns_key dictionary.
parent (None|ElementTree.Element) – The parent element. Defaults to the document root element if unspecified.
check_validity (bool) – Check whether the element is valid before serializing, by calling
is_valid()
.strict (bool) – Only used if check_validity = True. In that case, if True then raise an Exception (of appropriate type) if the structure is not valid, if False then log a hopefully helpful message.
exclude (tuple) – Attribute names to exclude from this generic serialization. This allows for child classes to provide specific serialization for special properties, after using this super method.
- Returns:
The constructed dom element, already assigned to the parent element.
- Return type:
ElementTree.Element
- to_dict(check_validity=False, strict=False, exclude=())¶
For json serialization.
- Parameters:
check_validity (bool) – Check whether the element is valid before serializing, by calling
is_valid()
.strict (bool) – Only used if check_validity = True. In that case, if True then raise an Exception (of appropriate type) if the structure is not valid, if False then log a hopefully helpful message.
exclude (tuple) – Attribute names to exclude from this generic serialization. This allows for child classes to provide specific serialization for special properties, after using this super method.
- Returns:
dict representation of class instance appropriate for direct json serialization.
- Return type:
OrderedDict
- to_xml_bytes(urn=None, tag='CPHD', check_validity=False, strict=False)¶
Gets a bytes array, which corresponds to the xml string in utf-8 encoding, identified as using the namespace given by urn (if given).
- Parameters:
urn (None|str|dict) – The xml namespace string or dictionary describing the xml namespace.
tag (None|str) – The root node tag to use. If not given, then the class name will be used.
check_validity (bool) – Check whether the element is valid before serializing, by calling
is_valid()
.strict (bool) – Only used if check_validity = True. In that case, if True then raise an Exception (of appropriate type) if the structure is not valid, if False then log a hopefully helpful message.
- Returns:
bytes array from
ElementTree.tostring()
call.- Return type:
bytes
- to_xml_string(urn=None, tag='CPHD', check_validity=False, strict=False)¶
Gets a xml string with utf-8 encoding, identified as using the namespace given by urn (if given).
- Parameters:
urn (None|str|dict) – The xml namespace or dictionary describing the xml namespace.
tag (None|str) – The root node tag to use. If not given, then the class name will be used.
check_validity (bool) – Check whether the element is valid before serializing, by calling
is_valid()
.strict (bool) – Only used if check_validity = True. In that case, if True then raise an Exception (of appropriate type) if the structure is not valid, if False then log a hopefully helpful message.
- Returns:
xml string from
ElementTree.tostring()
call.- Return type:
str
- version_required()¶
What CPHD version is required for valid support?
- Return type:
tuple
- make_file_header(xml_offset=1024, use_version=None)¶
Forms a CPHD file header consistent with the information in the Data and CollectionID nodes.
- Parameters:
xml_offset (int, optional) – Offset in bytes to the first byte of the XML block. If the provided value is not large enough to account for the length of the file header string, a larger value is chosen.
use_version (None|str) – What version to use?
- Returns:
header
- Return type:
CPHDHeader
- get_pvp_dtype()¶
Gets the dtype for the corresponding PVP structured array. Note that they must all have homogeneous dtype.
- Returns:
This will be a compound dtype for a structured array.
- Return type:
numpy.dtype
- classmethod from_xml_file(file_path)¶
Construct the cphd object from a stand-alone xml file path.
- Parameters:
file_path (str) –
- Return type: