예제 #1
0
def main():
    import sys
    import isceobj

    fi = FactoryInit()
    fi.fileInit = sys.argv[1]
    fi.defaultInitModule = 'InitFromXmlFile'
    fi.initComponentFromFile()

    hh = fi.getComponent('HH')
    hv = fi.getComponent('HV')
    vh = fi.getComponent('VH')
    vv = fi.getComponent('VV')

    #2013-06-03 Kosal: getComponent returns an object which attributes _leaderFileList and _imageFileList are dictionary
    #but in ALOS.py, extractImage() expects lists
    for f in [hh, hv, vh, vv]:
        f._leaderFileList = f._leaderFileList.values()
        f._imageFileList = f._imageFileList.values()
    #Kosal

    xmlFile = InitFromXmlFile(sys.argv[2])
    variables = xmlFile.init()
    filter = variables['FILTER']['value']
    filterSize = ()
    if (filter != 'None'):
        filterSize = (variables['FILTER_SIZE_X']['value'],variables['FILTER_SIZE_Y']['value'])
    frOutput = variables['FARADAY_ROTATION']['value']
    tecOutput = variables['TEC']['value']
    phaseOutput = variables['PHASE']['value']

    focuser = Focuser(hh=hh,hv=hv,vh=vh,vv=vv,fr=frOutput,tec=tecOutput,phase=phaseOutput)
    focuser.filter = filter
    focuser.filterSize = filterSize
    focuser.focuser()
예제 #2
0
def main():

    # create FormSLC object and initilaize it using FormSLC930110.xml. it actually contains all the parameters already except the raw and slc images.
    # one could use the Platform and Radar objects to change some of the parameters.
    obj = FormSLC()
    initfileForm = 'FormSCL930110.xml'
    #instantiate a InitFromXmlFile object passinf the file name in the contructor
    fileInit = InitFromXmlFile(initfileForm)
    # init FormSLC by passing the init object
    obj.initComponent(fileInit)

    initfilePl = 'Platform930110.xml'
    fileInit = InitFromXmlFile(initfilePl)
    objPl = Platform()
    objPl.initComponent(fileInit)

    #instantiate a InitFromObject object passing the object from which to initialize in the contructor
    objInit = InitFromObject(objPl)
    obj.initComponent(objInit)

    initfileRadar = 'Radar930110.xml'
    fileInit = InitFromXmlFile(initfileRadar)
    objRadar = Radar()
    objRadar.initComponent(fileInit)

    objInit = InitFromObject(objRadar)
    obj.initComponent(objInit)
    obj.printComponent()
    filename = "930110.raw"
    accessmode = 'read'
    endian = 'l'
    width = 11812

    objRaw = RawImage()
    # only sets the parameter
    objRaw.initImage(filename, accessmode, endian, width)
    # it actually creates the C++ object
    objRaw.createImage()

    filenameSLC = "930110.slc"
    accessmode = 'write'
    endian = 'l'
    width = 5700

    dict = {
        'FILE_NAME': filenameSLC,
        'ACCESS_MODE': accessmode,
        'BYTE_ORDER': endian,
        'WIDTH': width
    }
    dictInit = InitFromDictionary(dict)
    objSlc = SlcImage()

    objSlc.initComponent(dictInit)
    objSlc.createImage()

    obj.formSLCImage(objRaw, objSlc)
    #call this to do some cleaning. always call it if initImage (or the initComponent) was called
    objSlc.finalizeImage()
    objRaw.finalizeImage()
예제 #3
0
def main():
    referenceOrbit = sys.argv[1] #look for reference_orbit.txt
    fin1 = open(referenceOrbit)
    allLines = fin1.readlines()
    s_mocomp = []
    for line in allLines:
        lineS = line.split()
        s_mocomp.append(float(lineS[2]))
    fin1.close()
    initfileDem = 'DemImage.xml'
    initDem = InitFromXmlFile(initfileDem)
    objDem = DemImage()
    # only sets the parameter
    objDem.initComponent(initDem)
    # it actually creates the C++ object
    objDem.createImage()
    
    initfileTopo = 'TopoImage.xml'
    initTopo = InitFromXmlFile(initfileTopo)
    objTopo = IntImage()
    # only sets the parameter
    objTopo.initComponent(initTopo)
    # it actually creates the C++ object
    objTopo.createImage()
    initFile = 'Geocode.xml' 
    fileInit = InitFromXmlFile(initFile)

    obj = Geocode()
    obj.initComponent(fileInit)
    obj.setReferenceOrbit(s_mocomp)
    obj.geocode(objDem,objTopo)
    geoWidth= obj.getGeoWidth()
    geoLength  = obj.getGeoLength()
    latitudeSpacing = obj.getLatitudeSpacing()
    longitudeSpacing = obj.getLongitudeSpacing()
    minimumGeoLatitude = obj.getMinimumGeoLatitude()
    minimumGeoLongitude = obj.getMinimumGeoLongitude()
    maximumGeoLatitude = obj.getMaximumGeoLatitude()
    maximumGeoLongitude = obj.getMaxmumGeoLongitude()
    print(geoWidth,\
    geoLength,\
    latitudeSpacing,\
    longitudeSpacing,\
    minimumGeoLatitude,\
    minimumGeoLongitude,\
    maximumGeoLatitude,\
    maximumGeoLongitude)
    
    objDem.finalizeImage()
    objTopo.finalizeImage()
예제 #4
0
def main():

    filename = sys.argv[1]  # rgoffset.out
    fin = open(filename)
    allLines = fin.readlines()
    locationAc = []
    locationAcOffset = []
    locationDn = []
    locationDnOffset = []
    snr = []
    for line in allLines:
        lineS = line.split()
        locationAc.append(float(lineS[0]))
        locationAcOffset.append(float(lineS[1]))
        locationDn.append(float(lineS[2]))
        locationDnOffset.append(float(lineS[3]))
        snr.append(float(lineS[4]))
    dict = {}
    dict['LOCATION_ACROSS1'] = locationAc
    dict['LOCATION_ACROSS_OFFSET1'] = locationAcOffset
    dict['LOCATION_DOWN1'] = locationDn
    dict['LOCATION_DOWN_OFFSET1'] = locationDnOffset
    dict['SNR1'] = snr
    initDict = InitFromDictionary(dict)
    initfileResamp_image = 'Resamp_image.xml'

    initResamp_image = InitFromXmlFile(initfileResamp_image)

    initfileRangeIm = 'RangeOffsetImage.xml'
    initRangeIm = InitFromXmlFile(initfileRangeIm)

    objRangeIm = MhtImage()
    # only sets the parameter
    objRangeIm.initComponent(initRangeIm)
    # it actually creates the C++ object
    objRangeIm.createImage()
    obj = Resamp_image()
    obj.initComponent(initResamp_image)
    obj.initComponent(initDict)
    obj.resamp_image(objRangeIm)

    objRangeIm.finalizeImage()
예제 #5
0
def main():
    obj = Cpxmag2rg()
    initfileSlc1 = 'SlcImage1.xml'
    initSlc1 = InitFromXmlFile(initfileSlc1)
    objSlc1 = SlcImage()
    # only sets the parameter
    objSlc1.initComponent(initSlc1)
    # it actually creates the C++ object
    objSlc1.createImage()

    initfileSlc2 = 'SlcImage2.xml'
    initSlc2 = InitFromXmlFile(initfileSlc2)
    objSlc2 = SlcImage()
    # only sets the parameter
    objSlc2.initComponent(initSlc2)
    # it actually creates the C++ object
    objSlc2.createImage()
    outname = 'testRGOut'
    obj.setOutputImageName(outname)
    obj.cpxmag2rg(objSlc1, objSlc2)
    objSlc1.finalizeImage()
    objSlc2.finalizeImage()
예제 #6
0
def main():
    filename = sys.argv[1]  #rgoffset.out
    fin = open(filename)
    allLines = fin.readlines()
    locationAc = []
    locationAcOffset = []
    locationDn = []
    locationDnOffset = []
    snr = []
    for line in allLines:
        lineS = line.split()
        locationAc.append(float(lineS[0]))
        locationAcOffset.append(float(lineS[1]))
        locationDn.append(float(lineS[2]))
        locationDnOffset.append(float(lineS[3]))
        snr.append(float(lineS[4]))
    dict = {}
    dict['LOCATION_ACROSS1'] = locationAc
    dict['LOCATION_ACROSS_OFFSET1'] = locationAcOffset
    dict['LOCATION_DOWN1'] = locationDn
    dict['LOCATION_DOWN_OFFSET1'] = locationDnOffset
    dict['SNR1'] = snr
    initDict = InitFromDictionary(dict)

    initfileResamp_amps = 'Resamp_amps.xml'
    initResamp_amps = InitFromXmlFile(initfileResamp_amps)

    initfileAmpIn = 'AmpImageIn.xml'
    initAmpIn = InitFromXmlFile(initfileAmpIn)

    objAmpIn = AmpImage()
    # only sets the parameter
    objAmpIn.initComponent(initAmpIn)
    # it actually creates the C++ object
    objAmpIn.createImage()

    initfileAmpOut = 'AmpImageOut.xml'
    initAmpOut = InitFromXmlFile(initfileAmpOut)

    objAmpOut = AmpImage()
    # only sets the parameter
    objAmpOut.initComponent(initAmpOut)
    # it actually creates the C++ object
    objAmpOut.createImage()
    obj = Resamp_amps()
    obj.initComponent(initResamp_amps)
    obj.initComponent(initDict)
    obj.resamp_amps(objAmpIn, objAmpOut)

    ulr = obj.getULRangeOffset()
    ula = obj.getULAzimuthOffset()
    urr = obj.getURRangeOffset()
    ura = obj.getURAzimuthOffset()
    lrr = obj.getLRRangeOffset()
    lra = obj.getLRAzimuthOffset()
    llr = obj.getLLRangeOffset()
    lla = obj.getLLAzimuthOffset()
    cr = obj.getCenterRangeOffset()
    ca = obj.getCenterAzimuthOffset()
    print(ulr, ula, urr, ura, lrr, lra, llr, lla, cr, ca)

    objAmpIn.finalizeImage()
    objAmpOut.finalizeImage()