Normalizing Data to Data Range Using Raster Calculator

3343
1
08-20-2013 06:18 AM
VM3
by
New Contributor
Hi,

I???d like to normalize map data in raster format to the data range using Raster Calculator. I'm not so much concerned with the accuracy of the method.

e.g. v???(i) = (v(i) - minA) / (maxA - minA)


What is the syntax I need to do this? I am getting problems using the following script:

("raster" - min("raster")) / (max("raster") - min("raster"))

Thanks!
0 Kudos
1 Reply
XanderBakker
Esri Esteemed Contributor
Hi,

I�??d like to normalize map data in raster format to the data range using Raster Calculator. I'm not so much concerned with the accuracy of the method.

e.g. v�??(i) = (v(i) - minA) / (maxA - minA)


What is the syntax I need to do this? I am getting problems using the following script:

("raster" - min("raster")) / (max("raster") - min("raster"))

Thanks!


Hi,

If I could convince you to do this in the Python Window, it would be a lot easier. In that case you can make use of the Raster object in arcpy. Just have a look at the code below:

import arcpy
my_raster = arcpy.Raster(r'obj\objecten')
result = (my_raster - my_raster.minimum) / (my_raster.maximum - my_raster.minimum)


Basically you load the arcpy module, you define a variable "my_raster" to which you will assign the raster you want to process. In this case I used a raster called "objecten" which resides in a grouplayer called "obj", but you can just specify the name of the raster as it is called in your table of content. The last line performs the calculation (make sure you have the Spatial Analyst extension switched on). As you can see you can access the minimum and maximum values of a raster, since they are properties of the raster object.

See also:
http://resources.arcgis.com/en/help/main/10.1/index.html#//002100000017000000
http://resources.arcgis.com/en/help/main/10.1/index.html#//018z00000051000000


To save the result, you can add another line:

result.save('yourNameGoesHere')


It will save it in your current workspace.

Hope this helps you.

Kind regards,

Xander
0 Kudos