wookie

Picking raster values randomly

Discussion created by wookie on Jun 29, 2011
Latest reply on Jun 30, 2011 by wookie
I have a number of rasters which are binary in nature; i.e. raster1 is either 0 or 1, raster2 is either 0 or 2, raster3 is either 0 or 3 etc. (I have 9 rasters) The values cluster in different values geographically, however some values overlap (i.e. one pixel could be 0 for raster1, 2 in raster2 and 3 in raster3).

I have been trying to randomly select a value in each pixel. The problem I have is that I want to select a positive value if it exists in one of the rasters. But I want that positive value to be randomly chosen. If I use a 'pick' or 'rank' function based on a random integer grid, then some values end up as 0 when there could have been a positive value in one of the other rasters. If I change 0 to NoData then I end up with lots of NoData values. Is there any efficient way of choosing raster1, 2 or 3 randomly, only choosing positive values, and only coming back with 0 if all three rasters are 0?

Outcomes