[GIS] ArcMap 10; Syntax for Minimum operator in raster calculator

arcgis-10.1arcgis-desktopraster-calculator

I want to linear stretch my raster grid formate having column/rows 3128, 3503 with 30 meter resolution by using the following syntax in raster calculator of arcmap 10.1.

("raster" - FocalStatistics("raster", NbrRectangle, 30, 30, "Minimum") / 
(FocalStatistics("raster", NbrRectangle, 30, 30, "Maximum") - 
FocalStatistics("raster", NbrRectangle, 30, 30, "Minimum"))

But this gives me the error while executing.
I have also tried the simple equation but did not work.

("raster" - min("raster")) * 1.0 / (max("raster") - min("raster")) + 0.0

Error displayed:

000539 : Error message from Python.
ArcGIS 10.1 Locate topic
Description
The calculation used by the Calculate Field or Calculate Value tool is
invalid. This error message provided will list the specific Python
error.
Solution
This error code covers a number of Python errors:
Example error 1: exceptions.TypeError: cannot concatenate 'str' and 'int' objects.The
above is a Python-specific error. The calculation is attempting to add
or concatenate a string and a number.
Example error 2: Invalid field shape@distance
The above is an error using the geometry object. The distance method
is not a valid method of the geometry object.For specific Python
issues, consult the external Python help for more information, or
consult the Calculate Field or Calculate Value help for more
information on these tools.

What is the right syntax.

Best Answer

The expression of the rectangle is incorrect, your neighbourhood should be specified like this:

FocalStatistics("raster",NbrRectangle(30,30),"MINIMUM")

As the NbrRectangle is an object... to specify your first calculation use:

("raster" - FocalStatistics("raster",NbrRectangle(30,30),"MINIMUM"))  
/ ((FocalStatistics("raster",NbrRectangle(30,30),"MAXIMUM")) 
- (FocalStatistics("raster",NbrRectangle(30,30),"MINIMUM")))

The 'simple' equation is anything but... minimum and maximum can only be obtained when statistics have been built, if they are not you will receive an error saying 'value unobtainable' or something along those lines. Using the whole raster min and max:

Con(IsNull("raster"),-9999,("raster"
/ (float(arcpy.GetRasterProperties_management("raster","MAXIMUM").getOutput(0)) 
- float(arcpy.GetRasterProperties_management("raster","MINIMUM").getOutput(0))) * 100))