Closed thais-lima closed 4 years ago
Thanks for this report. It seems that the underlying GDAL is unable to read that image file. Have you recently upgraded Fmask and/or GDAL? Could you try reading that .jp2 file with something else, to check that the file is not corrupted?
Dear Neil Flood, Thank you for your answer. Yes, I have recently upgraded Fmask and GDAL. GDAL is working fine and it can read Sentinel-2 images in other interfaces. The file is not corrupted because I have worked with it in other platforms (QGIS and R). Thank you, Thais
@thais-lima I see that you have installed python-fmask
into the root environment of an Anaconda distribution. conda-forge and Anaconda packages do not usually work well together so I would recommend (taken from https://conda-forge.org/#about):
conda --add channels conda-forge
conda config --set channel_priority strict
conda create -n testend python-fmask
conda activate testenv
And it should work then. Always install packages into an environment and use them from there - anything using GDAL requires it to work properly.
If that doesn't work, check the output of conda list
and confirm all your packages are coming from conda-forge.
Closed, assuming no further troubles.
Fmask for Sentinel-2 does work . I was using the code exactly the same way in May and it was fine. Thank you!
Here is the log: (base) C:\landEcology\analysis\RS\1.matupi\1.raster_data\S2_2019>fmask_sentinel2Stacked.py -o cloud.img --safedir S2A_MSIL1C_20190605T142751_N0207_R053_T20MPS_20190605T191007.SAFE Traceback (most recent call last): File "C:\Users\almetha\Anaconda3\Scripts\fmask_sentinel2Stacked.py-script.py", line 10, in
sys.exit(mainRoutine())
File "C:\Users\almetha\Anaconda3\lib\site-packages\fmask\cmdline\sentinel2Stacked.py", line 285, in mainRoutine
resampledBands = makeStackAndAngles(cmdargs)
File "C:\Users\almetha\Anaconda3\lib\site-packages\fmask\cmdline\sentinel2Stacked.py", line 197, in makeStackAndAngles
resampleMethod = chooseResampleMethod(cmdargs.pixsize, inBandImg)
File "C:\Users\almetha\Anaconda3\lib\site-packages\fmask\cmdline\sentinel2Stacked.py", line 226, in chooseResampleMethod
imginfo = fileinfo.ImageInfo(inBandImg)
File "C:\Users\almetha\Anaconda3\lib\site-packages\rios\fileinfo.py", line 79, in init
ds = gdal.Open(str(filename), gdal.GA_ReadOnly)
File "C:\Users\almetha\Anaconda3\lib\site-packages\osgeo\gdal.py", line 3087, in Open
return _gdal.Open(*args)
RuntimeError: `S2A_MSIL1C_20190605T142751_N0207_R053_T20MPS_20190605T191007.SAFE/GRANULE\L1C_T20MPS_A020642_20190605T143120/IMG_DATA\T20MPS_20190605T142751_B01.jp2' not recognized as a supported file format.