def stack_calc_wrapper(params): """ Wrapper for stacking on a set of tiles. """ log.info('Calculating rate map via stacking') if not Configuration.vcmt_path(params).exists(): raise FileNotFoundError( "VCMT is not found on disc. Have you run the 'correct' step?") params[C.PREREAD_IFGS] = cp.load( open(Configuration.preread_ifgs(params), 'rb')) params[C.VCMT] = np.load(Configuration.vcmt_path(params)) params[C.TILES] = Configuration.get_tiles(params) tiles_split(_stacking_for_tile, params) log.debug("Finished stacking calc!")
def timeseries_calc_wrapper(params): """ Wrapper for time series calculation on a set of tiles. """ if params[C.TIME_SERIES_METHOD] == 1: log.info('Calculating time series using Laplacian Smoothing method') elif params[C.TIME_SERIES_METHOD] == 2: log.info('Calculating time series using SVD method') if not Configuration.vcmt_path(params).exists(): raise FileNotFoundError("VCMT is not found on disc. Have you run the 'correct' step?") params[C.PREREAD_IFGS] = cp.load(open(Configuration.preread_ifgs(params), 'rb')) params[C.VCMT] = np.load(Configuration.vcmt_path(params)) params[C.TILES] = Configuration.get_tiles(params) tiles_split(__calc_time_series_for_tile, params) log.debug("Finished timeseries calc!")
def maxvar_vcm_calc_wrapper(params): """ MPI wrapper for maxvar and vcmt computation """ preread_ifgs = params[cf.PREREAD_IFGS] ifg_paths = [ifg_path.tmp_sampled_path for ifg_path in params[cf.INTERFEROGRAM_FILES]] log.info('Calculating the temporal variance-covariance matrix') def _get_r_dist(ifg_path): """ Get RDIst class object """ ifg = Ifg(ifg_path) ifg.open() r_dist = RDist(ifg)() ifg.close() return r_dist r_dist = mpiops.run_once(_get_r_dist, ifg_paths[0]) prcs_ifgs = mpiops.array_split(list(enumerate(ifg_paths))) process_maxvar = {} for n, i in prcs_ifgs: log.debug(f'Calculating maxvar for {n} of process ifgs {len(prcs_ifgs)} of total {len(ifg_paths)}') process_maxvar[int(n)] = cvd(i, params, r_dist, calc_alpha=True, write_vals=True, save_acg=True)[0] maxvar_d = shared.join_dicts(mpiops.comm.allgather(process_maxvar)) maxvar = [v[1] for v in sorted(maxvar_d.items(), key=lambda s: s[0])] vcmt = mpiops.run_once(get_vcmt, preread_ifgs, maxvar) log.debug("Finished maxvar and vcm calc!") params[cf.MAXVAR], params[cf.VCMT] = maxvar, vcmt np.save(Configuration.vcmt_path(params), arr=vcmt) return maxvar, vcmt