# arcgis.raster.functions.gbl module¶

Global Raster functions. These functions are applied to the raster data to create a processed product on disk, using ImageryLayer.save() method or arcgis.raster.analytics.generate_raster().

Global functions cannot be used for visualization using dynamic image processing. They cannot be applied to layers that are added to a map for on-the-fly image processing or visualized inline within the Jupyter notebook.

Functions can be applied to various rasters (or images), including the following:

• Imagery layers

• Rasters within imagery layers

## calculate_distance¶

arcgis.raster.functions.gbl.calculate_distance(in_source_data, maximum_distance=None, output_cell_size=None, allocation_field=None, generate_out_allocation_raster=False, generate_out_direction_raster=False, generate_out_back_direction_raster=False, in_barrier_data=None, distance_method='PLANAR')

Calculates the Euclidean distance, direction, and allocation from a single source or set of sources.

Parameters
• in_source_data – Required. The layer that defines the sources to calculate the distance to. The layer can be raster or feature. To use a raster input, it must be of integer type.

• maximum_distance

Optional. Defines the threshold that the accumulative distance values cannot exceed. If an accumulative Euclidean distance value exceeds this value, the output value for the cell location will be NoData. The default distance is to the edge of the output raster.

Supported units: Meters | Kilometers | Feet | Miles

Example:

{“distance”:”60”,”units”:”Meters”}

• output_cell_size

Optional. Specify the cell size to use for the output raster.

Supported units: Meters | Kilometers | Feet | Miles

Example: {“distance”:”60”,”units”:”Meters”}

• allocation_field

Optional. A field on the input_source_data layer that holds the values that defines each source.

It can be an integer or a string field of the source dataset.

The default for this parameter is ‘Value’.

• generate_out_direction_raster

Optional Boolean, determines whether out_direction_raster should be generated or not. Set this parameter to True, in order to generate the out_direction_raster. If set to true, the output will be a named tuple with name values being output_distance_service and output_direction_service. eg,

out_layer = calculate_distance(in_source_data, generate_out_direction_raster=True) out_var = out_layer.save()

then,

out_var.output_distance_service -> gives you the output distance imagery layer item out_var.output_direction_service -> gives you the output backlink raster imagery layer item

The output direction raster is in degrees, and indicates the direction to return to the closest source from each cell center. The values on the direction raster are based on compass directions, with 0 degrees reserved for the source cells. Thus, a value of 90 means 90 degrees to the East, 180 is to the South, 270 is to the west, and 360 is to the North.

• generate_out_allocation_raster

Optional Boolean, determines whether out_allocation_raster should be generated or not. Set this parameter to True, in order to generate the out_backlink_raster. If set to true, the output will be a named tuple with name values being output_distance_service and output_allocation_service. eg,

out_layer = calculate_distance(in_source_data, generate_out_allocation_raster=True) out_var = out_layer.save()

then,

out_var.output_distance_service -> gives you the output distance imagery layer item out_var.output_allocation_service -> gives you the output allocation raster imagery layer item

This parameter calculates, for each cell, the nearest source based on Euclidean distance.

• generate_out_back_direction_raster

Optional Boolean, determines whether out_back_direction_raster should be generated or not. Set this parameter to True, in order to generate the out_back_direction_raster. If set to true, the output will be a named tuple with name values being output_distance_service and out_back_direction_service. eg,

out_layer = calculate_distance(in_source_data, generate_out_back_direction_raster=True) out_var = out_layer.save()

then,

out_var.output_distance_service -> gives you the output distance imagery layer item out_var.out_back_direction_service -> gives you the output back direction raster imagery layer item

• in_barrier_data – Optional barrier raster. The input raster that defines the barriers. The dataset must contain NoData where there are no barriers. Barriers are represented by valid values including zero. The barriers can be defined by an integer or floating-point raster.

• distance_method

Optional String. Determines whether to calculate the distance using a planar (flat earth) or a geodesic (ellipsoid) method.

Planar - Planar measurements use 2D Cartesian mathematics to calculate length and area. The option is only available when measuring in a projected coordinate system and the 2D plane of that coordinate system will be used as the basis for the measurements. This is the default.

Geodesic - The shortest line between two points on the earth’s surface on a spheroid (ellipsoid). Therefore, regardless of input or output projection, the results do not change.

One use for a geodesic line is when you want to determine the shortest distance between two cities for an airplane’s flight path. This is also known as a great circle line if based on a sphere rather than an ellipsoid.

Returns

output raster with function applied

## calculate_travel_cost¶

arcgis.raster.functions.gbl.calculate_travel_cost(in_source_data, in_cost_raster=None, in_surface_raster=None, in_horizontal_raster=None, in_vertical_raster=None, horizontal_factor='BINARY', vertical_factor='BINARY', maximum_distance=None, source_cost_multiplier=None, source_start_cost=None, source_resistance_rate=None, source_capacity=None, source_direction=None, allocation_field=None, generate_out_allocation_raster=False, generate_out_backlink_raster=False)
Parameters
• in_source_data – Required. The layer that defines the sources to calculate the distance too. The layer can be raster or feature.

• in_cost_raster – Optional. A raster defining the impedance or cost to move planimetrically through each cell.

• in_surface_raster – Optional. A raster defining the elevation values at each cell location.

• in_horizontal_raster – Optional. A raster defining the horizontal direction at each cell.

• in_vertical_raster – Optional. A raster defining the vertical (z) value for each cell.

• horizontal_factor – Optional. The Horizontal Factor defines the relationship between the horizontal cost factor and the horizontal relative moving angle. Possible values are: “BINARY”, “LINEAR”, “FORWARD”, “INVERSE_LINEAR”

• vertical_factor – Optional. The Vertical Factor defines the relationship between the vertical cost factor and the vertical relative moving angle (VRMA) Possible values are: “BINARY”, “LINEAR”, “SYMMETRIC_LINEAR”, “INVERSE_LINEAR”, “SYMMETRIC_INVERSE_LINEAR”, “COS”, “SEC”, “COS_SEC”, “SEC_COS”

• maximum_distance – Optional. The maximum distance to calculate out to. If no distance is provided, a default will be calculated that is based on the locations of the input sources.

• source_cost_multiplier – Optional. Multiplier to apply to the cost values.

• source_start_cost – Optional. The starting cost from which to begin the cost calculations.

• source_resistance_rate – Optional. This parameter simulates the increase in the effort to overcome costs as the accumulative cost increases.

• source_capacity – Optional. Defines the cost capacity for the traveler for a source.

• source_direction – Optional. Defines the direction of the traveler when applying horizontal and vertical factors, the source resistance rate, and the source starting cost. Possible values: FROM_SOURCE, TO_SOURCE

• allocation_field – Optional. A field on theinputSourceRasterOrFeatures layer that holds the values that define each source.

Optional Boolean, determines whether out_backlink_raster should be generated or not. Set this parameter to True, in order to generate the out_backlink_raster. If set to true, the output will be a named tuple with name values being output_distance_service and output_backlink_service. eg,

out_layer = calculate_travel_cost(in_source_data, generate_out_backlink_raster=True) out_var = out_layer.save()

then,

out_var.output_distance_service -> gives you the output distance imagery layer item

• generate_out_allocation_raster

Optional Boolean, determines whether out_allocation_raster should be generated or not. Set this parameter to True, in order to generate the out_backlink_raster. If set to true, the output will be a named tuple with name values being output_distance_service and output_allocation_service. eg,

out_layer = calculate_travel_cost(in_source_data, generate_out_allocation_raster=False) out_var = out_layer.save()

then,

out_var.output_distance_service -> gives you the output distance imagery layer item

out_var.output_allocation_service -> gives you the output allocation raster imagery layer item

• gis – Optional, the GIS on which this tool runs. If not specified, the active GIS is used.

Returns

output raster with function applied

## corridor¶

arcgis.raster.functions.gbl.corridor(in_distance_raster1, in_distance_raster2)

Calculates the sum of accumulative costs for two input accumulative cost rasters.

Parameters
• in_distance_raster1 – Required. The first input distance raster. It should be an accumulated cost distance output from a distance function such as cost_distance or path_distance.

• in_distance_raster2 – Required. The second input distance raster. It should be an accumulated cost distance output from a distance function such as cost_distance or path_distance.

Returns

output raster with function applied

## cost_allocation¶

arcgis.raster.functions.gbl.cost_allocation(in_source_data, in_cost_raster, in_value_raster=None, max_distance=None, source_field=None, source_cost_multiplier=None, source_start_cost=None, source_resistance_rate=None, source_capacity=None, source_direction=None)

Calculates, for each cell, its least-cost source based on the least accumulative cost over a cost surface. For more information, see http://pro.arcgis.com/en/pro-app/help/data/imagery/cost-allocation-global-function.htm

Parameters
• in_source_data – Required. The input raster that identifies the pixels or locations to which the least accumulated cost distance for every output pixel location is calculated. The Source Raster can be an integer or a floating-point value. If the input Source Raster is floating point, the Value Raster must be set, and it must be an integer. The Value Raster will take precedence over any setting of the Source Field.

• in_cost_raster – Required. A raster defining the cost or impedance to move planimetrically through each pixel. The value at each pixel location represents the cost-per-unit distance for moving through it. Each pixel location value is multiplied by the pixel resolution, while also compensating for diagonal movement to obtain the total cost of passing through the pixel. The values of the Cost Raster can be integer or floating point, but they cannot be negative or zero.

• in_value_raster – Optional. The input integer raster that identifies the zone values that should be used for each input source location. For each source location pixel, the value defined by the Value Raster will be assigned to all pixels allocated to the source location for the computation. The Value Raster will take precedence over any setting for the Source Field.

• max_distance – Optional. The threshold that the accumulative cost values cannot exceed. If an accumulative cost distance exceeds this value, the output value for the pixel location will be NoData. The maximum distance defines the extent for which the accumulative cost distances are calculated. The default distance is to the edge of the output raster.

• source_field – Optional. The field used to assign values to the source locations. It must be an integer type. If the Value Raster has been set, the values in that input will take precedence over any setting for the Source Field.

• source_cost_multiplier – Optional. This parameter allows for control of the mode of travel or the magnitude at a source. The greater the multiplier, the greater the cost to move through each cell. The default value is 1. The values must be greater than 0. A numeric (double) value or a field from the Source Raster can be used for this parameter.

• source_start_cost – Optional. The starting cost from which to begin the cost calculations. This parameter allows for the specification of the fixed cost associated with a source. Instead of starting at a cost of 0, the cost algorithm will begin with the value set here. The default is 0. The value must be 0 or greater. A numeric (double) value or a field from the Source Raster can be used for this parameter.

• source_resistance_rate – Optional. This parameter simulates the increase in the effort to overcome costs as the accumulative cost increases. It is used to model fatigue of the traveler. The growing accumulative cost to reach a pixel is multiplied by the resistance rate and added to the cost to move into the subsequent pixel. It is a modified version of a compound interest rate formula that is used to calculate the apparent cost of moving through a pixel. As the value of the resistance rate increases, it increases the cost of the pixels that are visited later. The greater the resistance rate, the higher the cost to reach the next pixel, which is compounded for each subsequent movement. Since the resistance rate is similar to a compound rate and generally the accumulative cost values are very large, small resistance rates are suggested, such as 0.005 or even smaller, depending on the accumulative cost values. The default is 0. The values must be 0 or greater. A numeric (double) value or a field from the Source Raster can be used for this parameter.

• source_capacity – Optional. Defines the cost capacity for the traveler for a source. The cost calculations continue for each source until the specified capacity is reached. The default capacity is to the edge of the output raster. The values must be greater than 0. A double numeric value or a field from the Source Raster can be used for this parameter.

• source_direction

Optional. Defines the direction of the traveler when applying the source resistance rate and the source starting cost.

FROM_SOURCE - The source resistance rate and source starting cost will be applied beginning at the input source and moving out to the nonsource cells. This is the default.

TO_SOURCE - The source resistance rate and source starting cost will be applied beginning at each nonsource cell and moving back to the input source.

Either specify the FROM_SOURCE or TO_SOURCE keyword, which will be applied to all sources, or specify a field in the Source Raster that contains the keywords to identify the direction of travel for each source. That field must contain the string FROM_SOURCE or TO_SOURCE.

Returns

output raster with function applied

## cost_distance¶

arcgis.raster.functions.gbl.cost_distance(in_source_data, in_cost_raster, max_distance=None, source_cost_multiplier=None, source_start_cost=None, source_resistance_rate=None, source_capacity=None, source_direction=None)

Calculates the least accumulative cost distance for each cell from or to the least-cost source over a cost surface. For more information, see http://pro.arcgis.com/en/pro-app/help/data/imagery/cost-distance-global-function.htm

Parameters
• in_source_data – Required. The input raster that identifies the pixels or locations to which the least accumulated cost distance for every output pixel location is calculated. The Source Raster can be an integer or a floating-point value.

• in_cost_raster – Required. A raster defining the cost or impedance to move planimetrically through each pixel. The value at each pixel location represents the cost-per-unit distance for moving through it. Each pixel location value is multiplied by the pixel resolution, while also compensating for diagonal movement to obtain the total cost of passing through the pixel.

• max_distance – Optional. The threshold that the accumulative cost values cannot exceed. If an accumulative cost distance exceeds this value, the output value for the pixel location will be NoData. The maximum distance defines the extent for which the accumulative cost distances are calculated. The default distance is to the edge of the output raster.

• source_cost_multiplier – Optional. The threshold that the accumulative cost values cannot exceed. If an accumulative cost distance exceeds this value, the output value for the pixel location will be NoData. The maximum distance defines the extent for which the accumulative cost distances are calculated. The default distance is to the edge of the output raster.

• source_start_cost – Optional. The starting cost from which to begin the cost calculations. This parameter allows for the specification of the fixed cost associated with a source. Instead of starting at a cost of 0, the cost algorithm will begin with the value set here. The default is 0. The value must be 0 or greater. A numeric (double) value or a field from the Source Raster can be used for this parameter.

• source_resistance_rate – Optional. This parameter simulates the increase in the effort to overcome costs as the accumulative cost increases. It is used to model fatigue of the traveler. The growing accumulative cost to reach a pixel is multiplied by the resistance rate and added to the cost to move into the subsequent pixel. It is a modified version of a compound interest rate formula that is used to calculate the apparent cost of moving through a pixel. As the value of the resistance rate increases, it increases the cost of the pixels that are visited later. The greater the resistance rate, the higher the cost to reach the next pixel, which is compounded for each subsequent movement. Since the resistance rate is similar to a compound rate and generally the accumulative cost values are very large, small resistance rates are suggested, such as 0.005 or even smaller, depending on the accumulative cost values. The default is 0. The values must be 0 or greater. A numeric (double) value or a field from the Source Raster can be used for this parameter.

• source_capacity – Optional. Defines the cost capacity for the traveler for a source. The cost calculations continue for each source until the specified capacity is reached. The default capacity is to the edge of the output raster. The values must be greater than 0. A double numeric value or a field from the Source Raster can be used for this parameter.

• source_direction

Optional. Defines the direction of the traveler when applying the source resistance rate and the source starting cost.

FROM_SOURCE - The source resistance rate and source starting cost will be applied beginning at the input source and moving out to the nonsource cells. This is the default.

TO_SOURCE - The source resistance rate and source starting cost will be applied beginning at each nonsource cell and moving back to the input source.

Either specify the FROM_SOURCE or TO_SOURCE keyword, which will be applied to all sources, or specify a field in the Source Raster that contains the keywords to identify the direction of travel for each source. That field must contain the string FROM_SOURCE or TO_SOURCE.

Returns

output raster with function applied

## cost_path¶

arcgis.raster.functions.gbl.cost_path(in_destination_data, in_cost_distance_raster, in_cost_backlink_raster, path_type='EACH_CELL', destination_field=None, force_flow_direction_convention=None)

Calculates the least-cost path from a source to a destination.

Parameters
• in_destination_data – Required raster layer. A raster that identifies those cells from which the least-cost path is determined to the least costly source. The input raster layer consists of cells that have valid values (zero is a valid value), and the remaining cells must be assigned NoData.

• in_cost_distance_raster – Required. The name of a cost distance raster to be used to determine the least-cost path from the destination locations to a source. The cost distance raster is usually created with the Cost Distance, Cost Allocation or Cost Back Link tools. The cost distance raster stores, for each cell, the minimum accumulative cost distance over a cost surface from each cell to a set of source cells.

• in_cost_backlink_raster – Required. The name of a cost back link raster used to determine the path to return to a source via the least-cost path. For each cell in the back link raster, a value identifies the neighbor that is the next cell on the least accumulative cost path from the cell to a single source cell or set of source cells.

• path_type

Optional. A keyword defining the manner in which the values and zones on the input destination data will be interpreted in the cost path calculations.

EACH_CELL - For each cell with valid values on the input destination data, a least-cost path is determined and saved on the output raster. With this option, each cell of the input destination data is treated separately, and a least-cost path is determined for each from cell.

EACH_ZONE - For each zone on the input destination data, a least-cost path is determined and saved on the output raster. With this option, the least-cost path for each zone begins at the cell with the lowest cost distance weighting in the zone.

BEST_SINGLE - For all cells on the input destination data, the least-cost path is derived from the cell with the minimum of the least-cost paths to source cells.

• destination_field – Optional. The field used to obtain values for the destination locations. Input feature data must contain at least one valid field.

• force_flow_direction_convention – Optional boolean. Set to True to force flow direction convention for backlink raster

Returns

output raster with function applied

## distance_accumulation¶

arcgis.raster.functions.gbl.distance_accumulation(in_source_data, in_barrier_data=None, in_surface_raster=None, in_cost_raster=None, in_vertical_raster=None, vertical_factor='BINARY 1 -30 30', in_horizontal_raster=None, horizontal_factor='BINARY 1 45', generate_back_direction_band=False, source_initial_accumulation=None, source_maximum_accumulation=None, source_cost_multiplier=None, source_direction=None, distance_method='PLANAR')

Calculates the least accumulative cost distance for each cell from or to the least-cost source over a cost surface, preserving euclidean distance metric

Parameters
• in_source_data

Required. The input source locations.

This is a raster that identifies the cells or locations from or to which the least accumulated cost distance for every output cell location is calculated.

For rasters, the input type can be integer or floating point.

• in_barrier_data – Optional barrier raster. The input raster that defines the barriers. The dataset must contain NoData where there are no barriers. Barriers are represented by valid values including zero. The barriers can be defined by an integer or floating-point raster.

• in_surface_raster – Optional. A raster defining the elevation values at each cell location. The values are used to calculate the actual surface distance covered when passing between cells.

• in_cost_raster

Optional. A raster defining the impedance or cost to move planimetrically through each cell.

The value at each cell location represents the cost-per-unit distance for moving through the cell. Each cell location value is multiplied by the cell resolution while also compensating for diagonal movement to obtain the total cost of passing through the cell.

The values of the cost raster can be integer or floating point, but they cannot be negative or zero (you cannot have a negative or zero cost).

• in_horizontal_raster – Optional. A raster defining the horizontal direction at each cell. The values on the raster must be integers ranging from 0 to 360, with 0 degrees being north, or toward the top of the screen, and increasing clockwise. Flat areas should be given a value of -1. The values at each location will be used in conjunction with the {horizontal_factor} to determine the horizontal cost incurred when moving from a cell to its neighbors.

• in_vertical_raster – Optional. A raster defining the vertical (z) value for each cell. The values are used for calculating the slope used to identify the vertical factor incurred when moving from one cell to another.

• horizontal_factor – Optional. The Horizontal Factor defines the relationship between the horizontal cost factor and the horizontal relative moving angle.

• vertical_factor – Optional. The Vertical Factor defines the relationship between the vertical cost factor and the vertical relative moving angle (VRMA)

• maximum_distance

Optional. Defines the threshold that the accumulative cost values cannot exceed. If an accumulative cost distance value exceeds this value, the output value for the cell location will be NoData. The maximum distance defines the extent for which the accumulative cost distances are calculated.

The default distance is to the edge of the output raster.

• distance_method

Optional String; Determines whether to calculate the distance using a planar (flat earth) or a geodesic (ellipsoid) method.

Planar - Planar measurements use 2D Cartesian mathematics to calculate length and area. The option is only available when measuring in a projected coordinate system and the 2D plane of that coordinate system will be used as the basis for the measurements. This is the default.

Geodesic - The shortest line between two points on the earth’s surface on a spheroid (ellipsoid). Therefore, regardless of input or output projection, the results do not change.

One use for a geodesic line is when you want to determine the shortest distance between two cities for an airplane’s flight path. This is also known as a great circle line if based on a sphere rather than an ellipsoid.

• generate_back_direction_band – Optional bool, Default is False. If set to True, function generates back direction as additional band in the output raster

• source_initial_accumulation

Optional. The starting cost from which to begin the cost calculations.

Allows for the specification of the fixed cost associated with a source. Instead of starting at a cost of zero, the cost algorithm will begin with the value set by source_start_cost.

The values must be zero or greater. The default is 0.

• source_maximum_accumulation

Optional. The cost capacity for the traveler for a source.

The cost calculations continue for each source until the specified capacity is reached.

The values must be greater than zero. The default capacity is to the edge of the output raster.

• source_cost_multiplier – Optional. Multiplier to apply to the cost values. Allows for control of the mode of travel or the magnitude at a source. The greater the multiplier, the greater the cost to move through each cell. The values must be greater than zero. The default is 1.

• source_direction – Optional. Defines the direction of the traveler when applying horizontal and vertical factors, the source resistance rate, and the source starting cost. Possible values: FROM_SOURCE, TO_SOURCE

Returns

output raster with function applied

## distance_allocation¶

arcgis.raster.functions.gbl.distance_allocation(in_source_data, in_barrier_data=None, in_surface_raster=None, in_cost_raster=None, in_vertical_raster=None, vertical_factor='BINARY 1 -30 30', in_horizontal_raster=None, horizontal_factor='BINARY 1 45', generate_source_row_column_bands=False, source_field=None, source_initial_accumulation=None, source_maximum_accumulation=None, source_cost_multiplier=None, source_direction=None, distance_method='PLANAR')

Calculates, for each cell, its least-cost source based on the least accumulative cost over a cost surface, avoiding network distance distortion.”,

Parameters
• in_source_data

Required The input source locations.

This is a raster that identifies the cells or locations from or to which the least accumulated cost distance for every output cell location is calculated.

For rasters, the input type can be integer or floating point.

• in_barrier_data – Optional barrier raster. The input raster that defines the barriers. The dataset must contain NoData where there are no barriers. Barriers are represented by valid values including zero. The barriers can be defined by an integer or floating-point raster.

• in_surface_raster – Optional. A raster defining the elevation values at each cell location. The values are used to calculate the actual surface distance covered when passing between cells.

• in_cost_raster

Optional. A raster defining the impedance or cost to move planimetrically through each cell.

The value at each cell location represents the cost-per-unit distance for moving through the cell. Each cell location value is multiplied by the cell resolution while also compensating for diagonal movement to obtain the total cost of passing through the cell.

The values of the cost raster can be integer or floating point, but they cannot be negative or zero (you cannot have a negative or zero cost).

• in_vertical_raster – Optional. A raster defining the vertical (z) value for each cell. The values are used for calculating the slope used to identify the vertical factor incurred when moving from one cell to another.

• vertical_factor – Optional. The Vertical Factor defines the relationship between the vertical cost factor and the vertical relative moving angle (VRMA)

• in_horizontal_raster – Optional. A raster defining the horizontal direction at each cell. The values on the raster must be integers ranging from 0 to 360, with 0 degrees being north, or toward the top of the screen, and increasing clockwise. Flat areas should be given a value of -1. The values at each location will be used in conjunction with the {horizontal_factor} to determine the horizontal cost incurred when moving from a cell to its neighbors.

• horizontal_factor – Optional. The Horizontal Factor defines the relationship between the horizontal cost factor and the horizontal relative moving angle.

• source_field – Optional. The field used to assign values to the source locations. It must be an integer type. If the Value Raster has been set, the values in that input will take precedence over any setting for the source field.

• generate_source_row_column_bands – Optional bool, Default is False. If set to True, function generates source row and column as additional bands in the output raster

• source_initial_accumulation

Optional. The starting cost from which to begin the cost calculations.

Allows for the specification of the fixed cost associated with a source. Instead of starting at a cost of zero, the cost algorithm will begin with the value set by source_start_cost.

The values must be zero or greater. The default is 0.

• source_maximum_accumulation

Optional. The cost capacity for the traveler for a source.

The cost calculations continue for each source until the specified capacity is reached.

The values must be greater than zero. The default capacity is to the edge of the output raster.

• source_cost_multiplier – Optional. Multiplier to apply to the cost values. Allows for control of the mode of travel or the magnitude at a source. The greater the multiplier, the greater the cost to move through each cell. The values must be greater than zero. The default is 1.

• source_direction – Optional. Defines the direction of the traveler when applying horizontal and vertical factors, the source resistance rate, and the source starting cost. Possible values: FROM_SOURCE, TO_SOURCE

• distance_method

Optional String; Determines whether to calculate the distance using a planar (flat earth) or a geodesic (ellipsoid) method.

Planar - Planar measurements use 2D Cartesian mathematics to calculate length and area. The option is only available when measuring in a projected coordinate system and the 2D plane of that coordinate system will be used as the basis for the measurements. This is the default.

Geodesic - The shortest line between two points on the earth’s surface on a spheroid (ellipsoid). Therefore, regardless of input or output projection, the results do not change.

One use for a geodesic line is when you want to determine the shortest distance between two cities for an airplane’s flight path. This is also known as a great circle line if based on a sphere rather than an ellipsoid.

Returns

output raster with function applied

## euclidean_allocation¶

arcgis.raster.functions.gbl.euclidean_allocation(in_source_data, in_value_raster=None, max_distance=None, cell_size=None, source_field=None, distance_method='PLANAR', in_barrier_data=None)

Calculates, for each cell, the nearest source based on Euclidean distance. For more information, see http://pro.arcgis.com/en/pro-app/help/data/imagery/euclidean-allocation-global-function.htm

Parameters
• in_source_data – Required; The input raster that identifies the pixels or locations to which the Euclidean distance for every output pixel location is calculated. The input type can be an integer or a floating-point value. If the input Source Raster is floating point, the Value Raster must be set, and it must be an integer. The Value Raster will take precedence over any setting of the Source Field.

• in_value_raster – Optional. The input integer raster that identifies the zone values that should be used for each input source location. For each source location pixel, the value defined by the Value Raster will be assigned to all pixels allocated to the source location for the computation. The Value Raster will take precedence over any setting for the Source Field .

• max_distance – Optional. The threshold that the accumulative distance values cannot exceed. If an accumulative Euclidean distance exceeds this value, the output value for the pixel location will be NoData. The default distance is to the edge of the output raster

• cell_size – Optional. The pixel size at which the output raster will be created. If the cell size was explicitly set in Environments, that will be the default cell size. If Environments was not set, the output cell size will be the same as the Source Raster

• source_field – Optional. The field used to assign values to the source locations. It must be an integer type. If the Value Raster has been set, the values in that input will take precedence over any setting for the Source Field.

• distance_method

Optional String; Determines whether to calculate the distance using a planar (flat earth) or a geodesic (ellipsoid) method.

Planar - Planar measurements use 2D Cartesian mathematics to calculate length and area. The option is only available when measuring in a projected coordinate system and the 2D plane of that coordinate system will be used as the basis for the measurements. This is the default.

Geodesic - The shortest line between two points on the earth’s surface on a spheroid (ellipsoid). Therefore, regardless of input or output projection, the results do not change.

One use for a geodesic line is when you want to determine the shortest distance between two cities for an airplane’s flight path. This is also known as a great circle line if based on a sphere rather than an ellipsoid.

• in_barrier_data – Optional barrier raster. The input raster that defines the barriers. The dataset must contain NoData where there are no barriers. Barriers are represented by valid values including zero. The barriers can be defined by an integer or floating-point raster.

Returns

output raster with function applied

## euclidean_back_direction¶

arcgis.raster.functions.gbl.euclidean_back_direction(in_source_data, cell_size=None, max_distance=None, distance_method='PLANAR', in_barrier_data=None)

Calculates, for each cell, the direction, in degrees, to the neighboring cell along the shortest path back to the closest source while avoiding barriers.

The direction is calculated from each cell center to the center of the source cell that’s nearest to it.

The range of values is from 0 degrees to 360 degrees, with 0 reserved for the source cells. Due east (right) is 90 and the values increase clockwise (180 is south, 270 is west, and 360 is north).

Parameters
• in_source_data – Required; The input raster that identifies the pixels or locations to which the Euclidean direction for every output cell location is calculated. The input type can be an integer or a floating-point value.

• cell_size – Optional. The pixel size at which the output raster will be created. If the cell size was explicitly set in Environments, that will be the default cell size. If Environments was not set, the output cell size will be the same as the Source Raster

• max_distance – Optional. The threshold that the accumulative distance values cannot exceed. If an accumulative Euclidean distance exceeds this value, the output value for the pixel location will be NoData. The default distance is to the edge of the output raster

• distance_method

Optional. Optional String; Determines whether to calculate the distance using a planar (flat earth) or a geodesic (ellipsoid) method.

Planar - Planar measurements use 2D Cartesian mathematics to calculate length and area. The option is only available when measuring in a projected coordinate system and the 2D plane of that coordinate system will be used as the basis for the measurements. This is the default.

Geodesic - The shortest line between two points on the earth’s surface on a spheroid (ellipsoid). Therefore, regardless of input or output projection, the results do not change.

One use for a geodesic line is when you want to determine the shortest distance between two cities for an airplane’s flight path. This is also known as a great circle line if based on a sphere rather than an ellipsoid.

• in_barrier_data – Optional barrier raster. The input raster that defines the barriers. The dataset must contain NoData where there are no barriers. Barriers are represented by valid values including zero. The barriers can be defined by an integer or floating-point raster.

Returns

output raster with function applied

## euclidean_direction¶

arcgis.raster.functions.gbl.euclidean_direction(in_source_data, cell_size=None, max_distance=None, distance_method='PLANAR', in_barrier_data=None)

Calculates, for each cell, the Euclidean distance to the closest source.

Parameters
• in_source_data – Required raster layer. The input source locations. This is a raster that identifies the cells or locations to which the Euclidean distance for every output cell location is calculated. For rasters, the input type can be integer or floating point.

• cell_size – Optional. Defines the threshold that the accumulative distance values cannot exceed. If an accumulative Euclidean distance value exceeds this value, the output value for the cell location will be NoData. The default distance is to the edge of the output raster.

• max_distance – Optional. Defines the threshold distance within which the direction to the closest source will be calculated. If the distance to the nearest source exceeds this, the output for that cell will be NoData. The default distance is to the extent of the output raster.

• distance_method

Optional String; Determines whether to calculate the distance using a planar (flat earth) or a geodesic (ellipsoid) method.

Planar - Planar measurements use 2D Cartesian mathematics to calculate length and area. The option is only available when measuring in a projected coordinate system and the 2D plane of that coordinate system will be used as the basis for the measurements. This is the default.

Geodesic - The shortest line between two points on the earth’s surface on a spheroid (ellipsoid). Therefore, regardless of input or output projection, the results do not change.

One use for a geodesic line is when you want to determine the shortest distance between two cities for an airplane’s flight path. This is also known as a great circle line if based on a sphere rather than an ellipsoid.

• in_barrier_data – Optional barrier raster. The input raster that defines the barriers. The dataset must contain NoData where there are no barriers. Barriers are represented by valid values including zero. The barriers can be defined by an integer or floating-point raster.

Returns

output raster with function applied

## euclidean_distance¶

arcgis.raster.functions.gbl.euclidean_distance(in_source_data, cell_size=None, max_distance=None, distance_method='PLANAR', in_barrier_data=None)

Calculates, for each cell, the Euclidean distance to the closest source. For more information, see http://pro.arcgis.com/en/pro-app/help/data/imagery/euclidean-distance-global-function.htm

Parameters
• in_source_data – Required. The input raster that identifies the pixels or locations to which the Euclidean distance for every output pixel location is calculated. The input type can be an integer or a floating-point value.

• cell_size – Optional. The pixel size at which the output raster will be created. If the cell size was explicitly set in Environments, that will be the default cell size. If Environments was not set, the output cell size will be the same as the Source Raster

• max_distance – Optional. The threshold that the accumulative distance values cannot exceed. If an accumulative Euclidean distance exceeds this value, the output value for the pixel location will be NoData. The default distance is to the edge of the output raster

• distance_method

Optional String; Determines whether to calculate the distance using a planar (flat earth) or a geodesic (ellipsoid) method.

Planar - Planar measurements use 2D Cartesian mathematics to calculate length and area. The option is only available when measuring in a projected coordinate system and the 2D plane of that coordinate system will be used as the basis for the measurements. This is the default.

Geodesic - The shortest line between two points on the earth’s surface on a spheroid (ellipsoid). Therefore, regardless of input or output projection, the results do not change.

One use for a geodesic line is when you want to determine the shortest distance between two cities for an airplane’s flight path. This is also known as a great circle line if based on a sphere rather than an ellipsoid.

• in_barrier_data – Optional barrier raster. The input raster that defines the barriers. The dataset must contain NoData where there are no barriers. Barriers are represented by valid values including zero. The barriers can be defined by an integer or floating-point raster.

Returns

output raster with function applied

## expand¶

arcgis.raster.functions.gbl.expand(input_raster, number_of_cells, zone_values)

Expands specified zones of a raster by a specified number of cells. https://pro.arcgis.com/en/pro-app/help/data/imagery/expand-function.htm

Parameters
• input_raster – Required. The input raster for which the identified zones are to be expanded. It must be of integer type.

• number_of_cells – Required. The number of cells to expand by. The value must be integer, and can be 1 or greater.

• zone_values – Required. The list of zones to expand. The zone values must be integer, and they can be in any order. The zone values can be specified as a list or as a string. If specified as a string and if it is required to specify multiple zones, use a semicolon (“;”) to separate the zone values.

Returns

output raster with function applied

## fill¶

arcgis.raster.functions.gbl.fill(input_surface_raster, zlimit=None)

Fills sinks in a surface raster to remove small imperfections in the data

Parameters
• input_surface_raster – Required. The input raster representing a continuous surface.

• zlimit – Optional. Data type - Double. Maximum elevation difference between a sink and its pour point to be filled. If the difference in z-values between a sink and its pour point is greater than the z_limit, that sink will not be filled. The value for z-limit must be greater than zero. Unless a value is specified for this parameter, all sinks will be filled, regardless of depth.

Returns

output raster with function applied

## flow_accumulation¶

arcgis.raster.functions.gbl.flow_accumulation(input_flow_direction_raster, input_weight_raster=None, data_type='FLOAT', flow_direction_type='D8')

” Replaces cells of a raster corresponding to a mask with the values of the nearest neighbors.

Parameters
• input_flow_direction_raster – Required. The input raster that shows the direction of flow out of each cell.

• input_weight_raster – An optional input raster for applying a weight to each cell.

• data_type – Optional. Choice List: INTEGER, FLOAT, DOUBLE

Returns

output raster with function applied

## flow_direction¶

arcgis.raster.functions.gbl.flow_direction(input_surface_raster, force_flow='NORMAL', flow_direction_type='D8', generate_out_drop_raster=False)

The flow_direction task creates a raster of flow direction from each cell to its steepest downslope neighbor.

This task supports three flow modeling algorithms. Those are D8, Multi Flow Direction (MFD), and D-Infinity (DINF).

D8 flow modeling algorithm

The D8 flow method models flow direction from each cell to its steepest downslope neighbor.

The output of the FlowDirection task run with the D8 flow direction type is an integer raster whose values range from 1-255. The values for each direction from the center are the following:

For example, if the direction of steepest drop was to the left of the current processing cell, its flow direction would be coded at 16.

The following are additional considerations for using the D8 flow method:

• If a cell is lower than its eight neighbors, that cell is given the value of its lowest neighbor, and flow is defined toward this cell. If multiple neighbors have the lowest value, the cell is still given this value, but flow is defined with one of the two methods explained below. This is used to filter out one-cell sinks, which are considered noise.

• If a cell has the same change in z-value in multiple directions and that cell is part of a sink, the flow direction is referred to as undefined. In such cases, the value for that cell in the output flow direction raster will be the sum of those directions. For example, if the change in z-value is the same both to the right (flow direction = 1) and down (flow direction = 4), the flow direction for that cell is 5.

• If a cell has the same change in z-value in multiple directions and is not part of a sink, the flow directions is assigned with a lookup table defining the most likely direction. See Greenlee (1987).

• The output drop raster is calculated as the difference in z-value divided by the path length between the cell centers, expressed in percentages. For adjacent cells, this is analogous to the percent slop between cells. Across a flat area, the distance becomes the distance to the nearest cell of lower elevation. The result is a map of percent rise in the path of steepest descent from each cell.

• When calculating a drop raster in flat areas, the distance to diagonally adjacent cells (1.41421 * cell size) is approximated by 1.5 * cell size for improved performance.

• With the forceFlow parameter set to the default value False, a cell at the edge of the surface raster will flow towards the inner cell with the steepest z-value. If the drop is less than or equal to zero, the cell will flow out of the surface raster.

MFD flow modeling algorithm

The MFD algorithm, described by Qin et al. (2007), partitions flow from a cell to all downslope neighbors. A flow-partition exponent is created from an adaptive approach based on local terrain conditions and is used to determine fraction of flow draining to all downslope neighbors.

When the MFD flow direction output is added to a map, it only displays the D8 flow direction. As MFD flow directions have potentially multiple values tied to each cell (each value corresponds to proportion of flow to each downslope neighbor), it is not easily visualized. However, an MFD flow direction output raster is an input recognized by the FlowAccumulation task that would utilize the MFD flow directions to proportion and accumulate flow from each cell to all downslope neighbors.

DINF flow modeling algorithm

The DINF flow method, described by Tarboton (1997), determines flow direction as the steepest downward slope on eight triangular facets formed in a 3x3 cell window centered on the cell of interest. The flow direction output is a floating-point raster represented as a single angle in degrees going counter-clockwise from 0 (due east) to 360 (also due east).

 Argument Description input_surface_raster Required. The input raster representing a continuous surface. force_flow Optional string. Specifies if edge cells will always flow outward or follow normal flow rules. Choice list: [‘NORMAL’, ‘FORCE’] The default value is ‘NORMAL’. flow_direction_type Optional string. Specifies the flow direction type to use. Choice list: [‘D8’, ‘MFD’, ‘DINF’] D8 is for the D8 flow direction type. This is the default. MFD is for the Multi Flow Direction type. DINF is for the D-Infinity type. The default value is ‘D8’. generate_out_drop_raster Optional Boolean, determines whether out_drop_raster should be generated or not. Set this parameter to True, in order to generate the out_drop_raster. If set to true, the output will be a named tuple with name values being output_flow_direction_service and output_drop_service.
Returns

output raster with function applied

# Usage Example: To add an image to an existing image collection.
flow_direction_output =  flow_direction(input_surface_raster=in_raster,
force_flow="NORMAL",
flow_direction_type="D8",
generate_out_drop_raster=True)

out_var = flow_direction_output.save()

out_var.output_flow_direction_service  # gives you the output flow direction imagery layer item

out_var.output_drop_service # gives you the output drop raster imagery layer item


## flow_distance¶

arcgis.raster.functions.gbl.flow_distance(input_stream_raster, input_surface_raster, input_flow_direction_raster=None, distance_type='VERTICAL', flow_direction_type='D8', statistics_type='MINIMUM')

This function computes, for each cell, the minimum downslope horizontal or vertical distance to cell(s) on a stream or river into which they flow. If an optional flow direction raster is provided, the down slope direction(s) will be limited to those defined by the input flow direction raster.

:param input_stream_raster:Required. An input raster that represents a linear stream network :param input_surface_raster: Required. The input raster representing a continuous surface. :param input_flow_direction_raster: Optional. The input raster that shows the direction of flow out of each cell. :param distance_type: Optional. VERTICAL or HORIZONTAL distance to compute; if not

specified, VERTICAL distance is computed.

Parameters
• flow_direction_type

Optional String; Defines the type of the input flow direction raster.

D8 - The input flow direction raster is of type D8. This is the default.

MFD - The input flow direction raster is of type Multi Flow Direction (MFD).

Dinf - The input flow direction raster is of type D-Infinity (DINF).

• statistics_type

Optional String; Determines the statistics type used to compute flow distance over multiple flow paths. If there is only a single flow path from each cell to a cell on the stream, all statistics types produce the same result.

MINIMUM - Where multiple flow paths exist, minimum flow distance in computed. This is the default.

WEIGHTED_MEAN - Where multiple flow paths exist, a weighted mean of flow distance is computed. Flow proportion from a cell to its downstream neighboring cells are used as weights for computing weighted mean.

MAXIMUM - When multiple flow paths exist, maximum flow distance is computed.

Returns

output raster with function applied

## flow_length¶

arcgis.raster.functions.gbl.flow_length(input_flow_direction_raster, direction_measurement='DOWNSTREAM', input_weight_raster=None)

Creates a raster layer of upstream or downstream distance, or weighted distance, along the flow path for each cell.

A primary use of the Flow Length function is to calculate the length of the longest flow path within a given basin. This measure is often used to calculate the time of concentration of a basin. This would be done using the Upstream option.

The function can also be used to create distance-area diagrams of hypothetical rainfall and runoff events using the weight raster as an impedance to movement downslope.

Parameters
• input_flow_direction_raster – Required. The input raster that shows the direction of flow out of each cell. The flow direction raster can be created by running the Flow Direction function.

• direction_measurement

Optional String. The direction of measurement along the flow path.

DOWNSTREAM - Calculates the downslope distance along the flow path, from each cell to a sink or outlet on the edge of the raster. this is the default.

UPSTREAM - Calculates the longest upslope distance along the flow path, from each cell to the top of the drainage divide.

• input_weight_raster – An optional input raster for applying a weight to each cell. If no weight raster is specified, a default weight of 1 will be applied to each cell.

Returns

output raster with function applied

## kernel_density¶

arcgis.raster.functions.gbl.kernel_density(in_features, population_field, cell_size=None, search_radius=None, area_unit_scale_factor='SQUARE_MAP_UNITS', out_cell_values='DENSITIES', method='PLANAR')

Calculates a magnitude-per-unit area from point or polyline features using a kernel function to fit a smoothly tapered surface to each point or polyline. For more information, see http://pro.arcgis.com/en/pro-app/help/data/imagery/kernel-density-global-function.htm

Parameters
• in_features – Required. The input point or line features for which to calculate the density

• population_field – Required. Field denoting population values for each feature. The Population Field is the count or quantity to be spread across the landscape to create a continuous surface. Values in the population field may be integer or floating point.

• cell_size – Optional. The pixel size for the output raster dataset. If the Cellsize has been set in the geoprocessing Environments it will be the default.

• search_radius – Optional. The search radius within which to calculate density. Units are based on the linear unit of the projection.

• area_unit_scale_factor

Optional. The desired area units of the output density values. -SQUARE_MAP_UNITS-For the square of the linear units of the output spatial reference.

-SQUARE_MILES-For (U.S.) miles.

-SQUARE_KILOMETERS-For kilometers.

-ACRES For (U.S.) acres.

-HECTARES-For hectares.

-SQUARE_METERS-For meters.

-SQUARE_YARDS-For (U.S.) yards.

-SQUARE_FEET-For (U.S.) feet.

-SQUARE_INCHES-For (U.S.) inches.

-SQUARE_CENTIMETERS-For centimeters.

-SQUARE_MILLIMETERS-For millimeters.

• out_cell_values

Optional. Determines what the values in the output raster represent.

• DENSITIES-The output values represent the predicted density value. This is the default.

• EXPECTED_COUNTS-The output values represent the predicted amount of the phenomenon within each pixel. Since the pixel value is linked to the specified Cellsize, the resulting raster cannot be resampled to a different pixel size and still represent the amount of the phenomenon.

• method

Optional. Determines whether to use a shortest path on a spheroid (geodesic) or a flat earth (planar) method.

• PLANAR-Uses planar distances between the features. This is the default.

• GEODESIC-Uses geodesic distances between features. This method takes into account the curvature of the spheroid and correctly deals with data near the poles and the International dateline.

Returns

output raster

## least_cost_path¶

arcgis.raster.functions.gbl.least_cost_path(in_source_data, in_cost_raster, in_destination_data, destination_field=None, path_type='EACH_CELL', max_distance=None, source_cost_multiplier=None, source_start_cost=None, source_resistance_rate=None, source_capacity=None, source_direction=None)

Calculates the least-cost path from a source to a destination. The least accumulative cost distance is calculated for each pixel over a cost surface, to the nearest source. This produces an output raster that records the least-cost path, or paths, from selected locations to the closest source pixels defined within the accumulative cost surface, in terms of cost distance. For more information, see http://pro.arcgis.com/en/pro-app/help/data/imagery/least-cost-path-global-function.htm

Parameters
• in_source_data – Required. The input raster that identifies the pixels or locations to which the least accumulated cost distance for every output pixel location is calculated. The Source Raster can be an integer or a floating-point value. If the input Source Raster is floating point, the Value Raster must be set, and it must be an integer. The Value Raster will take precedence over any setting of the Source Field.

• in_cost_raster – Required. A raster defining the cost or impedance to move planimetrically through each pixel. The value at each pixel location represents the cost-per-unit distance for moving through it. Each pixel location value is multiplied by the pixel resolution, while also compensating for diagonal movement to obtain the total cost of passing through the pixel. The values of the Cost Raster can be integer or floating point, but they cannot be negative or zero.

• in_destination_data – Required. A raster that identifies the pixels from which the least-cost path is determined to the least costly source. This input consists of pixels that have valid values, and the remaining pixels must be assigned NoData. Values of 0 are valid.

• destination_field – Optional. The field used to obtain values for the destination locations.

• path_type

Optional. A keyword defining the manner in which the values and zones on the input destination data will be interpreted in the cost path calculations:

EACH_CELL-A least-cost path is determined for each pixel with valid values on the input destination data, and saved on the output raster. Each cell of the input destination data is treated separately, and a least-cost path is determined for each from cell.

EACH_ZONE-A least-cost path is determined for each zone on the input destination data and saved on the output raster. The least-cost path for each zone begins at the pixel with the lowest cost distance weighting in the zone.

BEST_SINGLE-For all pixels on the input destination data, the least-cost path is derived from the pixel with the minimum of the least-cost paths to source cells.

• max_distance – Optional. The threshold that the accumulative cost values cannot exceed. If an accumulative cost distance exceeds this value, the output value for the pixel location will be NoData. The maximum distance defines the extent for which the accumulative cost distances are calculated. The default distance is to the edge of the output raster.

• source_field – Optional. The field used to assign values to the source locations. It must be an integer type. If the Value Raster has been set, the values in that input will take precedence over any setting for the Source Field.

• source_cost_multiplier – Optional. The threshold that the accumulative cost values cannot exceed. If an accumulative cost distance exceeds this value, the output value for the pixel location will be NoData. The maximum distance defines the extent for which the accumulative cost distances are calculated. The default distance is to the edge of the output raster.

• source_start_cost – Optional. The starting cost from which to begin the cost calculations. This parameter allows for the specification of the fixed cost associated with a source. Instead of starting at a cost of 0, the cost algorithm will begin with the value set here. The default is 0. The value must be 0 or greater. A numeric (double) value or a field from the Source Raster can be used for this parameter.

• source_resistance_rate – Optional. This parameter simulates the increase in the effort to overcome costs as the accumulative cost increases. It is used to model fatigue of the traveler. The growing accumulative cost to reach a pixel is multiplied by the resistance rate and added to the cost to move into the subsequent pixel. It is a modified version of a compound interest rate formula that is used to calculate the apparent cost of moving through a pixel. As the value of the resistance rate increases, it increases the cost of the pixels that are visited later. The greater the resistance rate, the higher the cost to reach the next pixel, which is compounded for each subsequent movement. Since the resistance rate is similar to a compound rate and generally the accumulative cost values are very large, small resistance rates are suggested, such as 0.005 or even smaller, depending on the accumulative cost values. The default is 0. The values must be 0 or greater. A numeric (double) value or a field from the Source Raster can be used for this parameter.

• source_capacity – Optional. Defines the cost capacity for the traveler for a source. The cost calculations continue for each source until the specified capacity is reached. The default capacity is to the edge of the output raster. The values must be greater than 0. A double numeric value or a field from the Source Raster can be used for this parameter.

• source_direction

Optional. Defines the direction of the traveler when applying the source resistance rate and the source starting cost.

FROM_SOURCE - The source resistance rate and source starting cost will be applied beginning at the input source and moving out to the nonsource cells. This is the default.

TO_SOURCE - The source resistance rate and source starting cost will be applied beginning at each nonsource cell and moving back to the input source.

Either specify the FROM_SOURCE or TO_SOURCE keyword, which will be applied to all sources, or specify a field in the Source Raster that contains the keywords to identify the direction of travel for each source. That field must contain the string FROM_SOURCE or TO_SOURCE.

Returns

output raster with function applied

## nibble¶

arcgis.raster.functions.gbl.nibble(input_raster, input_mask_raster, nibble_values='ALL_VALUES', nibble_no_data='PRESERVE_NODATA', input_zone_raster=None)

Replaces cells of a raster corresponding to a mask with the values of the nearest neighbors.

Parameters
• input_raster – Required. The input rater to nibble. The input raster can be either integer or floating point type.

• input_mask_raster – Required. The input raster to use as the mask.

• nibble_values – Optional. possbile options are “ALL_VALUES” and “DATA_ONLY”. Default is “ALL_VALUES”

• nibble_no_data – Optional. PRESERVE_NODATA or PROCESS_NODATA possible values; Default is PRESERVE_NODATA.

• input_zone_raster – Optional. The input raster that defines the zones to use as the mask.

Returns

output raster with function applied

## path_distance¶

arcgis.raster.functions.gbl.path_distance(in_source_data, in_cost_raster=None, in_surface_raster=None, in_horizontal_raster=None, in_vertical_raster=None, horizontal_factor='BINARY', vertical_factor='BINARY', maximum_distance=None, source_cost_multiplier=None, source_start_cost=None, source_resistance_rate=None, source_capacity=None, source_direction=None)

Calculates, for each cell, the least accumulative cost distance from or to the least-cost source, while accounting for surface distance along with horizontal and vertical cost factors

Parameters
• in_source_data

Required. The input source locations. This is a raster that identifies the cells or locations from or to which the least accumulated cost distance for every output cell location is calculated.

The raster input type can be integer or floating point.

• in_cost_raster – Optional. A raster defining the impedance or cost to move planimetrically through each cell. The value at each cell location represents the cost-per-unit distance for moving through the cell. Each cell location value is multiplied by the cell resolution while also compensating for diagonal movement to obtain the total cost of passing through the cell. The values of the cost raster can be integer or floating point, but they cannot be negative or zero (you cannot have a negative or zero cost).

• in_surface_raster – Optional. A raster defining the elevation values at each cell location. The values are used to calculate the actual surface distance covered when passing between cells.

• in_horizontal_raster – Optional. A raster defining the horizontal direction at each cell. The values on the raster must be integers ranging from 0 to 360, with 0 degrees being north, or toward the top of the screen, and increasing clockwise. Flat areas should be given a value of -1. The values at each location will be used in conjunction with the {horizontal_factor} to determine the horizontal cost incurred when moving from a cell to its neighbors.

• in_vertical_raster – Optional. A raster defining the vertical (z) value for each cell. The values are used for calculating the slope used to identify the vertical factor incurred when moving from one cell to another.

• horizontal_factor – Optional. The Horizontal Factor defines the relationship between the horizontal cost factor and the horizontal relative moving angle. Possible values are: “BINARY”, “LINEAR”, “FORWARD”, “INVERSE_LINEAR”

• vertical_factor – Optional. The Vertical Factor defines the relationship between the vertical cost factor and the vertical relative moving angle (VRMA) Possible values are: “BINARY”, “LINEAR”, “SYMMETRIC_LINEAR”, “INVERSE_LINEAR”, “SYMMETRIC_INVERSE_LINEAR”, “COS”, “SEC”, “COS_SEC”, “SEC_COS”

• maximum_distance

Optional. Defines the threshold that the accumulative cost values cannot exceed. If an accumulative cost distance value exceeds this value, the output value for the cell location will be NoData. The maximum distance defines the extent for which the accumulative cost distances are calculated.

The default distance is to the edge of the output raster.

• source_cost_multiplier – Optional. Multiplier to apply to the cost values.

• source_start_cost – Optional. The starting cost from which to begin the cost calculations.

• source_resistance_rate – Optional. This parameter simulates the increase in the effort to overcome costs as the accumulative cost increases. It is used to model fatigue of the traveler. The growing accumulative cost to reach a cell is multiplied by the resistance rate and added to the cost to move into the subsequent cell.

• source_capacity – Optional. Defines the cost capacity for the traveler for a source. The cost calculations continue for each source until the specified capacity is reached. The values must be greater than zero. The default capacity is to the edge of the output raster.

• source_direction – Optional. Defines the direction of the traveler when applying horizontal and vertical factors, the source resistance rate, and the source starting cost. Possible values: FROM_SOURCE, TO_SOURCE

Returns

output raster with function applied

## path_distance_allocation¶

arcgis.raster.functions.gbl.path_distance_allocation(in_source_data, in_cost_raster=None, in_surface_raster=None, in_horizontal_raster=None, in_vertical_raster=None, horizontal_factor='BINARY', vertical_factor='BINARY', maximum_distance=None, in_value_raster=None, source_field=None, source_cost_multiplier=None, source_start_cost=None, source_resistance_rate=None, source_capacity=None, source_direction=None)

Calculates the least-cost source for each cell based on the least accumulative cost over a cost surface, while accounting for surface distance along with horizontal and vertical cost factors.

Parameters
• in_source_data

Required. The input source locations. This is a raster that identifies the cells or locations from or to which the least accumulated cost distance for every output cell location is calculated.

For rasters, the input type can be integer or floating point.

If the input source raster is floating point, the {in_value_raster} must be set, and it must be of integer type. The value raster will take precedence over any setting of the {source_field}.

• in_cost_raster – Optional. A raster defining the impedance or cost to move planimetrically through each cell.

• in_surface_raster – Optional. A raster defining the elevation values at each cell location.

• in_horizontal_raster – Optional. A raster defining the horizontal direction at each cell.

• in_vertical_raster – Optional. A raster defining the vertical (z) value for each cell.

• horizontal_factor – Optional. The Horizontal Factor defines the relationship between the horizontal cost factor and the horizontal relative moving angle. Possible values are: “BINARY”, “LINEAR”, “FORWARD”, “INVERSE_LINEAR”

• vertical_factor – Optional. The Vertical Factor defines the relationship between the vertical cost factor and the vertical relative moving angle (VRMA) Possible values are: “BINARY”, “LINEAR”, “SYMMETRIC_LINEAR”, “INVERSE_LINEAR”, “SYMMETRIC_INVERSE_LINEAR”, “COS”, “SEC”, “COS_SEC”, “SEC_COS”

• maximum_distance – Optional. Defines the threshold that the accumulative cost values cannot exceed.

• in_value_raster – Optional. The input integer raster that identifies the zone values that should be used for each input source location. For each source location cell, the value defined by the {in_value_raster} will be assigned to all cells allocated to the source location for the computation. The value raster will take precedence over any setting for the {source_field}.

• source_field – Optional. The field used to assign values to the source locations. It must be of integer type. If the {in_value_raster} has been set, the values in that input will have precedence over any setting for the {source_field}.

• source_cost_multiplier

Optional. Multiplier to apply to the cost values. Allows for control of the mode of travel or the magnitude at a source. The greater the multiplier, the greater the cost to move through each cell.

The values must be greater than zero. The default is 1.

• source_start_cost

Optional. The starting cost from which to begin the cost calculations. Allows for the specification of the fixed cost associated with a source. Instead of starting at a cost of zero, the cost algorithm will begin with the value set by source_start_cost.

The values must be zero or greater. The default is 0.

• source_resistance_rate – Optional. This parameter simulates the increase in the effort to overcome costs as the accumulative cost increases. It is used to model fatigue of the traveler. The growing accumulative cost to reach a cell is multiplied by the resistance rate and added to the cost to move into the subsequent cell.

• source_capacity

Optional. Defines the cost capacity for the traveler for a source. The cost calculations continue for each source until the specified capacity is reached.

The values must be greater than zero. The default capacity is to the edge of the output raster.

• source_direction – Optional. Defines the direction of the traveler when applying horizontal and vertical factors, the source resistance rate, and the source starting cost. Possible values: FROM_SOURCE, TO_SOURCE

Returns

output raster with function applied

## region_group¶

arcgis.raster.functions.gbl.region_group(in_raster, number_of_neighbor_cells='FOUR', zone_connectivity='WITHIN', add_link='ADD_LINK', excluded_value=0)

For each cell in the output, the identity of the connected region to which that cell belongs is recorded. A unique number is assigned to each region.

Parameters
• in_raster – Required, the input raster whose unique connected regions will be identified. It must be of integer type.

• number_of_neighbor_cells – Optional. The number of neighboring cells to use in evaluating connectivity between cells. Possible values - FOUR, EIGHT. Default is FOUR

• zone_connectivity – Optional. Defines which cell values should be considered when testing for connectivity. Possible values - WITHIN, CROSS. Default is WITHIN

• excluded_value

Optional. Identifies a value such that if a cell location contains the value, no spatial connectivity will be evaluated regardless how the number of neighbors is specified (FOUR or EIGHT).

Cells with the excluded value will be treated as NoData and are eliminated from calculations. Cell locations that contain the excluded value will receive 0 on the output raster.

The excluded value is similar to the concept of a background value, or setting a mask in the environment for a single run of the tool. A value must be specified for this parameter if the CROSS keyword is specified

Returns

output raster with function applied

## shrink¶

arcgis.raster.functions.gbl.shrink(input_raster, number_of_cells, zone_values)

Shrinks the selected zones by a specified number of cells by replacing them with the value of the cell that is most frequent in its neighborhood. https://pro.arcgis.com/en/pro-app/help/data/imagery/shrink-function.htm

Parameters
• input_raster – Required. The input raster for which the identified zones are to be shrunk. It must be of integer type.

• number_of_cells – Required. The number of cells by which to shrink each specified zone. The value must be integer, and can be 1 or greater.

• zone_values – Required. The list of zones to shrink. The zone values must be integer, and they can be in any order. The zone values can be specified as a list or as a string. If specified as a string and if it is required to specify multiple zones, use a semicolon (“;”) to separate the zone values.

Returns

output raster with function applied

## sink¶

arcgis.raster.functions.gbl.sink(input_flow_direction_raster)

Creates a raster layer identifying all sinks or areas of internal drainage.

The value type for the Sink function output raster layer is floating point.

Parameters

input_flow_direction_raster

Required. The input raster that shows the direction of flow out of each cell.

The flow direction raster can be created by running the Flow Direction function.

Returns

output raster with function applied

## snap_pour_point¶

arcgis.raster.functions.gbl.snap_pour_point(in_pour_point_data, in_accumulation_raster=None, snap_distance=0, pour_point_field=None)

Snaps pour points to the cell of highest flow accumulation within a specified distance.

Parameters
• in_pour_point_data – Required. The input pour point locations that are to be snapped. For an input raster layer, all cells that are not NoData (that is, have a value) will be considered pour points and will be snapped.

• in_accumulation_raster – optional raster; The input flow accumulation raster layer.

• snap_distance – Optional. Maximum distance, in map units, to search for a cell of higher accumulated flow. Default is 0

• pour_point_field – Optional. Field used to assign values to the pour point locations.

Returns

output raster with function applied

## stream_order¶

arcgis.raster.functions.gbl.stream_order(input_stream_raster, input_flow_direction_raster=None, order_method='STRAHLER')

Creates a raster layer that assigns a numeric order to segments of a raster representing branches of a linear network.

Parameters
• input_stream_raster – Required. An input stream raster that represents a linear stream network.

• input_flow_direction_raster – Optional. The input raster that shows the direction of flow out of each cell The flow direction raster can be created by running the Flow Direction function.

• order_method

Optional. The method used for assigning stream order.

STRAHLER - The method of stream ordering proposed by Strahler in 1952. Stream order only increases when streams of the same order intersect. Therefore, the intersection of a first-order and second-order link will remain a second-order link, rather than creating a third-order link. This is the default.

SHREVE - The method of stream ordering by magnitude, proposed by Shreve in 1967. All links with no tributaries are assigned a magnitude (order) of one. Magnitudes are additive downslope. When two links intersect, their magnitudes are added and assigned to the downslope link.

Returns

output raster with function applied

## watershed¶

arcgis.raster.functions.gbl.watershed(input_flow_direction_raster, input_pour_point_data, pour_point_field=None)

Replaces cells of a raster corresponding to a mask with the values of the nearest neighbors.

Parameters
• input_flow_direction_raster – Required raster layer. The input raster that shows the direction of flow out of each cell.

• input_pour_point_data – Required raster layer. This raster represents cells above which the contributing area, or catchment, will be determined. All cells that are not NoData will be used as source cells.

• pour_point_field – Optional string. Field used to assign values to the pour point locations. For a raster pour point dataset, Value is used by default.

Returns

output raster with function applied

## zonal_statistics¶

arcgis.raster.functions.gbl.zonal_statistics(in_zone_data, zone_field, in_value_raster, ignore_nodata=True, statistics_type='MEAN', process_as_multidimensional=None)

” Calculates statistics on values of a raster within the zones of another dataset. For more information, http://pro.arcgis.com/en/pro-app/help/data/imagery/zonal-statistics-global-function.htm

Parameters
• in_zone_data – Required raster layer. Dataset that defines the zones. The zones can be defined by an integer raster

• zone_field – Required string or integer. Field that holds the values that define each zone. It can be an integer or a string field of the zone raster.

• in_value_raster – Required raster layer. Raster that contains the values on which to calculate a statistic.

• ignore_no_data

Optional bool. Denotes whether NoData values in the Value Raster will influence the results of the zone that they fall within.

True - Within any particular zone, only pixels that have a value in the Value Raster will be used in determining the output value for that zone. NoData pixels in the Value Raster will be ignored in the statistic calculation.

This is the default.

False - Within any particular zone, if any NoData pixels exist in the Value Raster, it is deemed that there is insufficient information to perform statistical calculations for all the pixels in that zone; therefore, the entire zone will receive the NoData value on the output raster.

• statistics_type

Optional str. Statistic type to be calculated. Default is MEAN

MEAN-Calculates the average of all pixels in the Value Raster that belong to the same zone as the output pixel.

MAJORITY-Determines the value that occurs most often of all pixels in the Value Raster that belong to the same zone as the output pixel.

MAXIMUM-Determines the largest value of all pixels in the Value Raster that belong to the same zone as the output pixel.

MEDIAN-Determines the median value of all pixels in the Value Raster that belong to the same zone as the output pixel.

MINIMUM-Determines the smallest value of all pixels in the Value Raster that belong to the same zone as the output pixel.

MINORITY-Determines the value that occurs least often of all pixels in the Value Raster that belong to the same zone as the output pixel.

RANGE-Calculates the difference between the largest and smallest value of all pixels in the Value Raster that belong to the same zone as the output pixel.

STD-Calculates the standard deviation of all pixels in the Value Rasterthat belong to the same zone as the output pixel.

SUM-Calculates the total value of all pixels in the Value Raster that belong to the same zone as the output pixel.

VARIETY-Calculates the number of unique values for all pixels in the Value Raster that belong to the same zone as the output pixel.

• process_as_multidimensional – Optional bool, Process as multidimensional if set to True. (If the input is multidimensional raster.)

Returns

output raster with function applied