コード例 #1
0
    parser.add_argument('--polyOrderX',
                        default=3,
                        type=int,
                        help='Order for x-direction polynomials')
    parser.add_argument('--polyOrderY',
                        default=3,
                        type=int,
                        help='Order for y-direction polynomials')
    parser.add_argument('input', help='Input SICD')
    parser.add_argument('output', help='Output SIO')
    args = parser.parse_args()

    if not os.path.isfile(args.input):
        print('{} is not a file'.format(args.input))
        sys.exit(1)

    if args.schema and not os.path.exists(args.schema):
        print('{} does not exist'.format(args.schema))
        sys.exit(1)

    schemaPaths = getSchemaPaths(args.schema)
    widebandData, complexData = six_sicd.read(args.input, schemaPaths)
    plane = getAreaPlane(complexData)
    toSlantRow, toSlantCol = findOutputToSlantPolynomials(
        complexData, args.polyOrderX, args.polyOrderY)
    dims = RowColSizeT(plane.xDirection.elements, plane.yDirection.elements)
    outputBuffer = projectToOutput(widebandData, dims, toSlantRow, toSlantCol)

    sio_lite.write(outputBuffer, args.output, numpy.float32)
    sys.exit(0)
コード例 #2
0
import numpy as np
import sys
import os
from pysix import 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>"
        sys.exit(0)

    widebandData, complexData = six_sicd.read(nitfPath)
    sio_lite.write(widebandData, sioPath)

    print "Wrote " + sioPath
コード例 #3
0
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public 
 * License along with this program; If not, 
 * see <http://www.gnu.org/licenses/>.
 *
 *
"""

from coda.sio_lite import write
import numpy as np
import sys

if __name__ == '__main__':
    if len(sys.argv) >= 3:
        arrayOutputPathname = sys.argv[1]
        transposedOutputPathname = sys.argv[2]
    else:
        print "Usage: " + sys.argv[0] + " <Output SIO for array> <Output SIO for transposed array>"
        sys.exit(0)

    array = np.array([[0.1, 1.1, 2.1, 3.1],
                      [4.2, 5.2, 6.2, 7.2],
                      [8.3, 9.3, 10.3, 11.3]], dtype='float32');
    write(array, arrayOutputPathname)

    #np.transpose() produces a non-contiguous array
    trans = np.transpose(array)
    write(trans, transposedOutputPathname)

コード例 #4
0
 * see <http://www.gnu.org/licenses/>.
 *
 *
"""

from coda.sio_lite import read, write
import sys

if __name__ == '__main__':

    if len(sys.argv) >= 3:
        inputPathname = sys.argv[1]
        outputPathname = sys.argv[2]
    else:
        print "Usage: " + sys.argv[0] + " <Input SIO> <Output SIO>"
        sys.exit(0)

    buf = read(inputPathname)

    print 'Input Dims: ' + str(buf.shape)
    print 'Input Type: ' + str(buf.dtype)

    write(buf, outputPathname)

    # Read the new one
    buf = read(outputPathname)

    print ''
    print 'Output Dims: ' + str(buf.shape)
    print 'Output Type: ' + str(buf.dtype)
コード例 #5
0
import numpy as np
import sys
import tempfile

if __name__ == '__main__':
    if len(sys.argv) >= 3:
        arrayOutputPathname = sys.argv[1]
        transposedOutputPathname = sys.argv[2]
    else:
        print "Usage: " + sys.argv[0] + " <Output SIO for array> <Output SIO for transposed array>"
        sys.exit(0)

    array = np.array([[0.1, 1.1, 2.1, 3.1],
                      [4.2, 5.2, 6.2, 7.2],
                      [8.3, 9.3, 10.3, 11.3]], dtype='float32');
    write(array, arrayOutputPathname)

    #np.transpose() produces a non-contiguous array
    trans = np.transpose(array)
    write(trans, transposedOutputPathname)

    # Make sure we can write with different dtype arguments
    tempfiles = [tempfile.mkstemp()[1] for _ in range(3)]
    write(array, tempfiles[0], 'float32')
    write(array, tempfiles[1], np.float32)
    write(array, tempfiles[2], FileHeader.FLOAT)

    contents = []
    for temp in tempfiles:
        with open(temp, 'r') as f:
            contents.append(f.read())
コード例 #6
0
ファイル: test_sio_round_trip.py プロジェクト: mdaus/nitro
 * see <http://www.gnu.org/licenses/>.
 *
 *
"""

from coda.sio_lite import read, write
import sys

if __name__ == '__main__':

    if len(sys.argv) >= 3:
        inputPathname = sys.argv[1]
        outputPathname = sys.argv[2]
    else:
        print "Usage: " + sys.argv[0] + " <Input SIO> <Output SIO>"
        sys.exit(0)
        
    buf = read(inputPathname)
    
    print 'Input Dims: ' + str(buf.shape)
    print 'Input Type: ' + str(buf.dtype)

    write(buf, outputPathname)
    
    # Read the new one
    buf = read(outputPathname)
    
    print ''
    print 'Output Dims: ' + str(buf.shape)
    print 'Output Type: ' + str(buf.dtype)
コード例 #7
0
ファイル: test_write_sio.py プロジェクト: porglezomp/coda-oss
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public 
 * License along with this program; If not, 
 * see <http://www.gnu.org/licenses/>.
 *
 *
"""

from coda.sio_lite import write
import numpy as np
import sys

if __name__ == '__main__':
    if len(sys.argv) >= 3:
        arrayOutputPathname = sys.argv[1]
        transposedOutputPathname = sys.argv[2]
    else:
        print "Usage: " + sys.argv[
            0] + " <Output SIO for array> <Output SIO for transposed array>"
        sys.exit(0)

    array = np.array(
        [[0.1, 1.1, 2.1, 3.1], [4.2, 5.2, 6.2, 7.2], [8.3, 9.3, 10.3, 11.3]],
        dtype='float32')
    write(array, arrayOutputPathname)

    #np.transpose() produces a non-contiguous array
    trans = np.transpose(array)
    write(trans, transposedOutputPathname)