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

FloatingPointError: invalid value encountered in true_divide error using the test-parallax branch #21

Closed gillins closed 5 years ago

gillins commented 5 years ago

Original report by Anonymous.


Hi

I am experimenting with the test-parallax branch and was trying to process the data bundle S2A_MSIL1C_20171031T101141_N0206_R022_T34WDS_20171031T122112.SAFE using the commands

gdalbuildvrt -resolution user -tr 20 20 -separate allbands.vrt _B0[1-8].jp2 _B8A.jp2 _B09.jp2 _B1[0-2].jp2

fmask_sentinel2makeAnglesImage.py -i ../*.xml -o angles.img

fmask_sentinel2Stacked.py -a allbands.vrt -z angles.img -o cloud.img

I have managed to run the code on other tiles but on this one I received this error


S2A_MSIL1C_20171031T101141_N0206_R022_T34WDS_20171031T122112.SAFE/GRANULE/L1C_T34WDS_A012317_20171031T101142/IMG_DATA$ fmask_sentinel2Stacked.py -a allbands.vrt -z angles.img -o cloud.img Traceback (most recent call last): File "/usr/local/bin/fmask_sentinel2Stacked.py", line 152, in mainRoutine() File "/usr/local/bin/fmask_sentinel2Stacked.py", line 144, in mainRoutine fmask.doFmask(fmaskFilenames, fmaskConfig) File "/usr/local/lib/python2.7/dist-packages/fmask/fmask.py", line 143, in doFmask fmaskFilenames, fmaskConfig, missingThermal) File "/usr/local/lib/python2.7/dist-packages/fmask/fmask.py", line 269, in doPotentialCloudFirstPass applier.apply(potentialCloudFirstPass, infiles, outfiles, otherargs, controls=controls) File "/usr/local/lib/python2.7/dist-packages/rios/applier.py", line 675, in apply userFunction(*params) File "/usr/local/lib/python2.7/dist-packages/fmask/fmask.py", line 360, in potentialCloudFirstPass (ratio8a8, ratio8a7, v8a8, v8a7, cdi) = calcCDI(ref, fmaskConfig, otherargs.refBands) File "/usr/local/lib/python2.7/dist-packages/fmask/fmask.py", line 1314, in calcCDI cdi = (v8a8 - v8a7) / (v8a8 + v8a7) FloatingPointError: invalid value encountered in true_divide

gillins commented 5 years ago

Original comment by Johan Mollevik (Bitbucket: [Johan Mollevik](https://bitbucket.org/Johan Mollevik), ).


I failed to sign in before reporting this but I will be watching this if you have any questions.

gillins commented 5 years ago

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


Thanks Johan. I am aware of the problem - see https://bitbucket.org/chchrsc/python-fmask/pull-requests/8 for the current status on that. That pull request will be merged shortly, and the floating point issue fixed.

gillins commented 5 years ago

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


Fixed in 0.5.0