Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion BRATProject.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
import os
import arcpy
import sys
from SupportingFunctions import make_folder, make_layer, get_execute_error_code, write_xml_element_with_path, find_available_num_prefix
import XMLBuilder
reload(XMLBuilder)
from SupportingFunctions import make_folder, make_layer, get_execute_error_code, write_xml_element_with_path, find_available_num_prefix

XMLBuilder = XMLBuilder.XMLBuilder


Expand Down
15 changes: 14 additions & 1 deletion BRAT_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,12 @@ def main(
arcpy.env.outputMFlag = "Disabled"
arcpy.CheckOutExtension("Spatial")


# --check input projections--
validate_inputs(seg_network, road, railroad, canal, is_verbose)

arcpy.env.outputCoordinateSystem = seg_network

# name and create output folder
new_output_folder, intermediate_folder, seg_network_copy = build_output_folder(proj_path, out_name, seg_network, road,
should_segment_network, ownership, segment_by_ownership,
Expand Down Expand Up @@ -546,7 +549,10 @@ def zSeg(vertex_type, out_field):
if is_verbose:
arcpy.AddMessage("Calculating iGeo_Slope...")
for row in cursor:
row[3] = (abs(row[0] - row[1]))/row[2]
if row[2] == 0:
row[3] = 0.0001
else:
row[3] = (abs(row[0] - row[1]))/row[2]
if row[3] == 0.0:
row[3] = 0.0001
cursor.updateRow(row)
Expand Down Expand Up @@ -954,6 +960,8 @@ def find_distance_from_feature(out_network, feature, valley_bottom, temp_dir, bu
ct = int(count.getOutput(0))
# if there are features, then set the distance from to high value (10000 m)
if ct < 1:
if is_verbose:
arcpy.AddMessage('No Data found for ' + new_field_name)
with arcpy.da.UpdateCursor(out_network, new_field_name) as cursor:
for row in cursor:
row[0] = 10000.0
Expand All @@ -963,6 +971,11 @@ def find_distance_from_feature(out_network, feature, valley_bottom, temp_dir, bu
# set extent to the stream network
arcpy.env.extent = out_network
# calculate euclidean distance from input features

sr = arcpy.Describe(feature_subset).spatialReference
unit = sr.linearUnitName
arcpy.AddMessage('Raster units are ' + unit)

ed_feature = EucDistance(feature_subset, cell_size = 5) # cell size of 5 m
# get min distance from feature in the within 30 m buffer of each network segment
if new_field_name == 'iPC_RoadX':
Expand Down
6 changes: 5 additions & 1 deletion Capacity_Validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ def main(in_network, output_name, dams=None, da_threshold=None):
:param da_threshold: Drainage area at which stream is presumably too large for dam building
:return:
"""


if da_threshold == "None":
da_threshold = None

Expand All @@ -41,6 +43,8 @@ def main(in_network, output_name, dams=None, da_threshold=None):
if dams:
dams = copy_dams_to_inputs(proj_path, dams, in_network)



if output_name.endswith('.shp'):
output_network = os.path.join(os.path.dirname(in_network), output_name)
else:
Expand Down Expand Up @@ -101,7 +105,7 @@ def copy_dams_to_inputs(proj_path, dams, in_network):
"""
if proj_path in dams:
# The dams input is already in our project folder, so we don't need to copy it over
return
return dams

inputs_folder = find_folder(proj_path, "Inputs")
beaver_dams_folder = find_folder(inputs_folder, "*[0-9]*_BeaverDams")
Expand Down
Loading