Solved! Go to Solution.
Con("landcover","landcover", Nibble("landcover",SetNull("landcover","landcover","VALUE NOT IN (1,2)")), "VALUE IN (3,4,5)")
I am working with a raster map vegetation types. I have about 20 types with unique raster code values that can be sorted into three classes:
1 - vegetation types I want to expand using the nibble function (e.g. forest)
2 - vegetation types I consider static that I do not want to either nibble or be nibbled (e.g. water, developed areas)
3 - vegetation types that I want to eliminate through the nibble function (early seral stages, such as grass and chaparral)
Nibble is tricky.
Nibble doesn't use a search radius - it requires adjacency to grow raster zones. It can't "jump" across a non-NoData area in your mask.
Assume:
Forest = 1 (expand)
Forest2 = 2 (expand)
Water = 3 (keep)
Developed = 4 (keep)
(Other - to be nibbled - deleted)
I'm assuming you're using the Raster Calculator tool here.
1. Set all cells to NoData except 1 and 2 cells
SetNull("landcover" != 1 and "landcover" != 2, "landcover") -> "maskras"
2. (nibble 1,2 cells into all nodata areas)
Nibble("landcover","maskras") -> "nibras"
3. "burn" class 3 and 4 cells back into raster results at their original locations
Con("landcover" == 3 or "landcover" == 4, "landcover", "nibras")
I want it to continue Nibbling farther than it does, I guess, especially when a cell is surrounded half by nodata and half by some other value. I get to the point where only one or two cells are nibbled at a time, which is very tedious (diminishing returns).... I was hoping there is a method to provoke the Nibble function to nibble more pixels at a time
I have not been using Raster Calculator, just doing a reclassify in between Nibble operations? Is this ill-advised for any reason. I haven't used the Raster Calculator ever before, actually, but it doesn't look too bad. Perhaps it might be more efficient?
I was trying to be concise earlier, but it seems my original post was a little misleading. I have classes that can be roughly though about as 3 overall types, but there are more than just those listed in my original post. What I really have are 14 vegetation types I want to nibble into 6 other vegetation types, while avoiding 6 distinct "other" types. Water is just one example of those 6 "other" types.
Con("landcover","landcover", Nibble("landcover",SetNull("landcover","landcover","VALUE NOT IN (1,2)")), "VALUE IN (3,4,5)")
UPDATE: it gets better, you can do this in one raster calculator expression that is easy to tweak if you change your mind about how to handle your classes. This all goes on one line -- I have separated it to make it easier to read:Con("landcover","landcover", Nibble("landcover",SetNull("landcover","landcover","VALUE NOT IN (1,2)")), "VALUE IN (3,4,5)")
1. Keep 3,4,5 cells as-is
2. Expand 1,2 cells everywhere else
(All values not mentioned will be overwritten by values 1 or 2)