contrib/stack/topsStack/adjust_vaild_with_looks.py
def main(iargs=None):
    '''
    adjust valid samples by considering number of looks
    '''
    inps = cmdLineParse(iargs)


    swathList = sorted(ut.getSwathList(inps.input))

    frames=[]
    for swath in swathList:
        frame = ut.loadProduct( os.path.join(inps.input , 'IW{0}.xml'.format(swath)))
        minBurst = frame.bursts[0].burstNumber
        maxBurst = frame.bursts[-1].burstNumber

        if minBurst==maxBurst:
            print('Skipping processing of swath {0}'.format(swath))
            continue

        frames.append(frame)


    if inps.nrlks != 1 or inps.nalks != 1:
        print('updating swath xml')
        box = mergeBox(frames)
        #adjust valid with looks, 'frames' ARE CHANGED AFTER RUNNING THIS
        #here numberRangeLooks, instead of numberRangeLooks0, is used, since we need to do next step multilooking after unwrapping. same for numberAzimuthLooks.
        (burstValidBox, burstValidBox2, message) = adjustValidWithLooks(frames, box, inps.nalks, inps.nrlks, edge=0, avalid='strict', rvalid='strict')
    else:
        print('number of range and azimuth looks are all equal to 1, no need to update swath xml')

    for swath in swathList:
        print('writing ', os.path.join(inps.output , 'IW{0}.xml'.format(swath)))
        os.makedirs(os.path.join(inps.output, 'IW{0}'.format(swath)), exist_ok=True)
        ut.saveProduct(frames[swath-1], os.path.join(inps.output , 'IW{0}.xml'.format(swath)))

    adjust valid samples by considering number of looks
    
adjust valid samples by considering number of looks
adjust valid samples by considering number of looks
def main(iargs=None):
    inps = cmdLineParse(iargs)
    swathList = sorted(ut.getSwathList(inps.input))
    frames=[]
    for swath in swathList:
        frame = ut.loadProduct( os.path.join(inps.input , 'IW{0}.xml'.format(swath)))
        minBurst = frame.bursts[0].burstNumber
        maxBurst = frame.bursts[-1].burstNumber
        if minBurst==maxBurst:
            print('Skipping processing of swath {0}'.format(swath))
            continue
        frames.append(frame)
    if inps.nrlks != 1 or inps.nalks != 1:
        print('updating swath xml')
        box = mergeBox(frames)
        (burstValidBox, burstValidBox2, message) = adjustValidWithLooks(frames, box, inps.nalks, inps.nrlks, edge=0, avalid='strict', rvalid='strict')
    else:
        print('number of range and azimuth looks are all equal to 1, no need to update swath xml')
    for swath in swathList:
        print('writing ', os.path.join(inps.output , 'IW{0}.xml'.format(swath)))
        os.makedirs(os.path.join(inps.output, 'IW{0}'.format(swath)), exist_ok=True)
        ut.saveProduct(frames[swath-1], os.path.join(inps.output , 'IW{0}.xml'.format(swath)))
def main ( iargs = None ) : inps = cmdLineParse ( iargs ) swathList = sorted ( ut . getSwathList ( inps . input ) ) frames = [ ] for swath in swathList : frame = ut . loadProduct ( os . path . join ( inps . input , 'IW{0}.xml' . format ( swath ) ) ) minBurst = frame . bursts [ 0 ] . burstNumber maxBurst = frame . bursts [ - 1 ] . burstNumber if minBurst == maxBurst : print ( 'Skipping processing of swath {0}' . format ( swath ) ) continue frames . append ( frame ) if inps . nrlks != 1 or inps . nalks != 1 : print ( 'updating swath xml' ) box = mergeBox ( frames ) ( burstValidBox , burstValidBox2 , message ) = adjustValidWithLooks ( frames , box , inps . nalks , inps . nrlks , edge = 0 , avalid = 'strict' , rvalid = 'strict' ) else : print ( 'number of range and azimuth looks are all equal to 1, no need to update swath xml' ) for swath in swathList : print ( 'writing ' , os . path . join ( inps . output , 'IW{0}.xml' . format ( swath ) ) ) os . makedirs ( os . path . join ( inps . output , 'IW{0}' . format ( swath ) ) , exist_ok = True ) ut . saveProduct ( frames [ swath - 1 ] , os . path . join ( inps . output , 'IW{0}.xml' . format ( swath ) ) )
adjust valid samples by considering number of looks
adjust valid samples by considering number of looks
'''
    adjust valid samples by considering number of looks
    ''' #adjust valid with looks, 'frames' ARE CHANGED AFTER RUNNING THIS #here numberRangeLooks, instead of numberRangeLooks0, is used, since we need to do next step multilooking after unwrapping. same for numberAzimuthLooks.
iargs