How do I change pixel value in a raster dataset?
If you have access to the Spatial Analyst extension, one way is to use the Conditional geoprocessing tools
An overview of the Conditional toolset—Help | ArcGIS for Desktop
You can also access the Conditional (Con) functions in Raster Calculator:
Raster Calculator—Help | ArcGIS for Desktop
There are some other possibilities, but it depends on what you would like to do. Can you provide more details on what you are trying to change?
Chris Donohue, GISP
Thank you Chris for your reply. I have one MODIS aerosol optical depth data. The raster file have 0 to 254 rowid and 1 to 255 pixel value. The 0 has marked as no data and 255 marked as maximum value. But actually, 0 has value and 255 has no value. I have change the 255 as null and add 1 to all other value to get correct pixel values.
Can you help me to solve this problem?
For the Null issue, consider using SetNull (Spatial Analyst):
Set Null—Help | ArcGIS for Desktop
Example from the Help:
Using an Expression:
To set any cell with a value greater than 5 to NoData and have the remaining cells retain their original values, the following parameters could be used on the tool dialog box:
Input conditional raster : InRas1
Expression : "Value < 5"
Input false raster or constant value : InRas1
Output raster : setnull_1
The equivalent using an expression in Map Algebra is as follows:
OutRas = SetNull(InRas1 < 5, InRas1)
Source: Setting values to NoData with Set Null—Help | ArcGIS for Desktop
As to incrementing the other values up by one, I believe the Raster Calculator would be the way to go, using Map Algebra.
What is Map Algebra?—ArcGIS Help | ArcGIS for Desktop
Example from the Help:
Operators can accept a mixture of rasters and numbers. For example, the following adds a constant value of 8 to all the cells in the input raster:
outRas = Raster("inras1") + 8
Source: A quick tour of using Map Algebra—ArcGIS Help | ArcGIS for Desktop
Chris Donohue, GISP
ok, great. I need to change the pixel values through model builder as I have many AOD raster files so I have to run a loop. so how to change the pixel values in a loop in model building.
The trick to processing all the rasters is to employ an Iterator in Modelbuilder. This will allow the looping through of each raster.
Here's the Modelbuilder Iterators:
A quick tour of using iterators—Help | ArcGIS for Desktop
Accessing iterators in ModelBuilder—Help | ArcGIS for Desktop
Example of using an iterator in a model—Help | ArcGIS for Desktop
Note, however, if you are conversant with Python, that would probably be more effective than using Modelbuilder (Modelbuilder can be a bit quirky).
Chris Donohue, GISP