arcgis.raster.functions module

Raster functions allow you to define processing operations that will be applied to one or more rasters. These functions are applied to the raster data on the fly as the data is accessed and viewed; therefore, they can be applied quickly without having to endure the time it would otherwise take to create a processed product on disk, for which raster analytics tools like arcgis.raster.analytics.generate_raster() can be used.

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

  • Imagery layers

  • Rasters within imagery layers

abs

arcgis.raster.functions.abs(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The abs function calculates the absolute value of the pixels in a raster.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the abs function on the input raster.

abs_op = abs([raster])

acos

arcgis.raster.functions.acos(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The acos operation calculates the inverse cosine of the pixels in a raster.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the acos function on a raster.

acos_op = acos([raster])

acosh

arcgis.raster.functions.acosh(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The acosh operation calculates the inverse hyperbolic cosine of the pixels in a raster.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the acosh function on a raster.

acosh_op = acosh([raster])

aggregate

arcgis.raster.functions.aggregate(raster, dimension=None, aggregation_function=None, aggregation_definition_type='ALL', interval_keyword=None, interval_value=None, interval_unit=None, interval_ranges=None, ignore_nodata=False, dimensionless=False, percentile_value=90, percentile_interpolation_type='NEAREST')

The aggregate function creates a new raster by applying an aggregation function to the input raster.

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

dimension

Optional string. This is the dimension along which the variables will be aggregated.

aggregation_function

Optional string. Specifies the mathematical method that will be used to combine the aggregated slices in an interval.

  • MEAN : Calculates the mean of a pixel’s values across all slices in the interval. This is the default.

  • MAXIMUM : Calculates the maximum value of a pixel across all slices in the interval.

  • MAJORITY : Calculates the value that occurred most frequently for a pixel across all slices in the interval.

  • MINIMUM : Calculates the minimum value of a pixel across all slices in the interval.

  • MINORITY : Calculates the value that occurred least frequently for a pixel across all slices in the interval.

  • MEDIAN : Calculates the median value of a pixel across all slices in the interval.

  • PERCENTILE : Calculates the percentile of values for a pixel across all slices in the interval. The 90th percentile is calculated by default. You can specify other values (from 0 to 100) using the percentile_value parameter.

  • RANGE : Calculates the range of values for a pixel across all slices in the interval.

  • STD : Calculates the standard deviation of a pixel’s values across all slices in the interval.

  • SUM : Calculates the sum of a pixel’s values across all slices in the interval.

  • VARIETY : Calculates the number of unique values of a pixel across all slices in the interval.

You may also pass custom aggregation function. Create an RFT object out of the raster function template item on the portal and specify that as the input to aggregation_function or directly specify the RFT in JSON format as the aggregation_function.

aggregation_definition_type

Optional string. Specifies the dimension interval for which the data will be aggregated.

  • ALL : The data values will be aggregated across all slices. This is the default.

  • INTERVAL_KEYWORD : The variable data will be aggregated using a commonly known interval.

  • INTERVAL_VALUE : The variable data will be aggregated using a user-specified interval and unit.

  • INTERVAL_RANGES : The variable data will be aggregated between specified pairs of values or dates.

interval_keyword

Optional string. Specifies the keyword interval that will be used when aggregating along the dimension. This parameter is required when the aggregation_definition_type parameter is set to INTERVAL_KEYWORD, and the aggregation must be across time.

  • HOURLY : The data values will be aggregated into hourly time steps, and the result will include every hour in the time series.

  • DAILY : The data values will be aggregated into daily time steps, and the result will include every day in the time series.

  • WEEKLY : The data values will be aggregated into weekly time steps, and the result will include every week in the time series.

  • DEKADLY : Divides each month into 3 periods of 10 days each (last period might have more or less than 10 days) and each month would output 3 slices.

  • PENTADLY : Divides each month into 6 periods of 5 days each (last period might have more or less than 5 days) and each month would output 6 slices.

  • MONTHLY : The data values will be aggregated into monthly time steps, and the result will include every month in the time series.

  • QUARTERLY : The data values will be aggregated into quarterly time steps, and the result will include every quarter in the time series.

  • YEARLY : The data values will be aggregated into yearly time steps, and the result will include every year in the time series.

  • RECURRING_DAILY : The data values will be aggregated into daily time steps, and the result includes each one aggregated value per day. The output will include, at most, 366 daily time slices

  • RECURRING_WEEKLY : The data values will be aggregated into weekly time steps, and the result will include one aggregated value per week. The output will include, at most, 53 weekly time slices.

  • RECURRING_MONTHLY : The data values will be aggregated into weekly time steps, and the result will include one aggregated value per month. The output will include, at most, 12 monthly time slices.

  • RECURRING_QUARTERLY : The data values will be aggregated into weekly time steps, and the result will include one aggregated value per quarter. The output will include, at most, 4 quarterly time slices.

interval_value

Optional string. The size of the interval that will be used for the aggregation. This parameter is required when the aggregation_definition_type parameter is set to INTERVAL_VALUE. For example, to aggregate 30 years of monthly temperature data into 5-year increments, enter 5 as the interval_value, and specify interval_unit as YEARS.

interval_unit

Optional string. The unit that will be used for the interval value. This parameter is required when the dimension parameter is set to a time field and the aggregation_definition_type parameter is set to INTERVAL_VALUE. If you are aggregating over anything other than time, this option will not be available and the unit for the interval value will match the variable unit of the input multidimensional raster data.

  • HOURS : The data values will be aggregated into hourly time slices at the interval provided.

  • DAYS : The data values will be aggregated into daily time slices at the interval provided.

  • WEEKS : The data values will be aggregated into weekly time slices at the interval provided.

  • MONTHS : The data values will be aggregated into monthly time slices at the interval provided.

  • YEARS : The data values will be aggregated into yearly time slices at the interval provided.

interval_ranges

Optional list of dictionary objects. Interval ranges specified as list of dictionary objects that will be used to aggregate groups of values. This parameter is required when the aggregation_definition parameter is set to INTERVAL_RANGE. If dimension is StdTime, then the value must be specified in human readable time format (YYYY-MM-DDTHH:MM:SS).

Syntax

[{“minValue”:”<min value>”,”maxValue”:”<max value>”}, {“minValue”:”<min value>”,”maxValue”:”<max value>”}]

Example

[{“minValue”:”2012-01-15T03:00:00”,”maxValue”:”2012-01-15T09:00:00”}, {“minValue”:”2012-01-15T12:00:00”,”maxValue”:”2012-01-15T21:00:00”}]

ignore_nodata

Optional boolean. Specifies whether NoData values are ignored.

  • True : The function will include all valid pixels and ignore any NoData pixels.

  • False : The function will result in NoData if there are any NoData values. This is the default.

dimensionless

Optional boolean. Specifies whether the layer will have dimension values. This parameter is only active if a single slice is selected to create a layer.

  • True : The layer will not have dimension values.

  • False : The layer will have dimension values. This is the default.

percentile_value

Optional float. The percentile to calculate. The default is 90, indicating the 90th percentile. The values can range from 0 to 100. The 0th percentile is essentially equivalent to the minimum statistic, and the 100th percentile is equivalent to maximum. A value of 50 will produce essentially the same result as the median statistic. This option is only honored if the aggregation_function parameter is set to PERCENTILE.

Example:

90

percentile_interpolation_type

Optional string. Specifies the method of percentile interpolation that will be used when there is an even number of values from the input raster to be calculated.

  • NEAREST : The nearest available value to the desired percentile will be used. In this case, the output pixel type will be the same as that of the input value raster. This is the default

  • LINEAR : The weighted average of the two surrounding values from the desired percentile will be used. In this case, the output pixel type will be floating point.

Example:

NEAREST

Returns

The output raster with the function applied.

# Usage Example 1: Calculates the aggregate of the input raster.

aggregate_op = aggregate(raster, aggregation_function="MAXIMUM")

# Usage Example 2: Calculates the aggregate of the input raster based on the specified interval range.

aggregate_op = aggregate(raster,
                         aggregation_function="MEDIAN",
                         aggregation_definition_type="INTERVAL_RANGES",
                         interval_ranges=[{"minValue":"2012-01-15T03:00:00","maxValue":"2012-01-15T09:00:00"},
                                          {"minValue":"2012-01-15T12:00:00","maxValue":"2012-01-15T21:00:00"}
                                         ]
                        )

aggregate_cells

arcgis.raster.functions.aggregate_cells(raster, cell_factor=2, aggregation_type=9, extent_handling=False, ignore_nodata=False)

Generates a reduced-resolution version of a raster.

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

cell_factor

Optional int. The factor by which to multiply the cell size of the input raster to obtain the desired resolution for the output raster. For example, a cell factor value of three would result in an output cell size three times larger than that of the input raster. The value must be an integer greater than 1.

aggregation_type

Optional int. Establishes how the value for each output cell will be determined. The values of the input cells encompassed by the coarser output cell are aggregated by one of the following statistics:

  • 2 (MAXIMUM) : The largest value of the input cells.

  • 3 (MEAN) : The average value of the input cells.

  • 4 (MEDIAN) : The median value of the input cells.

  • 5 (MINIMUM) : The smallest value of the input cells.

  • 9 (SUM) : The sum (total) of the input cell values.This is the default.

extent_handling

Optional boolean. Defines how to handle the boundaries of the input raster when its rows or columns are not a multiple of the cell factor.

  • True : Expands the top or right boundaries of the input raster so the total number of cells in a row or column is a multiple of the cell factor. Those expanded cells are given a value of NoData. With this option, the output raster can cover a larger spatial extent than the input raster. This is the default.

  • False : Reduces the number of rows or columns in the output raster by 1. This will truncate the remaining cells on the top or right boundaries of the input raster, making the number of rows or columns in the input raster a multiple of the cell factor. With this option, the output raster can cover a smaller spatial extent than the input raster.

ignore_nodata

Optional boolean. Denotes whether NoData values are ignored by the aggregation calculation.

  • True : Specifies that if NoData values exist for any of the cells that fall within the spatial extent of a larger cell on the output raster, the NoData values will be ignored when determining the value for output cell locations. Only input cells within the extent of the output cell that have data values will be used in determining the value of the output cell.

  • False : Specifies that if any cell that falls within the spatial extent of a larger cell on the output raster has a value of NoData, the value for that output cell location will be NoData.When the this option is used, it is implied that when cells within an aggregation contain the NoData value, there is insufficient information to perform the specified calculations necessary to determine an output value. This is the default.

Returns

The output raster with the function applied.

apparent_reflectance

arcgis.raster.functions.apparent_reflectance(raster, radiance_gain_values=None, radiance_bias_values=None, reflectance_gain_values=None, reflectance_bias_values=None, sun_elevation=None, albedo=False, scale_factor=None, offset=None)

Function calibrates the digital number (DN) values of imagery from some satellite sensors. The calibration uses sun elevation, acquisition date, sensor gain and bias for each band to derive Top of Atmosphere reflectance, plus sun angle correction.

Argument

Description

raster

Required Raster/ImageryLayer object.

radiance_gain_values

Optional list. The radiance gain values

radiance_bias_values

Optional list. The radiance bias values

reflectance_gain_values

Optional list. The reflectance gain values

reflectance_bias_values

Optional list. The reflectance bias values

sun_elevation

This is sun elevation value, expressed in degrees.

albedo

Optional bool The results of the Apparent Reflectance function can also be expressed as albedo, which is the percentage of the available energy reflected by the planetary surface. Albedo data is used by scientific users for complex modeling and technical remote-sensing applications.

  • False - The function returns apparent reflectance values. This is the default.

  • True - The function returns 32-bit floating-point values, which most commonly are in the range of 0.0 to 1.0. No data clipping is performed if this option is selected.

scale_factor

Optional int. Your apparent reflectance output value can be expressed as an integer. The scaling factor is multiplied by the albedo to convert all floating-point values into integer values.

If the scale factor is either 0 or not specified, default scaling will be applied depending on the pixel type of the input data:

For 16-bit unsigned data types, the default scale factor is 50,000.

For 8-bit unsigned data types, default scale factor is 255.

The scaling factor is always applied when the output is apparent reflectance. No scaling is applied when the output is albedo.

offset

Optional int. Your scaled albedo value can optionally have an offset value:

For 16-bit unsigned data types, the default scale offset is 5,000. For 8-bit unsigned data types, the default scale offset is 0. No scaling is applied when the output is albedo.

Returns

The output raster with the function applied.

apply

arcgis.raster.functions.apply(raster, fn_name, **kwargs)

Applies a server side raster function template defined by the imagery layer (image service) The name of the raster function template is available in the imagery layer properties.rasterFunctionInfos.

Function arguments are optional; argument names and default values are created by the author of the raster function template and are not known through the API. A client can simply provide the name of the raster function template only or, optionally, provide arguments to overwrite the default values. For more information about authoring server-side raster function templates, see Server-side raster functions.

The arguments for this function are as follows:

Argument

Description

raster

Required Raster/ImageryLayer object.

fn_name

name of the server side raster function template, See imagery layer properties.rasterFunctionInfos

kwargs

keyword arguments to override the default values of the raster function template, including astype

Returns

The output raster with the function applied.

arg_max

arcgis.raster.functions.arg_max(rasters, undefined_class=None, astype=None)

In the ArgMax method, all raster bands from every input raster are assigned a 0-based incremental band index, which is first ordered by the input raster index, as shown in the table below, and then by the relative band order within each input raster.

See http://desktop.arcgis.com/en/arcmap/latest/manage-data/raster-and-images/argstatistics-function.htm

The arguments for this function are as follows:

Argument

Description

rasters

Required Raster/ImageryLayer objects filtered by where clause, spatial and temporal filters

undefined_class

Requred int.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

arg_median

arcgis.raster.functions.arg_median(rasters, undefined_class=None, astype=None)

The ArgMedian method returns the Band index for which the given pixel attains the median value of values from all bands.

Consider values from all bands as an array. After sorting the array in ascending order, the median is the one value separating the lower half of the array from the higher half. More specifically, if the ascend-sorted array has n values, the median is the ith (0-based) value, where: i = ( (n-1) / 2 )

See http://desktop.arcgis.com/en/arcmap/latest/manage-data/raster-and-images/argstatistics-function.htm

The arguments for this function are as follows:

Argument

Description

rasters

Required Raster/ImageryLayer objects filtered by where clause, spatial and temporal filters

undefined_class

Required int.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

arg_min

arcgis.raster.functions.arg_min(rasters, undefined_class=None, astype=None)

ArgMin is the argument of the minimum, which returns the Band index for which the given pixel attains its minimum value.

See http://desktop.arcgis.com/en/arcmap/latest/manage-data/raster-and-images/argstatistics-function.htm

The arguments for this function are as follows:

Argument

Description

rasters

Required Raster/ImageryLayer objects filtered by where clause, spatial and temporal filters

undefined_class

Required int

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

arg_statistics

arcgis.raster.functions.arg_statistics(rasters, stat_type=None, min_value=None, max_value=None, undefined_class=None, astype=None)

The arg_statistics function produces an output with a pixel value that represents a statistical metric from all bands of input rasters. The statistics can be the band index of the maximum, minimum, or median value, or the duration (number of bands) between a minimum and maximum value

See http://desktop.arcgis.com/en/arcmap/latest/manage-data/raster-and-images/argstatistics-function.htm

Argument

Description

rasters

Required Raster/ImageryLayer objects filtered by where clause, spatial and temporal filters

stat_type

Optional string. one of “max”, “min”, “median”, “duration”

min_value

Optional float, required if the stat_type is “duration”

max_value

Optional float, required if the stat_type is “duration”

undefined_class

Optional int, required if the stat_type is “max” or “min”

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

arithmetic

arcgis.raster.functions.arithmetic(raster1, raster2, extent_type='FirstOf', cellsize_type='FirstOf', astype=None, operation_type=1)

The arithmetic function performs an arithmetic operation between two rasters or a raster and a scalar, and vice versa.

The arguments for the function are as follows:

Argument

Description

raster1

Required first input Raster/ImageryLayer object filtered by where clause, spatial and temporal filters.

raster2

Required second input Raster/ImageryLayer object filtered by where clause, spatial and temporal filters.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

operation_type

Optional int. Available options include:

1 = Plus. This is the default.

2 = Minus

3 = Multiply

4 = Divide

5 = Power

6 = Mode

Returns

The output raster with this function applied.

# Usage Example 1: Applies the multiplication opeeration on two rasters.

arithmetic_op = arithmetic(raster1=raster_obj_1, raster2=raster_obj_2, operation_type=3)

asin

arcgis.raster.functions.asin(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The asin operation calculates the inverse sine of the pixels in a raster.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the asin function on a raster.

asin_op = asin([raster])

asinh

arcgis.raster.functions.asinh(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The asinh function calculates the inverse hyperbolic sine of the pixels in a raster.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the asinh function on a raster.

asinh_op = asinh([raster])

aspect

arcgis.raster.functions.aspect(raster)

The aspect function identifies the downslope direction of the maximum rate of change in value from each cell to its neighbors. Aspect can be thought of as the slope direction. The values of the output raster will be the compass direction of the aspect. For more information, see Aspect function and How Aspect works.

Argument

Description

raster

Required input Raster/ImageryLayer object.

Returns

aspect applied to the input raster

# Usage Example 1: Applies the aspect function on a raster.

aspect_op = aspect(raster)

aspect_slope

arcgis.raster.functions.aspect_slope(raster, z_factor=1)

The aspect_slope function creates a raster layer that simultaneously displays the aspect and slope of a surface.

Argument

Description

raster

Required input Raster/ImageryLayer object.

z_factor

Optional float. A multiplication factor that converts the vertical (elevation) values to the linear units of the horizontal (x,y) coordinate system. Use larger values to add vertical exaggeration. Default is 1.

Returns

aspect_slope applied to the input raster

# Usage Example 1: Apply the aspect_slope function to an input raster.

aspect_slope_op = aspect_slope(raster)

atan

arcgis.raster.functions.atan(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The atan function calculates the inverse tangent of the pixels in a raster.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the atan function on a raster.

atan_op = atan([raster])

atan2

arcgis.raster.functions.atan2(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The atan2 function calculates the inverse tangent (with quadrant correction) of the pixels in a raster.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the atan2 function on a raster.

atan2_op = atan2([raster])

atanh

arcgis.raster.functions.atanh(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The atanh function calculates the inverse hyperbolic tangent of the pixels in a raster.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the atanh function on a raster.

atanh_op = atanh([raster])

bai

arcgis.raster.functions.bai(raster, band_indexes='3 4', astype=None)

The Burn Area Index (BAI) uses the reflectance values in the red and NIR portion of the spectrum to identify the areas of the terrain affected by fire.

BAI = 1/((0.1 -RED)^2 + (0.06 - NIR)^2)

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object

band_indexes

Optional string/list of band indexes.

  • “Red NIR”, e.g., “3 4” or [3,4]

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

band_arithmetic

arcgis.raster.functions.band_arithmetic(raster, band_indexes=None, astype=None, method=0)

The band_arithmetic function performs an arithmetic operation on the bands of a raster. For more information, see Band Arithmetic function at http://desktop.arcgis.com/en/arcmap/latest/manage-data/raster-and-images/band-arithmetic-function.htm

Argument

Description

raster

Required input Raster/ImageryLayer object.

band_indexes

Optional string or list. Band indexes can be given as a space seperated string or a list of integers or floating point values. e.g., “4 3” or [4,3]. For user defined methods the band index can be given as an expression such as “(B3 - B1)/(B3 + B1)”.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

method

Optional int. The type of band arithmetic algorithm you want to deploy. You can define your custom algorithm, or choose a predefined index.

0 = UserDefined

1 = NDVI

2 = SAVI

3 = TSAVI

4 = MSAVI

5 = GEMI

6 = PVI

7 = GVITM

8 = Sultan

9 = VARI

10 = GNDVI

11 = SR

12 = NDVIre

13 = SRre

14 = MTVI2

15 = RTVICore

16 = CIre

17 = CIg

18 = NDWI

19 = EVI

20 = IronOxide

21 = FerrousMinerals

22 = ClayMinerals

23 = WNDWI

24 = BAI

25 = NBR

26 = NDBI

27 = NDMI

28 = NDSI

29 = MNDW

Returns

The output raster with the function applied.

# Usage Example 1: Apply the 'NDVI' band arithmetic algorithm on the input raster.

band_op = band_arithmetic(raster, method=1)

# Usage Example 2: Apply user defined band arithmetic algorithm on the input raster.

band_operation = "(B3 - B1)/(B3 + B1)"
band_op = band_arithmetic(raster, band_indexes=band_operation, method=0)

bitwise_and

arcgis.raster.functions.bitwise_and(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The bitwise_and function performs a Bitwise And operation on the binary values of two input rasters.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the bitwise_and operation on two rasters.
# Extent here is defined by all rasters.

raster_list = [raster1, raster2]
bitwise_and_op = bitwise_and(raster_list, extent_type="UnionOf")

bitwise_left_shift

arcgis.raster.functions.bitwise_left_shift(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The bitwise_left_shift function performs a Bitwise Left Shift operation on the binary values of two input rasters.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Tip

This raster operation can also be performed by invoking the << operator between the two input rasters.

Example: op_raster = raster1 << raster2

Returns

The output raster with the function applied.

# Usage Example 1: Executes the bitwise_left_shift function on two rasters.

raster_list = [raster1, raster2]
bitwise_left_shift_op = bitwise_left_shift(raster_list)

bitwise_not

arcgis.raster.functions.bitwise_not(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The bitwise_not function performs a Bitwise Not operation on the binary values of an input raster.

The arguments for this function are as follows:

Argument

Description

rasters

Required Raster/ImageryLayer object. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the bitwise_not function on the input raster.

bitwise_not_op = bitwise_not([raster])

bitwise_or

arcgis.raster.functions.bitwise_or(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The bitwise_or function performs a Bitwise Or operation on the binary values of two input rasters.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the bitwise_or function on two rasters.

raster_list = [raster1, raster2]
bitwise_or_op = bitwise_or(raster_list)

bitwise_right_shift

arcgis.raster.functions.bitwise_right_shift(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The bitwise_right_shift function performs a Bitwise Right Shift operation on the binary values of two input rasters.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Tip

This raster operation can also be performed by invoking the >> operator between the two input rasters.

Example: op_raster = raster1 >> raster2

Returns

The output raster with the function applied.

# Usage Example 1: Executes the bitwise_right_shift function on two rasters.

raster_list = [raster1, raster2]
bitwise_right_shift_op = bitwise_right_shift(raster_list)

bitwise_xor

arcgis.raster.functions.bitwise_xor(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The bitwise_xor function performs a Bitwise Xor operation on the binary values of two input rasters.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the bitwise_xor function on two rasters.

raster_list = [raster1, raster2]
bitwise_xor_op = bitwise_xor(raster_list)

boolean_and

arcgis.raster.functions.boolean_and(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The boolean_and function performs a Boolean And operation on the pixels of two input rasters.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Tip

This raster operation can also be performed by invoking the & operator between the two input rasters.

Example: op_raster = raster1 & raster2

Returns

The output raster with the function applied.

# Usage Example 1: Executes the boolean_and function on two rasters.

raster_list = [raster1, raster2]
boolean_and_op = boolean_and(raster_list)

boolean_not

arcgis.raster.functions.boolean_not(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The boolean_not function performs a Boolean Not operation on the pixels of an input raster.

The arguments for this function are as follows:

Argument

Description

rasters

Required Raster/ImageryLayer object. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

Tip

This raster operation can also be performed by invoking the ~ operator in front of the input raster.

Example: op_raster = ~raster1

# Usage Example 1: Executes the boolean_not function on a raster.

boolean_not_op = boolean_not([raster1])

boolean_or

arcgis.raster.functions.boolean_or(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The boolean_or function performs a Boolean Or operation on the pixels of two input rasters.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Tip

This raster operation can also be performed by invoking the | operator between the two input rasters.

Example: op_raster = raster1 | raster2

Returns

The output raster with the function applied.

# Usage Example 1: Executes the boolean_or function on two rasters.

raster_list = [raster1, raster2]
boolean_or_op = boolean_or(raster_list)

boolean_xor

arcgis.raster.functions.boolean_xor(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The boolean_xor function performs a Boolean Xor operation on the pixels of two input rasters.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

Tip

This raster operation can also be performed by invoking the ^ operator between the two input rasters.

Example: To perform Boolean Xor between raster1 and raster2:

op_raster = raster2 ^ raster1

# Usage Example 1: Executes the boolean_xor function on two rasters.

raster_list = [raster1, raster2]
boolean_xor_op = boolean_xor(raster_list)

buffered

arcgis.raster.functions.buffered(raster)

The Buffered function is used to optimize the performance of complex function chains. It stores the output from the part of the function chain that comes before it in memory.

The arguments for this function are as follows:

Argument

Description

raster

Required Raster/ImageryLayer object.

Returns

The output raster with the function applied.

ccdc_analysis

arcgis.raster.functions.ccdc_analysis(raster, bands_for_detecting_change=[], bands_for_temporal_masking=[], chi_squared_threshold=0.99, min_anomaly_observations=6, update_frequency=1)

Function evaluates changes in pixel values over time using the Continuous Change Detection and Classification (CCDC) method and generates a change analysis raster containing the model results.

Note

This raster function is only supported in conjunction with the detect_change_using_change_analysis_raster function. To persist the output give the output of the ccdc_analysis function as input to the detect_change_using_change_analysis_raster() method and use the save() method on the resulting layer.

Argument

Description

raster

Required Raster/ImageryLayer object. The input multidimensional raster.

bands_for_detecting_change

Optional List. The band IDs to use for change detection. If no band IDs are provided, all the bands from the input raster dataset will be used.

Example:

[1,2,3,4,6]

bands_for_temporal_masking

Optional List. The band IDs of the green band and the SWIR band, to be used to mask for cloud, cloud shadow and snow. If band IDs are not provided, no masking will occur. Each element in the list should be within the range 1 to n where n is the number of bands of the input raster.

Example:

[1,2]

chi_squared_threshold

Optional Float. The chi-square change probability threshold. If an observation has a calculated change probability that is above this threshold, it is flagged as an anomaly, which is a potential change event. The default value is 0.99.

Example:

0.99

min_anomaly_observations

Optional Integer. The minimum number of consecutive anomaly observations that must occur before an event is considered a change. A pixel must be flagged as an anomaly for the specified number of consecutive time slices before it is considered a true change. The default value is 6.

Example:

6

update_frequency

Optional Float. The value that represents the update frequency. The default value is 1.

Example:

1

Returns

The output raster with the function applied.

# Usage Example 1: This example performs continuous change detection where only one band is used in the change detection
# and the chi-squared probability threshold is 0.90.
ccdc_analysis_op = ccdc_analysis(raster=input_multidimensional_raster,
                                 bands_for_detecting_change=[1],
                                 bands_for_temporal_masking=[],
                                 chi_squared_threshold=0.90,
                                 min_anomaly_observations=6,
                                 update_frequency=1
                                )

cire

arcgis.raster.functions.cire(raster, band_indexes='7 6', astype=None)

The Chlorophyll Index - Red-Edge (CIre) is a vegetation index for estimating the chlorophyll content in leaves using the ratio of reflectivity in the near-infrared (NIR) and red-edge bands.

CIre = [(NIR / RedEdge)-1]

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object

band_indexes

Optional string/list of band indexes.

  • “NIR RedEdge”, e.g., “7 6” or [7,6]

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

cig

arcgis.raster.functions.cig(raster, band_indexes='7 3', astype=None)

The Chlorophyll Index - Green (CIg) is a vegetation index for estimating the chlorophyll content in leaves using the ratio of reflectivity in the near-infrared (NIR) and green bands.

CIg = [(NIR / Green)-1]

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object

band_indexes

Optional string/list of band indexes.

  • “NIR Green”, e.g., “7 3” or [7,3]

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

classify

arcgis.raster.functions.classify(raster1, raster2=None, classifier_definition=None, astype=None)

classifies a segmented raster to a categorical raster.

The arguments for this function are as follows:

Argument

Description

raster1

Required first input Raster/ImageryLayer object filtered by where clause, spatial and temporal filters

raster2

Optional segmentation Raster/ImageryLayer object - If provided, pixels in each segment will get same class assignments. imagery layers filtered by where clause, spatial and temporal filters

classifier_definition

The classifier parameters as a Python dictionary / json format

Returns

The output raster with the function applied.

clay_minerals

arcgis.raster.functions.clay_minerals(raster, band_indexes='6 7', astype=None)

The Clay Minerals (CM) ratio is a geological index for identifying mineral features containing clay and alunite using two shortwave infrared (SWIR) bands. CM is used in mineral composite mapping.

CM = SWIR1 / SWIR2

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object

band_indexes

Optional string/list of band indexes.

  • “SWIR1 SWIR2”, e.g., “6 7” or [6,7]

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster.

clip

arcgis.raster.functions.clip(raster, geometry=None, clip_outside=True, astype=None, clipping_raster=None, use_input_geometry=True)

Clips a raster using a rectangular shape according to the extents defined or will clip a raster to the shape of an input polygon. The shape defining the clip can clip the extent of the raster or clip out an area within the raster.

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object

goemetry

Optional dictionary. Specifies the geometry for clipping.

clip_outside

Optional boolean, If True, the imagery outside the extents will be removed, else the imagery within the clipping geometry will be removed.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

clipping_raster

Optional Raster/ImageryLayer object. Specifies the raster from which the extent needs to be used for clipping.

use_input_geometry

Optional boolean. If True, the function uses the clip geometry defined by the geometry parameter. This is the default. If False, the function uses the extent of the clip geometry defined by the geometry parameter.

Returns

The clipped raster.

colormap

arcgis.raster.functions.colormap(raster, colormap_name=None, colormap=None, colorramp=None, astype=None)

The colormap function transforms the pixel values to display the raster data as a color (RGB) image, based on specific colors in a color map. For more information, see Colormap function at http://desktop.arcgis.com/en/arcmap/latest/manage-data/raster-and-images/colormap-function.htm

Argument

Description

raster

Required input Raster/ImageryLayer object.

colormap_name

Optional string. The colormap name. Available options are - “Random” | “NDVI” | “Elevation” | “Gray”.

colormap

Optional list.

Syntax

[

[<value1>, <red1>, <green1>, <blue1>], //[int, int, int, int] [<value2>, <red2>, <green2>, <blue2>]

]

colorramp

Can be a string specifiying color ramp name like - “Black To White” | “Yellow To Red” | “Slope” | more… For more information about colorramp object, see color ramp object at

https://developers.arcgis.com/documentation/common-data-types/color-ramp-objects.htm

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The colorized output raster.

# Usage Example 1: Apply NDVI color map to the raster to detect live vegetation.

colormap_op = colormap(raster, colormap="NDVI")

colormap_to_rgb

arcgis.raster.functions.colormap_to_rgb(raster)

The colormap_to_rgb function is designed to work with single band image service that has internal colormap. It will convert the image into a three-band 8-bit RGB raster. This function takes no arguments except an input raster. For qualified image service, there are two situations when ColormapToRGB function is automatically applied: The “colormapToRGB” property of the image service is set to true; or, client asks to export image into jpg or png format. For more information, see http://desktop.arcgis.com/en/arcmap/latest/manage-data/raster-and-images/colormap-to-rgb-function.htm)

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

Returns

The output raster.

# Usage Example 1: Converts the input raster into a three-band RGB raster.

rgb_op = colormap_to_rgb(raster)

colorspace_conversion

arcgis.raster.functions.colorspace_conversion(raster, conversion_type='rgb_to_hsv')

The ColorspaceConversion function converts the color model of a three-band unsigned 8-bit image from either the hue, saturation, and value (HSV) to red, green, and blue (RGB) or vice versa. An ExtractBand function and/or a Stretch function are sometimes used for converting the imagery into valid input of ColorspaceConversion function. For more information, see http://desktop.arcgis.com/en/arcmap/latest/manage-data/raster-and-images/color-model-conversion-function.htm

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

conversion_type

Optional string, one of “rgb_to_hsv” or “hsv_to_rgb”. Default is “rgb_to_hsv”

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster.

complex

arcgis.raster.functions.complex(raster)

Complex function computes magnitude from complex values. It is used when input raster has complex pixel type. It computes magnitude from complex value to convert the pixel type to floating point for each pixel. It takes no argument but an optional input raster. For more information, see http://desktop.arcgis.com/en/arcmap/latest/manage-data/raster-and-images/complex-function.htm

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

Returns

The output raster.

composite_band

arcgis.raster.functions.composite_band(rasters, astype=None, cellsize_type='MaxOf')

Combines multiple images to form a multiband image.

The arguments for this function are as follows:

Argument

Description

rasters

Required input Raster/ImageryLayer objects.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

Returns

The multiband image.

compute_change

arcgis.raster.functions.compute_change(raster1, raster2, method=0, from_class_values=[], to_class_values=[], filter_method=1, define_transition_colors=0, extent_type='IntersectionOf', cellsize_type='MaxOf', from_class_name_field_name=None, to_class_name_field_name=None)

Produce raster outputs representing of various changes. Function available in ArcGIS Image Server 10.8.1 and higher.

Argument

Description

raster1

Required Raster/ImageryLayer object. The first raster for compute change function. To evaluate change from time 1 (earlier) to time 2 (later), enter the time 1 raster here.

raster2

Required Raster/ImageryLayer object. The second raster for compute change function. To evaluate change from time 1 (earlier) to time 2 (later), enter the time 2 raster.

method

Optional string. Specifies the method to be used.

  • DIFFERENCE : The mathematical difference, or subtraction, between the pixel values in the input rasters will be calculated. This is the default.

  • RELATIVE_DIFFERENCE : The difference in pixel values, accounting for the magnitudes of the values being compared, will be calculated.

  • CATEGORICAL_DIFFERENCE : The difference between two categorical or thematic rasters will be calculated, where the output contains class transitions that occurred between the two rasters.

Example:

“DIFFERENCE”

from_class_values

Optional list. List of integer values corresponding to the ClassValue field in raster1. Required if method is CATEGORICAL_DIFFERENCE.

to_class_values

Optional list. List of integer values corresponding to the ClassValue field in raster2. Required if method is CATEGORICAL_DIFFERENCE.

filter_method

Optional string. Default value is “CHANGED_PIXELS_ONLY” (1).

Possible options are:

  • ALL

  • CHANGED_PIXELS_ONLY

  • UNCHANGED_PIXELS_ONLY

define_transition_colors

Optional string. Defines the method used to assign color for the output classes

  • AVERAGE : The color of the pixel will be the average of the color of its original class and the color of its final class.

  • FROM_COLOR : The color of the pixel will be the color of its original class.

  • TO_COLOR : The color of the pixel will be the color of its final class.

extent_type

Optional string. One of “FirstOf”, “IntersectionOf” “UnionOf”, “LastOf”

cellsize_type

Optional string. One of “FirstOf”, “MinOf”, “MaxOf “MeanOf”, “LastOf”

from_class_name_field_name

Optional string. A field that stores class names in the raster1. The function automatically searches for CLASSNAME field or CLASS_NAME field to use. Use this parameter if the input does not contain these standard field names Example: “CLASSES”

to_class_name_field_name

Optional string. A field that stores class names in the raster2. The function automatically searches for CLASSNAME field or CLASS_NAME field to use. Use this parameter if the input does not contain these standard field names Example: “CLASSES”

Returns

Raster/ImageryLayer

con

arcgis.raster.functions.con(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The con function performs a conditional if/else evaluation on each of the input cells of an input raster. For more information see, http://desktop.arcgis.com/en/arcmap/latest/tools/spatial-analyst-toolbox/con-.htm

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

Usage Example 1: To extract raster from flow direction raster layer that only covers the watershed.
               rasters:
               ["Input raster representing the true or false result of the desired condition. It can be of integer or floating point type.",
                "The input whose values will be used as the output cell values if the condition is true. It can be an integer or a floating point raster, or a constant value.",
                "The input whose values will be used as the output cell values if the condition is false. It can be an integer or a floating point raster, or a constant value."]

con_op = con([stowe_watershed_lyr, Stowe_fill_flow_direction_lyr, 0])

constant_raster

arcgis.raster.functions.constant_raster(constant, raster_info, gis=None)

Creates a virtual raster with a single pixel value.

The arguments for this function are as follows:

Argument

Description

constant

Required list. The value of the constant to be added to the virtual raster.

raster_info

Required Raster info dictionary or arcgis.raster.RasterInfo object or ImageryLayer object to set the properties of the output raster. if ImageryLayer is specified then the raster information is obtained from the ImageryLayer specified.

Example for RasterInfo dict -

{‘bandCount’: 3, ‘extent’: {“xmin”: 4488761.95, “ymin”: 5478609.805, “xmax”: 4489727.05, “ymax”: 5479555.305, “spatialReference”: { “wkt”: “PROJCS[“Deutsches_Hauptdreiecksnetz_Transverse_Mercator”, GEOGCS[“GCS_Deutsches_Hauptdreiecksnetz”, DATUM[“D_Deutsches_Hauptdreiecksnetz”, SPHEROID[“Bessel_1841”, 6377397.155,299.1528128]], PRIMEM[“Greenwich”, 0.0], UNIT[“Degree”, 0.0174532925199433]], PROJECTION[“Transverse_Mercator”], PARAMETER[“false_easting”, 4500000.0], PARAMETER[“false_northing”, 0.0], PARAMETER[“central_meridian”, 12.0], PARAMETER[“scale_factor”, 1.0], PARAMETER[“latitude_of_origin”, 0.0], UNIT[“Meter”, 1.0]]” }}, ‘pixelSizeX’: 0.0999999999999614, ‘pixelSizeY’: 0.1, ‘pixelType’: ‘U8’}

gis

Optional gis. gis parameter can be specified to render the output raster dynamically using the raster rendering service of the gis. If not provided, active gis will be used to do this. If gis parameter is not specified the output of constant_raster() cannot be displayed.

Returns

The output raster.

contour

arcgis.raster.functions.contour(raster, adaptive_smoothing=2.5, contour_type='CONTOUR_LINES', z_base=0, number_of_contours=0, contour_interval=100, nth_contour_line_in_bold=5, z_factor=1)

The contour function creates contour lines from the input raster.

The arguments for the function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object created from a DEM.

adaptive_smoothing

Optional float. The amount of smoothing to apply to the contour line. The default value is 2.5. A lower value produces a contour line with more granularity and less smoothing, while a higher value produces a contour line with more smoothing that appears less jagged.

contour_type

Optional string. Specifies the type of contour to be created. Available values include:

  • “CONTOUR_LINES” - Joins points of equal elevation to create a line representing constant elevation. This is the default.

  • “CONTOUR_FILL” - Fills the area between every contour line with the quantized elevation value.

  • “SMOOTH_SURFACE_ONLY” - Smooths the input elevation layer but does not produce contours.

z_base

Optional float. The base contour value. Contours are generated above and below this value as needed to cover the entire value range of the input raster. The default value is 0.

number_of_contours

Optional int. The number of contours to be generated in the display. This dynamically adjusts the contour interval to fit the terrain in the display while maintaining standardized intervals such as 1, 5, 10, and so on. The default value is 0.

contour_interval

Optional float. The difference in altitude between contour lines. The default value is 100.

nth_contour_line_in_bold

Optional int. The nth contour line that would be rendered in bold. The default value is 5; thus, every 5th contour line is bold.

z_factor

The unit conversion factor used when generating contours. The default value is 1.

Returns

The output raster with the function applied.

# Usage Example 1: Displays 50 units spaced contours in the raster

contour_op = contour(raster, contour_interval=50)

# Usage Example 2: Smoothes the input elevation layer. Note that this does not produce contours.

contour_op = contour(raster, contour_type="SMOOTH_SURFACE_ONLY")

contrast_brightness

arcgis.raster.functions.contrast_brightness(raster, contrast_offset=2, brightness_offset=1, astype=None)

The ContrastBrightness function enhances the appearance of raster data (imagery) by modifying the brightness or contrast within the image. This function works on 8-bit input raster only.

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

contrast_offset

float, between -100 to +100

brightness_offset

float, between -100 to +100

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster.

convolution

arcgis.raster.functions.convolution(raster, kernel=None, astype=None)

The Convolution function performs filtering on the pixel values in an image, which can be used for sharpening an image, blurring an image, detecting edges within an image, or other kernel-based enhancements. For more information, see Convolution function at http://desktop.arcgis.com/en/arcmap/latest/manage-data/raster-and-images/convolution-function.htm

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

kernel

well known kernel from arcgis.raster.kernels or user defined kernel passed as a list of list

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster.

cos

arcgis.raster.functions.cos(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The cos function calculates the cosine of the pixels in a raster.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the cos function on a raster.

cos_op = cos([raster])

cosh

arcgis.raster.functions.cosh(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The cosh function calculates the hyperbolic cosine of the pixels in a raster.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the cosh function on a raster.

cosh_op = cosh([raster])

curvature

arcgis.raster.functions.curvature(raster, curvature_type='standard', z_factor=1, astype=None)

The Curvature function displays the shape or curvature of the slope. A part of a surface can be concave or convex; you can tell that by looking at the curvature value. The curvature is calculated by computing the second derivative of the surface. Refer to this conceptual help on how it works.

http://desktop.arcgis.com/en/arcmap/latest/manage-data/raster-and-images/curvature-function.htm

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

curvature_type

Optional string. One of ‘standard’, ‘planform’, ‘profile’

z_factor

Optional float

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster.

detect_change_using_change_analysis_raster

arcgis.raster.functions.detect_change_using_change_analysis_raster(raster, change_type='TIME_OF_LATEST_CHANGE', max_number_of_changes=1, segment_date='BEGINNING_OF_SEGMENT', change_direction='ALL', filter_by_year=False, min_year=None, max_year=None, filter_by_duration=False, min_duration=None, max_duration=None, filter_by_magnitude=False, min_magnitude=None, max_magnitude=None, filter_by_start_value=False, min_start_value=None, max_start_value=None, filter_by_end_value=False, min_end_value=None, max_end_value=None)

Function generates a raster containing pixel change information using the output change analysis raster from the arcgis.raster.analytics.analyze_changes_using_ccdc() function or arcgis.raster.analytics.analyze_changes_using_landtrendr() function. Function available in ArcGIS Image Server 10.8.1 and higher.

Argument

Description

raster

Required Raster/ImageryLayer object. The raster generated from the analyze_changes_using_ccdc or analyze_changes_using_landtrendr.

change_type

Optional String. Specifies the change information to calculate.

  • TIME_OF_LATEST_CHANGE (0) - Each pixel will contain the date of the most recent change for that pixel in the time series.

  • TIME_OF_EARLIEST_CHANGE (1) - Each pixel will contain the date of the earliest change for that pixel in the time series.

  • TIME_OF_LARGEST_CHANGE (2) - Each pixel will contain the date of the most significant change for that pixel in the time series.

  • NUM_OF_CHANGES (3) - Each pixel will contain the total number of times the pixel changed in the time series.

  • TIME_OF_LONGEST_CHANGE (4) - Each pixel will contain the date of change at the end of the longest transition segment in the time series. Option available in ArcGIS Image Server 10.9 and higher.

  • TIME_OF_SHORTEST_CHANGE (5) - Each pixel will contain the date of change at the end of the shortest transition segment in the time series. Option available in ArcGIS Image Server 10.9 and higher.

  • TIME_OF_FASTEST_CHANGE (6) - Each pixel will contain the date of change at the end of the transition that occurred most quickly. Option available in ArcGIS Image Server 10.9 and higher.

  • TIME_OF_SLOWEST_CHANGE (7) - Each pixel will contain the date of change at the end of the transition that occurred most slowly. Option available in ArcGIS Image Server 10.9 and higher.

Example:

“TIME_OF_LATEST_CHANGE”

max_number_of_changes

Optional Integer. The maximum number of changes per pixel that will be calculated. This number corresponds to the number of bands in the output raster. The default is 1, meaning only one change date will be calculated, and the output raster will contain only one band.

This parameter is not available when the change_type parameter is set to NUM_OF_CHANGES.

Example:

3

segment_date

Optional string. Specifies whether to extract the date at the beginning of a change segment, or the end.

This parameter is available only when the input change analysis raster is the output from the arcgis.raster.analytics.analyze_changes_using_landtrendr function.

  • BEGINNING_OF_SEGMENT - Extract the date at the beginning of a change segment. This is the default.

  • END_OF_SEGMENT - Extract the date at the end of a change segment.

Example:

“END_OF_SEGMENT”

Parameter available in ArcGIS Image Server 10.9 and higher.

change_direction

Optional string. The direction of change to be included in the analysis. For example, choose Increasing to only extract date of change information for periods where the change is in the positive or increasing direction.

This parameter is available only when the input change analysis raster is the output from the analyze_changes_using_landtrendr function.

  • ALL - All change directions will be included in the output. This is the default.

  • INCREASE - Only change in the positive or increasing direction will be included in the output.

  • DECREASE - Only change in the negative or decreasing direction will be included in the output.

Example:

“DECREASE”

Parameter available in ArcGIS Image Server 10.9 and higher.

filter_by_year

Optional boolean. Specifies whether to filter by a range of years.

  • True - Filter results such that only changes that occurred within a specific range of years is included in the output.

  • False - Do not filter results by year. This is the default.

Example:

True

Parameter available in ArcGIS Image Server 10.9 and higher.

min_year

Optional int. The earliest year to use to filter results. This parameter is required if the filter_by_year parameter is set to True.

Example:

2000

Parameter available in ArcGIS Image Server 10.9 and higher.

max_year

Optional int. The latest year to use to filter results. This parameter is required if the filter_by_year parameter is set to True.

Example:

2005

Parameter available in ArcGIS Image Server 10.9 and higher.

filter_by_duration

Optional boolean. Specifies whether to filter by the change duration. This parameter is available only when the input change analysis raster is the output from the analyze_changes_using_landtrendr function.

  • True - Filter results by duration such that only the changes that lasted a given amount of time will be included in the output.

  • False - Do not filter results by duration. This is the default.

Example:

True

Parameter available in ArcGIS Image Server 10.9 and higher.

min_duration

Optional float. The minimum number of consecutive years to include in the results. This parameter is required if the filter_by_duration parameter is set to True

Example:

2

Parameter available in ArcGIS Image Server 10.9 and higher.

max_duration

Optional float. The maximum number of consecutive years to include in the results. This parameter is required if the filter_by_duration parameter is set to True

Example:

4

Parameter available in ArcGIS Image Server 10.9 and higher.

filter_by_magnitude

Optional boolean. Specifies whether to filter by change magnitude.

  • True - Filter results by magnitude such that only the changes of a given magnitude will be included in the output.

  • False - Do not filter results by magnitude. This is the default.

Example:

True

Parameter available in ArcGIS Image Server 10.9 and higher.

min_magnitude

Optional float. The minimum magnitude to include in the results. This parameter is required if the filter_by_magnitude parameter is set to True.

Example:

0.25

Parameter available in ArcGIS Image Server 10.9 and higher.

max_magnitude

Optional float. The maximum magnitude to include in the results. This parameter is required if the filter_by_magnitude parameter is set to True.

Example:

3

Parameter available in ArcGIS Image Server 10.9 and higher.

filter_by_start_value

Optional boolean. Specifies whether to filter by start value. This parameter is available only when the input change analysis raster is the output from the arcgis.raster.analytics.analyze_changes_using_landtrendr function.

  • True - Filter results by start value so that only the change that starts with value defined by a range.

  • False - Do not filter by start value. This is the default.

Example:

True

Parameter available in ArcGIS Image Server 10.9 and higher.

min_start_value

Optional float. The minimum value that defines the range of start value. This parameter is required if the filter_by_start_value parameter is set to True.

Example:

0.75

Parameter available in ArcGIS Image Server 10.9 and higher.

max_start_value

Optional float. The maximum value that defines the range of start value. This parameter is required if the filter_by_start_value parameter is set to True.

Example:

0.9

Parameter available in ArcGIS Image Server 10.9 and higher.

filter_by_end_value

Optional boolean. Specifies whether to filter by end value. This parameter is available only when the input change analysis raster is the output from the arcgis.raster.analytics.analyze_changes_using_landtrendr function.

  • True - Filter results by end value so that only the change that ends with value defined by a range.

  • False - Do not filter results by end value. This is the default.

Example:

True

Parameter available in ArcGIS Image Server 10.9 and higher.

min_end_value

Optional float. The minimum value that defines the range of end value. This parameter is required if the filter_by_end_value parameter is set to True.

Example:

-0.12

Parameter available in ArcGIS Image Server 10.9 and higher.

max_end_value

Optional float. The maximum value that defines the range of end value. This parameter is required if the filter_by_end_value parameter is set to True.

Example:

0.35

Parameter available in ArcGIS Image Server 10.9 and higher.

Returns

Raster/ImageryLayer

dimensional_moving_statistics

arcgis.raster.functions.dimensional_moving_statistics(raster, dimension=None, backward_window=1, forward_window=1, nodata_handling='DATA', statistics_type='MEAN', percentile_value=90, percentile_interpolation_type='AUTO_DETECT', circular_wrap_value=360)

The dimensional_moving_statistics function calculates statistics over a moving window on multidimensional data along a specified dimension.

Note

This raster function does not support on the fly rendering and can only be used to generate persisted output. To persist the output use the save() method on the resulting layer.

The arguments for this function are as follows:

Argument

Description

raster

Required multidimensional Raster/ImageryLayer object.

dimension

Optional string. The name of the dimension along which the window will move.

The default value is the first dimension other than x,y found in the input multidimensional raster.

backward_window

Optional integer. The value of how many slices before or above to be included in the defined window. The value must be a positive integer from 1 to 100. The default value is 1.

The unit of this parameter is slice.

forward_window

Optional integer. The value of how many slices after or below to be included in the defined window. The value must be a positive integer from 1 to 100. The default value is 1.

The unit of this parameter is slice.

nodata_handling

Optional string. Specifies how NoData values will be handled by the statistic calculation.

  • DATA - NoData values in the value input will be ignored in the results of the defined window that they fall within. This is the default.

  • NODATA - Output values will be NoData if any NoData values are found in the input within the defined window.

  • FILL_NODATA - NoData cell values will be replaced using the selected statistic on the values within the defined window.

statistics_type

Optional string. Statistic type to be calculated.

  • MEAN - The mean (average value) of the cells in the defined window will be calculated. This is the default.

  • CIRCULAR_MEAN - The circular mean (average value) of the cells in the window will be calculated. When this statistics type is selected, use the circular_wrap_value parameter to designate a wrap value to use.

  • MAJORITY - The majority (value that occurs most often) of the cells in the defined window will be identified.

  • MAXIMUM - The maximum (largest value) of the cells in the defined window will be identified.

  • MEDIAN - The median of the cells in the defined window will be identified.

  • MINIMUM - The minimum (smallest value) of the cells in the defined window will be identified.

  • PERCENTILE - A percentile of the cells in the defined window will be calculated. When this statistics_type is selected, the percentile_value and percentile_interpolation_type parameters become available. Use these new parameters to designate the percentile to calculate and choose the interpolation type to use, respectively.

percentile_value

Optional float. The percentile value that will be calculated. The default is 90, for the 90th percentile.

The value can range from 0 to 100. The 0th percentile is essentially equivalent to the minimum statistic, and the 100th percentile is equivalent to the maximum statistic. A value of 50 will produce essentially the same result as the median statistic.

This parameter is only supported if the statistics_type parameter is set to PERCENTILE.

percentile_interpolation_type

Optional string. Specifies the method of interpolation to be used when the specified percentile value lies between two input cell values.

  • AUTO_DETECT - If the input value raster has integer pixel type, the NEAREST method is used. If the input value raster has floating point pixel type, then the LINEAR method is used. This is the default.

  • NEAREST - Nearest value to the desired percentile. In this case, the output pixel type is same as that of the input value raster.

  • LINEAR - Weighted average of two surrounding values from the desired percentile. In this case, the output pixel type is floating point.

This parameter is only supported if the statistics_type parameter is set to MEDIAN or PERCENTILE.

circular_wrap_value

Optional float. The value that will be used to round a linear value to the range of a given circular mean.

Its value must be positive. The default value is 360 degrees.

This parameter is only supported if the statistics_type parameter is set to CIRCULAR_MEAN.

Returns

The output raster with the function applied.

# Usage Example 1: Calculates MEAN statistics over a moving window on multidimensional data along StdTime dimension.

op = dimensional_moving_statistics(raster, dimension="StdTime")

divide

arcgis.raster.functions.divide(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The divide function divides the pixel values of two rasters on a pixel-by-pixel basis.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of two rasters/two ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Tip

This raster operation can also be performed by dividing the two input rasters using the / operator.

Example: op_raster = raster1 / raster2

Returns

The output raster with the function applied.

# Usage Example 1: Executes the divide function on a list of two rasters.
# Processing extent is determined using all rasters.

raster_list = [raster1, raster2]
divide_op = divide(raster_list, extent_type="UnionOf")

duration

arcgis.raster.functions.duration(rasters, min_value=None, max_value=None, undefined_class=None, astype=None)

Returns the duration (number of bands) between a minimum and maximum value. The Duration method finds the longest consecutive elements in the array, where each element has a value greater than or equal to min_value and less than or equal to max_value, and then returns its length.

See http://desktop.arcgis.com/en/arcmap/latest/manage-data/raster-and-images/argstatistics-function.htm

The arguments for this function are as follows:

Argument

Description

rasters

Required Raster/ImageryLayer objects filtered by where clause, spatial and temporal filters

undefined_class

Required int

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied to it.

elevation_void_fill

arcgis.raster.functions.elevation_void_fill(raster, max_void_width=0, astype=None)

The elevation_void_fill function is used to create pixels where holes exist in your elevation. Refer to this conceptual help on how it works. The arguments for the elevation_void_fill function are as follows:

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

max_void_width

Optional number. Maximum void width to fill. 0: fill all

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster.

equal_to

arcgis.raster.functions.equal_to(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The equal_to function performs an equal-to operation on two input rasters on a pixel-by-pixel basis.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Tip

This raster operation can also be performed by invoking the == operator between the two input rasters.

Example: equal_to_op = raster1 == raster2

Returns

The output raster with the function applied.

# Usage Example 1: Executes the equal_to function on two input rasters.

equal_to_op = equal_to([raster1, raster2])

evi

arcgis.raster.functions.evi(raster, band_indexes='5 4 2', astype=None)

The Enhanced Vegetation Index (EVI) is an optimized vegetation index that accounts for atmospheric influences and vegetation background signal. It’s similar to NDVI, but is less sensitive to background and atmospheric noise, and it does not become saturated NDVI when viewing areas with very dense green vegetation.

EVI = 2.5 * [(NIR - Red)/(NIR + (6*Red) - (7.5*Blue) + 1)]

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

band_indexes

Optional string/list of band indexes.

  • “NIR Red Blue”, e.g., “5 4 2” or [5,4,2]

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster.

exp

arcgis.raster.functions.exp(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The exp function calculates base ‘e’ exponential of the pixels in a raster.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the exp function on a raster.

exp_op = exp([raster])

exp10

arcgis.raster.functions.exp10(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The exp10 function calculates base 10 exponential of the pixels in a raster.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the exp10 function on a raster.

exp10_op = exp10([raster])

exp2

arcgis.raster.functions.exp2(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The exp2 function calculates base 2 exponential of the pixels in a raster.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the exp2 function on a raster.

exp2_op = exp2([raster])

expression

arcgis.raster.functions.expression(raster, expression='(B3 - B1 / B3 + B1)', astype=None)

Use a single-line algebraic formula to create a single-band output.

The supported operators are -, +, /, *, and unary -.

To identify the bands, prepend the band number with a B or b:

  • For example: “(B1 + B2) / (B3 * B5)”

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

expression

The algebriac formula

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster.

extract_band

arcgis.raster.functions.extract_band(raster, band_ids=None, band_names=None, band_wavelengths=None, missing_band_action=None, wavelength_match_tolerance=None, astype=None)

The extract_band function allows you to extract one or more bands from a raster, or it can reorder the bands in a multiband image.

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

band_ids

Optional list of integers, band_ids uses one-based indexing.

band_names

Optional list of strings

band_wavelengths

Optional list of floats

missing_band_action

Optional integer, 0 = esriMissingBandActionFindBestMatch, 1 = esriMissingBandActionFail

wavelength_match_tolerance

Optional float

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster.

ferrous_minerals

arcgis.raster.functions.ferrous_minerals(raster, band_indexes='6 5', astype=None)

The Ferrous Minerals (FM) ratio is a geological index for identifying rock features containing some quantity of iron-bearing minerals using the shortwave infrared (SWIR) and near-infrared (NIR) bands. FM is used in mineral composite mapping.

FM = SWIR / NIR

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

band_indexes

Optional string/list of band indexes.

  • “SWIR NIR”, e.g., “6 5” or [6,5].

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster.

FLOAT

arcgis.raster.functions.FLOAT(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The FLOAT function converts each pixel value of a raster into a floating-point representation.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the FLOAT function on the input raster.

float_op = FLOAT([raster])

float_divide

arcgis.raster.functions.float_divide(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The float_divide function

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the float_divide function on two input rasters.

float_div_op = float_divide([raster1, raster2])

floor_divide

arcgis.raster.functions.floor_divide(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The floor_divide function

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the floor_divide function on two input rasters.

floor_div_op = floor_divide([raster1, raster2])

focal_stats

arcgis.raster.functions.focal_stats(raster, neighborhood_type=1, width=3, height=3, inner_radius=1, outer_radius=3, radius=3, start_angle=0, end_angle=90, neighborhood_values=None, stat_type=3, percentile_value=90, ignore_no_data=True)

Calculates for each input cell location a statistic of the values within a specified neighborhood around it. For more information see, https://pro.arcgis.com/en/pro-app/help/data/imagery/focal-statistics-function.htm

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

neighborhood_type

int, default is 1. The shape of the area around each cell used to calculate the statistic. 1 = Rectangle 2 = Circle 3 = Annulus 4 = Wedge 5 = Irregular 6 = Weight

width

int, default is 3. Specified when neighborhood_type is Rectangle

height

int, default is 3. Specified when neighborhood_type is Rectangle

inner_radius

int, default is 1. Specified when neighborhood_type is Annulus

outer_radius

int, default is 3. Specified when neighborhood_type is Annulus

radius

int, default is 3. Specified when neighborhood_type is Circle or Wedge

start_angle

float, default is 0. Specified when neighborhood_type is Wedge

end_angle

float, default is 90. Specified when neighborhood_type is Wedge

neighborhood_values

Specified when neighborhood_type is Irregular or Weight. It can be a list of lists, in which the width and height will be automatically set from the columns and rows of the two dimensional list, respectively. Alternatively, it can be a one dimensional list obtained from flattening a two dimensional list. In this case, the dimensions need to be specified explicitly with the width and height parameters.

stat_type

int, default is 3(Mean)

There are 11 types of statistics available: 1=Majority, 2=Maximum, 3=Mean , 4=Median, 5= Minimum, 6 = Minority, 7=Range, 8=Standard deviation, 9=Sum, 10=Variety, 12=Percentile

  • Majority = Calculates the majority (value that occurs most often) of the cells in the neighborhood.

  • Maximum = Calculates the maximum (largest value) of the cells in the neighborhood.

  • Mean = Calculates the mean (average value) of the cells in the neighborhood.

  • Median = Calculates the median of the cells in the neighborhood.

  • Minimum = Calculates the minimum (smallest value) of the cells in the neighborhood.

  • Minority = Calculates the minority (value that occurs least often) of the cells in the neighborhood.

  • Range = Calculates the range (difference between largest and smallest value) of the cells in the neighborhood.

  • Standard deviation = Calculates the standard deviation of the cells in the neighborhood.

  • Sum = Calculates the sum (total of all values) of the cells in the neighborhood.

  • Variety = Calculates the variety (the number of unique values) of the cells in the neighborhood.

  • Percentile = Calculates a specified percentile of the cells in the neighborhood.

ignore_no_data

boolean, default is True.

  • True - Specifies that if a NoData value exists within a neighborhood, the NoData value will be ignored. Only cells within the neighborhood that have data values will be used in determining the output value. This is the default.

  • False - Specifies that if any cell in a neighborhood has a value of NoData, the output for the processing cell will be NoData.

percentile_value

float, default is 90. Denotes which percentile to calculate when the stat_type is Percentile. The value can range from 0 to 100.

Returns

The output raster.

Note

The focal_stats() function is different from the focal_statistics() function in the following aspects:

The focal_stats() function supports Mean, Majority, Maximum, Median, Minimum, Minority, Percentile, Range, Standard deviation, Sum, and Variety. The focal_statistics() function supports only Minimum, Maximum, Mean, and Standard Deviation.

The focal_stats() function supports Rectangle, Circle, Annulus, Wedge, Irregular, and Weight neighborhoods. The focal_statistics() function supports only Rectangle.

The option to determine whether NoData values are ignored or not is available in the focal_stats() function by setting a boolean value for ignore_no_data param. This option is not present in the focal_statistics() function.

The option to determine if NoData pixels are to be processed out is available in the focal_statistics() function by setting a boolean value for fill_no_data_only param. This option is not present in the focal_stats() function.

gemi

arcgis.raster.functions.gemi(raster, band_indexes='4 3', astype=None)

Global Environmental Monitoring Index

GEMI = eta*(1-0.25*eta)-((Red-0.125)/(1-Red))

where eta = (2*(NIR^2-Red^2)+1.5*NIR+0.5*Red)/(NIR+Red+0.5)

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

band_indexes

Optional string/list of band indexes.

  • “NIR Red”, e.g., “4 3” or [4,3]

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster.

generate_trend

arcgis.raster.functions.generate_trend(raster, dimension_name, regression_type=0, cycle_length=1, cycle_unit='YEARS', harmonic_frequency=1, polynomial_order=2, ignore_nodata=True, rmse=True, r2=False, slope_p_value=False, seasonal_period='DAYS')

Estimates the trend for each pixel along a dimension for one or more variables in a multidimensional raster. The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

dimension_name

Required String. The dimension along which a trend will be extracted for the variable or variables selected in the analysis.

regression_type

Optional Integer or String. Specifies the type of line to be used to fit to the pixel values along a dimension.

  • 0 (LINEAR) : Fits the pixel values for a variable along a linear trend line. This is the default.

  • 1 (HARMONIC) : Fits the pixel values for a variable along a harmonic trend line.

  • 2 (POLYNOMIAL) : Fits the pixel values for a variable along a second-order polynomial trend line.

  • 3 (MANN-KENDALL) : Variable pixel values will be evaluated using the Mann-Kendall trend test.

  • 4 (SEASONAL-KENDALL) : Variable pixel values will be evaluated using the Seasonal-Kendall trend test.

cycle_length

Optional Integer. The length of periodic variation to model. This parameter is required when Trend Line Type is set to Harmonic. For example, leaf greenness often has one strong cycle of variation in a single year, so the cycle length is 1 year. Hourly temperature data has one strong cycle of variation throughout a single day, so the cycle length is 1 day. Default is 1.

cycle_unit

Optional String. Specifies the time unit to be used for the length of harmonic cycle. Options: “DAYS”, “YEARS” (This is the default).

harmonic_frequency

Optional Integer. The frequency number to use in the trend fitting. This parameter specifies the frequency of cycles in a year. The default value is 1, or one harmonic cycle per year. This parameter is only included in the trend analysis for a harmonic regression (regression_type=1).

polynomial_order

Optional Integer. The polynomial order number to use in the trend fitting. This parameter specifies the polynomial order. The default value is 2, or second-order polynomial. This parameter is only included in the trend analysis for a polynomial regression (regression_type=2).

ignore_nodata

Optional Boolean. Specifies whether NoData values are ignored in the analysis.

  • True : The analysis will include all valid pixels along a given dimension and ignore any NoData pixels. This is the default.

  • False : The analysis will result in NoData if there are any NoData values for the pixels along the given dimension.

rmse

Optional Boolean. Specifies whether to generate the root mean square error (RMSE) of the trend fit line.

  • True : The RMSE will be calculated and displayed when the tool is finished running. This is the default.

  • False : The RMSE will not be calculated.

r2

Optional Boolean. Specifies whether to calculate the R-squared goodness-of-fit statistic for the trend fit line.

  • True : The R-squared will be calculated and displayed when the tool is finished running.

  • False : The R-squared will not be calculated. This is the default.

slope_p_value

Optional Boolean. Specifies whether to calculate the p-value statistic for the slope coefficient of the trend line.

  • True : The p-value will be calculated and displayed when the tool is finished running.

  • False : The p-value will not be calculated. This is the default.

seasonal_period

Optional String. Specifies the seasonal period. Default - “DAYS” Possible Options - “DAYS”, “MONTHS”

Returns

The output raster.

geometric

arcgis.raster.functions.geometric(raster, geodata_transforms=None, append_geodata_xform=None, z_factor=None, z_offset=None, constant_z=None, correct_geoid=None, astype=None, tolerance=None, dem=None)

The geometric function transforms the image (for example, orthorectification) based on a sensor definition and a terrain model.This function was added at 10.1.

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

geodata_transforms

Please refer to the Geodata Transformations documentation for more details.

append_geodata_xform

Optional boolean. Indicates whether the geodata transformation is appended to the existing one from the input raster.

z_offset

Optional float. The base value to be added to the elevation value in the DEM. This could be used to offset elevation values that do not start at sea level.

constant_z

Optional float. Specify a constant elevation to use for the Geometric function.

correct_geoid

Optional boolean. Set it to True to apply the geoid (EGM96) correction to the z-values, unless your DEM is already referenced to ellipsoidal heights.

tolerance

Optional float. Specify the maximum tolerable error in the geometric function, given in number of pixels.

dem

Optional Raster/ImageryLayer. Specify the DEM to use for the Geometric function

gndvi

arcgis.raster.functions.gndvi(raster, band_indexes='4 2', astype=None)

Green Normalized Difference Vegetation Index

GNDVI = (NIR-Green)/(NIR+Green)

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

band_indexes

Optional string/list of band indexes.

  • “NIR Green”, e.g., “5 3” or [5,3]

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster.

grayscale

arcgis.raster.functions.grayscale(raster, conversion_parameters=None)

The Grayscale function converts a multi-band image into a single-band grayscale image. Specified weights are applied to each of the input bands, and a normalization is applied for output. For more information, see http://desktop.arcgis.com/en/arcmap/latest/manage-data/raster-and-images/grayscale-function.htm

Argument

Description

raster

Required input Raster/ImageryLayer object.

conversion_parameters

Optional list of length N representing the weights of each band, where N is the band count.

Returns

The output raster with this function applied to it.

# Usage Example 1: Performs a linear transformation for a 3-band input raster with weighted bands.

grayscale_op = grayscale(input_raster, [1, 3, 2])

greater_than

arcgis.raster.functions.greater_than(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The greater_than function performs a relational greater-than operation on two input rasters on a pixel-by-pixel basis.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Tip

This raster operation can also be performed by invoking the > operator between the two input rasters.

Example: gt_raster = raster1 > raster2

Returns

The output raster with the function applied.

# Usage Example 1: Executes the greater_than function on two input rasters.

gt_raster = greater_than([raster1, raster2])

greater_than_equal

arcgis.raster.functions.greater_than_equal(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The greater_than_equal function performs a relational greater-than-or-equal-to operation on two inputs on a pixel-by-pixel basis.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Tip

This raster operation can also be performed by invoking the >= operator between the two input rasters.

Example: ge_raster = raster1 >= raster2

Returns

The output raster with the function applied.

# Usage Example 1: Executes the greater_than function on two input rasters.

ge_raster = greater_than_equal([raster1, raster2])

gvitm

arcgis.raster.functions.gvitm(raster, band_indexes='1 2 3 4 5 6', astype=None)

Green Vegetation Index - Landsat TM

GVITM = -0.2848*Band1-0.2435*Band2-0.5436*Band3+0.7243*Band4+0.0840*Band5-0.1800*Band7

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

band_indexes

Optional string/list of band indexes.

  • “Band1 Band2 Band3 Band4 Band5 Band7”, e.g., “1 2 3 4 5 6” or [1,2,3,4,5,6]

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

return

The output raster.

heat_index

arcgis.raster.functions.heat_index(temperature_raster, relative_humidity_raster, temperature_units='Fahrenheit', heat_index_units='Fahrenheit')

Calculates apparent temperature based on ambient temperature and relative humidity. The apparent temperature is often described as how hot it feels to the human body.

Argument

Description

temperature_raster

Required input Raster/ImageryLayer object. The raster that represent temperature. A single-band raster where pixel values represent ambient air temperature.

relative_humidity_raster

Required input Raster/ImageryLayer object. The raster that represent relative humidity. A single-band raster where pixel values represent relative humidity as a percentage value between 0 and 100.

temperature_units

Optional String. The unit of measurement associated with the input temperature raster. Available input units are Celsius, Fahrenheit, and Kelvin.

heat_index_units

Optional String. The unit of measurement associated with the output raster. Available output units are Celsius, Fahrenheit, and Kelvin.

Returns

the output raster

hillshade

arcgis.raster.functions.hillshade(dem, azimuth=215.0, altitude=75.0, z_factor=0.3, slope_type=1, ps_power=None, psz_factor=None, remove_edge_effect=None, astype=None, hillshade_type=0)

A hillshade is a grayscale 3D model of the surface taking the sun’s relative position into account to shade the image. For more information, see hillshade function and How hillshade works.

The arguments for the hillshade function are as follows:

Argument

Description

dem

Required Raster/ImageryLayer object created from a DEM.

azimuth

Optional float. Azimuth is the sun’s relative position along the horizon (in degrees). This position is indicated by the angle of the sun measured clockwise from due north. An azimuth of 0 degrees indicates north, east is 90 degrees, south is 180 degrees, and west is 270 degrees.

This parameter is only valid when hillshade_type is 0 (0 = Traditional). The default is 215 degrees, which is from the southwest.

altitude

Optional float. Altitude is the sun’s angle of elevation above the horizon and ranges from 0 to 90 degrees. A value of 0 degrees indicates that the sun is on the horizon, that is, on the same horizontal plane as the frame of reference. A value of 90 degrees indicates that the sun is directly overhead.

This parameter is only valid when hillshade_type is 0 (0 = Traditional). The default is 75 degrees above the horizon.

z_factor

Optional float. Scaling factor used to convert the elevation values for two purposes:

  • Convert the elevation units (such as meters or feet) to the horizontal coordinate units of the dataset, which may be feet, meters, or degrees.

  • Add vertical exaggeration for visual effect.

Default is 0.3.

slope_type

(New at 10.2) Optional float.

Available options are -
  • 1=DEGREE

  • 2=PERCENTRISE

  • 3=SCALED.

Default is 1.

ps_power

(New at 10.2) Optional float. Pixel Size Power accounts for the altitude changes (or scale) as the viewer zooms in and out on the map display. Used together with SCALED slope type.

psz_factor

(New at 10.2) Optional float. Pixel Size Factor controls the rate at which z_factor changes. Used together with SCALED slope type.

remove_edge_effect

(New at 10.2) Optional bool. Using this option will avoid any resampling artifacts that may occur along the edges of a raster. Optional boolean.

  • False - Bilinear resampling will be applied uniformly to resample the output.

  • True - Bilinear resampling will be used to resample the output, except along the edges of the rasters or beside pixels of NoData.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

hillshade_type

Optional int. Controls the illumination source for the hillshade.

  • 0 = Traditional. Calculates hillshade from a single illumination direction. You can set the azimuth and altitude arguments to control the location of the light source. This is the default.

  • 1 = Multi-directional. Combines light from multiple sources to represent an enhanced visualization of the terrain.

Default is 0.

Returns

The output raster with the function applied. to it.

# Usage Example 1: Produces a hillshade of the input raster with the sun located east and 80 degrees overhead.

hillshade_op = hillshade(raster, azimuth=90, altitude=80)

identity

arcgis.raster.functions.identity(raster)

The function is used to define the source raster as part of the default mosaicking behavior of the mosaic dataset. This function is a no-op function and takes no arguments except a raster. For more information, see (http://desktop.arcgis.com/en/arcmap/latest/manage-data/raster-and-images/identity-function.htm)

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

Returns

The output raster.

INT

arcgis.raster.functions.INT(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The INT function converts each pixel value of a raster to an integer by truncation.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the INT function on the input raster.

int_raster = INT([raster])

interpolate_irregular_data

arcgis.raster.functions.interpolate_irregular_data(point_feature, value_field=None, cell_size=0, interpolation_method=0, radius=3, gis=None)

Interpolates from point clouds or irregular grids. (Supported from 10.8.1)

Argument

Description

point_feature_class

Required FeatureLayer. The input point feature layer.

value_field

Optional string. The name of the field that contains the value of the points to be interpolated.

cell_size

Optional int. The cell size for the output raster dataset.

interpolation_method

Optional int or string. The resampling method to use for interpolation:

  • 0 or NEAREST_NEIGBOR : Calculates pixel value using the nearest pixel. If no source pixel exists, no new pixel can be created in the output. This is the default.

  • 2 or LINEAR_TINNING : Uses a triangular irregular network from the center points of each cell in the irregular raster to interpolate a surface that is then converted to a regular raster.

  • 3 or NATURAL_NEIGHBOR : Finds the closest subset of input samples to a query point and applies weights to them based on proportionate areas to interpolate a value.

  • 4 or INVERSE_DISTANCE_WEIGHTED : Determines cell values using a linearly weighted combination of a set of sample points or cells. The weight is a function of the inverse of the distance from the known points or cells.

radius

Optional int. The number of pixels to be included for resampling. The default value is 3 pixels.

gis

Optional gis. gis parameter can be specified to render the output raster dynamically using the raster rendering service of the gis. If not provided, active gis will be used to do this. If gis parameter is not specified the output of interpolate_irregular_data() cannot be displayed.

Returns

output raster with function applied

interpolate_raster_by_dimension

arcgis.raster.functions.interpolate_raster_by_dimension(raster, interpolation_method='LINEAR', variables=None, dimension_definition=None, dimension_values=None, dimension=None, start_value=None, end_value=None, interval_value=None, interval_unit=None, target_raster=None, ignore_nodata=True)

Interpolates a multidimensional raster at a specified dimension value using adjacent values. Function available in ArcGIS Image Server 10.9.1 and higher.

Argument

Description

raster

Required Raster/ImageryLayer object.

interpolation_method

Optional string. Specifies the interpolation method.

Possible values are - LINEAR, NEARESTNEIGHBOR

Default is LINEAR.

variables

Optional List. The list of variables that will be included in the interpolation. If not specified the function will take all variables by default.

dimension_definition

Optional String. Specifies the dimension definition. It can be one of the following:

  • BY_VALUES

  • BY_INTERVAL

  • BY_TARGET_RASTER

dimension_values

Optional List of Dictionaries. This slices the data based on the dimension name and the value specified. This parameter is required when the dimension_definition is set to BY_VALUES. If dimension is StdTime, then the value must be specified in human readable time format (YYYY-MM-DDTHH:MM:SS).

The input should be specified as: [{“dimension”:”<dimension_name>”, “value”:”<dimension_value>”},{“dimension”:”<dimension_name>”, “value”:”<dimension_value>”}]

Example:

[{“dimension”:”StdTime”, “value”:”2012-01-15T03:00:00”}]

dimension

Optional String. The dimension along which the variables will be interpolated. This parameter is required when the dimension_definition is set to BY_INTERVAL.

start_value

Optional String. The beginning of the interval. This parameter is required when the dimension_definition is set to BY_INTERVAL

end_value

Optional String. The end of the interval. This parameter is required when the dimension_definition is set to BY_INTERVAL

interval_value

Optional Float. The frequency with which the data will be sliced. This parameter is required when the dimension_definition is set to BY_INTERVAL

interval_unit

Optional String. Specifies the interval unit. This parameter is required when the dimension_definition is set to BY_INTERVAL and the dimension parameter is set to StdTime.

  • HOURS - Uses hours as the specified unit of time.

  • DAYS - Uses days as the specified unit of time.

  • WEEKS - Uses weeks as the specified unit of time.

  • MONTHS - Uses months as the specified unit of time.

  • YEARS -Uses years as the specified unit of time.

target_raster

Optional Raster/ImageryLayer object. Parameter used to specify the target raster from which the dimension definition would be taken. Required when dimension_definition is set to BY_TARGET_RASTER

ignore_nodata

Optional Boolean. Specifies whether NoData values are ignored in the interpolation.

  • True : Only the cells that are have noData values will be used in interpolation. This is the default.

  • False : The cells that have noData values will be used in interpolation.

Returns

The output raster with the function applied.

# Usage Example 1: Apply the interpolate_raster_by_dimension() on the input raster using BY_VALUES dimension_definition.
interpolated_op = interpolate_raster_by_dimension(raster,
                                                  variables="water_temp",
                                                  dimension_definition="BY_VALUES",
                                                  dimension_values=[{"dimension":"StdTime", "value":"2012-01-15T03:00:00"}])

iron_oxide

arcgis.raster.functions.iron_oxide(raster, band_indexes='4 2', astype=None)

The Iron Oxide (IO) ratio is a geological index for identifying rock features that have experienced oxidation of iron-bearing sulfides using the red and blue bands. IO is useful in identifying iron oxide features below vegetation canopies, and is used in mineral composite mapping.

IronOxide = Red / Blue

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

param band_indexes

Optional string/list of band indexes.

  • “Red Blue”, e.g., “4 2” or [4,2]

param astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster.

is_null

arcgis.raster.functions.is_null(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The is_null function determines which values from the input raster are NoData on a pixel-by-pixel basis.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the is_null function on the input raster.

is_null_raster = is_null([raster])

landtrendr_analysis

arcgis.raster.functions.landtrendr_analysis(raster, processing_band=None, snapping_date='06-30', max_num_segments=5, vertex_count_overshoot=2, spike_threshold=0.9, recovery_threshold=0.25, prevent_one_year_recovery=True, increasing_recovery_trend=True, min_num_observations=6, best_model_proportion=1.25, pvalue_threshold=0.01, output_other_bands=False)

Function evaluates changes in pixel values over time using the Landsat-based detection of trends in disturbance and recovery (LandTrendr) method and generates a change analysis raster containing the model results.

Note

This raster function is only supported in conjunction with the detect_change_using_change_analysis_raster function. To persist the output give the output of the landtrendr_analysis function as input to the detect_change_using_change_analysis_raster() method and use the save() method on the resulting layer.

Argument

Description

raster

Required Raster/ImageryLayer object. The input multidimensional raster.

processing_band

Optional string. The band to use for segmenting the pixel value trajectories over time. Choose the band that will best capture the changes in the feature you want to observe.

Example:

“Band_1”

snapping_date

Optional string. The date used to select a slice for each year in the input multidimensional dataset. The slice with the date closest to the snapping date will be selected. This parameter is required if the input dataset contains sub-yearly data.

The default is “06-30” (or June 30), approximately midway through a calendar year.

Example:

“06-30”

max_num_segments

Optional integer. The maximum number of segments to be fitted to the time series for each pixel. The default is 5.

Example:

5

vertex_count_overshoot

Optional integer. The number of additional vertices beyond max_num_segments + 1 that can be used to fit the model during the initial stage of identifying vertices. Later in the modeling process, the number of additional vertices will be reduced to max_num_segments + 1. The default is 2.

Example:

2

spike_threshold

Optional float. The threshold to use for dampening spikes or anomalies in the pixel value trajectory. The value must range between 0 and 1, where 1 means no dampening. The default is 0.9.

Example:

0.9

recovery_threshold

Optional float. The recovery threshold value, in years. If a segment has a recovery rate that is faster than 1/recovery threshold, the segment is discarded and not included in the time series model. The value must range between 0 and 1. The default is 0.25.

Example:

0.25

prevent_one_year_recovery

Optional boolean. Specifies whether segments that exhibit a one year recovery will be excluded.

  • True - Segments that exhibit a one year recovery will be excluded. This is the default.

  • False - Segments that exhibit a one year recovery will not be excluded.

Example:

True

increasing_recovery_trend

Optional boolean. Specifies whether the recovery has an increasing (positive) trend.

  • True - The recovery has an increasing trend. This is the default.

  • False - The recovery has a decreasing trend.

Example:

True

min_num_observations

Optional integer. The minimum number of valid observations required to perform fitting. The number of years in the input multidimensional dataset must be equal to or greater than this value. The default is 6.

Example:

6

best_model_proportion

Optional float. The best model proportion value. During the model selection process, the tool will calculate the p-value for each model and select a model that has the most vertices while maintaining the smallest (most significant) p-value based on this proportion value. A value of 1 means the model has the lowest p-value but may not have a high number of vertices. The default is 1.25.

Example:

1.25

pvalue_threshold

Optional float. The p-value threshold for a model to be selected. After the vertices are detected in the initial stage of the model fitting, the tool will fit each segment and calculate the p-value to determine the significance of the model. On the next iteration, the model will decrease the number of segments by one and recalculate the p-value. This will continue and, if the p-value is smaller than the value specified in this parameter, the model will be selected and the tool will stop searching for a better model. If no such model is selected, the tool will select a model with a p-value smaller than the lowest p-value × best model proportion value. The default is 0.01.

Example:

0.01

output_other_bands

Optional boolean. Specifies whether other bands will be included in the segmentation process.

  • True - Other bands will be included. The segmentation and vertices information from the initial segmentation band specified in the processing_band parameter will also be fitted to the remaining bands in the multiband images. The model results will include the segmentation band first, then the remaining bands.

  • False - Other bands will not be included. This is the default.

Example:

True

Returns

The output raster with the function applied.

# Usage Example 1:
landtrendr_analysis_op = landtrendr_analysis(raster=input_multidimensional_raster,
                                             processing_band="Band_1"
                                            )

less_than

arcgis.raster.functions.less_than(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The less_than function performs a relational less-than operation on two inputs on a pixel-by-pixel basis.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Tip

This raster operation can also be performed by invoking the < operator between the two input rasters.

Example: lt_raster = raster1 < raster2

Returns

The output raster with the function applied.

# Usage Example 1: Executes the less_than function on two input rasters.

lt_raster = less_than([raster1, raster2])

less_than_equal

arcgis.raster.functions.less_than_equal(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The less_than_equal function performs a relational less-than-or-equal-to operation on two inputs on a pixel-by-pixel basis.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Tip

This raster operation can also be performed by invoking the <= operator between the two input rasters.

Example: le_raster = raster1 <= raster2

Returns

The output raster with the function applied.

# Usage Example 1: Executes the greater_than function on two input rasters.

le_raster = less_than_equal([raster1, raster2])

linear_spectral_unmixing

arcgis.raster.functions.linear_spectral_unmixing(raster, spectral_profile_def=None, non_negative=False, sum_to_one=False)

Performs subpixel classification and calculates the fractional abundance of different land cover types for individual pixels.

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

spectral_profile_def

Optional dictionary. The class spectral profile information.

non_negative

Optional boolean. Specifies the options to define the output pixel values.

  • True : There will be no negative output values.

  • False : There can be negative values of fractional land cover. This is the default.

sum_to_one

Optional boolean. Specifies the options to define the output pixel values.

  • True : Class values for each pixel are provided in decimal format with the sum of all classes equal to 1.

    Example:
    • Class1 = 0.16; Class2 = 0.24; Class3 = 0.60.

  • False : The sum of all classes in a pixel can exceed 1. This is the default.

Returns

The output raster.

ln

arcgis.raster.functions.ln(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The ln function calculates the natural logarithm of the pixels in a raster.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the ln function on a raster.

ln_op = ln([raster])

local

arcgis.raster.functions.local(rasters, operation, extent_type='FirstOf', cellsize_type='FirstOf', astype=None, process_as_multiband=None, percentile_value=90, percentile_interpolation_type='AUTO_DETECT')

The local function allows you to perform bitwise, conditional, logical, mathematical, and statistical operations on a pixel-by-pixel basis. For more information, see local function.

License:At 10.5, you must license your ArcGIS Server as ArcGIS Server 10.5.1 Enterprise Advanced or ArcGIS Image Server to use this resource. At versions prior to 10.5, the hosting ArcGIS Server needs to have a Spatial Analyst license.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

operation

Optional int. Specifies the operation to be used. see reference here.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

process_as_multiband

Optional boolean. Set to True to process as multiband. Applicable for operations - Majority, Maximum, Mean, Median, Minimum, Minority, Percentile, Range, Standard Deviation, Sum, and Variety.

percentile_value

Optional float. The percentile to calculate. The default is 90, indicating the 90th percentile. The values can range from 0 to 100. The 0th percentile is essentially equivalent to the minimum statistic, and the 100th percentile is equivalent to maximum. A value of 50 will produce essentially the same result as the median statistic.

Parameter is honoured only if operation is 94 or 93 (Percentile operation)

percentile_interpolation_type

Optional string. Specifies the method of interpolation to be used when the specified percentile value lies between two input cell values.

  • AUTO_DETECT-If the input rasters are of integer pixel type, the NEAREST method is used. If the input rasters are of floating point pixel type, the LINEAR method is used. This is the default.

  • NEAREST-The nearest available value to the desired percentile is used. In this case, the output pixel type is the same as that of the input rasters.

  • LINEAR-The weighted average of the two surrounding values from the desired percentile is used. In this case, the output pixel type is floating point.

Parameter is honoured only if operation is 94 or 93 or 41 or 69 (Percentile or Median operation)

Returns

The output raster with the function applied.

# Usage Example 1: Executes the mean function on a list of input rasters.

mean_raster = local([raster1, raster2, raster3], operation=68)

log10

arcgis.raster.functions.log10(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The log10 function calculates base 10 logarithm of the pixels in a raster.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the log10 function on a raster.

log10_op = log10([raster])

log2

arcgis.raster.functions.log2(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The log2 function calculates base 2 logarithm of the pixels in a raster.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the log2 function on a raster.

log2_op = log2([raster])

lookup

arcgis.raster.functions.lookup(raster, field=None)

Creates a new raster by looking up values found in another field in the table of the input raster. For more information see, https://pro.arcgis.com/en/pro-app/help/data/imagery/lookup-function.htm

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object that contains a field from which to create a new raster.

field

Field containing the desired values for the new raster.

Returns

the output raster with this function applied to it.

majority

arcgis.raster.functions.majority(rasters, extent_type='FirstOf', cellsize_type='FirstOf', ignore_nodata=False, astype=None, process_as_multiband=None)

The majority function determines the value that occurs most often from multiple rasters, on a pixel-by-pixel basis.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

ignore_nodata

Optional boolean. Set to True to ignore NoData values.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

process_as_multiband

Optional boolean. Set to True to process as multiband.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the majority function on a list of input rasters.

majority_op = majority([raster1, raster2, raster3])

# Usage Example 2: Executes the majority function on a list of input rasters.
# Setting process_as_multiband to True so as to process multiband inputs as multiband.

majority_op = majority([raster1, raster2, raster3], process_as_multiband=True)

mask

arcgis.raster.functions.mask(raster, no_data_values=None, included_ranges=None, no_data_interpretation=None, astype=None)

The mask function changes the image by specifying a certain pixel value or a range of pixel values as no data.

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

no_data_values

list of strings [“band0_val”, “band1_val”, …]. The NoData values can be specified for each band. The index of each element in no_data_values list represents the no data value in the corresponding band.

included_ranges

list of floats [band0_lowerbound, band0_upperbound, band1_lowerbound, band1_upperbound, band2_lowerbound, …], The included ranges can be specified for each band by specifying a minimum and maximum value.

no_data_interpretation

int. 0=MatchAny, 1=MatchAll. This parameter refers to how the NoData values will impact the output image.

  • 0 (MatchAny) : If the NoData value you specify occurs for a cell in a specified band, then that cell in the output image will be NoData.

  • 1 (MatchAll) : The NoData values you specify for each band must occur in the same cell for the output image to contain the NoData cell.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

the output raster with this function applied to it.

max

arcgis.raster.functions.max(rasters, extent_type='FirstOf', cellsize_type='FirstOf', ignore_nodata=False, astype=None, process_as_multiband=None)

The max function determines the maximum value from multiple rasters, on a pixel-by-pixel basis. .

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

ignore_nodata

Optional boolean. Set to True to ignore NoData values.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

process_as_multiband

Optional boolean. Set to True to process as multiband.

Tip

This raster operation can also be performed by calling the in-built max function for the input rasters.

Example: max_op = max([raster1, raster2, raster3])

Returns

The output raster with the function applied.

# Usage Example 1: Executes the max function on a list of input rasters with the same band count.

max_op = max([raster1, raster2, raster3])

# Usage Example 2: Executes the max function on a list of input rasters with different band counts.

max_op = max([raster1, raster2, raster3], process_as_multiband=True)

mean

arcgis.raster.functions.mean(rasters, extent_type='FirstOf', cellsize_type='FirstOf', ignore_nodata=False, astype=None, process_as_multiband=None)

The mean function determines the average value from multiple rasters, on a pixel-by-pixel basis.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer object. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

ignore_nodata

Optional boolean. Set to True to ignore NoData values.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

process_as_multiband

Optional boolean. Set to True to process as multiband.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the mean function on a list of input rasters.

mean_raster = mean([raster1, raster2, raster3])

med

arcgis.raster.functions.med(rasters, extent_type='FirstOf', cellsize_type='FirstOf', ignore_nodata=False, astype=None, process_as_multiband=None, percentile_interpolation_type='AUTO_DETECT')

The med function calculates the middle value of the pixels from multiple rasters, on a pixel-by-pixel basis.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

ignore_nodata

Optional boolean. Set to True to ignore NoData values.

astype

Optional string. Specifies the output pixel type.

Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

process_as_multiband

Optional boolean. Set to True to process as multiband.

percentile_interpolation_type

Optional string. Specifies the method of interpolation to be used when the median lies between two input cell values.

  • AUTO_DETECT-If the input rasters are of integer pixel type, the NEAREST method is used. If the input rasters are of floating point pixel type, the LINEAR method is used. This is the default.

  • NEAREST-The nearest available value to the desired percentile is used. In this case, the output pixel type is the same as that of the input rasters.

  • LINEAR-The weighted average of the two surrounding values from the desired percentile is used. In this case, the output pixel type is floating point.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the med function on a list of input rasters.

med_raster = med([raster1, raster2, raster3])

min

arcgis.raster.functions.min(rasters, extent_type='FirstOf', cellsize_type='FirstOf', ignore_nodata=False, astype=None, process_as_multiband=None)

The min function determines the smallest value from multiple rasters, on a pixel-by-pixel basis.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer object. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

ignore_nodata

Optional boolean. Set to True to ignore NoData values.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

process_as_multiband

Optional boolean. Set to True to process as multiband.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the min function on an input raster.

min_raster = min([raster])

minority

arcgis.raster.functions.minority(rasters, extent_type='FirstOf', cellsize_type='FirstOf', ignore_nodata=False, astype=None, process_as_multiband=None)

The miniority function determines the value that occurs least often from multiple rasters, on a pixel-by-pixel basis.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

ignore_nodata

Optional boolean. Set to True to ignore NoData values.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

process_as_multiband

Optional boolean. Set to True to process as multiband.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the minority function on a list of input rasters.

minority_op = minority([raster1, raster2, raster3])

# Usage Example 2: Executes the minority function on a list of input rasters.
# Setting process_as_multiband to True so as to process multiband inputs as multiband.

minority_op = minority([raster1, raster2, raster3], process_as_multiband=True)

minus

arcgis.raster.functions.minus(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The minus function subtracts the value of the second input raster from the value of the first input raster on a cell-by-cell basis.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Tip

This raster operation can also be performed by subtracting the second input raster from the first using the - operator.

Example: diff_raster = raster1 - raster2

Returns

The output raster with the function applied.

# Usage Example 1: Executes the minus function on the input raster.

diff_raster = minus([raster1, raster2])

ml_classify

arcgis.raster.functions.ml_classify(raster, signature, astype=None)

The ml_classify function allows you to perform a supervised classification using the maximum likelihood classification algorithm. The hosting ArcGIS Server needs to have a Spatial Analyst license.LicenseLicense:At 10.5, you must license your ArcGIS Server as ArcGIS Server 10.5.1 Enterprise Advanced or ArcGIS Image Server to use this resource. At versions prior to 10.5, the hosting ArcGIS Server needs to have a Spatial Analyst license.

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

signature

Required string. a signature string returned from computeClassStatistics (GSG)

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

the output raster with this function applied to it.

mndwi

arcgis.raster.functions.mndwi(raster, band_indexes='3 6', astype=None)

The Modified Normalized Difference Water Index (MNDWI) uses green and SWIR bands for the enhancement of open water features. It also diminishes built-up area features that are often correlated with open water in other indices.

MNDWI = (Green - SWIR) / (Green + SWIR)

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

param band_indexes

Optional string/list of band indexes.

  • “Green SWIR”, e.g., “3 6” or [3,6]

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

the output raster with this function applied to it.

mod

arcgis.raster.functions.mod(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The mod function calculates the remainder (modulo) of the first raster when divided by the second raster on a pixel-by-pixel basis.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Tip

This raster operation can also be performed by finding the ‘remainder’ upon division of the two input rasters by using the % operator.

Example: op_raster = raster1 % raster2

Returns

The output raster with the function applied.

# Usage Example 1: Executes the mod function on a raster.

mod_op = mod([raster])

monitor_vegetation

arcgis.raster.functions.monitor_vegetation(raster, method='NDVI', band_indexes=None, astype=None)

The monitor_vegetation function performs an arithmetic operation on the bands of a multiband raster layer to reveal vegetation coverage information of the study area. see Band Arithmetic function at http://desktop.arcgis.com/en/arcmap/latest/manage-data/raster-and-images/band-arithmetic-function.htm

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

method

String. The method to create the vegetation index layer. The different vegetation indexes can help highlight certain features or reduce various noise. NDVI, SAVI, TSAVI, MSAVI, GEMI, PVI, GVITM, Sultan, VARI, GNDVI, SR, NDVIre, SRre, MTVI2, RTVICore, CIre, CIg, NDWI, EVI Default is NDVI.

band_indexes

Optional band_indexes.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

the output raster with this function applied to it.

mosaic_rasters

arcgis.raster.functions.mosaic_rasters(rasters, mosaic_type='BLEND')

The mosaic_rasters function creates a single mosaicked image using multiple images. When there is overlap between the images, you can choose from several methods to determine the priority with which images are displayed.

The arguments for the function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects.

mosaic_type

Optional string. Resolve any conflict when you have parts of two or more images that overlap. The options include the following:

  • “FIRST” - Display the pixels from the first image in the list of images overlapping a given area.

  • “LAST” - Display the pixels from the last image in the list of images overlapping a given area.

  • “MIN” - Display the lowest valued pixel of all the overlapping layers. With this option, you have no guarantee of displaying the pixels of just one image in the overlapping area but rather a combination of all potential layers.

  • “MAX” - Display the highest valued pixel of all the overlapping layers. With this option, you have no guarantee of displaying the pixels of just one image in the overlapping area but rather a combination of all potential layers.

  • “MEAN” - Calculate and display an average of the overlapping pixels.

  • “BLEND” - Calculate and display an average of the overlapping pixels by giving more weight to pixels that are closer to neighboring images so the output is a smoother image. This is the default.

Returns

The output raster with the function applied.

# Usage Example 1: mosaic two rasters and display the pixels form the first raster in the list of rasters overlapping a given area.

mosaiced_op = mosaic_rasters([ras1, ras2], mosaic_type="FIRST")

msavi

arcgis.raster.functions.msavi(raster, band_indexes='4 3', astype=None)

Modified Soil Adjusted Vegetation Index

MSAVI2 = (1/2)*(2(NIR+1)-sqrt((2*NIR+1)^2-8(NIR-Red)))

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

band_indexes

Optional string/list of band indexes.

  • “NIR Red”, e.g., “4 3” or [4,3].

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

the output raster.

mtvi2

arcgis.raster.functions.mtvi2(raster, band_indexes='7 5 3', astype=None)

The Modified Triangular Vegetation Index (MTVI2) is a vegetation index for detecting leaf chlorophyll content at the canopy scale while being relatively insensitive to leaf area index. It uses reflectance in the green, red, and near-infrared (NIR) bands

MTVI2 = (1.5*(1.2*(NIR-Green)-2.5*(Red-Green))/sqrt((2*NIR+1)^2-(6*NIR-5*sqrt(Red))-0.5))

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

band_indexes

Optional string/list of band indexes.

  • “NIR Red Green”, e.g., “7 5 3” or [7,5,3]

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

the output raster.

multidimensional_filter

arcgis.raster.functions.multidimensional_filter(raster, variables=None, dimension_definition='ALL', dimension=None, dimension_ranges=None, dimension_values=None, start_of_first_iteration=None, end_of_first_iteration=None, iteration_step=3, iteration_unit=None, dimensionless=False)

Applies a filter on a multidimensional raster. Function creates a raster layer from a multidimensional raster by slicing data along defined variables and dimensions.

The arguments for this function are as follows:

Argument

Description

raster

Required input multidimensional Raster/ImageryLayer object.

variables

Optional List. The list of variables that will be included in the output multidimensional raster layer. If no variable is specified, the first variable will be used.

dimension_definition

Optional String. Specifies the method that will be used to slice the dimension.

  • ALL : The full range for each dimension will be used. This is the default.

  • BY_RANGES : The dimension will be sliced using a range or a list of ranges.

  • BY_ITERATION : The dimension will be sliced over a specified interval.

  • BY_VALUES : The dimension will be sliced using a list of dimension values.

dimension

Optional String. The dimension along which the variables will be sliced. This parameter is required when the dimension_definition is set to BY_ITERATION.

dimension_ranges

Optional list of dicts. This slices the data based on the dimension name and the minimum and maximum values for the range. This parameter is required when the dimension_definition is set to BY_RANGE. If dimension is StdTime, then the min value and max value must be specified in human readable time format (YYYY-MM-DDTHH:MM:SS). The input should be specified as: [{“dimension”:”<dimension_name>”, “minValue”:”<dimension_min_value>”, “maxValue”:”<dimension_max_value>”},{“dimension”:”<dimension_name>”, “minValue”:”<dimension_min_value>”, “maxValue”:”<dimension_max_value>”}]

Example:

[{“dimension”:”StdTime”, “minValue”:”2013-05-17T00:00:00”, “maxValue”:”2013-05-17T03:00:00”},{“dimension”:”StdZ”, “minValue”:”-5000”, “maxValue”:”-4000”}]

dimension_values

Optional List of Dicts. This slices the data based on the dimension name and the value specified. This parameter is required when the dimension_definition is set to BY_VALUE.

If dimension is StdTime, then the value must be specified in human readable time format (YYYY-MM-DDTHH:MM:SS). The input should be specified as: [{“dimension”:”<dimension_name>”, “value”:”<dimension_value>”},{“dimension”:”<dimension_name>”, “value”:”<dimension_value>”}]

Example:

[{“dimension”:”StdTime”, “value”:”2012-01-15T03:00:00”},{“dimension”:” StdZ “, “value”:”-4000”}]

start_of_first_iteration

Optional String. The beginning of the interval. This parameter is required when the dimension_definition is set to BY_ITERATION

end_of_first_iteration

Optional String. The end of the interval. This parameter is required when the dimension_definition is set to BY_ITERATION

iteration_step

Optional Float. The frequency with which the data will be sliced. This parameter is required when the dimension_definition is set to BY_ITERATION The default is 3.

iteration_unit

Optional String. Specifies the iteration unit. This parameter is required when the dimension_definition is set to BY_ITERATION and the dimension parameter is set to StdTime.

  • HOURS - Uses hours as the specified unit of time.

  • DAYS - Uses days as the specified unit of time.

  • WEEKS - Uses weeks as the specified unit of time.

  • MONTHS - Uses months as the specified unit of time.

  • YEARS -Uses years as the specified unit of time.

dimensionless

Optional Boolean. Specifies whether the layer should have dimension values. This option is only available if a single slice is selected to create a layer.

  • True - The layer will not have dimension values.

  • False - The layer will have a dimension value. This is the default.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

the output raster.

nbr

arcgis.raster.functions.nbr(raster, band_indexes='5 7', astype=None)

The Normalized Burn Ratio Index (NBRI) uses the NIR and SWIR bands to emphasize burned areas, while mitigating illumination and atmospheric effects. Your images should be corrected to reflectance values before using this index.

NBR = (NIR - SWIR) / (NIR+ SWIR)

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object

band_indexes

Optional string/list of band indexes.

  • “NIR SWIR”, e.g., “5 7” or [5,7]

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

ndbi

arcgis.raster.functions.ndbi(raster, band_indexes='6 5', astype=None)

The Normalized Difference Built-up Index (NDBI) uses the NIR and SWIR bands to emphasize man-made built-up areas. It is ratio based to mitigate the effects of terrain illumination differences as well as atmospheric effects.

NDBI = (SWIR - NIR) / (SWIR + NIR)

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object

band_indexes

Optional string/list of band indexes.

  • “SWIR NIR”, e.g., “6 5” or [6,5]

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

ndmi

arcgis.raster.functions.ndmi(raster, band_indexes='5 6', astype=None)

The Normalized Difference Moisture Index (NDMI) is sensitive to the moisture levels in vegetation. It is used to monitor droughts as well as monitor fuel levels in fire-prone areas. It uses NIR and SWIR bands to create a ratio designed to mitigate illumination and atmospheric effects.

NDMI = (NIR - SWIR1)/(NIR + SWIR1)

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object

band_indexes

Optional string/list of band indexes.

  • “NIR SWIR1”, e.g., “5 6” or [5,6]

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

ndsi

arcgis.raster.functions.ndsi(raster, band_indexes='4 6', astype=None)

The Normalized Difference Snow Index (NDSI) is designed to use MODIS (band 4 and band 6) and Landsat TM (band 2 and band 5) for identification of snow cover while ignoring cloud cover. Since it is ratio based, it also mitigates atmospheric effects.

NDSI = (Green - SWIR) / (Green + SWIR)

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object

band_indexes

Optional string/list of band indexes.

  • “Green SWIR”, e.g., “4 6” or [4,6]

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

ndvi

arcgis.raster.functions.ndvi(raster, band_indexes='4 3', astype=None)

Normalized Difference Vegetation Index NDVI = ((NIR - Red)/(NIR + Red))

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object

band_indexes

Optional string/list of band indexes.

  • Band Indexes “NIR Red”, e.g., “4 3” or [4,3]

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster.

ndvire

arcgis.raster.functions.ndvire(raster, band_indexes='7 6', astype=None)

Red-Edge NDVI (NDVIre) The Red-Edge NDVI (NDVIre) is a vegetation index for estimating vegetation health using the red-edge band. It is especially useful for estimating crop health in the mid to late stages of growth where the chlorophyll concentration is relatively higher. Also, NDVIre can be used to map the within-field variability of nitrogen foliage to understand the fertilizer requirements of crops.

NDVIre = (NIR-RedEdge)/(NIR+RedEdge)

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

band_indexes

Optional string/list of band indexes.

  • “NIR RedEdge”, e.g., “7 6” or [7,6]

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

NDVI

arcgis.raster.functions.NDVI(raster, visible_band=2, ir_band=1, astype=None)

The Normalized Difference Vegetation Index (ndvi) is a standardized index that allows you to generate an image displaying greenness (relative biomass). This index takes advantage of the contrast of the characteristics of two bands from a multispectral raster dataset the chlorophyll pigment absorptions in the red band and the high reflectivity of plant materials in the near-infrared (NIR) band. For more information, see ndvi function.

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

visible_band_id

int (zero-based band id, e.g. 2)

infrared_band_id

int (zero-based band id, e.g. 1)

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Note

The following equation is used by the NDVI function to generate a 0 200 range 8 bit result: NDVI = ((IR - R)/(IR + R)) * 100 + 100

If you need the specific pixel values (-1.0 to 1.0), use the lowercase ndvi method.

Returns

The output raster with the function applied.

ndwi

arcgis.raster.functions.ndwi(raster, band_indexes='5 3', astype=None)

The Normalized Difference Water Index (NDWI) is an index for delineating and monitoring content changes in surface water. It is computed with the near-infrared (NIR) and green bands.

NDWI = (Green - NIR)/(Green +NIR)

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

band_indexes

Optional string/list of band indexes.

  • “NIR Green”, e.g., “5 3” or [5,3]

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

negate

arcgis.raster.functions.negate(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The negate function changes the sign (multiplies by -1) of the pixel values of the input raster on a pixel-by-pixel basis.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer object. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

Tip

This raster operation can also be performed by placing the - operator in front of the input raster.

Example: neg_raster = -raster

# Usage Example 1: Executes the negate function on a raster.

neg_op = negate([raster])

not_equal

arcgis.raster.functions.not_equal(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The not_equal function performs a relational not-equal-to operation on two input rasters on a pixel-by-pixel basis.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

Tip

This raster operation can also be performed by invoking the != operator between the two input rasters.

Example: ne_op = raster1 != raster2

# Usage Example 1: Executes the boolean_not function on a raster.

ne_op = not_equal([raster1, raster2])

pansharpen

arcgis.raster.functions.pansharpen(pan_raster, ms_raster, ir_raster=None, fourth_band_of_ms_is_ir=True, weights=[0.166, 0.167, 0.167, 0.5], type='ESRI', sensor=None)

The Pansharpening function uses a higher-resolution panchromatic raster to fuse with a lower-resolution, multiband raster. It can generate colorized multispectral image with higher resolution. For more information, see http://desktop.arcgis.com/en/arcmap/latest/manage-data/raster-and-images/pansharpening-function.htm

The arguments for this function are as follows:

Argument

Description

pan_raster

Required Raster/ImageryLayer object, which is panchromatic.

ms_raster

Required Raster/ImageryLayer object, which is multispectral

ir_raster

Optional Raster/ImageryLayer object, if fourth_band_of_ms_is_ir is true or selected pansharpening method doesn’t require near-infrared image

fourth_band_of_ms_is_ir

Optional Boolean, “true” if “ms_raster” has near-infrared image on fourth band

weights

Optional list. Weights applied for Red, Green, Blue, Near-Infrared bands. 4-elements list, Sum of values is 1

type

Optional string, describes the Pansharpening method one of “IHS”, “Brovey” “ESRI”, “SimpleMean”, “Gram-Schmidt”. Default is “ESRI”

sensor

Optional string, it is an optional parameter to specify the sensor name

Returns

The output raster with the function applied.

percentile

arcgis.raster.functions.percentile(rasters, percentile_value=90, percentile_interpolation_type='AUTO_DETECT', extent_type='FirstOf', cellsize_type='FirstOf', ignore_nodata=False, astype=None, process_as_multiband=None)

The percentile function calculates the percentile of the inputs. The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a double.

percentile_value

Optional float. The percentile to calculate. The default is 90, indicating the 90th percentile. The values can range from 0 to 100. The 0th percentile is essentially equivalent to the minimum statistic, and the 100th percentile is equivalent to maximum. A value of 50 will produce essentially the same result as the median statistic.

percentile_interpolation_type

Optional string. Specifies the method of interpolation to be used when the specified percentile value lies between two input cell values.

  • AUTO_DETECT-If the input rasters are of integer pixel type, the NEAREST method is used. If the input rasters are of floating point pixel type, the LINEAR method is used. This is the default.

  • NEAREST-The nearest available value to the desired percentile is used. In this case, the output pixel type is the same as that of the input rasters.

  • LINEAR-The weighted average of the two surrounding values from the desired percentile is used. In this case, the output pixel type is floating point.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

ignore_nodata

Optional boolean. Set to True to ignore NoData values.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

process_as_multiband

Optional boolean. Set to True to process as multiband.

Returns

The output raster with the function applied.

# Usage Example 1: Calculates the 90th percentile on a list of input rasters.

percentile_raster = percentile([raster1, raster2, raster3], percentile_value=90)

plus

arcgis.raster.functions.plus(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The plus function adds (sums) the values of two rasters on a cell-by-cell basis.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Tip

This raster operation can also be performed by adding the two input rasters using the + operator.

Example: plus_op = raster1 + raster2

Returns

The output raster with the function applied.

# Usage Example 1: Executes the plus function on the input raster.

plus_op = plus([raster1, raster2])

power

arcgis.raster.functions.power(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The power function raises the cell values in a raster to the power of the values found in another raster.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Tip

This raster operation can also be performed using the ** operator.

Example: pow_raster = raster1 ** raster2

Returns

The output raster with the function applied.

# Usage Example 1: Executes the power function on the input raster.

pow_raster = power([raster1, raster2])

predict_using_trend

arcgis.raster.functions.predict_using_trend(raster, dimension_definition_type=0, dimension_values=None, start=None, end=None, interval_value=1, interval_unit='HOURS')

Computes a forecasted multidimensional raster layer using the output trend raster from the generate_trend function.

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

dimension_definition_type

Optional Integer or String. Specifies the method used to provide prediction dimension values.

  • 0 (BY_VALUE) : The prediction will be calculated for a single dimension value. For example, you want to predict yearly precipitation for the years 2050, 2100, and 2150. This is the default.

  • 1 (BY_INTERVAL) : The prediction will be calculated for an interval of the dimension defined by a start and an end value. For example, you want to predict yearly precipitation for every year between 2050 and 2150.

dimension_values

Optional List. The dimension value or values to be used in the prediction. The format of the time, depth, and height values must match the format of the dimension values used to generate the trend raster. If the trend raster was generated for the StdTime dimension, the format should be YYYY-MM-DDTHH:MM:SS, for example, 2050-01-01T00:00:00.

start

Optional String or Integer. The start date, height, or depth of the dimension interval to be used in the prediction. This parameter is required when the dimension_definition_type parameter is set to 1 (By Interval).

end

Optional String or Integer. The end date, height, or depth of the dimension interval to be used in the prediction. This parameter is required when the dimension_definition_type parameter is set to 1 (By Interval).

interval_value

Optional Integer. The number of steps between two dimension values to be included in the prediction. The default value is 1. This parameter is required when the dimension_definition_type parameter is set to 1 (By Interval).

interval_unit

Optional String. The unit that will be used for the value interval. This parameter only applies when the dimension of analysis is a time dimension.

  • HOURS - The prediction will be calculated for each hour in the range of time described by the start, end, and interval_value parameters.

  • DAYS - The prediction will be calculated for each day in the range of time described by the start, end, and interval_value parameters.

  • WEEKS - The prediction will be calculated for each week in the range of time described by the start, end, and interval_value parameters.

  • MONTHS - The prediction will be calculated for each month in the range of time described by the start, end, and interval_value parameters.

  • YEARS - The prediction will be calculated for each year in the range of time described by the start, end, and interval_value parameters.

Returns

The output raster with the function applied.

pvi

arcgis.raster.functions.pvi(raster, band_indexes='4 3 0.3 0.5', astype=None)

Perpendicular Vegetation Index PVI = (NIR-a*Red-b)/(sqrt(1+a^2)) where a = slope of the soil line and b = gradient of the soil line.

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

band_indexes

Optional string/list of band indexes.

  • “NIR Red a b”, e.g., “4 3 0.3 0.5” or [4,3,0.3,0.5]

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster.

cellstats_range

arcgis.raster.functions.cellstats_range(rasters, extent_type='FirstOf', cellsize_type='FirstOf', ignore_nodata=False, astype=None, process_as_multiband=None)

The cellstats_range function calculates the difference between the largest and the smallest values of a raster on a pixel-by-pixel basis.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

ignore_nodata

Optional boolean. Set to True to ignore NoData values.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

process_as_multiband

Optional boolean. Set to True to process as multiband.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the cellstats_range function on the list of rasters.

range_op = cellstats_range([raster1, raster2])

random_raster

arcgis.raster.functions.random_raster(raster_info, distribution=1, min_uniform=0.0, max_uniform=1.0, min_integer=1, max_integer=10, normal_mean=0.0, std_dev=1.0, exp_mean=1.0, poisson_mean=1.0, alpha=1.0, beta=1.0, N=10, r=10, probability=0.5, seed=1, generator_type=2, gis=None)

Creates a virtual raster with random values for each cell.

The arguments for this function are as follows:

Argument

Description

raster_info

Required Raster info dictionary or arcgis.raster.RasterInfo object or ImageryLayer object to set the properties of the output raster. if ImageryLayer is specified then the raster information is obtained from the ImageryLayer specified.

Example for RasterInfo dict -

{‘bandCount’: 3, ‘extent’: {“xmin”: 4488761.95, “ymin”: 5478609.805, “xmax”: 4489727.05, “ymax”: 5479555.305, “spatialReference”: { “wkt”: “PROJCS[“Deutsches_Hauptdreiecksnetz_Transverse_Mercator”, GEOGCS[“GCS_Deutsches_Hauptdreiecksnetz”, DATUM[“D_Deutsches_Hauptdreiecksnetz”, SPHEROID[“Bessel_1841”, 6377397.155,299.1528128]], PRIMEM[“Greenwich”,0.0], UNIT[“Degree”, 0.0174532925199433]], PROJECTION[“Transverse_Mercator”], PARAMETER[“false_easting”, 4500000.0], PARAMETER[“false_northing”, 0.0], PARAMETER[“central_meridian”, 12.0], PARAMETER[“scale_factor”, 1.0], PARAMETER[“latitude_of_origin”, 0.0], UNIT[“Meter”, 1.0]]” }}, ‘pixelSizeX’: 0.0999999999999614, ‘pixelSizeY’: 0.1, ‘pixelType’: ‘U8’}

distribution:

Optional int. Specify the random value distribution method to use. Default is 1. i,e; Uniform

Choice list:

Uniform = 1 UniformInteger = 2 Normal = 3 Exponential = 4 Poisson = 5 Gamma = 6 Binomial = 7 Geometric = 8 NegativeBinomial = 9

  • Uniform - A uniform distribution with the defined range.

  • UniformInteger - An integer distribution with the defined range.

  • Normal - A normal distribution with a defined {normal_mean} and {std_dev}.

  • Exponential - An exponential distribution with a defined {exp_mean}.

  • Poisson - A Poisson distribution with a defined {Mean}.

  • Gamma - A gamma distribution with a defined {alpha} and {beta}.

  • Binomial - A binomial distribution with a defined {N} and {probability}.

  • Geometric - A geometric distribution with a defined {probability}.

  • NegativeBinomial - A Pascal distribution with a defined {r} and {probability}.

min_uniform

Optional float. The default value is 0.0

max_uniform

Optional float. The default value is 1.0

min_integer

Optional int. The default value is 1

max_integer

Optional int. The default value is 10

normal_mean

Optional float. The default value is 0.0

std_dev

Optional float. The default value is 1.0

exp_mean

Optional float. The default value is 1.0

poisson_mean

Optional float. The default value is 1.0

alpha

Optional float. The default value is 1.0

beta

Optional float. The default value is 1.0

N

Optional int. The default value is 0.0

r

Optional int. The default value is 0.0

probability

Optional float. The default value is 0.5

seed

Optional int. The default value is 0.0

generator_type

Optional int. Default 2. i.e; MersenneTwister

Choice list:

Standard C Rand = 0 ACM collected algorithm 599 = 1 MersenneTwister = 2

gis

Optional gis. gis parameter can be specified to render the output raster dynamically using the raster rendering service of the gis.

If not provided, active gis will be used to do this. If gis parameter is not specified the output of constant_raster() cannot be displayed.

Returns

The output raster.

raster_calculator

arcgis.raster.functions.raster_calculator(rasters, input_names, expression, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The RasterCalculator function provides access to all existing math functions so you can make calls to them when building your expressions. The calculator function requires single-band inputs. If you need to perform expressions on bands in a multispectral image as part of a function chain, you can use the Extract Bands Function before the RasterCalculator function. For more info including operators supported, see Calculator function http://pro.arcgis.com/en/pro-app/help/data/imagery/calculator-function.htm

The arguments for this function are as follows:

Argument

Description

raster

Required list of Raster/ImageryLayer objects

input_names

Required list of strings for arbitrary raster names.

expression

Required string, expression to calculate output raster from input rasters.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster.

raster_collection_function

arcgis.raster.functions.raster_collection_function(raster, item_function=None, aggregation_function=None, processing_function=None, aggregation_definition_type='ALL', dimension=None, interval_keyword=None, interval_value=None, interval_unit=None, interval_ranges=None)

Creates a new raster by applying item, aggregation and processing function

The arguments for this function are as follows:

Argument

Description

raster

Input Imagery Layer. The image service the layer is based on should be a mosaic dataset

item_function

The raster function template to be applied on each item of the mosaic dataset. Create an RFT object out of the raster function template item on the portal and specify that as the input to item_function

aggregation_function

The aggregation function to be applied on the mosaic dataset. Create an RFT object out of the raster function template item on the portal and specify that as the input to aggregation_function

processing_function

The processing template to be applied on the imagery layer. Create an RFT object out of the raster function template item on the portal and specify that as the input to processing_function.

aggregation_definition_type

Optional String. Specifies the dimension interval for which the data will be aggregated.

  • ALL : The data values will be aggregated across all slices. This is the default.

  • INTERVAL_KEYWORD : The variable data will be aggregated using a commonly known interval.

  • INTERVAL_VALUE : The variable data will be aggregated using a user-specified interval and unit.

  • INTERVAL_RANGES : The variable data will be aggregated between specified pairs of values or dates.

dimension

Optional String. This is the dimension along which the variables will be aggregated.

interval_keyword

Optional String. Specifies the keyword interval that will be used when aggregating along the dimension. This parameter is required when the aggregation_definition_type parameter is set to INTERVAL_KEYWORD, and the aggregation must be across time.

  • HOURLY : The data values will be aggregated into hourly time steps, and the result will include every hour in the time series.

  • DAILY : The data values will be aggregated into daily time steps, and the result will include every day in the time series.

  • WEEKLY : The data values will be aggregated into weekly time steps, and the result will include every week in the time series.

  • DEKADLY : Divides each month into 3 periods of 10 days each (last period might have more or less than 10 days) and each month would output 3 slices.

  • PENTADLY : Divides each month into 6 periods of 5 days each (last period might have more or less than 5 days) and each month would output 6 slices.

  • MONTHLY : The data values will be aggregated into monthly time steps, and the result will include every month in the time series.

  • QUARTERLY : The data values will be aggregated into quarterly time steps, and the result will include every quarter in the time series.

  • YEARLY : The data values will be aggregated into yearly time steps, and the result will include every year in the time series.

  • RECURRING_DAILY : The data values will be aggregated into daily time steps, and the result includes each one aggregated value per day. The output will include, at most, 366 daily time slices

  • RECURRING_WEEKLY : The data values will be aggregated into weekly time steps, and the result will include one aggregated value per week. The output will include, at most, 53 weekly time slices.

  • RECURRING_MONTHLY : The data values will be aggregated into weekly time steps, and the result will include one aggregated value per month. The output will include, at most, 12 monthly time slices.

  • RECURRING_QUARTERLY : The data values will be aggregated into weekly time steps, and the result will include one aggregated value per quarter. The output will include, at most, 4 quarterly time slices.

interval_value

Optional String. The size of the interval that will be used for the aggregation. This parameter is required when the aggregation_definition_type parameter is set to INTERVAL_VALUE.

For example, to aggregate 30 years of monthly temperature data into 5-year increments, enter 5 as the interval_value, and specify interval_unit as YEARS.

interval_unit

Optional String. The unit that will be used for the interval value. This parameter is required when the dimension parameter is set to a time field and the aggregation_definition_type parameter is set to INTERVAL_VALUE.

If you are aggregating over anything other than time, this option will not be available and the unit for the interval value will match the variable unit of the input multidimensional raster data.

  • HOURS : The data values will be aggregated into hourly time slices at the interval provided.

  • DAYS : The data values will be aggregated into daily time slices at the interval provided.

  • WEEKS : The data values will be aggregated into weekly time slices at the interval provided.

  • MONTHS : The data values will be aggregated into monthly time slices at the interval provided.

  • YEARS : The data values will be aggregated into yearly time slices at the interval provided.

interval_ranges

Optional List of dictionary objects. Interval ranges specified as list of dictionary objects that will be used to aggregate groups of values.

This parameter is required when the aggregation_definition parameter is set to INTERVAL_RANGE. If dimension is StdTime, then the value must be specified in human readable time format (YYYY-MM-DDTHH:MM:SS).

Syntax:

[{“minValue”:”<min value>”,”maxValue”:”<max value>”}, {“minValue”:”<min value>”,”maxValue”:”<max value>”}]

Example:

[{“minValue”:”2012-01-15T03:00:00”,”maxValue”:”2012-01-15T09:00:00”}, {“minValue”:”2012-01-15T12:00:00”,”maxValue”:”2012-01-15T21:00:00”}]

Returns

The output raster.

rasterize_features

arcgis.raster.functions.rasterize_features(raster, feature_class, class_index_field=None, resolve_overlap_method=0)

Converts features to raster. Features are assigned pixel values based on the feature’s OBJECTID (default). Optionally, the pixel values can be based on a user defined value field in the input feature’s attribute table.

Argument

Description

raster

Required input Raster/ImageryLayer object

feature_class

Required FeatureLayer. The input point feature layer.

class_index_field

Optional string. Select the field to use to identify each feature.

resolve_overlap_method

Optional int or string. Determine how to manage features that overlap:

  • FIRST - The overlapping areas will be assigned a value from the first dataset listed.

  • LAST - The overlapping areas will be assigned a value from the last dataset listed.

  • SMALLEST - The overlapping areas will be assigned a value from the smaller of the features.

  • LARGEST - The overlapping areas will be assigned a value from the larger of the features.

Returns

output raster with function applied

remap

arcgis.raster.functions.remap(raster, input_ranges=None, output_values=None, geometry_type=None, geometries=None, no_data_ranges=None, allow_unmatched=None, astype=None)

The remap function allows you to change or reclassify the pixel values of the raster data. For more information, see remap function.

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

input_ranges

[float, float, …], input ranges are specified in pairs: from (inclusive) and to (exclusive).

output_values

[float, …], output values of corresponding input ranges

geometry_type

Optional geometry type. added at 10.3

geometries

Optional geometries. added at 10.3

no_data_ranges

[float, float, …], nodata ranges are specified in pairs: from (inclusive) and to (exclusive).

allow_unmatched

Boolean, specify whether to keep the unmatched values or turn into nodata.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster.

reproject

arcgis.raster.functions.reproject(raster, spatial_reference=None, x_cell_size=0, y_cell_size=0, x_registration_point=0, y_registration_point=0)

Modifies the projection of a raster dataset, mosaic dataset, or raster item in a mosaic dataset. It can also resample the data to a new cell size and define an origin.

Argument

Description

raster

Required input Raster/ImageryLayer object. The raster dataset to be reprojected or resampled.

spatial_reference

Optional dict. The coordinate system used to reproject the data.

Example:
{
“wkid” : 4176,
“latestWkid” : 4176
}

x_cell_size

Optional.The x-dimension to which the data should be resampled. This is optional. If the value is 0 or less, the output envelope (extent and cell sizes) is calculated from the input raster.

y_cell_size

Optional.The y-dimension to which the data should be resampled. This is optional. If the value is 0 or less, the output envelope (extent and cell sizes) is calculated from the input raster.

x_registration_point

Optional. The x-coordinate used to define the upper left corner of the dataset. This coordinate must be defined in the units of the new spatial reference. If both the x_cell_size and y_cell_size parameters are greater than 0, they are used along with the x_registration_point and y_registration_point parameters to define the output envelope.

y_registration_point

Optional. The y-coordinate used to define the upper left corner of the dataset. This coordinate must be defined in the units of the new spatial reference. If both the x_cell_size and y_cell_size parameters are greater than 0, they are used along with the x_registration_point and y_registration_point parameters to define the output envelope.

Returns

output raster with function applied

resample

arcgis.raster.functions.resample(raster, resampling_type=None, input_cellsize=None, output_cellsize=None, astype=None)

The resample function resamples pixel values from a given resolution.

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object

resampling_type

one of NearestNeighbor,Bilinear,Cubic,Majority,BilinearInterpolationPlus,BilinearGaussBlur, BilinearGaussBlurPlus, Average, Minimum, Maximum,VectorAverage(require two bands)

input_cellsize

point that defines cellsize in source spatial reference

output_cellsize

point that defines output cellsize

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster.

round_down

arcgis.raster.functions.round_down(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The round_down function returns the next lower integer, as a floating-point value, for each pixel in a raster.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the round_down function on the input raster.

round_down_op = round_down([raster])

round_up

arcgis.raster.functions.round_up(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The round_up function returns the next higher integer, as a floating-point value, for each pixel in a raster.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the round_up function on the input raster.

round_up_op = round_up([raster])

rtvi_core

arcgis.raster.functions.rtvi_core(raster, band_indexes='7 6 3', astype=None)

The Red-Edge Triangulated Vegetation Index (RTVICore) is a vegetation index for estimating leaf area index and biomass. This index uses reflectance in the NIR, red-edge, and green spectral bands

RTVICore = [100(NIR-RedEdge)-10(NIR-Green)]

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object

band_indexes

Optional string/list of band indexes.

  • “NIR RedEdge Green”, e.g., “7 6 3” or [7,6,3]

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster.

s1_radiometric_calibration

arcgis.raster.functions.s1_radiometric_calibration(raster, calibration_type=None)

Performs different types of radiometric calibration on Sentinel-1 data.

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

The Sentinel-1 Level-1 GRD or SLC input raster you want to process.

The function will use the LUT file either to apply the thermal correction or to remove the correction, depending on the contents of the LUT.

calibration_type

Optional string or int. one of four calibration types:

  • “beta_nought” (0) - Calibrates the reflectivity returned to the sensor from a unit area on the slant range.

  • “sigma_nought” (1) - Calibrates the backscatter returned to the sensor from a unit area on the ground with the plane locally tangent to the ellipsoid. Sigma nought values vary due to incidence angle, wavelength, polarization, terrain, and surface scattering properties.

  • “gamma_nought” (2) - Calibrates the backscatter returned to the sensor from a unit area aligned with plane perpendicular to the slant range. This normalizes sigma nought using the incidence angle relative to the ellipsoid. Gamma nought values vary due to wavelength, polarization, terrain, and surface scattering properties.

  • None - No calibration is applied. This is the default.

Returns

The output raster.

s1_thermal_noise_removal

arcgis.raster.functions.s1_thermal_noise_removal(raster)

Removes thermal noise from Sentinel-1 data.

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object. The Sentinel-1 Level-1 GRD or SLC input raster you want to process.

The function will use the LUT file either to apply the thermal correction or to remove the correction, depending on the contents of the LUT.

Returns

The output raster.

savi

arcgis.raster.functions.savi(raster, band_indexes='4 3 0.33', astype=None)

Soil-Adjusted Vegetation Index SAVI = ((NIR - Red) / (NIR + Red + L)) x (1 + L) where L represents amount of green vegetative cover, e.g., 0.5

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object

band_indexes

Optional string/list of band indexes.

  • “NIR Red L”, for example, “4 3 0.33” or [4,3,0.33]

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster.

segment_mean_shift

arcgis.raster.functions.segment_mean_shift(raster, spectral_detail=None, spatial_detail=None, spectral_radius=None, spatial_radius=None, min_num_pixels_per_segment=20, astype=None, boundaries_only=False, max_num_pixels_per_segment=- 1)

The segment_mean_shift function produces a segmented output. Pixel values in the output image represent the converged RGB colors of the segment. The input raster needs to be a 3-band 8-bit image. If the imagery layer is not a 3-band 8-bit unsigned image, you can use the Stretch function before the segment_mean_shift function.

License:At 10.5, you must license your ArcGIS Server as ArcGIS Server 10.5.1 Enterprise Advanced or ArcGIS Image Server to use this resource. At versions prior to 10.5, the hosting ArcGIS Server needs to have a Spatial Analyst license.

When specifying arguments for segment_mean_shift, use either spectral_detail, spatial_detail as a pair, or use spectral_radius, spatial_radius. They have an inverse relationship. spectral_radius = 21 - spectral_detail, spatial_radius = 21 - spectral_radius

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

spectral_detail

Optional float between 0-21. The relative importance of separating objects based on color characteristics.

Smaller values result in broad classes and more smoothing. A higher value is appropriate when you want to discriminate between features having somewhat similar spectral characteristics.

spatial_detail

Optional integer between 0-21. The relative importance of separating objects based on spatial characteristics.

Valid integer values range from 0 to 21. Smaller values result in broad classes and more smoothing. A higher value is appropriate for discriminating between features that are spatially small and clustered together.

spectral_radius

Optional float. The relative importance of separating objects based on color characteristics.

Valid values range from 0 to 21. Larger values result in broad classes and more smoothing. A lower value is appropriate when you want to discriminate between features having somewhat similar spectral characteristics.

spatial_radius

Optional integer. The relative importance of separating objects based on spatial characteristics.

Valid integer values range from 0 to 21. Larger values result in broad classes and more smoothing. A lower value is appropriate for discriminating between features that are spatially small and clustered together.

min_num_pixels_per_segment

Optional integer. The minimum segment size, measured in pixels. This value is related to your minimum mapping unit, and will filter out smaller blocks of pixels. All segments that are smaller than the specified value will merge the smaller segments with their best fitting neighbor segment. The default is 20.

boundaries_only

Optional boolean. The segment boundaries draw as a black contour line around each segment. This is helpful so you can distinguish adjacent segments that have similar colors.

  • True : The segment boundaries are displayed with black contour lines around each segment.

  • False : The segment boundaries are not displayed. This is the default.

max_num_pixels_per_segment

Optional integer. The maximum size of a segment. Segments that are larger than the specified size will be divided. Use this parameter to prevent artifacts in the output layer resulting from large segments. max_num_pixels_per_segment must be greater than min_num_pixels_per_segment when it is a positive integer. The default is -1.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster.

# Usage Example: Apply the segment_mean_shift function on a raster.

segmented_raster_op = segment_mean_shift(raster=raster_obj,
                                         spectral_detail=15.5,
                                         spatial_detail=15,
                                         min_num_pixels_per_segment=20
                                        )

set_null

arcgis.raster.functions.set_null(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The set_null function sets the identified pixels of a raster to NoData on a pixel by pixel basis.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the set_null function on the list of input rasters.

# The first input raster would be a raster with any logical math function applied
# on it to generate a boolean raster (values of 1 and 0).

# The second input raster will be the False Raster.

# On using the set_null function, all the values of 1 in the boolean raster
# (first raster) will be set to NoData, and all values of 0 will be set to
# the False Raster (second raster) values.

bool_raster = boolean_not(raster)  # Generate the boolean raster using boolean_not function
set_null_op = set_null([bool_raster, false_raster])

shaded_relief

arcgis.raster.functions.shaded_relief(raster, azimuth=None, altitude=None, z_factor=None, colormap=None, slope_type=None, ps_power=None, psz_factor=None, remove_edge_effect=None, astype=None, colorramp=None, hillshade_type=0)

Shaded relief is a color 3D model of the terrain, created by merging the images from the Elevation-coded and Hillshade methods. For more information, see Shaded relief function.

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

azimuth

float (e.g. 215.0)

altitude

float (e.g. 75.0)

z_factor

float (e.g. 0.3)

colormap

[[<value1>, <red1>, <green1>, <blue1>], [<value2>, <red2>, <green2>, <blue2>]]

slope_type

1=DEGREE, 2=PERCENTRISE, 3=SCALED. default is 1.

ps_power

float, used together with SCALED slope type

psz_factor

float, used together with SCALED slope type

remove_edge_effect

boolean, True or False

astype

output pixel type

colorramp

string, specifying color ramp name like <Black To White|Yellow To Red|Slope|more..> or a color ramp object. For more information about colorramp object, see color ramp object at https://developers.arcgis.com/documentation/common-data-types/color-ramp-objects.htm)

hillshade_type

new at 10.8.1. int, 0 = traditional, 1 = multi - directional; default is 0

Returns

The output raster.

sin

arcgis.raster.functions.sin(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The sin operation calculates the sine of the pixels in a raster.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the sin function on a raster.

sin_op = sin([raster])

sinh

arcgis.raster.functions.sinh(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The sinh operation calculates the hyperbolic sine of the pixels in a raster.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the sinh function on a raster.

sinh_op = sinh([raster])

slope

arcgis.raster.functions.slope(dem, z_factor=None, slope_type=None, ps_power=None, psz_factor=None, remove_edge_effect=None, astype=None)

Slope represents the rate of change of elevation for each pixel. For more information, see slope function and How slope works.

The arguments for the slope function are as follows:

Argument

Description

dem

Required input Raster/ImageryLayer object created from a DEM.

z_factor

Optional float. Scaling factor used to convert the elevation values for two purposes:

  • Convert the elevation units (such as meters or feet) to the horizontal coordinate units of the dataset, which may be feet, meters, or degrees.

  • Add vertical exaggeration for visual effect.

Default is 0.3.

slope_type

(New at 10.2) Optional float. Available options are -

  • 1=DEGREE

  • 2=PERCENTRISE

  • 3=SCALED.

Default is 1.

ps_power

(New at 10.2) Optional float. Pixel Size Power accounts for the altitude changes (or scale) as the viewer zooms in and out on the map display. Used together with SCALED slope type.

psz_factor

(New at 10.2) Optional float. Pixel Size Factor controls the rate at which z_factor changes.

remove_edge_effect

(New at 10.2) Optional bool. Using this option will avoid any resampling artifacts that may occur along the edges of a raster. Optional bool.

  • False - Bilinear resampling will be applied uniformly to resample the output.

  • True - Bilinear resampling will be used to resample the output, except along the edges of the rasters or beside pixels of NoData.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

the output raster

# Usage Example 1: Applies the slope function to a raster with edge resampling artifact removal.

slope_op = slope(raster, remove_edge_effect=True)

spectral_conversion

arcgis.raster.functions.spectral_conversion(raster, conversion_matrix)

The SpectralConversion function applies a matrix to a multi-band image to affect the spectral values of the output. In the matrix, different weights can be assigned to all the input bands to calculate each of the output bands. The column/row size of the matrix equals to the band count of input raster. For more information, see Spectral Conversion function http://desktop.arcgis.com/en/arcmap/latest/manage-data/raster-and-images/spectral-conversion-function.htm

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

conversion_parameters

list of floats (A NxN length one-dimension matrix, where N=band count.)

Returns

The output raster.

speckle

arcgis.raster.functions.speckle(raster, filter_type='Lee', filter_size='3x3', noise_model='Multiplicative', noise_var=None, additive_noise_mean=None, multiplicative_noise_mean=1, nlooks=1, damp_factor=None)

The Speckle function filters the speckled radar dataset to smooth out the noise while retaining the edges or sharp features in the image. Four speckle reduction filtering algorithms are provided through this function. For more information including required and optional parameters for each filter and the default parameter values, see Speckle function http://desktop.arcgis.com/en/arcmap/latest/manage-data/raster-and-images/speckle-function.htm

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

filter_type

Optional string, one of “Lee”, “EnhancedLee” “Frost”, “Kaun”. Default is “Lee”.

filter_size

Optional string, kernel size. One of “3x3”, “5x5”, “7x7”, “9x9”, “11x11”. Default is “3x3”.

noise_model

Optional string, For Lee filter only. One of “Multiplicative”, “Additive”, “AdditiveAndMultiplicative”

noise_var

Optional float, for Lee filter with noise_model “Additive” or “AdditiveAndMultiplicative”

additive_noise_mean

Optional string, for Lee filter witth noise_model “AdditiveAndMultiplicative” only

multiplicative_noise_mean

Optional float, For Lee filter with noise_model “Additive” or “AdditiveAndMultiplicative”

nlooks

Optional int, for Lee, EnhancedLee and Kuan Filters

damp_factor

Optional float, for EnhancedLee and Frost filters

Returns

The output raster.

sqrt

arcgis.raster.functions.sqrt(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The sqrt function calculates the square-root of the pixels in a raster.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the sqrt function on a raster.

sqrt_op = sqrt([raster])

square

arcgis.raster.functions.square(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The square operation calculates the squares of the pixels in a raster.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the square function on a raster.

square_op = square([raster])

sr

arcgis.raster.functions.sr(raster, band_indexes='4 3', astype=None)

Simple Ratio (SR)

SR = NIR / Red

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object

band_indexes

Optional string/list of band indexes.

  • “NIR Red”, e.g., “4 3” or [4,3]

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster.

srre

arcgis.raster.functions.srre(raster, band_indexes='7 6', astype=None)

The Red-Edge Simple Ratio (SRre) is a vegetation index for estimating the amount of healthy and stressed vegetation. It is the ratio of light scattered in the NIR and red-edge bands, which reduces the effects of atmosphere and topography.

Values are high for vegetation with high canopy closure and healthy vegetation, lower for high canopy closure and stressed vegetation, and low for soil, water, and nonvegetated features. The range of values is from 0 to about 30, where healthy vegetation generally falls between values of 1 to 10.

SRre = NIR / RedEdge

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object

band_indexes

Optional string/list of band indexes.

  • “NIR RedEdge”, e.g., “7 6” or [7,6]

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster.

focal_statistics

arcgis.raster.functions.focal_statistics(raster, kernel_columns=None, kernel_rows=None, stat_type=None, columns=None, rows=None, fill_no_data_only=None, astype=None)

The focal_statistics function calculates focal statistics for each pixel of an image based on a defined focal neighborhood. For more information, see statistics function.

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

kernel_columns

int (e.g. 3)

kernel_rows

int (e.g. 3)

stat_type

int or string. There are four types of focal statistical functions:

1=Min, 2=Max, 3=Mean, 4=StandardDeviation, 5=Median, 6=Majority, 7=Minority

  • Min - Calculates the minimum value of the pixels within the neighborhood

  • Max - Calculates the maximum value of the pixels within the neighborhood

  • Mean - Calculates the average value of the pixels within the neighborhood. This is the default.

  • StandardDeviation - Calculates the standard deviation value of the pixels within the neighborhood

  • Median - Calculates the median value of pixels within the neighborhood.

  • Majority - Calculates the majority value, or the value that occurs most frequently, of the pixels within the neighborhood.

  • Minority - Calculates the minority value, or the value that occurs least frequently, of the pixels within the neighborhood.

columns

int (e.g. 3). The number of pixel rows to use in your focal neighborhood dimension.

rows

int (e.g. 3). The number of pixel columns to use in your focal neighborhood dimension.

fill_no_data_only

boolean

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster.

Note

The focal_statistics() function is different from the focal_stats() function in the following aspects:

The focal_statistics() function supports Minimum, Maximum, Mean, and Standard Deviation, Median, Majority, Minority. The focal_stats() function supports Mean, Majority, Maximum, Median, Minimum, Minority, Range, Standard deviation, Sum, and Variety.

The focal_statistics() function supports only Rectangle. The focal_stats() function supports Rectangle, Circle, Annulus, Wedge, Irregular, and Weight neighborhoods.

The option to determine if NoData pixels are to be processed out is available in the focal_statistics() function by setting a boolean value for fill_no_data_only param. This option is not present in the focal_stats() function.

The option to determine whether NoData values are ignored or not is available in the focal_stats() function by setting a boolean value for ignore_no_data param. This option is not present in the focal_statistics() function.

statistics_histogram

arcgis.raster.functions.statistics_histogram(raster, statistics=None, histograms=None)

The function is used to define the statistics and histogram of a raster. It is normally used for control the default display of exported image. For more information, see Statistics and Histogram function, http://desktop.arcgis.com/en/arcmap/latest/manage-data/raster-and-images/statistics-and-histogram-function.htm

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object

statistics

list of statistics objects. (Predefined statistics for each band)

histograms

list of histogram objects. (Predefined histograms for each band)

Returns

The output raster.

std

arcgis.raster.functions.std(rasters, extent_type='FirstOf', cellsize_type='FirstOf', ignore_nodata=False, astype=None, process_as_multiband=None)

The std function calculates the standard deviation of the pixels of a raster on a pixel-by-pixel basis.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

ignore_nodata

Optional boolean. Set to True to ignore NoData values.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

process_as_multiband

Optional boolean. Set to True to process as multiband.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the std function on a list of input rasters with the same band count.

raster_list = [raster1, raster2, raster3]
std_raster = std(raster_list)

stretch

arcgis.raster.functions.stretch(raster, stretch_type=0, min=None, max=None, num_stddev=None, statistics=None, dra=None, min_percent=None, max_percent=None, gamma=None, compute_gamma=None, sigmoid_strength_level=None, astype=None, colorramp=None)

The stretch function enhances an image through multiple stretch types. For more information, see stretch function.

Gamma stretch works with all stretch types. The Gamma parameter is needed when UseGamma is set to true. Min and Max can be used to define output minimum and maximum. DRA is used to get statistics from the extent in the export_image request. ComputeGamma will automatically calculate best gamma value to render exported image based on empirical model.

Stretch type None does not require other parameters. Stretch type StdDev requires NumberOfStandardDeviations, Statistics, or DRA (true). Stretch type Histogram (Histogram Equalization) requires the source dataset to have histograms or additional DRA (true). Stretch type MinMax requires Statistics or DRA (true). Stretch type PercentClip requires MinPercent, MaxPercent, and DRA (true), or histograms from the source dataset. Stretch type Sigmoid does not require other parameters.

Optionally, set the SigmoidStrengthLevel (1 to 6) to adjust the curvature of Sigmoid curve used in color stretch.

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object

stretch_type

Optional string, one of None, StdDev, Histogram, MinMax, PercentClip, 9 = Sigmoid

min

Optional float

max

Optional float

num_stddev

Optional float (e.g. 2.5)

statistics

Optional float (e.g. 2.5)[<min1>, <max1>, <mean1>, <standardDeviation1>], //[float, float, float, float][<min2>, <max2>, <mean2>, <standardDeviation2>]],

dra

Optional boolean. derive statistics from current request, Statistics parameter is ignored when DRA is true

min_percent

Optional float (e.g. 0.25), applicable to PercentClip

max_percent

Optional float (e.g. 0.5), applicable to PercentClip

gamma

Optional list of floats

compute_gamma

Optional boolean, applicable to any stretch type when “UseGamma” is “true”

sigmoid_strength_level

Optional integer (1~6), applicable to Sigmoid

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

colorramp

Can be a string specifiying color ramp name like <Black To White|Yellow To Red|Slope|more..> or a color ramp object.

For more information about colorramp object, see color ramp object at https://developers.arcgis.com/documentation/common-data-types/color-ramp-objects.htm)

Returns

The output raster.

sultan

arcgis.raster.functions.sultan(raster, band_indexes='1 2 3 4 5 6', astype=None)

Sultan’s Formula (transform to 3 band 8 bit image)

Band 1 = (Band5 / Band6) x 100
Band 2 = (Band5 / Band1) x 100
Band 3 = (Band3 / Band4) x (Band5 / Band4) x 100

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object

band_indexes

Optional string/list of band indexes.

  • “Band1 Band2 Band3 Band4 Band5 Band6”, e.g., “1 2 3 4 5 6” or [1,2,3,4,5,6]

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster.

sum

arcgis.raster.functions.sum(rasters, extent_type='FirstOf', cellsize_type='FirstOf', ignore_nodata=False, astype=None, process_as_multiband=None)

The sum function adds the values of the rasters on a pixel-by-pixel basis.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

ignore_nodata

Optional boolean. Set to True to ignore NoData values.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

process_as_multiband

Optional boolean. Set to True to process as multiband.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the sum function on a list of rasters.

sum_op = sum([raster1, raster2, raster3])

# Usage Example 2: Executes the sum function on a list of rasters.
# Setting process_as_multiband to True so as to process multiband inputs as multiband.

sum_op = sum([raster1, raster2, raster3], process_as_multiband=True)

tan

arcgis.raster.functions.tan(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The tan function calculates the tangent of the pixels in a raster.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the tan function on a raster.

tan_op = tan([raster])

tanh

arcgis.raster.functions.tanh(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The tanh operation calculates the hyperbolic tangent of the pixels in a raster.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the tanh function on a raster.

tanh_op = tanh([raster])

tasseled_cap

arcgis.raster.functions.tasseled_cap(raster)

The function is designed to analyze and map vegetation and urban development changes detected by various satellite sensor systems. It is known as the Tasseled Cap transformation due to the shape of the graphical distribution of data. This function takes no arguments except a raster. The input for this function is the source raster of image service. There are no other parameters for this function because all the information is derived from the input’s properties and key metadata (bands, data type, and sensor name). Only imagery from the Landsat MSS, Landsat TM, Landsat ETM+, IKONOS, QuickBird, WorldView-2 and RapidEye sensors are supported. Prior to applying this function, there should not be any functions that would alter the pixel values in the function chain, such as the Stretch, Apparent Reflectance or Pansharpening function. The only exception is for Landsat ETM+; when using Landsat ETM+, the Apparent Reflectance function must precede the Tasseled Cap function. For more information, see http://desktop.arcgis.com/en/arcmap/latest/manage-data/raster-and-images/tasseled-cap-transformation.htm

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object

Returns

The output raster.

threshold

arcgis.raster.functions.threshold(raster, astype=None)

The threshold function produces a binary thresholded image. It uses the Otsu method and assumes the input image to have a bi-modal histogram.

The arguments for the threshold function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

astype

Optional string. Output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Applies binary thresholding to the input raster.

threshold_op = threshold(inp_raster)

times

arcgis.raster.functions.times(rasters, extent_type='FirstOf', cellsize_type='FirstOf', astype=None)

The times function multiplies the values of two rasters on a cell-by-cell basis.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Tip

This raster operation can also be performed by multiplying the two input rasters using the * operator.

Example: prod_raster = raster1 * raster2

Returns

The output raster with the function applied.

# Usage Example 1: Executes the times function on the input raster.

prod_raster = times([raster1, raster2])

transpose_bits

arcgis.raster.functions.transpose_bits(raster, input_bit_positions=None, output_bit_positions=None, constant_fill_check=None, constant_fill_value=None, fill_raster=None, astype=None)

The transpose_bits function performs a bit operation. It extracts bit values from the source data and assigns them to new bits in the output data.

The arguments for this function are as follows:

If constant_fill_check is False, it assumes there is an input fill_raster. If an input fill_raster is not given, it falls back constant_fill_check to True and looks for constant_fill_value. Filling is used to initialize pixel values of the output raster. Landsat 8 has a quality assessment band. The following are the example input and output bit positions to extract confidence levels by mapping them to 0-3:

  • Landsat 8 Water: {“input_bit_positions”:[4,5],”output_bit_positions”:[0,1]}

  • Landsat 8 Cloud Shadow: {“input_bit_positions”:[6,7],”output_bit_positions”:[0,1]}

  • Landsat 8 Vegetation: {“input_bit_positions”:[8,9],”output_bit_positions”:[0,1]}

  • Landsat 8 Snow/Ice: {“input_bit_positions”:[10,11],”output_bit_positions”:[0,1]}

  • Landsat 8 Cirrus: {“input_bit_positions”:[12,13],”output_bit_positions”:[0,1]}

  • Landsat 8 Cloud: {“input_bit_positions”:[14,15],”output_bit_positions”:[0,1]}

  • Landsat 8 Designated Fill: {“input_bit_positions”:[0],”output_bit_positions”:[0]}

  • Landsat 8 Dropped Frame: {“input_bit_positions”:[1],”output_bit_positions”:[0]}

  • Landsat 8 Terrain Occlusion: {“input_bit_positions”:[2],”output_bit_positions”:[0]}

Argument

Description

raster

Required input Raster/ImageryLayer object

input_bit_positions

list of integers, required

output_bit_positions

list of integers, required

constant_fill_check

boolean, optional

constant_fill_value

integer, required

fill_raster

optional, the fill raster (Raster/ImageryLayer object)

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster.

trend_to_rgb

arcgis.raster.functions.trend_to_rgb(raster, model_type=0)

Display the generate trend raster. Function available in ArcGIS Image Server 10.8.1 and higher.

Argument

Description

raster

Required input Raster/ImageryLayer object.

model_type

Optional String. Specifies the model type.

  • “LINEAR” (0)

  • “HARMONIC” (1)

Example:

“LINEAR”

Returns

Imagery layer

tsavi

arcgis.raster.functions.tsavi(raster, band_indexes='4 3 0.33 0.50 1.50', astype=None)

Transformed Soil Adjusted Vegetation Index

TSAVI = (s(NIR-s*Red-a))/(a*NIR+Red-a*s+X*(1+s^2))

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object

band_indexes

Optional string/list of band indexes.

  • “NIR Red s a X”, e.g., “4 3 0.33 0.50 1.50” or [4,3,0.33,0.50,1.50] where a = the soil line intercept, s = the soil line slope, X = an adjustment factor that is set to minimize soil noise

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster.

unit_conversion

arcgis.raster.functions.unit_conversion(raster, from_unit=None, to_unit=None, astype=None)

The unit_conversion function performs unit conversions.

The arguments for this function are as follows:

from_unit and to_unit take the following str values: Speed Units: MetersPerSecond, KilometersPerHour, Knots, FeetPerSecond, MilesPerHour Temperature Units: Celsius,Fahrenheit,Kelvin Distance Units: str, one of Inches, Feet, Yards, Miles, NauticalMiles, Millimeters, Centimeters, Meters

Argument

Description

raster

Required input Raster/ImageryLayer object.

from_unit

units constant listed above (int).

to_unit

units constant listed above (int).

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster.

vari

arcgis.raster.functions.vari(raster, band_indexes='3 2 1', astype=None)

Visible Atmospherically Resistant Index

VARI = (Green - Red)/(Green + Red - Blue)

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object.

band_indexes

Optional string/list of band indexes.

  • “Red Green Blue”, e.g., “3 2 1” or [3,2,1]

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster.

variety

arcgis.raster.functions.variety(rasters, extent_type='FirstOf', cellsize_type='FirstOf', ignore_nodata=False, astype=None, process_as_multiband=None)

The variety function calculates the number of unique values of a raster on a pixel-by-pixel basis.

The arguments for this function are as follows:

Argument

Description

rasters

Required list of Raster/ImageryLayer objects. If a scalar is needed for the operation, the scalar can be a float.

extent_type

Optional string. Specifies the extent to be used for the function.

  • “FirstOf” - Use the extent of the first input raster to determine the processing extent. This is the default.

  • “IntersectionOf” - Use the extent of the overlapping pixels to determine the processing extent.

  • “UnionOf” - Use the extent of all the rasters to determine the processing extent.

  • “LastOf” - Use the extent of the last input raster to determine the processing extent.

cellsize_type

Optional string. Specifies the cell size to be used for the function.

  • “FirstOf” - Use the first cell size of the input rasters. This is the default.

  • “MinOf” - Use the smallest cell size of all the input rasters.

  • “MaxOf” - Use the largest cell size of all the input rasters.

  • “MeanOf” - Use the mean cell size of all the input rasters.

  • “LastOf” - Use the last cell size of the input rasters.

ignore_nodata

Optional boolean. Set to True to ignore NoData values.

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

process_as_multiband

Optional boolean. Set to True to process as multiband. Default is None.

Returns

The output raster with the function applied.

# Usage Example 1: Executes the variety function on a list of rasters.

variety_op = variety([raster1, raster2])

vector_field

arcgis.raster.functions.vector_field(raster_u_mag, raster_v_dir, input_data_type='Vector-UV', angle_reference_system='Geographic', output_data_type='Vector-UV', astype=None)

The VectorField function is used to composite two single-band rasters (each raster represents U/V or Magnitude/Direction) into a two-band raster (each band represents U/V or Magnitude/Direction). Data combination type (U-V or Magnitude-Direction) can also be converted interchangeably with this function. For more information, see Vector Field function (http://desktop.arcgis.com/en/arcmap/latest/manage-data/raster-and-images/vector-field-function.htm)

The arguments for this function are as follows:

Argument

Description

raster_u_mag

raster item representing ‘U’ or ‘Magnitude’ - Required input Raster/ImageryLayer object filtered by where clause, spatial and temporal filters

raster_v_dir

raster item representing ‘V’ or ‘Direction’ - Required input Raster/ImageryLayer object filtered by where clause, spatial and temporal filters

input_data_type

string, ‘Vector-UV’ or ‘Vector-MagDir’ per input used in ‘raster_u_mag’ and ‘raster_v_dir’

angle_reference_system

string, optional when ‘input_data_type’ is ‘Vector-UV’, one of “Geographic”, “Arithmetic”

output_data_type

string, ‘Vector-UV’ or ‘Vector-MagDir’

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster.

vector_field_renderer

arcgis.raster.functions.vector_field_renderer(raster, is_uv_components=None, reference_system=None, mass_flow_angle_representation=None, calculation_method='Vector Average', symbology_name='Single Arrow', astype=None)

The vector_field_renderer function symbolizes a U-V or Magnitude-Direction raster.

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object

is_uv_components

boolean

reference_system

int 1=Arithmetic, 2=Angular

mass_flow_angle_representation

int 0=from 1=to

calculation_method

string, “Vector Average” (default) | “Nearest neighbor” | “Bilinear” | “Cubic” | “Minimum” | “Maximum”

symbology_name

string, “Single Arrow” | “Wind Barb” | “Ocean Current”

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

The output raster.

weighted_overlay

arcgis.raster.functions.weighted_overlay(rasters, fields, influences, remaps, eval_from, eval_to)

The WeightedOverlay function allows you to overlay several rasters using a common measurement scale and weights each according to its importance. For more information, see http://desktop.arcgis.com/en/arcmap/latest/manage-data/raster-and-images/weighted-overlay-function.htm

The arguments for this function are as follows:

Argument

Description

raster

Required list of Raster/ImageryLayer objects.

fields

Required list of string fields of the input rasters to be used for weighting.

influences

Required list of floats, Each input raster is weighted according to its importance, or its influence. The sum of the influence weights must equal 1

remaps

Required list of strings, Each value in an input raster is assigned a new value based on the remap. The remap value can be a valid value or a NoData value.

eval_from

required, numeric value of evaluation scale from

eval_to

required, numeric value of evaluation scale to

Returns

The output raster.

weighted_sum

arcgis.raster.functions.weighted_sum(rasters, fields, weights)

The weighted_sum function allows you to overlay several rasters, multiplying each by their given weight and summing them together. For more information, see http://desktop.arcgis.com/en/arcmap/latest/manage-data/raster-and-images/weighted-sum-function.htm

The arguments for this function are as follows:

Argument

Description

raster

Required list of Raster/ImageryLayer objects.

fields

Required list of string fields of the input rasters to be used for weighting.

weights

Required list of floats, The weight value by which to multiply the raster. It can be any positive or negative decimal value

Returns

The output raster.

wind_chill

arcgis.raster.functions.wind_chill(temperature_raster, wind_speed_raster, temperature_units='Fahrenheit', wind_speed_units='mph', wind_chill_units='Fahrenheit')

The Wind Chill function is useful for identifying dangerous winter conditions that, depending on exposure times to the elements, can result in frostbite or even hypothermia. Wind chill is a way to measure how cold an individual feels when wind is taken into account with already cold temperatures. The faster the wind speed, the more quickly the body will lose heat and the colder they will feel.

Argument

Description

temperature_raster

Required Raster/ImageryLayer object that represent temperature. A single-band raster where pixel values represent ambient air temperature.

wind_speed_raster

Required Raster/ImageryLayer object that represent relative humidity. A single-band raster where pixel values represent wind speed.

temperature_units

Optional String. The unit of measurement associated with the input temperature raster. Available input units are Celsius, Fahrenheit, and Kelvin.

wind_speed_units

Optional String. Defines the unit of measurement for the wind-speed raster. Available input units are mph, km/h, ft/s and kn. Each represents

  • Miles Per Hour (mph)

  • Kilometers Per Hour (km/h)

  • Meters Per Second (m/s)

  • Feet Per Second (ft/s)

  • Knots (kn)

wind_chill_units

Optional String. The unit of measurement associated with the output raster. Available output units are Celsius, Fahrenheit, and Kelvin.

Returns

the output raster

wndwi

arcgis.raster.functions.wndwi(raster, band_indexes='2 5 6 0.5', astype=None)

The Weighted Normalized Difference Water Index (WNDWI) is a water index developed to reduce error typically encountered in other water indices, including water turbidity, small water bodies, or shadow in remote sensing scenes. Supported from 10.8.

WNDWI = [Green – α * NIR – (1 – α) * SWIR ] / [Green + α * NIR + (1 – α) * SWIR] where α = a weighted coefficient ranging from 0 to 1.

The arguments for this function are as follows:

Argument

Description

raster

Required input Raster/ImageryLayer object

band_indexes

Optional string/list of band indexes.

  • “Green NIR SWIR α”, e.g., “2 5 6 0.5” or [2,5,6,0.5]

astype

Optional string. Specifies the output pixel type. Available options are - “C128” | “C64” | “F32” | “F64” | “S16” | “S32” | “S8” | “U1” | “U16” | “U2” | “U32” | “U4” | “U8”. Default is None.

Returns

output raster

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.