Geoscience Reference
In-Depth Information
//check for cloud: retrieve bits 14--15 from QA band
nconfidenceBits=(stlvLineBuffer[icol]>>14)&3;
//check for cloud
switch (nconfidenceBits){
case (0)://00 undetermined
case (1)://01 cloud low confidence
bCloud= false ;
break ;
case (2)://10 cloud medium confidence
case (3)://11 cloud high confidence
bCloud= true ;
break ;
}
if (bCloud){
stlvLineBuffer[icol]=nCloud;
continue ;//next pixel
}
else {//check for cirrus: retrieve bits 12--13 from QA band
nconfidenceBits=(stlvLineBuffer[icol]>>12)&3;
switch (nconfidenceBits){
case (0)://00 undetermined
case (1)://01 cirrus low confidence
bCirrus= false ;
break ;
case (2)://10 cirrus medium confidence
case (3)://11 cirrus high confidence
bCirrus= true ;
break ;
}
if (bCirrus){
stlvLineBuffer[icol]=nCirrus;
continue ;//next pixel
}
else
stlvLineBuffer[icol]=nNoCloud;
}
We compile the code and link to the GDAL library:
g++ -o bqa2cloud bqa2cloud.cc -I/usr/include/gdal -lgdal
We then run the program on the QA band of the Landsat 8 scene LC820702320 -
13160LGN00 .We also attach a color table using the utilitywe created inSect. 14.3.6 .
The result is shown in Fig. 14.11 .
1 ./bqa2cloud LC82070232013160LGN00_BQA.TIF
LC82070232013160LGN00_CLD.TIF
./addct -ct ct.txt LC82070232013160LGN00_CLD.TIF
 
Search WWH ::




Custom Search