Ejemplo n.º 1
0
    def run_tropospheric_delay_correction(self, step_name):
        """Correct tropospheric delays."""
        geom_file = ut.check_loaded_dataset(self.workDir, print_msg=False)[2]
        mask_file = 'maskTempCoh.h5'

        fnames = self.get_timeseries_filename(self.template)[step_name]
        in_file = fnames['input']
        out_file = fnames['output']
        if in_file != out_file:
            poly_order  = self.template['mintpy.troposphericDelay.polyOrder']
            tropo_model = self.template['mintpy.troposphericDelay.weatherModel']
            weather_dir = self.template['mintpy.troposphericDelay.weatherDir']
            method      = self.template['mintpy.troposphericDelay.method']

            def get_dataset_size(fname):
                atr = readfile.read_attribute(fname)
                return (atr['LENGTH'], atr['WIDTH'])

            # Phase/Elevation Ratio (Doin et al., 2009)
            if method == 'height_correlation':
                tropo_look = self.template['mintpy.troposphericDelay.looks']
                tropo_min_cor = self.template['mintpy.troposphericDelay.minCorrelation']
                scp_args = '{f} -g {g} -p {p} -m {m} -o {o} -l {l} -t {t}'.format(f=in_file,
                                                                                  g=geom_file,
                                                                                  p=poly_order,
                                                                                  m=mask_file,
                                                                                  o=out_file,
                                                                                  l=tropo_look,
                                                                                  t=tropo_min_cor)
                print('tropospheric delay correction with height-correlation approach')
                print('tropo_phase_elevation.py', scp_args)
                if ut.run_or_skip(out_file=out_file, in_file=in_file) == 'run':
                    mintpy.tropo_phase_elevation.main(scp_args.split())

            # Weather Re-analysis Data (Jolivet et al., 2011;2014)
            elif method == 'pyaps':
                scp_args = '-f {f} --model {m} -g {g} -w {w}'.format(f=in_file,
                                                                     m=tropo_model,
                                                                     g=geom_file,
                                                                     w=weather_dir)
                print('Atmospheric correction using Weather Re-analysis dataset (PyAPS, Jolivet et al., 2011)')
                print('Weather Re-analysis dataset:', tropo_model)
                tropo_file = './inputs/{}.h5'.format(tropo_model)
                if ut.run_or_skip(out_file=out_file, in_file=[in_file, tropo_file]) == 'run':
                    if os.path.isfile(tropo_file) and get_dataset_size(tropo_file) == get_dataset_size(in_file):
                        scp_args = '{f} {t} -o {o} --force'.format(f=in_file, t=tropo_file, o=out_file)
                        print('--------------------------------------------')
                        print('Use existed tropospheric delay file: {}'.format(tropo_file))
                        print('diff.py', scp_args)
                        mintpy.diff.main(scp_args.split())
                    else:
                        if tropo_model in ['ERA5']:
                            from mintpy import tropo_pyaps3
                            print('tropo_pyaps3.py', scp_args)
                            tropo_pyaps3.main(scp_args.split())
                        else:
                            # opt 1 - using tropo_pyaps as python module and call its main function
                            # prefered, disabled for now to make it compatible with python2-pyaps
                            #print('tropo_pyaps.py', scp_args)
                            #from mintpy import tropo_pyaps
                            #tropo_pyaps.main(scp_args.split())
                            # opt 2 - using tropo_pyaps as executable script
                            # will be deprecated after python3-pyaps is fully funcational
                            cmd = 'tropo_pyaps.py '+scp_args
                            print(cmd)
                            status = subprocess.Popen(cmd, shell=True).wait()

        else:
            print('No tropospheric delay correction.')
        return
Ejemplo n.º 2
0
    def run_tropospheric_delay_correction(self, step_name):
        """Correct tropospheric delays."""
        geom_file = ut.check_loaded_dataset(self.workDir, print_msg=False)[2]
        mask_file = 'maskTempCoh.h5'

        fnames = self.get_timeseries_filename(self.template)[step_name]
        in_file = fnames['input']
        out_file = fnames['output']
        if in_file != out_file:
            poly_order  = self.template['mintpy.troposphericDelay.polyOrder']
            tropo_model = self.template['mintpy.troposphericDelay.weatherModel']
            weather_dir = self.template['mintpy.troposphericDelay.weatherDir']
            method      = self.template['mintpy.troposphericDelay.method']

            def get_dataset_size(fname):
                atr = readfile.read_attribute(fname)
                return (atr['LENGTH'], atr['WIDTH'])

            # Phase/Elevation Ratio (Doin et al., 2009)
            if method == 'height_correlation':
                tropo_look = self.template['mintpy.troposphericDelay.looks']
                tropo_min_cor = self.template['mintpy.troposphericDelay.minCorrelation']
                scp_args = '{f} -g {g} -p {p} -m {m} -o {o} -l {l} -t {t}'.format(f=in_file,
                                                                                  g=geom_file,
                                                                                  p=poly_order,
                                                                                  m=mask_file,
                                                                                  o=out_file,
                                                                                  l=tropo_look,
                                                                                  t=tropo_min_cor)
                print('tropospheric delay correction with height-correlation approach')
                print('tropo_phase_elevation.py', scp_args)
                if ut.run_or_skip(out_file=out_file, in_file=in_file) == 'run':
                    mintpy.tropo_phase_elevation.main(scp_args.split())

            # Weather Re-analysis Data (Jolivet et al., 2011;2014)
            elif method == 'pyaps':
                scp_args = '-f {f} --model {m} -g {g} -w {w}'.format(f=in_file,
                                                                     m=tropo_model,
                                                                     g=geom_file,
                                                                     w=weather_dir)
                print('Atmospheric correction using Weather Re-analysis dataset (PyAPS, Jolivet et al., 2011)')
                print('Weather Re-analysis dataset:', tropo_model)
                tropo_file = './inputs/{}.h5'.format(tropo_model)
                if ut.run_or_skip(out_file=out_file, in_file=[in_file, tropo_file]) == 'run':
                    if os.path.isfile(tropo_file) and get_dataset_size(tropo_file) == get_dataset_size(in_file):
                        scp_args = '{f} {t} -o {o} --force'.format(f=in_file, t=tropo_file, o=out_file)
                        print('--------------------------------------------')
                        print('Use existed tropospheric delay file: {}'.format(tropo_file))
                        print('diff.py', scp_args)
                        mintpy.diff.main(scp_args.split())
                    else:
                        if tropo_model in ['ERA5']:
                            from mintpy import tropo_pyaps3
                            print('tropo_pyaps3.py', scp_args)
                            tropo_pyaps3.main(scp_args.split())
                        else:
                            # opt 1 - using tropo_pyaps as python module and call its main function
                            # prefered, disabled for now to make it compatible with python2-pyaps
                            #print('tropo_pyaps.py', scp_args)
                            #from mintpy import tropo_pyaps
                            #tropo_pyaps.main(scp_args.split())
                            # opt 2 - using tropo_pyaps as executable script
                            # will be deprecated after python3-pyaps is fully funcational
                            cmd = 'tropo_pyaps.py '+scp_args
                            print(cmd)
                            status = subprocess.Popen(cmd, shell=True).wait()

        else:
            print('No tropospheric delay correction.')
        return
Ejemplo n.º 3
0
    def run_tropospheric_delay_correction(self, step_name):
        """Correct tropospheric delays."""
        geom_file = ut.check_loaded_dataset(self.workDir, print_msg=False)[2]
        mask_file = 'maskTempCoh.h5'

        fnames = self.get_timeseries_filename(self.template)[step_name]
        in_file = fnames['input']
        out_file = fnames['output']
        if in_file != out_file:
            poly_order  = self.template['mintpy.troposphericDelay.polyOrder']
            tropo_model = self.template['mintpy.troposphericDelay.weatherModel']
            weather_dir = self.template['mintpy.troposphericDelay.weatherDir']
            method      = self.template['mintpy.troposphericDelay.method']

            def get_dataset_size(fname):
                atr = readfile.read_attribute(fname)
                return (atr['LENGTH'], atr['WIDTH'])

            # Phase/Elevation Ratio (Doin et al., 2009)
            if method == 'height_correlation':
                tropo_look = self.template['mintpy.troposphericDelay.looks']
                tropo_min_cor = self.template['mintpy.troposphericDelay.minCorrelation']
                iargs = [in_file, 
                         '-g', geom_file,
                         '-p', poly_order,
                         '-m', mask_file,
                         '-o', out_file,
                         '-l', tropo_look, 
                         '-t', tropo_min_cor]
                print('tropospheric delay correction with height-correlation approach')
                print('\ntropo_phase_elevation.py', ' '.join(iargs))
                if ut.run_or_skip(out_file=out_file, in_file=in_file) == 'run':
                    mintpy.tropo_phase_elevation.main(iargs)

            # Weather re-analysis data with iterative tropospheric decomposition (GACOS)
            # Yu et al., 2017; 2018a; 2018b
            elif method == 'gacos':
                GACOS_dir = self.template['mintpy.troposphericDelay.gacosDir']
                iargs = ['-f', in_file, '-g', geom_file, '-o', out_file, '--dir', GACOS_dir]
                print('tropospheric delay correction with gacos approach')
                print('\ntropo_gacos.py', ' '.join(iargs))
                if ut.run_or_skip(out_file=out_file, in_file=in_file) == 'run':
                    mintpy.tropo_gacos.main(iargs)

            # Weather Re-analysis Data (Jolivet et al., 2011;2014)
            elif method == 'pyaps':
                iargs = ['-f', in_file, '--model', tropo_model, '-g', geom_file, '-w', weather_dir]
                print('Atmospheric correction using Weather Re-analysis dataset (PyAPS, Jolivet et al., 2011)')
                print('Weather Re-analysis dataset:', tropo_model)
                tropo_file = './inputs/{}.h5'.format(tropo_model)
                if ut.run_or_skip(out_file=out_file, in_file=[in_file, tropo_file]) == 'run':
                    if os.path.isfile(tropo_file) and get_dataset_size(tropo_file) == get_dataset_size(in_file):
                        iargs = [in_file, tropo_file, '-o', out_file, '--force']
                        print('--------------------------------------------')
                        print('Use existed tropospheric delay file: {}'.format(tropo_file))
                        print('\ndiff.py', ' '.join(iargs))
                        mintpy.diff.main(iargs)
                    else:
                        if tropo_model in ['ERA5']:
                            from mintpy import tropo_pyaps3
                            print('\ntropo_pyaps3.py', ' '.join(iargs))
                            tropo_pyaps3.main(iargs)
                        else:
                            # opt 1 - using tropo_pyaps as python module and call its main function
                            # prefered, disabled for now to make it compatible with python2-pyaps
                            #print('tropo_pyaps.py', ' '.join(iargs))
                            #from mintpy import tropo_pyaps
                            #tropo_pyaps.main(iargs)
                            # opt 2 - using tropo_pyaps as executable script
                            # will be deprecated after python3-pyaps is fully funcational
                            cmd = 'tropo_pyaps.py '+' '.join(iargs)
                            print(cmd)
                            status = subprocess.Popen(cmd, shell=True).wait()

        else:
            print('No tropospheric delay correction.')
        return