示例#1
0
def make_layers(out_network):
    """
    Writes the layers
    :param out_network: The output network, which we want to make into a layer
    :return:
    """
    arcpy.AddMessage("Making layers...")
    analyses_folder = os.path.dirname(out_network)
    output_folder = make_folder(
        analyses_folder,
        find_available_num_prefix(analyses_folder) + "_Capacity")
    historic_folder = make_folder(
        output_folder,
        find_available_num_prefix(output_folder) + "_HistoricCapacity")
    existing_folder = make_folder(
        output_folder,
        find_available_num_prefix(output_folder) + "_ExistingCapacity")

    trib_code_folder = os.path.dirname(os.path.abspath(__file__))
    symbology_folder = os.path.join(trib_code_folder, 'BRATSymbology')
    existing_capacity_layer = os.path.join(symbology_folder,
                                           "ExistingDamBuildingCapacity.lyr")
    historic_capacity_layer = os.path.join(symbology_folder,
                                           "HistoricDamBuildingCapacity.lyr")
    existing_capacity_count_layer = os.path.join(symbology_folder,
                                                 "ExistingDamComplexSize.lyr")
    historic_capacity_count_layer = os.path.join(symbology_folder,
                                                 "HistoricDamComplexSize.lyr")

    make_layer(existing_folder,
               out_network,
               "Existing Dam Building Capacity",
               existing_capacity_layer,
               is_raster=False)
    make_layer(historic_folder,
               out_network,
               "Historic Dam Building Capacity",
               historic_capacity_layer,
               is_raster=False)
    make_layer(existing_folder,
               out_network,
               "Existing Dam Complex Size",
               existing_capacity_count_layer,
               is_raster=False)
    make_layer(historic_folder,
               out_network,
               "Historic Dam Complex Size",
               historic_capacity_count_layer,
               is_raster=False)
示例#2
0
def make_layers(input_network):
    """
    Makes the layers for the modified output
    :param input_network: The path to the network that we'll make a layer from
    :return:
    """
    arcpy.AddMessage("Making layers...")
    intermediates_folder = os.path.dirname(input_network)
    veg_folder_name = find_available_num_prefix(
        intermediates_folder) + "_VegDamCapacity"
    veg_folder = make_folder(intermediates_folder, veg_folder_name)

    trib_code_folder = os.path.dirname(os.path.abspath(__file__))
    symbology_folder = os.path.join(trib_code_folder, 'BRATSymbology')

    existing_veg_symbology = os.path.join(
        symbology_folder, "ExistingVegDamBuildingCapacity.lyr")
    historic_veg_symbology = os.path.join(
        symbology_folder, "HistoricVegDamBuildingCapacity.lyr")

    make_layer(veg_folder,
               input_network,
               "Existing Veg Dam Building Capacity",
               existing_veg_symbology,
               is_raster=False)
    make_layer(veg_folder,
               input_network,
               "Historic Veg Dam Building Capacity",
               historic_veg_symbology,
               is_raster=False)
示例#3
0
def copyIntoFolder(thingToCopy, copyFolderRoot, copyFolderName):
    copyFolder = make_folder(
        copyFolderRoot,
        find_available_num_prefix(copyFolderRoot) + '_' + copyFolderName)
    copyPath = os.path.join(copyFolder, os.path.basename(thingToCopy))
    arcpy.Copy_management(thingToCopy, copyPath)
    return copyPath
def copy_dams_to_inputs(proj_path, dams, in_network):
    """
    If the given dams are not in the inputs,
    :param proj_path: The path to the project root
    :param dams: The path to the given dams
    :param in_network: the input Conservation Restoration Network
    :return: Filepath to dams in inputs folder
    """
    if proj_path in dams:
        # The dams input is already in our project folder, so we don't need to copy it over
        return

    inputs_folder = find_folder(proj_path, "Inputs")
    beaver_dams_folder = find_folder(inputs_folder, "*[0-9]*_BeaverDams")
    if beaver_dams_folder is None:
        beaver_dams_folder = make_folder(
            inputs_folder,
            find_available_num_prefix(inputs_folder) + "_BeaverDams")
    new_dam_folder = make_folder(
        beaver_dams_folder,
        "Beaver_Dam_" + find_available_num_suffix(beaver_dams_folder))
    new_dam_path = os.path.join(new_dam_folder, os.path.basename(dams))
    coord_sys = arcpy.Describe(in_network).spatialReference

    arcpy.Project_management(dams, new_dam_path, coord_sys)

    return new_dam_path
def make_layers(output_network, dams):
    """
    Makes the layers for the modified output
    :param output_network: The path to the network that we'll make a layer from
    :param dams: Filepath to dams in the project folder
    :return:
    """
    arcpy.AddMessage("Making layers...")
    analysis_folder = os.path.dirname(output_network)
    validation_folder_name = find_available_num_prefix(
        analysis_folder) + "_Validation"
    validation_folder = make_folder(analysis_folder, validation_folder_name)

    trib_code_folder = os.path.dirname(os.path.abspath(__file__))
    symbology_folder = os.path.join(trib_code_folder, 'BRATSymbology')

    dam_symbology = os.path.join(symbology_folder,
                                 "SurveyedBeaverDamLocations.lyr")
    historic_remaining_symbology = os.path.join(
        symbology_folder, "PercentofHistoricDamCapacityRemaining.lyr")
    pred_v_surv_symbology = os.path.join(
        symbology_folder, "PredictedDamCountvs.SurveyedDamCount.lyr")
    management_strategies_symbology = os.path.join(
        symbology_folder, "CurrentBeaverDamManagementStrategies.lyr")
    occupancy_symbology = os.path.join(
        symbology_folder,
        "PercentofExistingCapacityOccupiedbySurveyedDams.lyr")

    make_layer(validation_folder,
               output_network,
               "Percent of Historic Dam Capacity Remaining",
               historic_remaining_symbology,
               is_raster=False,
               symbology_field="mCC_EXvHPE")

    if dams is not None:
        make_layer(os.path.dirname(dams),
                   dams,
                   "Surveyed Beaver Dam Locations",
                   dam_symbology,
                   is_raster=False,
                   symbology_field="Snapped")
        make_layer(validation_folder,
                   output_network,
                   "Predicted Dam Count vs. Surveyed Dam Count",
                   pred_v_surv_symbology,
                   is_raster=False,
                   symbology_field="BRATvSurv")
        make_layer(validation_folder,
                   output_network,
                   "Current Beaver Dam Management Strategies",
                   management_strategies_symbology,
                   is_raster=False,
                   symbology_field="ConsVRest")
        make_layer(validation_folder,
                   output_network,
                   "Occupancy Rate of Surveyed Beaver Dams",
                   occupancy_symbology,
                   is_raster=False,
                   symbology_field="e_DamPcC")
示例#6
0
def makeLayers(inputNetwork):
    """
    Makes the layers for the modified output
    :param inputNetwork: The path to the network that we'll make a layer from
    :return:
    """
    arcpy.AddMessage("Making layers...")
    intermediates_folder = os.path.dirname(inputNetwork)
    hydrology_folder_name = find_available_num_prefix(
        intermediates_folder) + "_Hydrology"
    hydrology_folder = make_folder(intermediates_folder, hydrology_folder_name)

    tribCodeFolder = os.path.dirname(os.path.abspath(__file__))
    #symbologyFolder = os.path.join(tribCodeFolder, 'BRATSymbology')

    highflowSymbology = os.path.join(symbologyFolder,
                                     "Highflow_StreamPower.lyr")
    baseflowSymbology = os.path.join(symbologyFolder,
                                     "Baseflow_StreamPower.lyr")

    make_layer(hydrology_folder,
               inputNetwork,
               "Highflow Stream Power",
               highflowSymbology,
               is_raster=False)
    make_layer(hydrology_folder,
               inputNetwork,
               "Baseflow Stream Power",
               baseflowSymbology,
               is_raster=False)
示例#7
0
def copy_points_to_inputs(proj_path, conflict_points, in_network):
    """
    If the given points are not in the inputs,
    :param proj_path: The path to the project root
    :param conflict_points: The path to known points of beaver dam-human conflict
    :param in_network: the input Conservation Restoration Network
    :return: Filepath to points in inputs folder
    """
    if proj_path in conflict_points:
        # The points input is already in our project folder, so we don't need to copy it over
        return

    inputs_folder = find_folder(proj_path, "Inputs")
    conflict_pts_folder = find_folder(inputs_folder, "*[0-9]*_ConflictPoints")
    if conflict_pts_folder is None:
        conflict_pts_folder = make_folder(
            inputs_folder,
            find_available_num_prefix(inputs_folder) + "_ConflictPoints")
    new_pts_folder = make_folder(
        conflict_pts_folder,
        "Conflict_Points_" + find_available_num_suffix(conflict_pts_folder))
    new_conflict_path = os.path.join(new_pts_folder,
                                     os.path.basename(conflict_points))
    coord_sys = arcpy.Describe(in_network).spatialReference

    arcpy.Project_management(conflict_points, new_conflict_path, coord_sys)

    return new_conflict_path
示例#8
0
def make_layers(out_network):
    """
    Writes the layers
    :param out_network: The output network, which we want to make into a layer
    :return:
    """
    arcpy.AddMessage("Making layers...")
    analyses_folder = os.path.dirname(out_network)
    output_folder = make_folder(
        analyses_folder,
        find_available_num_prefix(analyses_folder) + "_Management")

    trib_code_folder = os.path.dirname(os.path.abspath(__file__))
    symbology_folder = os.path.join(trib_code_folder, 'BRATSymbology')

    strategy_map_symbology = os.path.join(
        symbology_folder, "StrategiestoPromoteDamBuilding.lyr")
    limitations_dams_symbology = os.path.join(
        symbology_folder, "UnsuitableorLimitedDamBuildingOpportunities.lyr")
    undesirable_dams_symbology = os.path.join(symbology_folder,
                                              "RiskofUndesirableDams.lyr")
    conservation_restoration_symbology = os.path.join(
        symbology_folder, "BeaverDamConstraintsandOpportunities.lyr")

    make_layer(output_folder,
               out_network,
               "Unsuitable or Limited Dam Building Opportunities",
               limitations_dams_symbology,
               is_raster=False,
               symbology_field='oPBRC_UD')
    make_layer(output_folder,
               out_network,
               "Risk of Undesirable Dams",
               undesirable_dams_symbology,
               is_raster=False,
               symbology_field='oPBRC_UI')
    make_layer(output_folder,
               out_network,
               "Beaver Dam Constraints and Opportunities",
               conservation_restoration_symbology,
               is_raster=False,
               symbology_field='oPBRC_CR')

    # only try making strategies map layer if 'DamStrat' in fields
    fields = [f.name for f in arcpy.ListFields(out_network)]
    if 'DamStrat' in fields:
        make_layer(output_folder,
                   out_network,
                   "Strategies to Promote Dam Building",
                   strategy_map_symbology,
                   is_raster=False,
                   symbology_field='DamStrat')
示例#9
0
def make_optional_input_folder(input, file_path, folder_base_name):
    """
    Creates a folder with correct numbering for optional inputs
    :param input: The shapefile to go into  the folder. If this doesn't exist, then this function will return None.
    :param file_path: The filepath for the inputs folder where this folder will be created
    :param folder_base_name: The name of the folder to be created
    :return: A string that holds the complete file path for the created folder
    """
    if input:
        new_folder = make_folder(
            file_path,
            find_available_num_prefix(file_path) + folder_base_name)
        return new_folder
    else:
        return None
示例#10
0
def make_layers(input_network):
    """
    Makes the layers for the modified output
    :param input_network: The path to the network that we'll make a layer from
    :return:
    """
    arcpy.AddMessage("Making layers...")
    intermediates_folder = os.path.dirname(input_network)
    braid_folder_name = find_available_num_prefix(
        intermediates_folder) + "_AnabranchHandler"
    braid_folder = make_folder(intermediates_folder, braid_folder_name)

    trib_code_folder = os.path.dirname(os.path.abspath(__file__))
    symbology_folder = os.path.join(trib_code_folder, 'BRATSymbology')

    mainstem_symbology = os.path.join(symbology_folder, "AnabranchTypes.lyr")

    make_layer(braid_folder,
               input_network,
               "Anabranch Types",
               mainstem_symbology,
               is_raster=False)