Exemple #1
0
def burn_min_00(in_dem_path, in_zones_path):
    """
    Parameters
    ----------
    in_dem_path : str
        Path to the DEM input file
    in_zones_path : str
        Path to raster file resulting from zonal statistics minimum tool
    """

    from WBT.whitebox_tools import WhiteboxTools
    wbt = WhiteboxTools()

    out_group = new_group_00(in_dem_path)

    # Create position raster
    pos_path = out_file_00(in_dem_path, "POS", "tif", out_group)
    wbt.is_no_data(in_zones_path, pos_path)

    new_dem_path = out_file_00(in_dem_path, "DEM", "tif", out_group)

    inputs = "{};{}".format(in_zones_path, in_dem_path)

    # If position (isnodata) file = 0, use value from zones. If = 1, use value from dem.
    wbt.pick_from_list(inputs, pos_path, new_dem_path)

    return new_dem_path
def burn_min_00(in_dem_path, in_zones_path):
    """Creates a new DEM with culvert zones burned in.

    Uses culvert zone minimum values where they exist and values from the
    original DEM file everywhere else.

    Parameters
    -----------
    in_dem_path: str
        Path to the DEM input file
    in_zones_path: str
        Path to raster file resulting from zonal statistics minimum tool

    Returns
    -------
    output_path: str
    """

    from WBT.whitebox_tools import WhiteboxTools
    wbt = WhiteboxTools()

    out_group = new_group_00(in_dem_path)

    # Create position raster
    pos_path = new_file_00(in_dem_path, "POS", "tif", out_group)
    wbt.is_no_data(in_zones_path, pos_path)

    output_path = new_file_00(in_dem_path, "DEM", "tif", out_group)

    inputs = "{};{}".format(in_zones_path, in_dem_path)

    # If position (isnodata) file = 0, use value from zones. If = 1,
    # use value from dem.
    wbt.pick_from_list(inputs, pos_path, output_path)

    return output_path