@@ -382,6 +382,7 @@ def list_tools(self, keywords=[]):
382382
383383
384384
385+
385386
386387
387388 ##############
@@ -648,6 +649,20 @@ def raster_to_vector_points(self, i, output, callback=None):
648649 args .append ("--output='{}'" .format (output ))
649650 return self .run_tool ('raster_to_vector_points' , args , callback ) # returns 1 if error
650651
652+ def raster_to_vector_polygons (self , i , output , callback = None ):
653+ """Converts a raster dataset to a vector of the POLYGON shapetype.
654+
655+ Keyword arguments:
656+
657+ i -- Input raster file.
658+ output -- Output vector polygons file.
659+ callback -- Custom function for handling tool text outputs.
660+ """
661+ args = []
662+ args .append ("--input='{}'" .format (i ))
663+ args .append ("--output='{}'" .format (output ))
664+ return self .run_tool ('raster_to_vector_polygons' , args , callback ) # returns 1 if error
665+
651666 def reinitialize_attribute_table (self , i , callback = None ):
652667 """Reinitializes a vector's attribute table deleting all fields but the feature ID (FID).
653668
@@ -3372,24 +3387,28 @@ def burn_streams_at_roads(self, dem, streams, roads, output, width=None, callbac
33723387 if width is not None : args .append ("--width='{}'" .format (width ))
33733388 return self .run_tool ('burn_streams_at_roads' , args , callback ) # returns 1 if error
33743389
3375- def d8_flow_accumulation (self , dem , output , out_type = "cells" , log = False , clip = False , callback = None ):
3376- """Calculates a D8 flow accumulation raster from an input DEM.
3390+ def d8_flow_accumulation (self , i , output , out_type = "cells" , log = False , clip = False , pntr = False , esri_pntr = False , callback = None ):
3391+ """Calculates a D8 flow accumulation raster from an input DEM or flow pointer .
33773392
33783393 Keyword arguments:
33793394
3380- dem -- Input raster DEM file.
3395+ i -- Input raster DEM or D8 pointer file.
33813396 output -- Output raster file.
33823397 out_type -- Output type; one of 'cells' (default), 'catchment area', and 'specific contributing area'.
33833398 log -- Optional flag to request the output be log-transformed.
33843399 clip -- Optional flag to request clipping the display max by 1%.
3400+ pntr -- Is the input raster a D8 flow pointer rather than a DEM?.
3401+ esri_pntr -- Input D8 pointer uses the ESRI style scheme.
33853402 callback -- Custom function for handling tool text outputs.
33863403 """
33873404 args = []
3388- args .append ("--dem ='{}'" .format (dem ))
3405+ args .append ("--input ='{}'" .format (i ))
33893406 args .append ("--output='{}'" .format (output ))
33903407 args .append ("--out_type={}" .format (out_type ))
33913408 if log : args .append ("--log" )
33923409 if clip : args .append ("--clip" )
3410+ if pntr : args .append ("--pntr" )
3411+ if esri_pntr : args .append ("--esri_pntr" )
33933412 return self .run_tool ('d8_flow_accumulation' , args , callback ) # returns 1 if error
33943413
33953414 def d8_mass_flux (self , dem , loading , efficiency , absorption , output , callback = None ):
@@ -3428,26 +3447,28 @@ def d8_pointer(self, dem, output, esri_pntr=False, callback=None):
34283447 if esri_pntr : args .append ("--esri_pntr" )
34293448 return self .run_tool ('d8_pointer' , args , callback ) # returns 1 if error
34303449
3431- def d_inf_flow_accumulation (self , dem , output , out_type = "Specific Contributing Area" , threshold = None , log = False , clip = False , callback = None ):
3450+ def d_inf_flow_accumulation (self , i , output , out_type = "Specific Contributing Area" , threshold = None , log = False , clip = False , pntr = False , callback = None ):
34323451 """Calculates a D-infinity flow accumulation raster from an input DEM.
34333452
34343453 Keyword arguments:
34353454
3436- dem -- Input raster DEM file.
3455+ i -- Input raster DEM or D-infinity pointer file.
34373456 output -- Output raster file.
34383457 out_type -- Output type; one of 'cells', 'sca' (default), and 'ca'.
34393458 threshold -- Optional convergence threshold parameter, in grid cells; default is inifinity.
34403459 log -- Optional flag to request the output be log-transformed.
34413460 clip -- Optional flag to request clipping the display max by 1%.
3461+ pntr -- Is the input raster a D8 flow pointer rather than a DEM?.
34423462 callback -- Custom function for handling tool text outputs.
34433463 """
34443464 args = []
3445- args .append ("--dem ='{}'" .format (dem ))
3465+ args .append ("--input ='{}'" .format (i ))
34463466 args .append ("--output='{}'" .format (output ))
34473467 args .append ("--out_type={}" .format (out_type ))
34483468 if threshold is not None : args .append ("--threshold='{}'" .format (threshold ))
34493469 if log : args .append ("--log" )
34503470 if clip : args .append ("--clip" )
3471+ if pntr : args .append ("--pntr" )
34513472 return self .run_tool ('d_inf_flow_accumulation' , args , callback ) # returns 1 if error
34523473
34533474 def d_inf_mass_flux (self , dem , loading , efficiency , absorption , output , callback = None ):
@@ -3830,6 +3851,24 @@ def impoundment_size_index(self, dem, output, damlength, out_type="depth", callb
38303851 args .append ("--damlength='{}'" .format (damlength ))
38313852 return self .run_tool ('impoundment_size_index' , args , callback ) # returns 1 if error
38323853
3854+ def insert_dams (self , dem , dam_pts , output , damlength , callback = None ):
3855+ """Calculates the impoundment size resulting from damming a DEM.
3856+
3857+ Keyword arguments:
3858+
3859+ dem -- Input raster DEM file.
3860+ dam_pts -- Input vector dam points file.
3861+ output -- Output file.
3862+ damlength -- Maximum length of the dam.
3863+ callback -- Custom function for handling tool text outputs.
3864+ """
3865+ args = []
3866+ args .append ("--dem='{}'" .format (dem ))
3867+ args .append ("--dam_pts='{}'" .format (dam_pts ))
3868+ args .append ("--output='{}'" .format (output ))
3869+ args .append ("--damlength='{}'" .format (damlength ))
3870+ return self .run_tool ('insert_dams' , args , callback ) # returns 1 if error
3871+
38333872 def isobasins (self , dem , output , size , callback = None ):
38343873 """Divides a landscape into nearly equal sized drainage basins (i.e. watersheds).
38353874
@@ -3894,6 +3933,30 @@ def max_upslope_flowpath_length(self, dem, output, callback=None):
38943933 args .append ("--output='{}'" .format (output ))
38953934 return self .run_tool ('max_upslope_flowpath_length' , args , callback ) # returns 1 if error
38963935
3936+ def md_inf_flow_accumulation (self , dem , output , out_type = "specific contributing area" , exponent = 1.1 , threshold = None , log = False , clip = False , callback = None ):
3937+ """Calculates an FD8 flow accumulation raster from an input DEM.
3938+
3939+ Keyword arguments:
3940+
3941+ dem -- Input raster DEM file.
3942+ output -- Output raster file.
3943+ out_type -- Output type; one of 'cells', 'specific contributing area' (default), and 'catchment area'.
3944+ exponent -- Optional exponent parameter; default is 1.1.
3945+ threshold -- Optional convergence threshold parameter, in grid cells; default is inifinity.
3946+ log -- Optional flag to request the output be log-transformed.
3947+ clip -- Optional flag to request clipping the display max by 1%.
3948+ callback -- Custom function for handling tool text outputs.
3949+ """
3950+ args = []
3951+ args .append ("--dem='{}'" .format (dem ))
3952+ args .append ("--output='{}'" .format (output ))
3953+ args .append ("--out_type={}" .format (out_type ))
3954+ args .append ("--exponent={}" .format (exponent ))
3955+ if threshold is not None : args .append ("--threshold='{}'" .format (threshold ))
3956+ if log : args .append ("--log" )
3957+ if clip : args .append ("--clip" )
3958+ return self .run_tool ('md_inf_flow_accumulation' , args , callback ) # returns 1 if error
3959+
38973960 def num_inflowing_neighbours (self , dem , output , callback = None ):
38983961 """Computes the number of inflowing neighbours to each cell in an input DEM based on the D8 algorithm.
38993962
@@ -4092,7 +4155,7 @@ def watershed(self, d8_pntr, pour_pts, output, esri_pntr=False, callback=None):
40924155 Keyword arguments:
40934156
40944157 d8_pntr -- Input D8 pointer raster file.
4095- pour_pts -- Input vector pour points (outlet) file.
4158+ pour_pts -- Input pour points (outlet) file.
40964159 output -- Output raster file.
40974160 esri_pntr -- D8 pointer uses the ESRI style scheme.
40984161 callback -- Custom function for handling tool text outputs.
0 commit comments