How to mask out cloud from the tiff file with the help of cloud mask?

Viewed 40

I have a tiff file with 5 bands (4 + Cloud Mask). I want to mask out(remove) clouds from all the 4 bands with the help of Cloud Mask. So can you let me know how to do this?

File shape--> 256x256

[[ 601  594  912 ...  233  225  213]
 [ 563  678  786 ...  223  217  201]
 [ 698  764  698 ...  198  201  201]
 ...
 [1062 1048 1054 ... 7020 6960 6840]
 [1028  978 1004 ... 6400 6452 6440]
 [1000  926  930 ... 6368 6416 6524]]---> Band 1
[[ 800  843 1146 ...  270  239  234]
 [ 760  904 1098 ...  254  234  217]
 [ 972 1000  954 ...  250  237  218]
 ...
 [1452 1434 1404 ... 6300 6348 6320]
 [1394 1310 1338 ... 6104 6164 6264]
 [1354 1198 1230 ... 6364 6444 6500]]---> Band 2
[[ 935 1086 1324 ...  290  271  278]
 [ 855 1044 1200 ...  280  275  278]
 [1218 1268 1114 ...  267  275  269]
 ...
 [1762 1736 1776 ... 6212 6336 6348]
 [1716 1654 1648 ... 6352 6488 6508]
 [1644 1510 1510 ... 6708 6880 6928]]---> Band 3
[[2242 2404 3066 ...  421  378  398]
 [2302 2712 2972 ...  397  370  398]
 [2706 2946 2632 ...  402  388  400]
 ...
 [3076 3064 3064 ... 7764 7796 7724]
 [2954 2822 2836 ... 7448 7480 7480]
 [2862 2674 2658 ... 7496 7516 7616]] --->Band 4
[[4 4 5 ... 2 2 2]
 [4 4 5 ... 2 2 2]
 [5 5 5 ... 2 2 2]
 ...
 [5 5 5 ... 9 9 9]
 [5 5 5 ... 9 9 9]
 [5 5 5 ... 9 9 9]] ---> Cloud Mask

In the Cloud Mask array there are different categories of cloud masks. I only want to remove the number 9 cloud from the bands 1 to 4. Any resource or code you can share would be helpful. Thanks :)

0 Answers
Related