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 #24

Closed gillins closed 5 years ago

gillins commented 5 years ago

Original report by Anonymous.


Hi,

I am trying to run python-fmask, I can do all the steps but when I try to run the last one:

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

I get this error:

Traceback (most recent call last): File "/home/diego/anaconda3/envs/fmask/bin/fmask_usgsLandsatStacked.py", line 146, in mainRoutine() File "/home/diego/anaconda3/envs/fmask/bin/fmask_usgsLandsatStacked.py", line 143, in mainRoutine fmask.doFmask(fmaskFilenames, fmaskConfig) File "/home/diego/anaconda3/envs/fmask/lib/python3.6/site-packages/fmask/fmask.py", line 143, in doFmask fmaskFilenames, fmaskConfig, missingThermal) File "/home/diego/anaconda3/envs/fmask/lib/python3.6/site-packages/fmask/fmask.py", line 273, in doPotentialCloudFirstPass applier.apply(potentialCloudFirstPass, infiles, outfiles, otherargs, controls=controls) File "/home/diego/anaconda3/envs/fmask/lib/python3.6/site-packages/rios/applier.py", line 675, in apply userFunction(params) File "/home/diego/anaconda3/envs/fmask/lib/python3.6/site-packages/fmask/fmask.py", line 312, in potentialCloudFirstPass refNullmask = (inputs.toaref[otherargs.bandsForRefNull] == otherargs.refNull).any(axis=0) **IndexError: index 6 is out of bounds for axis 0 with size 6***

All the intermediate products has been well generated, so I can't figure out where is the error.

I'd appreciate your help. Anyway, thanks for this tool.

gillins commented 5 years ago

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


Hi,

Can you tell us how many layers you have in toa.img? Thanks,

gillins commented 5 years ago

Original comment by Diego García Díaz (Bitbucket: Digdgeo, GitHub: Digdgeo).


Hi Sam,

In the toa.img I got 6 bands (blue, green, red, nir, swir1 and swir2).

Thanks

gillins commented 5 years ago

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


Are you using Landsat 8? You should have 7 bands (the cirrus - band 9 - should be the last). See fmask.py line 264.

The wildcard in the documentation (LC8*_B[1-7,9].TIF - although I have a feeling this isn't quite right for the most recent data - should be LC08...) does include Band 9.

We will add a check that the correct number of bands are present in the input file for the next release. We are also working on adding the ability to generate all the required files within fmask_usgsLandsatStacked.py itself which may make life easier.

Sam.

gillins commented 5 years ago

Original comment by Diego García Díaz (Bitbucket: Digdgeo, GitHub: Digdgeo).


Thanks so much, Sam.

I just want to point out that, with Landsat 8, if you include Coastal Blue and Cirrus, you'll have 8 bands instead of 7.

gillins commented 5 years ago

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


Added test for correct number of input bands in #29cd035. Also added ability for fmask_usgsLandsatStacked.py to build the input stacks needed in 0.5.1.