Select to view content in your preferred language

CON Statement with OR and &

2275
2
01-17-2014 02:20 PM
by Anonymous User
Not applicable
Original User: ksmikrud

Hi,

I think what I want to accomplish and what I have in code is far from successful. I have 3 rasters: a lakes raster, a glacier raster and a land cover classification with multiple codes (11,12,13,14,....etc) and basically I'm just trying to correct some errors in the classification. For example where I know there is a lake (lakes.img =0 and my land cover class =51 or 52....I want to make sure I'm coding the final raster class to 53. Similarly if Glacier =0 and the classification values =52 or 53, I want to change those to have a value of 51. If possible and these conditions are not met I just want the original classification values to show in the output raster. Essentially I'm just trying to fix a couple of codes that have errors in my land cover raster but have an output that is pretty much my original land cover raster with those errors fixed. Is this possible to do? The statement below is what I was inputting to the raster calculator in 10.2. I think it also doesn't like my use of OR but even when I tried just a simpler version of the following statement I got errors saying the true value was ambiguous.


Con("lakes.img" == 0  &  ("TRH_Classification011314.img"  ==  51 OR "TRH_Classification011314.img"  ==  52),  53, Con("glacier4.img" == 0  & ("TRH_Classification011314.img"  ==  52
OR "TRH_Classification011314.img" == 53), 51, "TRH_Classification011314.img")

Thanks for the help in advance!!!
0 Kudos
2 Replies
Luke_Pinner
MVP Regular Contributor
0 Kudos
Luke_Pinner
MVP Regular Contributor
This is a direct link to the post mentioned in my previous answer (can't edit for some reason).
0 Kudos