Set Raster Properties (Data Management)
Summary
Sets some properties on a raster dataset or mosaic dataset, such as data type, statistics, and nodata values.
Usage
This tool allows you to define the statistics for a raster or mosaic dataset. Typically, you use this tool if you do not want to have ArcGIS calculate them for you. Statistics you can set are the minimum, maximum, standard deviation, and mean values for each band. These statistics can be read from an XML file. This XML file can be created by exporting the statistics from another raster or mosaic dataset, as follows:
- In the Catalog window, right-click the raster or mosaic dataset that contains the statistics you want to export and select Properties.
- Scroll down to the row containing the Statistics property.
- Expand the Options drop-down menu in the Value column.
- Click Export Statistics to XML.
The properties that can be set with this tool determine the default rendering settings in ArcMap, as well as statistics that are used by other tools.
Properties you can set include:
- Data Source Type: this defines whether the cell values represent elevation or categorical data, or whether the values have been processed by other methods and do not require stretching when displaying the data.
- Statistics Per Band: for each band, you can define minimum, maximum, mean, and standard deviation values.
- Bands for NoData Value: for each band, you can define a No Data value.
-
These properties can also be set in the Properties window, by right-clicking a raster in the Catalog window and selecting Properties, or by right-clicking a raster layer in ArcMap and selecting Properties. The Set Raster Properties tool allows you to set these properties within a geoprocessing model or in Python.
Syntax
Parameter | Explanation | Data Type |
in_raster |
The input raster dataset or mosaic dataset. | Mosaic Layer ; Raster Layer |
data_type (Optional) |
The type of data this dataset contains. These settings control the symbology applied when these datasets are rendered.
| String |
statistics [[band_index, min, max, mean, std_dev],...] (Optional) | Enter the band number, minimum statistics value, maximum statistics value, mean statistics value, and standard deviation value. | Value Table |
stats_file (Optional) |
An XML file that contains the statistics. This file can be created by exporting the statistics from another raster or mosaic dataset. | File |
nodata [[band index, nodata_value],...] (Optional) | Define values for each or all bands. Each band can have a unique NoData value defined, or the same value can be specified for all bands. If you want to define multiple NoData values for each band selection, use a space delimiter between each NoData value within the bands_for_nodata_value parameter. | Value Table |
Code Sample
This is a Python sample for SetRasterProperties.
import arcpy
arcpy.SetRasterProperties_management("\\cpu\data\srtm.tif", "ELEVATION",
"1 50 400 5 28" , "#" , "#")
This is a Python script sample for SetRasterProperties.
#Set raster dataset type and statistics
import arcpy
arcpy.env.workspace = "C:/Workspace"
arcpy.SetRasterProperties_management("srtmraster.tif", "ELEVATION",
"1 50 400 5 28", "#", "#")