示例#1
0
def roipac_header(file_path, params):
    """
    Function to obtain a header for roipac interferogram file or converted
    geotiff.
    """
    rsc_file = params[cf.DEM_HEADER_FILE]
    p = Path(file_path)
    if rsc_file is not None:
        projection = parse_header(rsc_file)[ifc.PYRATE_DATUM]
    else:
        raise RoipacException('No DEM resource/header file is provided')
    if file_path.endswith('_dem.tif'):
        header_file = os.path.join(params[cf.DEM_HEADER_FILE])
    elif file_path.endswith('unw_ifg.tif') or file_path.endswith('unw.tif'):
        # TODO: improve this
        interferogram_epoches = extract_epochs_from_filename(p.name)
        for header_path in params[cf.HEADER_FILE_PATHS]:
            h = Path(header_path.unwrapped_path)
            header_epochs = extract_epochs_from_filename(h.name)
            if set(header_epochs).__eq__(set(interferogram_epoches)):
                header_file = header_path.unwrapped_path
                break
    else:
        header_file = "%s%s" % (file_path, ROI_PAC_HEADER_FILE_EXT)

    header = manage_header(header_file, projection)

    return header
示例#2
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}")
示例#3
0
文件: gamma.py 项目: sixy6e/PyRate
def get_header_paths(input_file, slc_file_list):
    """
    Function that matches input GAMMA file names with GAMMA header file names

    :param str input_file: input GAMMA image file.
    :param slc_file_list: file listing the pool of available header files (GAMMA: slc.par, ROI_PAC: .rsc)
    :return: list of matching header files
    :rtype: list
    """
    f = Path(input_file)
    epochs = extract_epochs_from_filename(f.name)
    header_names = parse_namelist(slc_file_list)
    matches = [hdr for hdr in header_names if any(e in hdr for e in epochs)]
    return matches
示例#4
0
def get_header_paths(input_file, slc_file_list):
    """
    Function that matches input GAMMA file names with GAMMA header file names

    :param str input_file: input GAMMA image file.
    :param str slc_dir: GAMMA SLC header file directory
    :return: list of matching header files
    :rtype: list
    """
    f = Path(input_file)
    epochs = extract_epochs_from_filename(f.name)
    header_names = cf.parse_namelist(slc_file_list)
    matches = [hdr for hdr in header_names if any(e in hdr for e in epochs)]
    return matches