IndexError: index 1 is out of bounds for axis 0 with size 1

Issue #17 resolved
Anonymous created an issue

I encountered IndexError when I compute cloud mask with my Landsat 8 scene LC08_L1TP_150033_20150413_20170410_01_T1 downloaded from USGS Collection L1T products.

its all okey in

gdal_merge.py -separate -of HFA -co COMPRESSED=YES -o ref.img LC8*_B[1-7,9].TIF
gdal_merge.py -separate -of HFA -co COMPRESSED=YES -o thermal.img LC8*_B1[0,1].TIF
fmask_usgsLandsatMakeAnglesImage.py -m *_MTL.txt -t ref.img -o angles.img
mask_usgsLandsatSaturationMask.py -i ref.img -m *_MTL.txt -o saturationmask.img
fmask_usgsLandsatTOA.py -i ref.img -m *_MTL.txt -z angles.img -o toa.img

but it given me IndexError in :

fmask_usgsLandsatStacked.py -t thermal.img -a toa.img -m *_MTL.txt -z angles.img -s saturationmask.img -o cloud.img

below are the detailed error information

Traceback (most recent call last):
  File "/home/deyu1/anaconda2/envs/fmaskenv/bin/fmask_usgsLandsatStacked.py", line 146, in <module>
    mainRoutine()
  File "/home/deyu1/anaconda2/envs/fmaskenv/bin/fmask_usgsLandsatStacked.py", line 143, in mainRoutine
    fmask.doFmask(fmaskFilenames, fmaskConfig)
  File "/home/deyu1/anaconda2/envs/fmaskenv/lib/python2.7/site-packages/fmask/fmask.py", line 143, in doFmask
    fmaskFilenames, fmaskConfig, missingThermal)
  File "/home/deyu1/anaconda2/envs/fmaskenv/lib/python2.7/site-packages/fmask/fmask.py", line 269, in doPotentialCloudFirstPass
    applier.apply(potentialCloudFirstPass, infiles, outfiles, otherargs, controls=controls)
  File "/home/deyu1/anaconda2/envs/fmaskenv/lib/python2.7/site-packages/rios/applier.py", line 667, in apply
    userFunction(*params)
  File "/home/deyu1/anaconda2/envs/fmaskenv/lib/python2.7/site-packages/fmask/fmask.py", line 308, in potentialCloudFirstPass
    refNullmask = (inputs.toaref[otherargs.bandsForRefNull] == otherargs.refNull).any(axis=0)
IndexError: index 1 is out of bounds for axis 0 with size 1

its be appreciate anyone who give me why. thank u...

Comments (3)

  1. Neil Flood

    I downloaded the same image file you mention, and ran it on the latest version of the code (and an older version, just in case), and I could not find any problem, it seems to work fine.

    So, I suspect that there is some problem with how you have installed pythonfmask. Could you perhaps provide details of exactly how it was installed? I believe that if you use the conda binary distribution, there can be problems with incompatible binaries, depending on how it is done.

    Neil

  2. Log in to comment