sarkit.verification.SiddConsistency.from_file

classmethod SiddConsistency.from_file(file, schema=None)

Create a SiddConsistency object from a file

Parameters:
filefile object

SIDD NITF or SIDD XML file to check

schemastr, optional

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

Returns:
SiddConsistency

The initialized consistency checker object

See also

from_parts

Examples

Use from_file to check an XML file:

>>> import sarkit.verification as skver

>>> with open("data/example-sidd-3.0.0.xml", "r") as f:
...     con = skver.SiddConsistency.from_file(f)
>>> con.check()
>>> bool(con.passes())
True
>>> bool(con.failures())
False

Use from_file to check a SIDD NITF file:

>>> with file.open("rb") as f:
...     con = skver.SiddConsistency.from_file(f)
>>> con.check()  # open file only used for construction
>>> bool(con.passes())
True
>>> bool(con.failures())
False