delete random pixels in grid

456
2
06-29-2011 05:44 AM
JuliaPaleari
New Contributor
Hi,
I hope someone could help, or direct me to some useful resources. I have a raster dataset representing vegetation and I would like to delete randomly lets say 30% of the vegetation pixels. How can this be achieved?

Thanks for your replies

Juli
0 Kudos
2 Replies
MarkEllis
New Contributor II
You cannot just remove cells from a raster.  The equivalent would be to change the value of random cells to NODATA (or zero, as needed).  To do this, you could create a random point layer, then convert this to raster.  Once a raster, reclassify the cells to whatever value will delete the vegetation values. Make sure your other cells have some other value to keep them apart, of course.  Do you have Spatial Analyst?  If so, the Set Null function can be used to replace cell values where a condition is met, e.g. where your random points lie.  Use this to change your vegetation cell values accordingly.
0 Kudos
JuliaPaleari
New Contributor
Thank you for your reply,

here is what I came up with in the mean time and I think my approach is similiar to your suggestion.
I created a raster where vegetation is Value 1 and Non Vegetion NODATA. I used this raster as an analysis mask in Spatial Analyst to create a random raster with the function rand() (not exactly sure on this point, as I do not really know what this function does), then to delete 35% of the pixels I changed all pixels with a value above 0.35 to 1 and the others became NODATA. I used con([randomgrid]>0.35, 1). I then reclassified this grid so all NODATA cells became 0 and I multiplied this raster with my original vegetation raster and the result is hopefully what I wanted to achieve, 35% less pixels representing vegetation.
It sounds really longwinded, but I do not have a lot experience with ArcGIS, but I hope my approach works. Maybe someone can suggest a quicker route?

Thank you
0 Kudos