getSpatialData icon indicating copy to clipboard operation
getSpatialData copied to clipboard

Add Sen2Cor L2A functionality to generate atmospheric-corrected Sentinel-2 L2A imagery

Open aTnT opened this issue 5 years ago • 3 comments

Sen2Cor is a processor for Sentinel-2 Level 2A product generation and formatting; it performs the atmospheric-, terrain and cirrus correction of Top-Of- Atmosphere Level 1C input data. Sen2Cor creates Bottom-Of-Atmosphere, optionally terrain- and cirrus corrected reflectance images; additional, Aerosol Optical Thickness-, Water Vapor-, Scene Classification Maps and Quality Indicators for cloud and snow probabilities. Its output product format is equivalent to the Level 1C User Product: JPEG 2000 images, three different resolutions, 60, 20 and 10 m.

Sec2Cor ESA webpage: http://step.esa.int/main/third-party-plugins-2/sen2cor/

Sen2Cor on Docker: https://hub.docker.com/r/atavares/sen2cor/ https://bitbucket.org/atntavares/sen2cor/src/master/

aTnT avatar Nov 12 '18 14:11 aTnT

Good idea, will do so as soon as I find time to continue with the prep functions. Will include a function that binds to a present sen2cor installation.

16EAGLE avatar Nov 15 '18 10:11 16EAGLE

FYI, i was able to run Sen2Cor with Docker (i have created my own Sen2Cor docker image) with the output of getSentinel_data() and run prepSentinel(). The output of running Sen2Cor on Sentinel-2 L1C imagery + running prepSentinel() is equivalent to getting L2A imagery with getSentinel_data() + running `prepSentinel(). Note that L2A seems to be only available in the servers in Europe, so outside Europe one has to run Sen2Cor to generate L2A imagery. The steps i do to generate L2A imagery from L1C are:

  1. use getSentinel_data() to download L1C imagery
  2. unzip the .zip file to make the .SAFE folder available
  3. use the Docker image atavares\sen2cor to convert L1C to L2A imagery. An example usage command is docker run --rm -ti -v {/host/machine/mapped/folder/where/the/.SAFE/folder/is/located}:/data atavares/sen2cor /data/{name_of_SAFE_folder.SAFE}
  4. zip the generated output L2A .SAFE folder
  5. Run prepSentinel() on the L2A .zip file

Maybe some improvements to add to prepSentinel() are:

  • add somehow the names of the bands to the output .tif files. The L2A outputs are available with the names below in the original .SAFE data, but with prepSentinel() the band names get lost:

band.order <- list("aux" = c("AOT", "CLD", "SCL", "TCI", "WVP", "SNW"), "refl" = c("B01", "B02", "B03", "B04", "B05", "B06", "B07", "B08", "B8A", "B09", "B10", "B11", "B12"))

  • add a function input variable SAFE = true to avoid step 4 above (create a .zip file)

aTnT avatar Nov 16 '18 15:11 aTnT

In the sen2r package is a Sentinel-2 preprocessing function accessing the Sen2Cor software. It also installs the software if not yet on the machine.

https://github.com/ranghetti/sen2r/blob/master/R/sen2cor.R

hfisser avatar Jan 30 '19 14:01 hfisser