def timeseries_calc(ifg_paths, params, vcmt, tiles, preread_ifgs): """ Time series calculation. :param ifg_paths: List of interferogram paths :param params: Parameters dictionary corresponding to config file :param vcmt: vcmt array :param tiles: List of all tiles used during MPI processes :param preread_ifgs: Dictionary containing interferogram characteristics for efficient computing :return xxxx """ process_tiles = mpiops.array_split(tiles) log.info('Calculating time series') output_dir = params[cf.TMPDIR] for t in process_tiles: log.info('Calculating time series for tile {}'.format(t.index)) ifg_parts = [shared.IfgPart(p, t, preread_ifgs) for p in ifg_paths] mst_tile = np.load( os.path.join(output_dir, 'mst_mat_{}.npy'.format(t.index))) res = timeseries.time_series(ifg_parts, params, vcmt, mst_tile) tsincr, tscum, _ = res np.save(file=os.path.join(output_dir, 'tsincr_{}.npy'.format(t.index)), arr=tsincr) np.save(file=os.path.join(output_dir, 'tscuml_{}.npy'.format(t.index)), arr=tscum) mpiops.comm.barrier()
def linrate_calc(ifg_paths, params, vcmt, tiles, preread_ifgs): """ MPI capable linrate calculation. :param ifg_paths: List of interferogram paths :param params: Parameters dictionary corresponding to config file :param vcmt: vcmt array :param tiles: List of all tiles used during MPI processes :param preread_ifgs: Dictionary containing interferogram characteristics for efficient computing :return xxxx """ process_tiles = mpiops.array_split(tiles) log.info('Calculating linear rate') output_dir = params[cf.TMPDIR] for t in process_tiles: log.info('calculating lin rate of tile {}'.format(t.index)) ifg_parts = [shared.IfgPart(p, t, preread_ifgs) for p in ifg_paths] mst_grid_n = np.load( os.path.join(output_dir, 'mst_mat_{}.npy'.format(t.index))) rate, error, samples = linrate.linear_rate(ifg_parts, params, vcmt, mst_grid_n) # declare file names np.save(file=os.path.join(output_dir, 'linrate_{}.npy'.format(t.index)), arr=rate) np.save(file=os.path.join(output_dir, 'linerror_{}.npy'.format(t.index)), arr=error) np.save(file=os.path.join(output_dir, 'linsamples_{}.npy'.format(t.index)), arr=samples) mpiops.comm.barrier()
def _linrate_calc(ifg_paths, params, vcmt, tiles, preread_ifgs): """ MPI wrapper for linrate calculation """ process_tiles = mpiops.array_split(tiles) log.info('Calculating linear rate map') output_dir = params[cf.TMPDIR] for t in process_tiles: log.info('Calculating linear rate of tile {}'.format(t.index)) ifg_parts = [shared.IfgPart(p, t, preread_ifgs) for p in ifg_paths] mst_grid_n = np.load(os.path.join(output_dir, 'mst_mat_{}.npy'.format(t.index))) rate, error, samples = linrate.linear_rate(ifg_parts, params, vcmt, mst_grid_n) # declare file names np.save(file=os.path.join(output_dir, 'linrate_{}.npy'.format(t.index)), arr=rate) np.save(file=os.path.join(output_dir, 'linerror_{}.npy'.format(t.index)), arr=error) np.save(file=os.path.join(output_dir, 'linsamples_{}.npy'.format(t.index)), arr=samples) mpiops.comm.barrier()
def _timeseries_calc(ifg_paths, params, vcmt, tiles, preread_ifgs): """ MPI wrapper for time series calculation. """ if params[cf.TIME_SERIES_CAL] == 0: log.info('Time Series Calculation not required') return if params[cf.TIME_SERIES_METHOD] == 1: log.info('Calculating time series using Laplacian Smoothing method') elif params[cf.TIME_SERIES_METHOD] == 2: log.info('Calculating time series using SVD method') output_dir = params[cf.TMPDIR] process_tiles = mpiops.array_split(tiles) for t in process_tiles: log.info('Calculating time series for tile {}'.format(t.index)) ifg_parts = [shared.IfgPart(p, t, preread_ifgs) for p in ifg_paths] mst_tile = np.load(os.path.join(output_dir, 'mst_mat_{}.npy'.format(t.index))) res = timeseries.time_series(ifg_parts, params, vcmt, mst_tile) tsincr, tscum, _ = res np.save(file=os.path.join(output_dir, 'tsincr_{}.npy'.format(t.index)), arr=tsincr) np.save(file=os.path.join(output_dir, 'tscuml_{}.npy'.format(t.index)), arr=tscum) mpiops.comm.barrier()
def _calc_svd_time_series(ifg_paths, params, preread_ifgs, tiles): """ Helper function to obtain time series for spatio-temporal filter using SVD method """ # Is there other existing functions that can perform this same job? log.info('Calculating time series via SVD method for ' 'spatio-temporal filter') # copy params temporarily new_params = deepcopy(params) new_params[cf.TIME_SERIES_METHOD] = 2 # use SVD method process_tiles = mpiops.array_split(tiles) output_dir = params[cf.TMPDIR] nvels = None for t in process_tiles: log.info('Calculating time series for tile {} during aps ' 'correction'.format(t.index)) ifg_parts = [shared.IfgPart(p, t, preread_ifgs) for p in ifg_paths] mst_tile = np.load( os.path.join(output_dir, 'mst_mat_{}.npy'.format(t.index))) tsincr = time_series(ifg_parts, new_params, vcmt=None, mst=mst_tile)[0] np.save(file=os.path.join(output_dir, 'tsincr_aps_{}.npy'.format(t.index)), arr=tsincr) nvels = tsincr.shape[2] nvels = mpiops.comm.bcast(nvels, root=0) # need to assemble tsincr from all processes tsincr_g = mpiops.run_once(_assemble_tsincr, ifg_paths, params, preread_ifgs, tiles, nvels) log.info('Finished calculating time series for spatio-temporal filter') return tsincr_g