Summary
Categorizes the pixel values of a raster object into groups based on zones defined in another raster and zone-dependent value mapping defined in a table.
Discussion
For more information about how this function works, see the Zonal Remap raster function.
The referenced raster dataset for the raster object is temporary. To make it permanent, you can call the raster object's save method.
Syntax
ZonalRemap (raster, zonal_attribute_table, {zone_raster}, {zone_field}, {min_value_field_name}, {max_value_field_name}, {output_value_field_name}, {background_value}, {default_output_value}, {where_clause})
Parameter | Explanation | Data Type |
raster | A single-band raster input containing pixel values to remap. | Raster |
zonal_attribute_table | A table containing at least three fields. The table must have a minimum threshold value, a maximum threshold value, and a target value. The target value is the name of the field that will contain the remapped value. The format of the input can be a feature class, feature service, or any table type that ArcGIS supports. | String |
zone_raster | A single-band raster, where each pixel defines zones associated with a particular location. A zone is defined as all areas in the input that have the same value. The areas do not have to be contiguous. (The default value is None) | RasterCollection |
zone_field | The field name in the zonal_attribute_table that contains the zone ID values. The zone ID values are directly tied to the zone IDs in your zonal raster. The zone ID values provide another level of filtering while remapping. If there is no zone ID associated with a particular record in the table, it will not participate in the remapping. (The default value is 'ZoneID') | String |
min_value_field_name | The field name containing the minimum value above which an input pixel is remapped. If left unspecified, or if the field value is null, pixel values are not tested for minimum. (The default value is 'ZoneMin') | String |
max_value_field_name | The field name containing the maximum value below which an input pixel is remapped. If left unspecified, or if the field value is null, pixel values are not tested for maximum. (The default value is 'ZoneMax') | String |
output_value_field_name | The field name containing the target value to which an input pixel is remapped. If left unspecified, or if the field value is null, remapped pixel values are set to default_output_value. (The default value is 'ZoneValue') | String |
background_value | The initial pixel value of the output raster, before input pixels are remapped. (The default value is 0) | String |
default_output_value | The value that will be assigned to a pixel that does not satisfy any of the conditions set in the zonal_attribute_table. This value will also be the value of the output pixel if either the output_value_field_name parameter is left unspecified or the output value of the corresponding zonal threshold is left unspecified in the zonal_attribute_table. (The default value is 255) | String |
where_clause | A query applied to the zonal_attribute_table. (The default value is None) | String |
Data Type | Explanation |
Raster | The remapped raster object. |
Code sample
Remap pixels in a raster according to zones defined in another raster, or zone-dependent values defined in a table.
from arcpy.sa import *
out_zonalremap_raster = ZonalRemap("cloudceilings.tif","zonal.csv", "zone.tif")
out_zonalremap_raster.save("C:/arcpyExamples/outputs/Zonal_remap.tif")
Remap pixels in a raster according to zones defined in another raster, or zone-dependent values defined in a table.
# Import system modules
import arcpy
from arcpy.sa import *
# Set the analysis environments
arcpy.env.workspace = "C:/arcpyExamples/data"
# Set the local variables
in_raster = "NDVI.tif"
zonal_attribute_table = "zonal.csv"
zone_raster = "neighborhoods.tif"
# Apply ZonalRemap function
zonal_remap_raster = ZonalRemap(in_raster, zonal_attribute_table, zone_raster)
# Save the output
zonal_remap_raster.save("C:/arcpyExamples/outputs/NDVI.tif")