# count band numbers from multiband raster image

My raster image has 10 bands (10 bands are 10 year), cell values of each one are 1, 2, 3. One is negative anomaly, 2 is no change area, 3 is positive anomaly. Now I want to find how many years out of 10 have the negative anomaly,how many years have positive anomaly etc. For example, the cell(10;10) has a value of 3 for all 10 bands, then the value of output raster in cell(10;10) should be 10. if cell(11;11) has a value 3 for 7 bands, then output value would be 7 etc.

• Could you add a tag for the software you are using here? "raster-calculator" doesn't identify it precisely. – Spacedman Aug 30 '15 at 7:06

## 1 Answer

Assuming it's in ArcGIS from your other posts... Repeat the following process three times, once for each of the values 1, 2 and 3. For example the 3's:

• Import the different bands to ArcMap separately.
• Repeat ten times**, once for each year: Create a raster where all values of 3 are replaced by 1, the rest are replaced by 0. In order to achieve this, Open Raster Calculator and use the statement: Con("Threes_one" == 3,1,0)
• Add them up using Raster Calculator, statement is simply: "Threes_one_calced + Threes_two_calced... + Threes_ten_calced.

** To expedite the process you may instead use the batch option on Con tool (right click on the tool and click batch), and set the 10 bands as Input conditional rasters, under Expression type "VALUE" == 3 (for the above example), in Input true raster or constant value type 1 and under Input false... enter 0.