forked from Riverscapes/pyBRAT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conservation
932 lines (787 loc) · 32 KB
/
conservation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
import os
import arcpy
import BRATProject
import BRAT_table
import iHyd
import Veg_FIS
import Comb_FIS
import Constraints_Opportunities
import BRAT_Braid_Handler
import Data_Capture_Validation
import Drainage_Area_Check
import StreamObjects
import Layer_Package_Generator
import Collect_Summary_Products
class Toolbox(object):
def __init__(self):
"""Define the toolbox (the name of the toolbox is the name of the
.pyt file)."""
self.label = "BRAT Toolbox"
self.alias = "BRAT Toolbox"
# List of tool classes associated with this toolbox
self.tools = [BRAT_project_tool, BRAT_table_tool, BRAT_braid_handler, iHyd_tool, Veg_FIS_tool, Comb_FIS_tool,
Layer_Package_Generator_tool, Collect_Summary_Products_tool]
class BRAT_project_tool(object):
def __init__(self):
"""Define the tool (tool name is the name of the class)."""
self.label = "Step 1. BRAT Project Builder"
self.description = "Gathers inputs and creates folder structure for a BRAT project"
self.canRunInBackground = False
def getParameterInfo(self):
"""Define parameter definitions"""
param0 = arcpy.Parameter(
displayName="Select project folder",
name="projPath",
datatype="DEFolder",
parameterType="Required",
direction="Input")
param1 = arcpy.Parameter(
displayName="Project name",
name="projName",
datatype="GPString",
parameterType="Optional",
direction="Input")
param2 = arcpy.Parameter(
displayName="Watershed HUC ID",
name="hucID",
datatype="GPDouble",
parameterType="Optional",
direction="Input")
param3 = arcpy.Parameter(
displayName = "Watershed name",
name="hucName",
datatype="GPString",
parameterType="Optional",
direction="Input")
param4 = arcpy.Parameter(
displayName="Select existing vegetation datasets",
name="ex_veg",
datatype="DERasterDataset",
parameterType="Required",
direction="Input",
multiValue=True)
param5 = arcpy.Parameter(
displayName="Select historic vegetation datasets",
name="hist_veg",
datatype="DERasterDataset",
parameterType="Required",
direction="Input",
multiValue=True)
param6 = arcpy.Parameter(
displayName="Select drainage network datasets",
name="network",
datatype="DEFeatureClass",
parameterType="Required",
direction="Input",
multiValue=True)
param7 = arcpy.Parameter(
displayName="Select DEM inputs",
name="dem",
datatype="DERasterDataset",
parameterType="Required",
direction="Input",
multiValue=True)
param8 = arcpy.Parameter(
displayName="Select land use rasters",
name="landuse",
datatype="DERasterDataset",
parameterType="Optional",
direction="Input",
multiValue=True)
param9 = arcpy.Parameter(
displayName="Select valley bottom datasets",
name="valley",
datatype="DEFeatureClass",
parameterType="Optional",
direction="Input",
multiValue=True)
param10 = arcpy.Parameter(
displayName="Select roads datasets",
name="road",
datatype="DEFeatureClass",
parameterType="Optional",
direction="Input",
multiValue=True)
param11 = arcpy.Parameter(
displayName="Select railroads datasets",
name="rr",
datatype="DEFeatureClass",
parameterType="Optional",
direction="Input",
multiValue=True)
param12 = arcpy.Parameter(
displayName="Select canals datasets",
name="canal",
datatype="DEFeatureClass",
parameterType="Optional",
direction="Input",
multiValue=True)
param13 = arcpy.Parameter(
displayName="Select land ownership datasets",
name="ownership",
datatype="DEFeatureClass",
parameterType="Optional",
direction="Input",
multiValue=True)
param14 = arcpy.Parameter(
displayName="Beaver Dam Survey Data",
name="beaver_dams",
datatype="DEFeatureClass",
parameterType="Optional",
direction="Input",
multiValue=True)
param15 = arcpy.Parameter(
displayName="Perennial Stream",
name="perennial_stream",
datatype="DEFeatureClass",
parameterType="Optional",
direction="Input",
multiValue=True)
return [param0, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11,
param12, param13, param14, param15]
def isLicensed(self):
"""Set whether tool is licensed to execute."""
return True
def updateParameters(self, parameters):
"""Modify the values and properties of parameters before internal
validation is performed. This method is called whenever a parameter
has been changed."""
return
def updateMessages(self, parameters):
"""Modify the messages created by internal validation for each tool
parameter. This method is called after internal validation."""
return
def execute(self, p, messages):
"""The source code of the tool."""
reload(BRATProject)
BRATProject.main(p[0].valueAsText,
p[1].valueAsText,
p[2].valueAsText,
p[3].valueAsText,
p[4].valueAsText,
p[5].valueAsText,
p[6].valueAsText,
p[7].valueAsText,
p[8].valueAsText,
p[9].valueAsText,
p[10].valueAsText,
p[11].valueAsText,
p[12].valueAsText,
p[13].valueAsText,
p[14].valueAsText,
p[15].valueAsText)
return
class BRAT_table_tool(object):
def __init__(self):
"""Define the tool (tool name is the name of the class)."""
self.label = "Step 2. BRAT Table"
self.description = "Calculates, for each stream network segment, the attributes needed to run the BRAT tools"
self.canRunInBackground = False
def getParameterInfo(self):
"""Define parameter definitions"""
param0 = arcpy.Parameter(
displayName="Select project folder",
name="proj_path",
datatype="DEFolder",
parameterType="Required",
direction="Input")
param1 = arcpy.Parameter(
displayName="Input segmented network",
name="seg_network",
datatype="DEShapefile",
parameterType="Required",
direction="Input")
param1.filter.list = ["Polyline"]
param2 = arcpy.Parameter(
displayName="Input DEM",
name="in_DEM",
datatype="DERasterDataset",
parameterType="Required",
direction="Input")
param3 = arcpy.Parameter(
displayName="Input drainage area raster",
name="flow_acc",
datatype="DERasterDataset",
parameterType="Optional",
direction="Input")
param4 = arcpy.Parameter(
displayName="Input coded existing vegetation raster",
name="coded_veg",
datatype="DERasterDataset",
parameterType="Required",
direction="Input")
param5 = arcpy.Parameter(
displayName="Input coded historic vegetation raster",
name="coded_hist",
datatype="DERasterDataset",
parameterType="Required",
direction="Input")
param6 = arcpy.Parameter(
displayName="Input valley bottom polygon",
name="valley_bottom",
datatype="DEFeatureClass",
parameterType="Optional",
direction="Input")
param6.filter.list = ["Polygon"]
param7 = arcpy.Parameter(
displayName="Input roads feature class",
name="road",
datatype="DEFeatureClass",
parameterType="Optional",
direction="Input")
param7.filter.list = ["Polyline"]
param8 = arcpy.Parameter(
displayName="Input railroads feature class",
name="railroad",
datatype="DEFeatureClass",
parameterType="Optional",
direction="Input")
param8.filter.list = ["Polyline"]
param9 = arcpy.Parameter(
displayName="Input canal feature class",
name="canal",
datatype="DEFeatureClass",
parameterType="Optional",
direction="Input")
param9.filter.list = ["Polyline"]
param10 = arcpy.Parameter(
displayName="Input landuse raster",
name="landuse",
datatype="DERasterDataset",
parameterType="Optional",
direction="Input")
param11 = arcpy.Parameter(
displayName="Input land ownership feature class",
name="ownership",
datatype="DEFeatureClass",
parameterType="Optional",
direction="Input")
param12 = arcpy.Parameter(
displayName="Perennial stream network",
name="perennial_network",
datatype="DEFeatureClass",
parameterType="Optional",
direction="Input")
param13 = arcpy.Parameter(
displayName="Name BRAT table output feature class",
name="out_name",
datatype="GPString",
parameterType="Required",
direction="Input")
param13.value = "BRAT_Table"
param14 = arcpy.Parameter(
displayName="Short description for run - less than 100 characters",
name="description",
datatype="GPString",
parameterType="Optional",
direction="Input")
param15 = arcpy.Parameter(
displayName="Find Clusters",
name="find_clusters",
datatype="GPBoolean",
parameterType="Optional",
direction="Input")
param16 = arcpy.Parameter(
displayName="Segment Network by Roads",
name="should_segment_network",
datatype="GPBoolean",
parameterType="Optional",
direction="Input")
param17 = arcpy.Parameter(
displayName="Segment Network by Land Ownership",
name="segment_by_ownership",
datatype="GPBoolean",
parameterType="Optional",
direction="Input")
param18 = arcpy.Parameter(
displayName="Run Verbose",
name="is_verbose",
datatype="GPBoolean",
parameterType="Optional",
direction="Input")
return [param0, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16, param17, param18]
def isLicensed(self):
"""Set whether the tool is licensed to execute."""
return True
def updateParameters(self, parameters):
"""Modify the values and properties of parameters before internal
validation is performed. This method is called whenever a parameter
has been changed."""
return
def updateMessages(self, parameters):
"""Modify the messages created by internal validation for each tool
parameter. This method is called after internal validation."""
return
def execute(self, p, messages):
"""The source code of the tool."""
reload(BRAT_table)
BRAT_table.main(p[0].valueAsText,
p[1].valueAsText,
p[2].valueAsText,
p[3].valueAsText,
p[4].valueAsText,
p[5].valueAsText,
p[6].valueAsText,
p[7].valueAsText,
p[8].valueAsText,
p[9].valueAsText,
p[10].valueAsText,
p[11].valueAsText,
p[12].valueAsText,
p[13].valueAsText,
p[14].valueAsText,
p[15].valueAsText,
p[16].valueAsText,
p[17].valueAsText,
p[18].valueAsText)
return
class BRAT_braid_handler(object):
def __init__(self):
"""Define the tool (tool name is the name of the class)."""
self.label = "Step 2.2 Braid Handler (Optional)"
self.description = "In development and currently non-operational. Gives braided streams the appropriate values, once mainstems have been identified in the stream network."
self.canRunInBackground = False
def getParameterInfo(self):
"""Define parameter definitions"""
param0 = arcpy.Parameter(
displayName="Input BRAT network",
name="inputNetwork",
datatype="DEFeatureClass",
parameterType="Required",
direction="Input")
return [param0]
def isLicensed(self):
"""Set whether the tool is licensed to execute."""
return True
def updateParameters(self, parameters):
"""Modify the values and properties of parameters before internal
validation is performed. This method is called whenever a parameter
has been changed."""
return
def updateMessages(self, parameters):
"""Modify the messages created by internal validation for each tool
parameter. This method is called after internal validation."""
return
def execute(self, p, messages):
"""The source code of the tool."""
reload(BRAT_Braid_Handler)
reload(StreamObjects)
BRAT_Braid_Handler.main(p[0].valueAsText)
return
class iHyd_tool(object):
def __init__(self):
"""Define the tool (tool name is the name of the class)."""
self.label = "Step 3. iHyd Streamflow Attributes"
self.description = "Calculates, for each stream network segment, discharge (in cubic meters per second) and stream power for both baseflow and annual peak streamflows"
self.canRunInBackground = False
def getParameterInfo(self):
"""Define parameter definitions"""
param0 = arcpy.Parameter(
displayName="Input BRAT network",
name="in_network",
datatype="DEFeatureClass",
parameterType="Required",
direction="Input")
param0.filter.list = ["Polyline"]
param1 = arcpy.Parameter(
displayName="Select hydrologic region",
name="region",
datatype="GPDouble",
parameterType="Optional",
direction="Input")
param2 = arcpy.Parameter(
displayName="Baseflow equation",
name="Qlow_eqtn",
datatype="GPString",
parameterType="Optional",
direction="Input")
param3 = arcpy.Parameter(
displayName="Highflow equation",
name="Q2_eqtn",
datatype="GPString",
parameterType="Optional",
direction="Input")
return [param0, param1, param2, param3]
def isLicensed(self):
"""Set whether the tool is licensed to execute."""
return True
def updateParameters(self, parameters):
"""Modify the values and properties of parameters before internal
validation is performed. This method is called whenever a parameter
has been changed."""
return
def updateMessages(self, parameters):
"""Modify the messages created by internal validation for each tool
parameter. This method is called after internal validation."""
return
def execute(self, p, messages):
"""The source code of the tool."""
reload(iHyd)
iHyd.main(p[0].valueAsText,
p[1].valueAsText,
p[2].valueAsText,
p[3].valueAsText)
return
class Veg_FIS_tool(object):
def __init__(self):
"""Define the tool (tool name is the name of the class)."""
self.label = "Step 4. BRAT Vegetation Dam Capacity Model"
self.description = "Calculates dam capacity, for each stream network segment, based solely on vegetation. Capacity is calculated separately for existing and historic vegetation type."
self.canRunInBackground = False
def getParameterInfo(self):
"""Define parameter definitions"""
param0 = arcpy.Parameter(
displayName="Input BRAT network",
name="in_network",
datatype="DEFeatureClass",
parameterType="Required",
direction="Input")
param0.filter.list = ["Polyline"]
return [param0]
def isLicensed(self):
"""Set whether the tool is licensed to execute."""
return True
def updateParameters(self, parameters):
"""Modify the values and properties of parameters before internal
validation is performed. This method is called whenever a parameter
has been changed."""
return
def updateMessages(self, parameters):
"""Modify the messages created by internal validation for each tool
parameter. This method is called after internal validation."""
return
def execute(self, p, messages):
"""The source code of the tool."""
reload(Veg_FIS)
Veg_FIS.main(p[0].valueAsText)
return
class Comb_FIS_tool(object):
def __init__(self):
"""Define the tool (tool name is the name of the class)."""
self.label = "Step 5. BRAT Combined Dam Capacity Model"
self.description = "Calculates dam capacity, for each stream network segment, based on vegetation dam capacity estimates, baseflow stream power, annual peak stream power, and slope. Capacity is calculated separetly for existing and history vegetation."
self.canRunInBackground = False
def getParameterInfo(self):
"""Define parameter definitions"""
param0 = arcpy.Parameter(
displayName="Select project folder",
name="projPath",
datatype="DEFolder",
parameterType="Required",
direction="Input")
param1 = arcpy.Parameter(
displayName="Input BRAT network",
name="in_network",
datatype="DEFeatureClass",
parameterType="Required",
direction="Input")
param1.filter.list = ["Polyline"]
param2 = arcpy.Parameter(
displayName="Maximum DA threshold (in square kilometers)",
name = "max_DA_thresh",
datatype="GPDouble",
parameterType="Required",
direction="Input")
param3 = arcpy.Parameter(
displayName = "Name combined capacity model output feature class",
name = "out_name",
datatype="GPString",
parameterType="Required",
direction="Input")
param3.value = "Combined_Capacity_Model"
# param3.symbology = os.path.join(os.path.dirname(__file__), "Capacity.lyr")
return [param0, param1, param2, param3]
def isLicensed(self):
"""Set whether the tool is licensed to execute."""
return True
def updateParameters(self, parameters):
"""Modify the values and properties of parameters before internal
validation is performed. This method is called whenever a parameter
has been changed."""
return
def updateMessages(self, parameters):
"""Modify the messages created by internal validation for each tool
parameter. This method is called after internal validation."""
return
def execute(self, p, messages):
"""The source code of the tool."""
reload(Comb_FIS)
Comb_FIS.main(p[0].valueAsText,
p[1].valueAsText,
p[2].valueAsText,
p[3].valueAsText)
return
class Constraints_Opportunities_tool(object):
def __init__(self):
"""Define the tool (tool name is the name of the class)."""
self.label = "Step 6. BRAT Constraints and Opportunities Model"
self.description = "For each stream segment, assigns limiting factors to dam building potential, risk of beaver damage to infrastructure and dam building beaver restoration opportunities based on capacity, departure from historic capacity, risk of beaver damage and land use intensity scores."
self.canRunInBackground = False
def getParameterInfo(self):
"""Define parameter definitions"""
param0 = arcpy.Parameter(
displayName="Select project folder",
name="projPath",
datatype="DEFolder",
parameterType="Required",
direction="Input")
param1 = arcpy.Parameter(
displayName="Select combined dam capacity output network",
name="in_network",
datatype="DEFeatureClass",
parameterType="Required",
direction="Input")
param1.filter.list = ["Polyline"]
param2 = arcpy.Parameter(
displayName="Name the constraints and opportunities output",
name="out_name",
datatype="GPString",
parameterType="Required",
direction="Input")
param2.value = "Constraints_Opportunities_Model"
param3 = arcpy.Parameter(
displayName="Surveyed beaver dams",
name="surveyed_dams",
datatype="DEFeatureClass",
parameterType="Optional",
direction="Input")
param4 = arcpy.Parameter(
displayName="Conservation areas shapefile",
name="conservation_areas",
datatype="DEFeatureClass",
parameterType="Optional",
direction="Input")
param4.filter.list = ["Polygon"]
param5 = arcpy.Parameter(
displayName="Conservation easements shapefile",
name="conservation_easements",
datatype="DEFeatureClass",
parameterType="Optional",
direction="Input")
param5.filter.list = ["Polygon"]
return [param0, param1, param2, param3, param4, param5]
def isLicensed(self):
"""Set whether the tool is licensed to execute."""
return True
def updateParameters(self, parameters):
"""Modify the values and properties of parameters before internal
validation is performed. This method is called whenever a parameter
has been changed."""
return
def updateMessages(self, parameters):
"""Modify the messages created by internal validation for each tool
parameter. This method is called after internal validation."""
return
def execute(self, p, messages):
"""The source code of the tool."""
reload(Constraints_Opportunities)
Constraints_Opportunities.main(p[0].valueAsText,
p[1].valueAsText,
p[2].valueAsText,
p[3].valueAsText,
p[4].valueAsText,
p[5].valueAsText)
return
class Data_Capture_Validation_tool(object):
def __init__(self):
"""Define the tool (tool name is the name of the class)."""
self.label = "Step 7. Data Capture Validation (Optional)"
self.description = "Tests the results of BRAT against data on beaver dam sites"
self.canRunInBackground = False
def getParameterInfo(self):
"""Define parameter definitions"""
param0 = arcpy.Parameter(
displayName="Select constraints and opportunities model output network",
name="in_network",
datatype="DEFeatureClass",
parameterType="Required",
direction="Input")
param0.filter.list = ["Polyline"]
param1 = arcpy.Parameter(
displayName="Name the data validation output",
name="out_name",
datatype="GPString",
parameterType="Required",
direction="Input")
param1.value = "Data_Capture_Validation"
param2 = arcpy.Parameter(
displayName="Select beaver dam shape file",
name="dams",
datatype="DEFeatureClass",
parameterType="Optional",
direction="Input")
param3 = arcpy.Parameter(
displayName="Maximum DA threshold (in square kilometers)",
name="DA_threshold",
datatype="GPDouble",
parameterType="Optional",
direction="Input")
return [param0, param1, param2, param3]
def isLicensed(self):
"""Set whether the tool is licensed to execute."""
return True
def updateParameters(self, parameters):
"""Modify the values and properties of parameters before internal
validation is performed. This method is called whenever a parameter
has been changed."""
return
def updateMessages(self, parameters):
"""Modify the messages created by internal validation for each tool
parameter. This method is called after internal validation."""
return
def execute(self, p, messages):
"""The source code of the tool."""
reload(Data_Capture_Validation)
Data_Capture_Validation.main(p[0].valueAsText,
p[1].valueAsText,
p[2].valueAsText,
p[3].valueAsText)
class Drainage_Area_Check_tool(object):
def __init__(self):
"""Define the tool (tool name is the name of the class)."""
self.label = "Step 2.1 Drainage Area Check (Optional)"
self.description = "Looks for drainage area values that are less than an upstream value, and then modifies them"
self.canRunInBackground = False
def getParameterInfo(self):
"""Define parameter definitions"""
param0 = arcpy.Parameter(
displayName="Select BRAT Table output network",
name="in_network",
datatype="DEFeatureClass",
parameterType="Required",
direction="Input")
param0.filter.list = ["Polyline"]
return [param0]
def isLicensed(self):
"""Set whether the tool is licensed to execute."""
return True
def updateParameters(self, parameters):
"""Modify the values and properties of parameters before internal
validation is performed. This method is called whenever a parameter
has been changed."""
return
def updateMessages(self, parameters):
"""Modify the messages created by internal validation for each tool
parameter. This method is called after internal validation."""
return
def execute(self, p, messages):
"""The source code of the tool."""
reload(StreamObjects)
reload(Drainage_Area_Check)
Drainage_Area_Check.main(p[0].valueAsText)
return
class Layer_Package_Generator_tool(object):
def __init__(self):
"""Define the tool (tool name is the name of the class)."""
self.label = "Layer Package Generator"
self.description = "Creates a layer package based on the completed BRAT run"
self.canRunInBackground = False
def getParameterInfo(self):
"""Define parameter definitions"""
param0 = arcpy.Parameter(
displayName="Select output folder",
name="in_network",
datatype="DEFolder",
parameterType="Required",
direction="Input")
param1 = arcpy.Parameter(
displayName="Name the layer package output",
name="layer_package_name",
datatype="GPString",
parameterType="Optional",
direction="Input")
param2 = arcpy.Parameter(
displayName="Give a stream network to clip the layer package networks to",
name="clipping_network",
datatype="DEFeatureClass",
parameterType="Optional",
direction="Input")
param2.filter.list = ["Polyline"]
return [param0, param1, param2]
def isLicensed(self):
"""Set whether the tool is licensed to execute."""
return True
def updateParameters(self, parameters):
"""Modify the values and properties of parameters before internal
validation is performed. This method is called whenever a parameter
has been changed."""
return
def updateMessages(self, parameters):
"""Modify the messages created by internal validation for each tool
parameter. This method is called after internal validation."""
return
def execute(self, p, messages):
"""The source code of the tool."""
reload(Layer_Package_Generator)
Layer_Package_Generator.main(p[0].valueAsText, p[1].valueAsText, p[2].valueAsText)
return
class Collect_Summary_Products_tool(object):
def __init__(self):
"""Define the tool (tool name is the name of the class)."""
self.label = "Collect Summary Products"
self.description = "Creates a folder structure for the summary products, divided into AI, PDF, and PNG files"
self.canRunInBackground = False
def getParameterInfo(self):
"""Define parameter definitions"""
param0 = arcpy.Parameter(
displayName="Select project folder",
name="in_network",
datatype="DEFolder",
parameterType="Required",
direction="Input")
param1 = arcpy.Parameter(
displayName="Stream Network(s)",
name="clipping_network",
datatype="DEFeatureClass",
parameterType="Required",
direction="Input",
multiValue=True)
param2 = arcpy.Parameter(
displayName="Watershed/Area Name",
name="watershed_name",
datatype="GPString",
parameterType="Required",
direction="Input")
param3 = arcpy.Parameter(
displayName="Name the output Excel file",
name="excel_file_name",
datatype="GPString",
parameterType="Optional",
direction="Input")
param4 = arcpy.Parameter(
displayName="Dams Shapefile(s)",
name="dams_shapefile",
datatype="DEFeatureClass",
parameterType="Optional",
multiValue=True,
direction="Input")
param5 = arcpy.Parameter(
displayName="Output folder",
name="output_folder",
datatype="DEFolder",
parameterType="Optional",
multiValue=False,
direction="Input")
return [param0, param1, param2, param3, param4, param5]
def isLicensed(self):
"""Set whether the tool is licensed to execute."""
return True
def updateParameters(self, parameters):
"""Modify the values and properties of parameters before internal
validation is performed. This method is called whenever a parameter
has been changed."""
return
def updateMessages(self, parameters):
"""Modify the messages created by internal validation for each tool
parameter. This method is called after internal validation."""
return
def execute(self, p, messages):
"""The source code of the tool."""
reload(Collect_Summary_Products)
Collect_Summary_Products.main(p[0].valueAsText,
p[1].valueAsText,
p[2].valueAsText,
p[3].valueAsText,
p[4].valueAsText,
p[5].valueAsText)
return