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
74 stars 21 forks source link

Copernicus Sentinel-2 Major Products Upgrade on 2021/10/26 #47

Closed davidmichea closed 2 years ago

davidmichea commented 2 years ago

Hi,

Considering this annoucement :

https://sentinels.copernicus.eu/web/sentinel/-/copernicus-sentinel-2-major-products-upgrade-upcoming-l1c-and-l2a-sample-products

I tried fmask on a sample of the new SAFE format (can be found here) and it seems broken: fmask_sentinel2Stacked.py -o mask.tif --granuledir ./S2B_MSIL1C_20210517T103619_N7990_R008_T30QVE_20210929T075738.SAFE/GRANULE Traceback (most recent call last): File "/b/home/ipgs/a2s_prod/A2S/installs/venv_a2s/bin/fmask_sentinel2Stacked.py", line 22, in <module> sentinel2Stacked.mainRoutine() File "/b/home/ipgs/a2s_prod/A2S/installs/venv_a2s/lib/python3.6/site-packages/fmask/cmdline/sentinel2Stacked.py", line 285, in mainRoutine resampledBands = makeStackAndAngles(cmdargs) File "/b/home/ipgs/a2s_prod/A2S/installs/venv_a2s/lib/python3.6/site-packages/fmask/cmdline/sentinel2Stacked.py", line 177, in makeStackAndAngles sentinel2makeAnglesImage.makeAngles(xmlfile, anglesfile) File "/b/home/ipgs/a2s_prod/A2S/installs/venv_a2s/lib/python3.6/site-packages/fmask/cmdline/sentinel2makeAnglesImage.py", line 86, in makeAngles info = sen2meta.Sen2TileMeta(filename=infile) File "/b/home/ipgs/a2s_prod/A2S/installs/venv_a2s/lib/python3.6/site-packages/fmask/sen2meta.py", line 43, in __init__ f = open(filename) FileNotFoundError: [Errno 2] No such file or directory: './S2B_MSIL1C_20210517T103619_N7990_R008_T30QVE_20210929T075738.SAFE/GRANULE/MTD_TL.xml'

Is there a workaround ?

best regards David

davidmichea commented 2 years ago

Sorry, forget about this post: I was setting the wrong --granuledir param.

Everything works fine with the new SAFE format.

Sorry for the mistake.

neilflood commented 2 years ago

Thanks David, no problem.

I should warn you that there will be an update required for this new ESA product upgrade. They have made a change to the scaling of the pixel values, now allowing an offset which needs to be added to get reflectance values. This means that every piece of software which reads these files needs to be modified to use these offsets from the metadata, otherwise they will be interpreting the data incorrectly. So, within the next couple of weeks I will be making these changes to python-fmask.

It is a bit of a nightmare for everyone who uses software which reads ESA's files.

neilflood commented 2 years ago

@davidmichea Just letting you know, I have released a new version which should now cope with the new radiometric offsets.

davidmichea commented 2 years ago

Thanks a lot for the information Neil