Ejemplo n.º 1
0
    #get user parameters from input
    idir = inps.idir
    burstSyncFile = inps.burst_sync_file
    dateReference = inps.ref_date
    dateSecondary = inps.sec_date
    #######################################################

    #get date statistics
    dateDirs, dates, frames, swaths, dateIndexReference = stackDateStatistics(
        idir, dateReference)
    ndate = len(dates)
    nframe = len(frames)
    nswath = len(swaths)

    #compute burst synchronization
    trackReference = loadTrack(dateDirs[dateIndexReference],
                               dates[dateIndexReference])

    frames = [frame.frameNumber for frame in trackReference.frames]
    swaths = [swath.swathNumber for swath in trackReference.frames[0].swaths]
    startingSwath = swaths[0]
    endingSwath = swaths[-1]

    burstSync = '  reference date    secondary date    frame    swath    burst UNsync time [ms]    burst sync [%]\n'
    burstSync += '==================================================================================================\n'

    #compute burst synchronization
    for i in range(ndate):
        if i == dateIndexReference:
            continue
        if dateSecondary != []:
            if dates[i] not in dateSecondary:
Ejemplo n.º 2
0
    inps = cmdLineParse()


    #get user parameters from input
    idir = inps.idir
    date = inps.date
    outputFile = inps.output
    match = inps.match
    #######################################################

    spotlightModes, stripmapModes, scansarNominalModes, scansarWideModes, scansarModes = acquisitionModesAlos2()


    frames = sorted([x[-4:] for x in glob.glob(os.path.join(idir, 'f*_*'))])
    track = loadTrack(idir, date)

    #save current dir
    dirOriginal = os.getcwd()
    os.chdir(idir)


    if (track.operationMode in scansarModes) and (len(track.frames[0].swaths) >= 2):
        for i, frameNumber in enumerate(frames):
            frameDir = 'f{}_{}'.format(i+1, frameNumber)
            os.chdir(frameDir)

            mosaicDir = 'mosaic'
            os.makedirs(mosaicDir, exist_ok=True)
            os.chdir(mosaicDir)
Ejemplo n.º 3
0
    #######################################################

    spotlightModes, stripmapModes, scansarNominalModes, scansarWideModes, scansarModes = acquisitionModesAlos2(
    )

    warningMessage = ''

    #get date statistics
    dateDirs, dates, frames, swaths, dateIndexReference = stackDateStatistics(
        idir, dateReference)
    ndate = len(dates)
    nframe = len(frames)
    nswath = len(swaths)

    #load reference track
    referenceTrack = loadTrack(dateDirs[dateIndexReference],
                               dates[dateIndexReference])

    dateSecondaryFirst = None
    for idate in range(ndate):
        if idate == dateIndexReference:
            continue
        if dateSecondary != []:
            if dates[idate] not in dateSecondary:
                continue
        dateSecondaryFirst = dates[idate]
        break
    if dateSecondaryFirst is None:
        raise Exception('no secondary date is to be processed\n')

    #set number of matching points
    numberOfOffsetsRangeUsed = [[None for j in range(nswath)]
Ejemplo n.º 4
0
    maskedAreasIon = inps.masked_areas

    #######################################################

    pair = '{}-{}'.format(dateReference, dateSecondary)
    ms = pair
    ml1 = '_{}rlks_{}alks'.format(numberRangeLooks1, numberAzimuthLooks1)
    ml2 = '_{}rlks_{}alks'.format(numberRangeLooks1 * numberRangeLooks2,
                                  numberAzimuthLooks1 * numberAzimuthLooks2)
    dateDirs, dates, frames, swaths, dateIndexReference = stackDateStatistics(
        idir, dateReferenceStack)
    dateDirs2, dates2, frames2, swaths2, dateIndexReference2 = stackDateStatistics(
        idir2, dateReferenceStack)
    spotlightModes, stripmapModes, scansarNominalModes, scansarWideModes, scansarModes = acquisitionModesAlos2(
    )
    trackReferenceStack = loadTrack(os.path.join(idir, dateReferenceStack),
                                    dateReferenceStack)
    trackReference = loadTrack(os.path.join(idir2, dateReference),
                               dateReference)
    trackSecondary = loadTrack(os.path.join(idir2, dateSecondary),
                               dateSecondary)
    subbandRadarWavelength, subbandBandWidth, subbandFrequencyCenter, subbandPrefix = subbandParameters(
        trackReferenceStack)

    self = createObject()
    self._insar = createObject()
    self._insar.numberRangeLooks1 = numberRangeLooks1
    self._insar.numberAzimuthLooks1 = numberAzimuthLooks1
    self._insar.numberRangeLooks2 = numberRangeLooks2
    self._insar.numberAzimuthLooks2 = numberAzimuthLooks2
    self._insar.numberRangeLooksIon = numberRangeLooksIon
    self._insar.numberAzimuthLooksIon = numberAzimuthLooksIon
Ejemplo n.º 5
0
    demFile = inps.dem
    wbdFile = inps.wbd
    numberRangeLooks1 = inps.nrlks1
    numberAzimuthLooks1 = inps.nalks1
    useGPU = inps.gpu
    #######################################################

    demFile = os.path.abspath(demFile)
    wbdFile = os.path.abspath(wbdFile)

    insarDir = 'insar'
    os.makedirs(insarDir, exist_ok=True)
    os.chdir(insarDir)

    ml1 = '_{}rlks_{}alks'.format(numberRangeLooks1, numberAzimuthLooks1)

    latitude = date + ml1 + '.lat'
    longitude = date + ml1 + '.lon'
    height = date + ml1 + '.hgt'
    los = date + ml1 + '.los'
    wbdOut = date + ml1 + '.wbd'

    track = loadTrack('../', date)
    if useGPU and hasGPU():
        topoGPU(track, numberRangeLooks1, numberAzimuthLooks1, demFile,
                latitude, longitude, height, los)
    else:
        snwe = topoCPU(track, numberRangeLooks1, numberAzimuthLooks1, demFile,
                       latitude, longitude, height, los)
    waterBodyRadar(latitude, longitude, wbdFile, wbdOut)
Ejemplo n.º 6
0
            if 'azimuth offset' in linex:
                frameAzimuthOffsetGeometrical.append(float(linex.split()[3]))
                frameAzimuthOffsetMatching.append(float(linex.split()[4]))
    else:
        frameRangeOffsetGeometrical.append(0.0)
        frameRangeOffsetMatching.append(0.0)
        frameAzimuthOffsetGeometrical.append(0.0)
        frameAzimuthOffsetMatching.append(0.0)

    #compute accurate starting range and sensing start using offset file for reference date
    #swath offset is computed between adjacent swaths within a frame, offset unit: first swath sample size
    #frame offset is computed between first swaths of adjacent frames, offset unit: first swath sample size
    startingRangeAll = [[None for j in range(nswath)] for i in range(nframe)]
    sensingStartAll = [[None for j in range(nswath)] for i in range(nframe)]

    trackReference = loadTrack(dateDirs[dateIndexReference],
                               dates[dateIndexReference])
    for i, frameNumber in enumerate(frames):
        #startingRange and sensingStart of first swath of current frame
        # for i1 in range(i+1):
        #     startingRangeFirst = trackReference.frames[0].swaths[0].startingRange - \
        #                          frameRangeOffsetMatching[i1] * trackReference.frames[0].swaths[0].rangePixelSize
        #     sensingStartFirst  = trackReference.frames[0].swaths[0].sensingStart - \
        #                          datetime.timedelta(seconds = frameAzimuthOffsetMatching[i1] * trackReference.frames[0].swaths[0].azimuthLineInterval)

        startingRangeFirst = trackReference.frames[0].swaths[0].startingRange - \
                             sum(frameRangeOffsetMatching[0:i+1]) * trackReference.frames[0].swaths[0].rangePixelSize
        sensingStartFirst  = trackReference.frames[0].swaths[0].sensingStart - \
                             datetime.timedelta(seconds = sum(frameAzimuthOffsetMatching[0:i+1]) * trackReference.frames[0].swaths[0].azimuthLineInterval)

        #startingRange and sensingStart of each swath of current frame
        for j, swathNumber in enumerate(range(swaths[0], swaths[-1] + 1)):
Ejemplo n.º 7
0
    swathPhaseDiffSnapIon = inps.snap
    swathPhaseDiffLowerIon = inps.phase_diff_lower
    swathPhaseDiffUpperIon = inps.phase_diff_upper
    #######################################################

    pair = '{}-{}'.format(dateReference, dateSecondary)
    ms = pair

    ml1 = '_{}rlks_{}alks'.format(numberRangeLooks1, numberAzimuthLooks1)

    dateDirs, dates, frames, swaths, dateIndexReference = stackDateStatistics(
        idir, dateReferenceStack)
    nframe = len(frames)
    nswath = len(swaths)

    trackReferenceStack = loadTrack('./', dates[dateIndexReference])
    #trackReference = loadTrack('./', dateReference)
    #trackSecondary = loadTrack('./', dateSecondary)

    self = createObject()
    self._insar = createObject()
    self._insar.referenceFrames = frames
    self._insar.startingSwath = swaths[0]
    self._insar.endingSwath = swaths[-1]

    self._insar.numberRangeLooks1 = numberRangeLooks1
    self._insar.numberAzimuthLooks1 = numberAzimuthLooks1

    self._insar.interferogram = ms + ml1 + '.int'
    self._insar.amplitude = ms + ml1 + '.amp'
    self._insar.differentialInterferogram = 'diff_' + ms + ml1 + '.int'
Ejemplo n.º 8
0
        os.symlink(longitude+'.vrt', os.path.basename(longitude)+'.vrt')
        os.symlink(longitude+'.xml', os.path.basename(longitude)+'.xml')
    else:
        longitudeLink = False

    if not os.path.isfile(os.path.basename(height)):
        heightLink = True
        os.symlink(height, os.path.basename(height))
        os.symlink(height+'.vrt', os.path.basename(height)+'.vrt')
        os.symlink(height+'.xml', os.path.basename(height)+'.xml')
    else:
        heightLink = False



    track = loadTrack(dateParDir, date)
    if useGPU and hasGPU():
        geo2RdrGPU(track, numberRangeLooks1, numberAzimuthLooks1, 
            latitude, longitude, height, rangeOffset, azimuthOffset)
    else:
        geo2RdrCPU(track, numberRangeLooks1, numberAzimuthLooks1, 
            latitude, longitude, height, rangeOffset, azimuthOffset)



    if latitudeLink == True:
        os.remove(os.path.basename(latitude))
        os.remove(os.path.basename(latitude)+'.vrt')
        os.remove(os.path.basename(latitude)+'.xml')

    if longitudeLink == True:
Ejemplo n.º 9
0
    interferogram = pair + ml1 + '.int'
    amplitude = pair + ml1 + '.amp'

    spotlightModes, stripmapModes, scansarNominalModes, scansarWideModes, scansarModes = acquisitionModesAlos2(
    )

    #use one date to find frames and swaths. any date should work, here we use dateIndexReference
    frames = sorted([x[-4:] for x in glob.glob(os.path.join('./', 'f*_*'))])
    swaths = sorted(
        [int(x[-1]) for x in glob.glob(os.path.join('./', 'f1_*', 's*'))])

    nframe = len(frames)
    nswath = len(swaths)

    trackReferenceStack = loadTrack('./', dateReferenceStack)

    #mosaic swaths
    for i, frameNumber in enumerate(frames):
        frameDir = 'f{}_{}'.format(i + 1, frameNumber)
        os.chdir(frameDir)

        mosaicDir = 'mosaic'
        os.makedirs(mosaicDir, exist_ok=True)
        os.chdir(mosaicDir)

        if not (swaths[-1] - swaths[0] >= 1):

            swathDir = 's{}'.format(swaths[0])
            if not os.path.isfile(interferogram):
                os.symlink(os.path.join('../', swathDir, interferogram),
Ejemplo n.º 10
0
    numberAzimuthLooks1 = inps.nalks1
    numberRangeLooksIon = inps.nrlks_ion
    numberAzimuthLooksIon = inps.nalks_ion
    filterSubbandInt = inps.filt
    filterStrengthSubbandInt = inps.alpha
    filterWinsizeSubbandInt = inps.win
    filterStepsizeSubbandInt = inps.step
    removeMagnitudeBeforeFilteringSubbandInt = not inps.keep_mag
    #######################################################

    pair = '{}-{}'.format(dateReference, dateSecondary)
    ms = pair
    ml1 = '_{}rlks_{}alks'.format(numberRangeLooks1, numberAzimuthLooks1)
    dateDirs, dates, frames, swaths, dateIndexReference = stackDateStatistics(
        idir, dateReferenceStack)
    trackReference = loadTrack('./', dateReference)

    self = createObject()
    self._insar = createObject()
    self._insar.wbd = wbd
    self._insar.numberRangeLooks1 = numberRangeLooks1
    self._insar.numberAzimuthLooks1 = numberAzimuthLooks1
    self._insar.numberRangeLooksIon = numberRangeLooksIon
    self._insar.numberAzimuthLooksIon = numberAzimuthLooksIon

    self._insar.amplitude = ms + ml1 + '.amp'
    self._insar.differentialInterferogram = 'diff_' + ms + ml1 + '.int'
    self._insar.latitude = dateReferenceStack + ml1 + '.lat'
    self._insar.longitude = dateReferenceStack + ml1 + '.lon'
    self.filterSubbandInt = filterSubbandInt
    self.filterStrengthSubbandInt = filterStrengthSubbandInt