1

I am working with Landsat8 cloud data (BQA.tiff). I would like to set all medium and high confidence cloud/cloud shadow values (values listed below) to null and replace all other values in this image to surface temperature from another raster.

Here is one example of what I have tried--though I have tried a lot:

SetNull("q530_prj_Clip.tif" in [2800 | 2804 | 2808 | 2812 | 6896 | 6900 | 6904 | 6908 | 2976 | 2980 | 2984 | 2988 | 3008 | 3012 | 3016 | 3020 | 7072 | 7076 | 7080 | 7084 | 7104 | 7108 | 7112 | 7116 | 2752 | 2756 | 2760 | 2764 | 3008 | 3012 | 3016 | 3020 | 3776 | 3780 | 3784 | 3788 | 6848 | 6852 | 6856 | 6860 | 7104 | 7108 | 7112 | 7116 | 7872 | 7876 | 7880 | 7884],"May 30, 2013")

1 Answer 1

1

There is probably a more elegant way, but you can do this using Con, SetNull, and InList, which functions like the in conditional operator you were trying.

Con(IsNull(InList("q530_prj_Clip.tif", [2800,2804,2808,2812,6896,6900,6904,6908,2976,2980,2984,2988,3008,3012,3016,3020,7072,7076,7080,7084,7104,7108,7112,7116,2752,2756,2760,2764,3008,3012,3016,3020,3776,3780,3784,3788,6848,6852,6856,6860,7104,7108,7112,7116,7872,7876,7880,7884])), "May 30, 2013")

InList returns all cells within a raster that match the values in the provided array and sets all other cells to NoData. This method may have problems if your conditional raster ("q530_prj_Clip.tif") has NoData values already, so be aware of that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.