sarkit.verification.CphdConsistency

class CphdConsistency(cphd_xml, *, file_type_header=None, kvp_list=None, pvps=None, schema_override=None, file=None)

Check CPHD file structure and metadata for internal consistency

CphdConsistency objects should be instantiated using from_file or from_parts.

Parameters:
cphd_xmllxml.etree.Element or lxml.etree.ElementTree

CPHD XML

file_type_headerstr, optional

File type header from the first line of the file

kvp_listdict of {strstr}, optional

Key-Value pair list of header fields

pvpsdict of {strndarray}, optional

CPHD Per-Vector-Parameters keyed by channel identifier

schema_overridepath-like object, optional

Path to XML Schema. If None, tries to find a version-specific schema

filefile object, optional

CPHD file; when specified, portions of the file not specified in other parameters may be read

Methods

add_cli_args(parser)

Add CLI args used by run_cli to an argparser

all()

Returns all results.

check([func_name, allow_prefix, ignore_patterns])

Run checks.

failures([omit_passed_sub])

Returns failure results.

from_file(file[, schema, thorough])

Create a CphdConsistency object from a file

from_parts(cphd_xml[, file_type_header, ...])

Create a CphdConsistency object from assorted parts

get_polygon(polygon_node[, check])

Returns the polygon from the specified node, with basic polygon verification.

need([details])

Context manager for scoping 'Error' level checks

passes()

Returns passed checks that are not wholly No-Op.

precondition([details])

Context manager for scoping conditional ('No-Op' level) checks

print_result(*[, include_passed_asserts, ...])

Print results to stdout.

run_cli(config)

Run checks and print results using args from add_cli_args

skips([include_partial])

Returns passed checks that are No-Op.

want([details])

Context manager for scoping 'Warning' level checks

Notes

The following checks are available:

check_against_schema

The XML matches the schema.

check_antenna

Check that antenna node is consistent.

check_antenna_array_element_antgpid

Check that Array/AntGPId and Element/AntGPId, when present, are included together in /Antenna/AntPattern.

check_antenna_array_element_antgpid_exist

Check that used GPIds exist

check_antenna_arrayid_elementid_exist

Check that used gain phase arrays exist

check_antenna_ebfreqshiftsf

AntPattern/EBFreqShiftSF only included for EBFreqShift = true

check_antenna_ids_in_channel

If the Antenna branch exists, then Antenna is also present in /Channel/Parameters

check_antenna_mlfreqdilationsf

AntPattern/MLFreqDilationSF only included for MLFreqDilation = true

check_antenna_useacfpvp

UseACFPVP only included when PVP TxAntenna & RcvAntenna are included.

check_antenna_useebpvp

UseEBPVP only included when PVP TxAntenna & RcvAntenna are included.

check_antgainphase_support_array_domain

SupportArray/AntGainPhase grid coordinates are valid direction cosines.

check_channel_afdop

aFDOP PVP is consistent with other PVPs.

check_channel_afrr1

aFRR1 is consistent with /TxRcv/TxWFParameters/LFMRate.

check_channel_afrr1_afrr2_relative

aFRR1 & aFRR2 PVPs are related by fx_C.

check_channel_afrr2

aFRR2 is consistent with /TxRcv/TxWFParameters/LFMRate(s).

check_channel_antenna_exist

The antenna patterns and phase centers exist if declared.

check_channel_dtaid

If a DTAId is specified, the support array exists

check_channel_dwell_polys

/Dwell/CODTime/CODTimePoly and /Dwell/DwellTime/DwellTimePoly are consistent with other metadata.

check_channel_dwell_usedta

UseDTA only present with DTAId

check_channel_fx2_gt_fx1

FX2 PVPs greater than FX1 PVPs.

check_channel_fx_osr

FX domain vectors are sufficiently sampled

check_channel_fxbw

PVP agrees with FxBW.

check_channel_fxbwnoise

PVP agrees with FxBWNoise.

check_channel_fxc

PVP agrees with FxC.

check_channel_fxfixed

PVP agrees with FXFixed.

check_channel_global_fxminmax

PVP within global FxMin and FxMax.

check_channel_global_toaswath

PVP within global TOASwath.

check_channel_global_txtime

PVP within global TxTime1 and TxTime2.

check_channel_identifier_uniqueness

Identifier nodes within /Channel/Parameters are unique.

check_channel_imagearea_polygon

Image area polygon is simple and consistent with X1Y1 and X2Y2.

check_channel_imagearea_x1y1

Channel/Parameters/ImageArea X1Y1 and X2Y2 consistent with SceneCoordinates/ImageArea X1Y1 and X2Y2.

check_channel_normal_signal_pvp

SIGNAL PVP = 1 for at least half of the vectors.

check_channel_positive_pvps

FX1, FX2, SC0, SCSS PVPs are strictly positive

check_channel_rcv_sample_rate

/TxRcv/RcvParameters/SampleRate sufficient to support saved TOA swath.

check_channel_rcvpolref

Receive polarization parameters are consistent with Antenna metadata.

check_channel_signal_data

Check contents of signal array.

check_channel_signalnormal

PVP agrees with SignalNormal.

check_channel_srpfixed

PVP agrees with SRPFixed.

check_channel_toa_osr

TOA domain vectors are sufficiently sampled

check_channel_toaextsaved

PVP agrees with TOAExtSaved.

check_channel_toafixed

PVP agrees with TOAFixed.

check_channel_toasaved

PVP agrees with TOASaved.

check_channel_txpolref

Transmit polarization parameters are consistent with Antenna metadata.

check_channel_txrcv_exist

The declared TxRcv nodes exist.

check_classification_and_release_info

Asserts that the Classification and ReleaseInfo fields are the same in header KVP list and the xml.

check_data_num_bytes_pvp_accommodates_pvps

/Data/NumBytesPVP is large enough to accommodate PVPs described in XML

check_data_num_bytes_pvp_is_valid

/Data/NumBytesPVP is a multiple of 8 and > 0

check_data_num_cphd_channels

/Data/NumCPHDChannels matches #{/Data/Channel} nodes

check_data_num_support_arrays

/Data/NumSupportArrays matches #{/Data/SupportArray} nodes

check_dwell_num_cod_times

/Dwell/NumCODTimes matches #{/Dwell/CODTime} nodes

check_dwell_num_dwell_times

/Dwell/NumDwellTimes matches #{/Dwell/DwellTime} nodes

check_extended_imagearea_polygon

Scene extended area polygon is simple and consistent with X1Y1 and X2Y2.

check_extended_imagearea_x1y1_x2y2

Extended image area contains the image area.

check_file_fxfixed

The FXFixedCPHD element matches the rest of the file.

check_file_srpfixed

The SRPFixedCPHD element matches the rest of the file.

check_file_toafixed

The TOAFixedCPHD element matches the rest of the file.

check_file_type_header

File type header is consistent with the XML.

check_first_pvp_zero_offset

First PVP in the layout has zero offset

check_first_txtime

First TxTime greater than 0.

check_gaps_between_pvps

PVP layout described in XML does not contain gaps between parameters.

check_geoinfo_polygons

GeoInfo polygons are simple polygons in clockwise order.

check_global_fx_band

The Global FXBand matches the PVPs.

check_global_toaswath

The Global TOASwath matches the PVPs.

check_global_txtime_limits

The Global TxTime1 and TxTime2 match the PVPs.

check_header_kvp_list

Asserts that the required keys are in the header KVP list.

check_identifier_uniqueness

Identifier nodes are unique.

check_image_area_corner_points

The corner points represent a simple quadrilateral in clockwise order.

check_image_grid

SceneCoordinates/ImageGrid is consistent with ImageArea

check_image_grid_exists

Verify that the ImageGrid is defined

check_imagearea_polygon

Scene Image area polygon is simple and consistent with X1Y1 and X2Y2.

check_imagearea_x1y1_x2y2

SceneCoordinates/ImageArea is self-consistent.

check_optional_pvps_fx

FXN1 & FXN2 PVPs are included appropriately.

check_optional_pvps_toa

TOAE1 & TOAE2 PVPs are included appropriately.

check_overlapping_pvps

PVP layout described in XML does not contain overlapping parameters.

check_pad_after_pvp

The pad after PVPs is 0.

check_pad_after_support

The pad after support arrays is 0.

check_pad_after_xml

The pad after XML is 0.

check_pad_header_xml

The pad between the header and XML is 0.

check_polynomials

Polynomial types are correctly specified.

check_pvp_block_size

PVP_BLOCK_SIZE in header consistent with XML /Data branch.

check_pvp_set_finiteness

PVP sets have the same per-vector finiteness.

check_rcv_acxy

RcvACX and RcvACY PVPs are orthonormal

check_rcv_after_tx

RcvTime is after TxTime.

check_rcv_finite

RcvTime and Pos are finite.

check_rcveb

RcvEB composed of valid direction cosines

check_refgeom

The ReferenceGeometry parameters are consistent with the other metadata

check_scene_plane_axis_vectors

Scene plane axis vectors are orthonormal.

check_segment_polygons

SegmentPolygons are simple, valid and clockwise.

check_signal_at_end_of_file

Signal is at the end of the file.

check_signal_block_size_and_packing

Signal block is correctly sized and packed

check_support_arrays_have_data

Each /SupportArray array has a corresponding /Data/SupportArray

check_time_increasing

PVP times increase.

check_tx_acxy

TxACX and TxACY PVPs are orthonormal

check_txeb

TxEB composed of valid direction cosines

check_txrcv_ids_in_channel

If the TxRcv branch exists, then TxRcv is also present in /Channel/Parameters

check_txrcv_lfmrate

TxRcv LFMRate is not zero.

check_txrcv_posvel_residuals

Tx/Rcv Position/Velocity PVPs have small polyfit residual.