def isce2vrt(inname):
    '''
    Create VRT for ISCE product.
    '''
    img, dataname, metaname = IML.loadImage(inname)
    img.renderVRT()
    return
def isce2envi(inname):
    '''
    Create ENVI hdr for ISCSE product.
    '''
    img, dataname, metaname = IML.loadImage(inname)
    img.renderEnviHDR()

    return
Exemple #3
0
def changeXmlName(xmlFile, xmlFileNew):
    import os
    import isce
    import isceobj
    from imageMath import IML

    #currently, only sure about supporting SLC xml file
    xmlFileNew = xmlFileNew.rstrip('.xml')
    img, dataName, metaName = IML.loadImage(xmlFile)
    img.filename = xmlFileNew
    #img.setAccessMode('READ')
    os.remove(xmlFile)
    img.renderHdr()
Exemple #4
0
           m12=m12,
           m21=m21,
           m22=m22,
           t1=t1,
           t2=t2,
           rlks=inps.rlks,
           alks=inps.alks,
           rlks0=inps.rlks0,
           alks0=inps.alks0,
           format=formatx,
           method=methodx)

    rectInputFile = 'rect.in'
    with open(rectInputFile, 'w') as ff:
        ff.write(rectInput)

    #run fitoff here
    cmd = '$INSAR_ZERODOP_BIN/rect_with_looks {}'.format(rectInputFile)
    #print("{}".format(cmd))
    runCmd(cmd)

    #get xml file
    shutil.copy(inps.inimage + '.xml', inps.outimage + '.xml')
    #fix file name
    img, dataName, metaName = IML.loadImage(inps.outimage + '.xml')
    img.filename = inps.outimage
    #img.setAccessMode('READ')
    img.renderHdr()

#./rect.py -i 141018-141123_rg.off -o rect_141018-141123_rg.off -c ampsim_16rlks_16alks.aff -f real -r 16 -a 16
Exemple #5
0
    masterLength = getLength(inps.master + '.xml')
    slaveWidth = getWidth(inps.slave + '.xml')
    slaveLength = getLength(inps.slave + '.xml')

    with open(inps.slave + '.pck', 'rb') as fid:
        slaveFrame = pickle.load(fid)
    prf = slaveFrame.PRF

    #can get doppler centroid frequency information from frame now
    dop0 = slaveFrame.dopCoeff[0]
    dop1 = slaveFrame.dopCoeff[1]
    dop2 = slaveFrame.dopCoeff[2]
    dop3 = slaveFrame.dopCoeff[3]

    #get xml file for resampled SLC
    shutil.copy(inps.master + '.xml', inps.rslave + '.xml')
    #fix file name
    img, dataName, metaName = IML.loadImage(inps.rslave + '.xml')
    img.filename = inps.rslave
    #img.setAccessMode('READ')
    img.renderHdr()

    #run resamp
    cmd = "$INSAR_ZERODOP_BIN/resamp {} {} {} {} {} {} {} {} {} {} {} {} {}".format(
        inps.slave, inps.rslave, inps.rgoff, inps.azoff, masterWidth,
        masterLength, slaveWidth, slaveLength, prf, dop0, dop1, dop2, dop3)
    #print("{}".format(cmd))
    runCmd(cmd)

#./resample.py -m 20130927.slc -s 20141211.slc -r 20130927-20141211_rg.off -a 20130927-20141211_az.off -o 20141211_resamp.slc
    return inps


if __name__ == '__main__':
    '''
    Main driver.
    '''
    from imageMath import IML

    inps = cmdLineParse()

    if inps.infile.endswith('.xml'):
        inps.infile = os.path.splitext(inps.infile)[0]

    dirname = os.path.dirname(inps.infile)

    img, dataname, metaName = IML.loadImage(inps.infile)

    if inps.full:
        fname = os.path.abspath(
            os.path.join(dirname, os.path.basename(inps.infile)))
    elif inps.base:
        fname = os.path.basename(os.path.basename(inps.infile))
    else:
        raise Exception('Unknown state in {0}'.format(
            os.path.basename(__file__)))

    img.filename = fname
    img.setAccessMode('READ')
    img.renderHdr()
    elif inps.fmt == 'vrt':

        if (inps.latvrt is None) or (inps.lonvrt is None):
            isce2vrt(inps.infile)

        else:
            #            latf = inps.latvrt + '.vrt'
            #            if not os.path.exists(latf):
            isce2vrt(inps.latvrt)

            #            lonf = inps.lonvrt + '.vrt'
            #            if not os.path.exists(lonf):
            isce2vrt(inps.lonvrt)

            latimg, dummy, dummy = IML.loadImage(inps.latvrt)
            latwid = latimg.getWidth()
            latlgt = latimg.getLength()
            if latimg.getBands() != 1:
                raise Exception('Latitude image should be single band')

            lonimg, dummy, dummy = IML.loadImage(inps.lonvrt)
            lonwid = lonimg.getWidth()
            lonlgt = lonimg.getLength()

            if lonimg.getBands() != 1:
                raise Exception('Longitude image should be single band')

            img = isceobj.createImage()
            img.load(inps.infile + '.xml')
            wid = img.getWidth()