예제 #1
0
def main(argv):
    inps = cmdLineParse()
    if inps.template_file:
        inps = read_template2inps(inps.template_file, inps)
    inps.timeseriesFile = inps.outfile[0]
    inps.tempCohFile = inps.outfile[1]

    # Input file info
    atr = readfile.read_attribute(inps.ifgram_file)
    k = atr['FILE_TYPE']
    if not k == 'interferograms':
        sys.exit('ERROR: only interferograms file supported, input is ' + k +
                 ' file!')

    # Network Inversion
    if inps.resid_norm == 'L2':
        print 'inverse time-series using L2 norm minimization'
        ifgram_inversion(inps.ifgram_file,
                         inps.coherence_file,
                         meta=vars(inps))
    else:
        print 'inverse time-series using L1 norm minimization'
        ut.timeseries_inversion_L1(inps.ifgram_file, inps.timeseriesFile)

    return
예제 #2
0
def main(argv):

    inversion_method = 'l2'
    #maskFile = 'Mask.h5'
  
    if len(sys.argv)>2:
        try:   opts, args = getopt.getopt(argv,"h:f:l:o:")
        except getopt.GetoptError:
            usage() ; sys.exit(1)
  
        for opt,arg in opts:
            if opt in ("-h","--help"):  usage();   sys.exit()
            elif opt == '-f':           igramsFile        = arg
            elif opt == '-l':           inversion_method  = arg.lower()
            elif opt == '-o':           timeseriesFile    = arg
  
    elif len(sys.argv)==2:
        if os.path.isfile(argv[0]):     igramsFile = argv[0]
        else:  usage(); sys.exit(1)
    else:  usage(); sys.exit(1)
    
    #try:     igramsFile = argv[0]
    #except:  usage() ; sys.exit(1)
    #try:     inversion_method = argv[1]
    #except:  inversion_method = 'L2'
  
    try:    timeseriesFile
    except: timeseriesFile = 'timeseries.h5'
  
    #h5file = h5py.File(igramsFile,'r')
    atr = readfile.read_attribute(igramsFile)
    if not atr['FILE_TYPE'] == 'interferograms':
        print '**********************************************************************'
        print 'ERROR:'
        print '       '+igramsFile+ '  was not found or the file is not readable!'
        print '**********************************************************************'
        usage();sys.exit(1)

    #numIfgrams = len(h5file['interferograms'].keys())
    #if numIfgrams == 0.:
    #    print "load interferograms first by running: load_data.py TEMPLATEFILE"
    #    sys.exit(1)
    #h5timeseries = h5py.File(timeseriesFile,'w')
  
    print '\n************** Inverse Time Series ****************'
    if not inversion_method == 'l1':
        print 'Inverse time series using L2 norm minimization'
        ut.timeseries_inversion(igramsFile,timeseriesFile)
    else:
        print 'Inverse time series using L1 norm minimization'
        ut.timeseries_inversion_L1(igramsFile,timeseriesFile)
예제 #3
0
def main(argv):

    inversion_method = 'l2'
    #maskFile = 'Mask.h5'
  
    if len(sys.argv)>2:
        try:   opts, args = getopt.getopt(argv,"h:f:l:o:")
        except getopt.GetoptError:
            Usage() ; sys.exit(1)
  
        for opt,arg in opts:
            if opt in ("-h","--help"):  Usage();   sys.exit()
            elif opt == '-f':           igramsFile        = arg
            elif opt == '-l':           inversion_method  = arg.lower()
            elif opt == '-o':           timeseriesFile    = arg
  
    elif len(sys.argv)==2:
        if os.path.isfile(argv[0]):     igramsFile = argv[0]
        else:  Usage(); sys.exit(1)
    else:  Usage(); sys.exit(1)
    
    #try:     igramsFile = argv[0]
    #except:  Usage() ; sys.exit(1)
    #try:     inversion_method = argv[1]
    #except:  inversion_method = 'L2'
  
    try:    timeseriesFile
    except: timeseriesFile = 'timeseries.h5'
  
    #h5file = h5py.File(igramsFile,'r')
    atr = readfile.read_attributes(igramsFile)
    if not atr['FILE_TYPE'] == 'interferograms':
        print '**********************************************************************'
        print 'ERROR:'
        print '       '+igramsFile+ '  was not found or the file is not readable!'
        print '**********************************************************************'
        Usage();sys.exit(1)

    #numIfgrams = len(h5file['interferograms'].keys())
    #if numIfgrams == 0.:
    #    print "load interferograms first by running: load_data.py TEMPLATEFILE"
    #    sys.exit(1)
    #h5timeseries = h5py.File(timeseriesFile,'w')
  
    print '\n************** Inverse Time Series ****************'
    if not inversion_method == 'l1':
        print 'Inverse time series using L2 norm minimization'
        ut.timeseries_inversion(igramsFile,timeseriesFile)
    else:
        print 'Inverse time series using L1 norm minimization'
        ut.timeseries_inversion_L1(igramsFile,timeseriesFile)
예제 #4
0
def main(argv):
    inps = cmdLineParse()

    # Input file info
    atr = readfile.read_attribute(inps.ifgram_file)
    k = atr['FILE_TYPE']
    if not k == 'interferograms':
        sys.exit('ERROR: only interferograms file supported, input is '+k+' file!')

    # Network Inversion
    if not inps.inverse_method == 'L1':
        print 'Inverse time-series using L2 norm minimization'
        ut.timeseries_inversion(inps.ifgram_file, inps.timeseries_file)
    else:
        print 'Inverse time-series using L1 norm minimization'
        ut.timeseries_inversion_L1(inps.ifgram_file, inps.timeseries_file)

    return inps.timeseries_file