[GIS] Sentinel-2 cloud mask with fmask

cloud coverremote sensingsentinel-2

I'm trying to run fmask on a Sentinel-2 granule.
I downloaded the 3.2 version of Windows stand alone software for Sentinel 2 from https://github.com/prs021/fmask
When I try to run fmask by calling the FmaskMSI.exe through cmd from the folder containing the Sentinel-2 Granule (or from within the granule folder) i get the following error:

No L*MTL.txt header in the current folder!
Output argument "clr_pct" (and maybe others) not assigned during call to "autoFmask".
MATLAB:unassignedOutputs

The L*MTL.txt suggests that its's looking for a Landsat type product but i specifically point to the Sentinel-2 installation of fmask

How do i get fmask to run for Sentinel-2 data?

Best Answer

You can use the cloud mask .gml file provided by ESA with the archive you download from the hub or other vendors. You only need to convert the .gml file into .shp. I use GDAL's ogr2ogr to do this, a link for this conversion is here: Using ogr2ogr to convert GML to shapefile in Python?