Exemplo n.º 1
0
def process_timeseries(inps):
    """geocode timeseries**.h5 file and get the deformation field of two time periods"""
    atr_asc = inps.file

    #unw file
    cmd_args = [
        atr_asc, '-b', inps.SNWE, '-y', inps.latStep, '-x', inps.lonStep,
        '--outdir', "".join(inps.outdir)
    ]
    print("geocode.py", cmd_args)
    args_str = multitrack_utilities.seperate_str_byspace(cmd_args)
    mintpy.geocode.main(args_str.split())

    #save dataset of unw cor and dem
    os.chdir("".join(inps.outdir))
    filename, extension = multitrack_utilities.seprate_filename_extension(
        "".join(atr_asc))[1:3]

    cmd_args = [
        'geo_' + filename + extension,
        "".join([inps.startDate, '_', inps.endDate])
    ]
    print("save_roipac.py", cmd_args)
    asct_str = multitrack_utilities.seperate_str_byspace(cmd_args)
    os.system(
        multitrack_utilities.seperate_str_byspace(
            ['save_roipac.py', asct_str.split()]))

    process_saveroi(inps)
    multitrack_utilities.delete_tmpgeo(inps.outdir, 'geo_', '.h5')
Exemplo n.º 2
0
def main(iargs=None):
    inps = cmd_line_parse(iargs)

    print('single track!')
    inps.startDate, inps.endDate = multitrack_utilities.find_start_end_date(
        os.getcwd(), inps)

    print(inps)

    if str.find(inps.file, 'ifgramStack') != -1:
        process_ifgramStack(inps)
    elif str.find(inps.file, 'velocity') != -1:
        process_geocode(inps)
        process_velocity(inps)
    elif str.find(inps.file, 'timeseries') != -1:
        process_geocode(inps)
        process_timeseries(inps)
    else:
        process_HDFEOS(inps)
    # rename *.rsc1 to *.rsc
    outfile = multitrack_utilities.seperate_str_byspace(['srtm.dem' + '.rsc'])
    write_rsc_file(
        inps, outfile,
        multitrack_utilities.seperate_str_byspace(['srtm.dem' + '.rsc1']))
    os.remove(outfile)
    print('rename *.rsc1 to *.rsc')
    os.rename(
        multitrack_utilities.seperate_str_byspace(['srtm.dem' + '.rsc1']),
        outfile)
    # generate dem.jpeg
    dem_jpeg('srtm.dem')
Exemplo n.º 3
0
def process_geocode(inps):
    """process temporalCoherence.h5 and geometryRadar.h5 file"""
    # process cor and dem dataset
    if os.path.exists("".join(inps.outdir)) == False:
        os.makedirs("".join(inps.outdir))

    # geocode
    corname = 'temporalCoherence.h5'
    cmd_args = [
        corname, '-b', inps.SNWE, '-y', inps.latStep, '-x', inps.lonStep,
        '--outdir', "".join(inps.outdir)
    ]
    print("geocode.py", cmd_args)
    args_str = multitrack_utilities.seperate_str_byspace(cmd_args)
    mintpy.geocode.main(args_str.split())

    demname = 'geometryRadar.h5'
    if not os.path.isfile(demname):
        demname_f = './inputs/geometryRadar.h5'
    else:
        demname_f = 'geometryRadar.h5'
    cmd_args = [
        demname_f, '-b', inps.SNWE, '-y', inps.latStep, '-x', inps.lonStep,
        '--outdir', "".join(inps.outdir)
    ]
    print("geocode.py", cmd_args)
    args_str = multitrack_utilities.seperate_str_byspace(cmd_args)
    mintpy.geocode.main(args_str.split())
Exemplo n.º 4
0
def process_saveroi(inps):
    #save_roipac
    cmd_args = [
        'geo_temporalCoherence.h5', '-o',
        "".join(['geo_', inps.startDate, '_', inps.endDate, '.cor'])
    ]
    print("save_roipac.py", cmd_args)
    asct_str = multitrack_utilities.seperate_str_byspace(cmd_args)
    os.system(
        multitrack_utilities.seperate_str_byspace(
            ['save_roipac.py', asct_str.split()]))

    cmd_args = ['geo_geometryRadar.h5', 'height', '-o', 'srtm.dem']
    print("save_roipac.py", cmd_args)
    asct_str = multitrack_utilities.seperate_str_byspace(cmd_args)
    os.system(
        multitrack_utilities.seperate_str_byspace(
            ['save_roipac.py', asct_str.split()]))
Exemplo n.º 5
0
def process_velocity(inps):
    """process velocity.h5 file"""
    atr_asc = inps.file

    #velocity file
    cmd_args = [
        atr_asc, '-b', inps.SNWE, '-y', inps.latStep, '-x', inps.lonStep,
        '--outdir', "".join(inps.outdir)
    ]
    print("geocode.py", cmd_args)
    args_str = multitrack_utilities.seperate_str_byspace(cmd_args)
    mintpy.geocode.main(args_str.split())

    os.chdir("".join(inps.outdir))
    process_saveroi(inps)
    print('save unw file')
    multitrack_utilities.velo_disp(inps)

    multitrack_utilities.delete_tmpgeo(inps.outdir, 'geo_', '.h5')
Exemplo n.º 6
0
def process_HDFEOS(inps):
    """process *.he5 file"""
    atr_asc = inps.file

    #save dataset of unw cor and dem
    filename, extension = multitrack_utilities.seprate_filename_extension(
        "".join(atr_asc))[1:3]
    cmd_args = [
        filename + extension,
        "".join(['displacement-', inps.startDate, '_', inps.endDate]), '-o',
        "".join(['geo_', inps.startDate, '_', inps.endDate, '.unw'])
    ]
    print("save_roipac.py", cmd_args)
    asct_str = multitrack_utilities.seperate_str_byspace(cmd_args)
    os.system(
        multitrack_utilities.seperate_str_byspace(
            ['save_roipac.py', asct_str.split()]))

    cmd_args = [
        filename + extension, 'temporalCoherence', '-o',
        "".join(['geo_', inps.startDate, '_', inps.endDate, '.cor'])
    ]
    print("save_roipac.py", cmd_args)
    asct_str = multitrack_utilities.seperate_str_byspace(cmd_args)
    completion_status = os.system(
        multitrack_utilities.seperate_str_byspace(
            ['save_roipac.py', asct_str.split()]))

    cmd_args = [filename + extension, 'height', '-o', 'srtm.dem']
    print("save_roipac.py", cmd_args)
    asct_str = multitrack_utilities.seperate_str_byspace(cmd_args)
    os.system(
        multitrack_utilities.seperate_str_byspace(
            ['save_roipac.py', asct_str.split()]))

    # mv
    if os.path.exists(inps.outdir) == False:
        os.makedirs(inps.outdir)
    else:
        shutil.rmtree(inps.outdir)
        os.makedirs(inps.outdir)
    key1 = 'geo_'
    key2 = 'srtm'
    for file in os.listdir(os.getcwd()):
        if str.find(file, key1) != -1 or str.find(file, key2) != -1:
            shutil.move(file, inps.outdir)
    os.chdir("".join(inps.outdir))

    multitrack_utilities.delete_tmpgeo(inps.outdir, 'geo_', '.h5')
Exemplo n.º 7
0
def process_ifgramStack(inps):
    """process ifgramStack.h5 file"""
    if os.path.exists("".join(inps.outdir)) == False:
        os.makedirs("".join(inps.outdir))

    # dem file
    demname = 'geometryRadar.h5'
    if not os.path.isfile(demname):
        demname_f = './inputs/geometryRadar.h5'
    else:
        demname_f = 'geometryRadar.h5'
    cmd_args = [
        demname_f, '-b', inps.SNWE, '-y', inps.latStep, '-x', inps.lonStep,
        '--outdir', "".join(inps.outdir)
    ]
    print("geocode.py", cmd_args)
    args_str = multitrack_utilities.seperate_str_byspace(cmd_args)
    mintpy.geocode.main(args_str.split())

    #ifgramStack file
    atr_asc = ['./inputs/' + inps.file]
    cmd_args = [
        atr_asc, '-b', inps.SNWE, '-y', inps.latStep, '-x', inps.lonStep,
        '--outdir', "".join(inps.outdir)
    ]
    print("geocode.py", cmd_args)
    args_str = multitrack_utilities.seperate_str_byspace(cmd_args)
    mintpy.geocode.main(args_str.split())

    #save dataset of unw cor and dem
    os.chdir("".join(inps.outdir))
    filename, extension = multitrack_utilities.seprate_filename_extension(
        "".join(atr_asc))[1:3]

    cmd_args = [
        'geo_' + filename + extension,
        "".join(['unwrapPhase-', inps.startDate, '_', inps.endDate])
    ]
    print("save_roipac.py", cmd_args)
    asct_str = multitrack_utilities.seperate_str_byspace(cmd_args)
    os.system(
        multitrack_utilities.seperate_str_byspace(
            ['save_roipac.py', asct_str.split()]))

    cmd_args = [
        'geo_' + filename + extension,
        "".join(['coherence-', inps.startDate, '_', inps.endDate])
    ]
    print("save_roipac.py", cmd_args)
    asct_str = multitrack_utilities.seperate_str_byspace(cmd_args)
    completion_status = os.system(
        multitrack_utilities.seperate_str_byspace(
            ['save_roipac.py', asct_str.split()]))

    cmd_args = ['geo_geometryRadar.h5', 'height', '-o', 'srtm.dem']
    print("save_roipac.py", cmd_args)
    asct_str = multitrack_utilities.seperate_str_byspace(cmd_args)
    os.system(
        multitrack_utilities.seperate_str_byspace(
            ['save_roipac.py', asct_str.split()]))

    multitrack_utilities.delete_tmpgeo(inps.outdir, 'geo_', '.h5')