ubarsc / python-fmask

A set of command line utilities and Python modules that implement the ‘fmask’ algorithm
https://www.pythonfmask.org
GNU General Public License v3.0
75 stars 21 forks source link

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

Closed gillins closed 6 years ago

gillins commented 6 years ago

Original report by Anonymous.


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

#!python

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 :

#!python

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

#!python

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...

gillins commented 6 years ago

Original comment by Neil Flood (Bitbucket: neilflood, GitHub: neilflood).


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

gillins commented 6 years ago

Original comment by Sam Gillingham (Bitbucket: gillins, GitHub: gillins).


Runs fine for me in a new conda environment. Perhaps there is a problem with the file you downloaded?

Sam.

gillins commented 6 years ago

Original comment by Neil Flood (Bitbucket: neilflood, GitHub: neilflood).


The original poster did not respond further, so I assume the problem went away.