I'm trying to mask cloud cover of multi-spectral Landsat 5 image containing bands 1-7 that have been preprocessed using dark object subtraction and Landsat calibration.

I am using the fmask tool in ENVI5.5 and keeping all default parameters; Kernal Size 7 and Cloud Probability Threshold 22.5 as shown in the first PrintScreen below.

However when I try to run I get Error: Attempt to subscript list with index 0 is out of range (Second printscreen).

How do I overcome this error to produce a cloud mask?

enter image description here

enter image description here

  • The FMask algorithm will look in the file's metadata for the RGB, NIR, SWIR1,SWIR2, bands (at a minimum). Based on that error, it seems like envi may not be recognizing the band wavelengths from the metadata (this can be lost in pre-processing steps). You mentioned that you've preprocesed the imagery with dark obtract subtraction and calibration. Have you tried it using the original imagery?
    – toferkey
    Apr 26, 2020 at 16:38
  • @toferkey I've just tried using the original imagery and I get the same error. I am having problems opening the MTL file in ENVI could this be the problem? Thank you for your help. Apr 27, 2020 at 10:28
  • Yes, that could be the issue. Based on the tool's help document, it looks like you need to keep each of the Landsat bands in separate 1 band files (as they originally come), and use these files for the analysis. And to also make sure that the MTL file is in the same folder as these bands.
    – toferkey
    Apr 27, 2020 at 12:33
  • @toferkey Thank you, it now works! I had the MTL file in another folder but once in the same file worked fine. Apr 28, 2020 at 16:05
  • Glad it worked. Cheers!
    – toferkey
    Apr 28, 2020 at 21:49

1 Answer 1


I had the MTL.txt file in a separate folder to that of the bands causing an error when loading data into ENVI.

  • You should expand on this answer, at the moment it seems more like a comment
    – nmtoken
    May 1, 2020 at 15:17

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.