Create Random Raster (Data Management)

License Level:BasicStandardAdvanced

Summary

Creates a random raster dataset based on a user-specified distribution and extent.

Usage

Syntax

CreateRandomRaster_management (out_path, out_name, {distribution}, {raster_extent}, {cellsize})
ParameterExplanationData Type
out_path

The location of the output raster dataset.

Workspace;Raster Catalog
out_name

The name of the raster dataset to be created.

When not saving to a geodatabase, specify .tif for a TIFF file format, .img for an ERDAS IMAGINE file format, or no extension for a GRID file format.

String
distribution
(Optional)

The distribution of random values desired is as follows:

  • UNIFORM {Minimum}, {Maximum}—A uniform distribution with a range defined by the {Minimum} and {Maximum}. Both the {Minimum} and {Maximum} are of type double.

    The default values are 0.0 for {Minimum} and 1.0 for {Maximum}.

  • INTEGER {Minimum}, {Maximum}—An integer distribution with a range defined by the {Minimum} and {Maximum}. Both the {Minimum} and {Maximum} are of type long.

    The default values are 1 for {Minimum} and 10 for {Maximum}.

  • NORMAL {Mean}, {Standard Deviation}—A normal distribution with a defined {Mean} and {Standard Deviation}. Both the {Mean} and {Standard Deviation} are of type double.

    The default values are 0.0 for {Mean} and 1.0 for {Standard Deviation}.

  • EXPONENTIAL {Mean}—An exponential distribution with a defined {Mean}. The {Mean} is of type double.

    The default value for {Mean} is 1.0.

  • POISSON {Mean}—A Poisson distribution with a defined {Mean}. The {Mean} is of type double.

    The default value for {Mean} is 1.0.

  • GAMMA {Alpha}, {Beta}—A gamma distribution with a defined {Alpha} and {Beta}. Both the {Alpha} and {Beta} are of type double. The default values are 1.0 for {Alpha} and 1.0 for {Beta}.
  • BINOMIAL {N}, {Probability}—A binomial distribution with a defined {N} and {Probability}. The {N} is of type long and {Probability} is of type double.

    The default values are 10 for {N} and 0.5 for {Probability}.

  • GEOMETRIC {Probability}—A geometric distribution with a defined {Probability}. The {Probability} is of type double.

    The default value for {Probability} is 0.5.

  • NEGATIVE BINOMIAL {r}, {Probability}—A Pascal distribution with a defined {r} and {Probability}. The {r} is of type double and {Probability} is of type double.

    The default values are 10.0 for {r} and 0.5 for {Probability}.

String
raster_extent
(Optional)

The spatial extent of the random raster dataset.

Extent
cellsize
(Optional)

The cell size of the new random raster dataset.

Double

Code Sample

CreateRandomRaster example 1 (Python window)

This sample creates an output raster of random values with a normal distribution at the defined extent and cell size

import arcpy
arcpy.CreateRandomRaster_management("c:/output", "randrast", 
                                    "NORMAL 3.0", "0 0 500 500", 50)
CreateRandomRaster example 2 (stand-alone script)

This sample creates an output raster of random values with a Poisson distribution at the defined extent and cell size.

# Name: CreateRandomRaster_Ex_02.py
# Description: Creates a random raster dataset based on a 
#              user-specified distribution and extent.
# Requirements: None

# Import system modules
import arcpy

# Set local variables
outPath = "c:/output"
outFile = "randrast02"
distribution = "POISSON 6.4"
outExtent = "250 250 750 750"
cellSize = 25

# Execute CreateRandomRaster
arcpy.CreateRandomRaster_management(outPath, outFile, distribution, 
                                    outExtent, cellSize)

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Requires 3D Analyst or Spatial Analyst
ArcGIS for Desktop Standard: Requires 3D Analyst or Spatial Analyst
ArcGIS for Desktop Advanced: Yes
11/18/2013