示例#1
0
    location = os.path.split(os.path.realpath(__file__))[0]
    testPath = os.path.join(location, 'test_create_sicd_xml.py')
    subprocess.call(['python', testPath, '--includeNITF'])
    return os.path.join(os.getcwd(), 'test_create_sicd.nitf')


def clean(pathname):
    basename = os.path.splitext(pathname)
    for extension in ['.nitf', '.xml']:
        os.remove(basename + extension)
        os.remove(basename + '_rt' + extension)


if __name__ == '__main__':
    pathname = createNITF()
    assert os.path.exists(pathname)
    expectedArray, expectedData = read(pathname)
    numRows, numCols = expectedArray.shape
    actualArray, actualData = readRegion(pathname, 0, numRows, 0, numCols)
    try:
        assert (actualArray == expectedArray).all()
        assert actualData == expectedData
    except AssertionError:
        print('Behavior of readRegion() and read() differ. Test failed')
        sys.exit(1)
    except Exception as e:
        sys.exit(repr(e))
    print('Test passed')
    sys.exit(0)

示例#2
0
import sys
import os
from pysix import six_base, six_sicd
from coda import sio_lite

if __name__ == '__main__':
    if len(sys.argv) >= 3:
        # Set up
        nitfPath = os.path.abspath(sys.argv[1])
        sioPath = nitfPath.rstrip(".nitf") + ".sio"
        schemaPath = os.path.abspath(sys.argv[2])
    else:
        print("Usage: python " + sys.argv[0] + " <NITF path> <Schema path> [startRow numRows startCol numCols]")
        sys.exit(0)

    schemaPaths = six_base.VectorString()
    schemaPaths.push_back(schemaPath)

    if len(sys.argv) == 7:
        sfl = int(sys.argv[3])
        snl = int(sys.argv[4])
        sfe = int(sys.argv[5])
        sne = int(sys.argv[6])
        widebandData, complexData = six_sicd.readRegion(nitfPath, sfl, snl, sfe, sne, schemaPaths)
    else:
        widebandData, complexData = six_sicd.read(nitfPath, schemaPaths)

    sio_lite.write(widebandData, sioPath)

    print("Wrote " + sioPath)
示例#3
0
from pysix import six_base, six_sicd
from coda import sio_lite, coda_types

if __name__ == '__main__':
    if len(sys.argv) >= 3:
        # Set up
        nitfPath = os.path.abspath(sys.argv[1])
        sioPath = nitfPath.rstrip(".nitf") + ".sio"
        schemaPath = os.path.abspath(sys.argv[2])
    else:
        print("Usage: python " + sys.argv[0] +
              " <NITF path> <Schema path> [startRow numRows startCol numCols]")
        sys.exit(0)

    schemaPaths = coda_types.VectorString()
    schemaPaths.push_back(schemaPath)

    if len(sys.argv) == 7:
        sfl = int(sys.argv[3])
        snl = int(sys.argv[4])
        sfe = int(sys.argv[5])
        sne = int(sys.argv[6])
        widebandData, complexData = six_sicd.readRegion(
            nitfPath, sfl, snl, sfe, sne, schemaPaths)
    else:
        widebandData, complexData = six_sicd.read(nitfPath, schemaPaths)

    sio_lite.write(widebandData, sioPath)

    print("Wrote " + sioPath)