def get_auxtab(datadir,slavedate,masterdate,swathlist,pol):
    procslavelist = []
    slavedate_dt = dt.datetime(int(slavedate[:4]),int(slavedate[4:6]),int(slavedate[6:]))
    masterdate_dt = dt.datetime(int(masterdate[:4]),int(masterdate[4:6]),int(masterdate[6:]))
    for l in os.listdir(os.path.join(datadir,'RSLC')):
        if len(l) == 8 and l != slavedate and l[0] == '2':
            procslavelist.append(dt.datetime(int(l[:4]),int(l[4:6]),int(l[6:])))
    
    procbaseline = [abs(slavedate_dt-sd) for sd in procslavelist]
    if min(procbaseline) < abs(slavedate_dt-masterdate_dt):
        auxdate = procslavelist[np.argsort(procbaseline)[0]]
        auxtab = os.path.join(datadir,'RSLC3_tab')
        make_SLC_tab(os.path.join(datadir,'RSLC3_tab'),
                     os.path.join(datadir,'RSLC',
                                  auxdate.strftime('%Y%m%d'),
                                  auxdate.strftime('%Y%m%d')),
                     swathlist,pol)
    else:
        auxtab = []
    return auxtab
def derive_lut(datadir,masterdate,slavedate,swathlist,pol):
    slcdir = os.path.join(datadir,'SLC')
    geodir = os.path.join(datadir,'Geo')
    rslcdir = os.path.join(datadir,'RSLC')
    if not os.path.exists(rslcdir):
        os.mkdir(rslcdir)
    if not os.path.exists(os.path.join(rslcdir,slavedate)):
        os.mkdir(os.path.join(rslcdir,slavedate))
    exe_str = 'rdc_trans {sd}/{md}/{md}.mli.par {gd}/{md}.hgt '.format(sd=slcdir,
                                                                       md=masterdate,
                                                                       gd=geodir)
    exe_str += '{sd}/{sld}/{sld}.mli.par {rd}/{sld}.mli.lut'.format(sd=slcdir,
                                                                    sld=slavedate,
                                                                    rd=rslcdir)
    os.system(exe_str)
    make_SLC_tab(os.path.join(datadir,'SLC1_tab'),
                 os.path.join(slcdir,masterdate,masterdate),
                 swathlist,pol)
    make_SLC_tab(os.path.join(datadir,'SLC2_tab'),
                 os.path.join(slcdir,slavedate,slavedate),
                 swathlist,pol)
    make_SLC_tab(os.path.join(datadir,'RSLC2_tab'),
                 os.path.join(rslcdir,slavedate,slavedate),
                 swathlist,pol)
    SLC_interp(datadir,masterdate,slavedate,'-')
Exemple #3
0
def get_auxtab(datadir, slavedate, masterdate, swathlist, pol):
    procslavelist = []
    slavedate_dt = dt.datetime(int(slavedate[:4]), int(slavedate[4:6]),
                               int(slavedate[6:]))
    masterdate_dt = dt.datetime(int(masterdate[:4]), int(masterdate[4:6]),
                                int(masterdate[6:]))
    for l in os.listdir(os.path.join(datadir, 'RSLC')):
        if len(l) == 8 and l != slavedate and l[0] == '2':
            procslavelist.append(
                dt.datetime(int(l[:4]), int(l[4:6]), int(l[6:])))

    procbaseline = [abs(slavedate_dt - sd) for sd in procslavelist]
    if min(procbaseline) < abs(slavedate_dt - masterdate_dt):
        auxdate = procslavelist[np.argsort(procbaseline)[0]]
        auxtab = os.path.join(datadir, 'RSLC3_tab')
        make_SLC_tab(
            os.path.join(datadir, 'RSLC3_tab'),
            os.path.join(datadir, 'RSLC', auxdate.strftime('%Y%m%d'),
                         auxdate.strftime('%Y%m%d')), swathlist, pol)
    else:
        auxtab = []
    return auxtab
Exemple #4
0
def derive_lut(datadir, masterdate, slavedate, swathlist, pol):
    slcdir = os.path.join(datadir, 'SLC')
    geodir = os.path.join(datadir, 'Geo')
    rslcdir = os.path.join(datadir, 'RSLC')
    if not os.path.exists(rslcdir):
        os.mkdir(rslcdir)
    if not os.path.exists(os.path.join(rslcdir, slavedate)):
        os.mkdir(os.path.join(rslcdir, slavedate))
    exe_str = 'rdc_trans {sd}/{md}/{md}.mli.par {gd}/{md}.hgt '.format(
        sd=slcdir, md=masterdate, gd=geodir)
    exe_str += '{sd}/{sld}/{sld}.mli.par {rd}/{sld}.mli.lut'.format(
        sd=slcdir, sld=slavedate, rd=rslcdir)
    os.system(exe_str)
    make_SLC_tab(os.path.join(datadir, 'SLC1_tab'),
                 os.path.join(slcdir, masterdate, masterdate), swathlist, pol)
    make_SLC_tab(os.path.join(datadir, 'SLC2_tab'),
                 os.path.join(slcdir, slavedate, slavedate), swathlist, pol)
    make_SLC_tab(os.path.join(datadir, 'RSLC2_tab'),
                 os.path.join(rslcdir, slavedate, slavedate), swathlist, pol)
    SLC_interp(datadir, masterdate, slavedate, '-')