예제 #1
0
def validate_file_list_values(file_list, no_of_epochs):
    if file_list is None:  # pragma: no cover
        raise ValueError("No value supplied for input file list: " + str(file_list))

    files = parse_namelist(file_list)

    for f in files:
        if not Path(f).exists():  # pragma: no cover
            raise ConfigException(f"{f} does not exist")
        else:
            matches = extract_epochs_from_filename(filename_with_epochs=f)
            if len(matches) < no_of_epochs:  # pragma: no cover
                raise ConfigException(f"the number of epochs in {f} names are less the required number: {no_of_epochs}")
예제 #2
0
def _merge_stack(rows, cols, params):
    """
    Merge stacking outputs
    """
    # setup paths
    xlks, _, crop = cf.transform_params(params)
    base_unw_paths = []

    for p in Path(params[OUT_DIR]).rglob("*rlks_*cr.tif"):
        if "dem" not in str(p):
            base_unw_paths.append(str(p))

    if not base_unw_paths:
        raise ConfigException(
            f"No rlooked files available in {params[OBS_DIR]} or {params[OBS_DIR]}"
        )

    if "tif" in base_unw_paths[0].split(".")[1]:
        dest_tifs = base_unw_paths  # cf.get_dest_paths(base_unw_paths, crop, params, xlks)
        for i, dest_tif in enumerate(dest_tifs):
            dest_tifs[i] = dest_tif.replace("_tif", "")
    else:
        dest_tifs = base_unw_paths  # cf.get_dest_paths(base_unw_paths, crop, params, xlks)

    # load previously saved prepread_ifgs dict
    preread_ifgs_file = join(params[cf.TMPDIR], 'preread_ifgs.pk')
    ifgs = cp.load(open(preread_ifgs_file, 'rb'))
    tiles = shared.get_tiles(dest_tifs[0], rows, cols)

    # stacking aggregation
    if mpiops.size >= 3:
        [
            _save_stack(ifgs, params, tiles, out_type=t) for i, t in enumerate(
                ['stack_rate', 'stack_error', 'stack_samples'])
            if i == mpiops.rank
        ]
    else:
        if mpiops.rank == MASTER_PROCESS:
            [
                _save_stack(ifgs, params, tiles, out_type=t)
                for t in ['stack_rate', 'stack_error', 'stack_samples']
            ]
    mpiops.comm.barrier()
예제 #3
0
def _missing_option_error(option):
    """
    Convenience function for raising similar missing option errors.
    """
    msg = "Missing '%s' option in config file" % option
    raise ConfigException(msg)
예제 #4
0
def __validate_correct_steps(params):
    for step in params['correct']:
        if step not in correct_steps.keys():
            raise ConfigException(
                f"{step} is not a supported 'correct' step. \n"
                f"Supported steps are {correct_steps.keys()}")