dumping an SDS from LEDAPS QA and creating a mask product
As of gdal 1.8
Gdal_translate –ot Byte –of GTiff scale 2080 2080 1 1 <src> <dst>
Creates a mask which can be applied to a dataset
Now the syntax to pick the sds out of the SR data in ledaps.
Pseudocode if i1 = 2656 or i1 = 2592 or i1 = 6176 or i1 = 2336 i1 = 2308 or i1 = 3 then 1 else null (highlights bad pixels as null)
gdal_translate -ot Byte -of GTiff -scale <maskvalue1> <maskvalue1> 1 1 HDF4_EOS:EOS_GRID:"EODS_20120112_09_45_40/LS5_TM_OTH_P51_GALPGS01_095_082_20110127_1/scene01/lndsr.L5095082_08220110127.hdf":Grid:lndsr_QA <output>/<maskvalue1>_mask.tif (repeat for other mask values)
Pseudocode: if a mask value in any layer combine to create a mask (ignore zeros)
gdal_merge.py -o <output_mask>.tif -of GTiff –n 0 <maskvalue1>_mask.tif <maskvalue2>_mask.tif ….n ..n
Pseudocode: if mask value = 0 then good to go as a non cloud pixel
Gdal_translate using the –mask and above as input