Awesome
Feng Yin
Department of Geography, UCL
ucfafyi@ucl.ac.uk
Here, we use SIAC to do the atmospheric correction of Sentinel 2 TOA reflectance, then use inverse emulator to retrieve LAI from surface recflectance. These code will automatically download Sentinel 2 TOA reflectance data from Copernicus Open Access Hub and do atmospheric correction with SIAC and give per pixel LAI value at 20 meters resolution.
Requirements:
- A NASA Earthdata username and password and can be applied here.
- A Copernicus Open Access Hub username and password and can be applied here
Installation:
- Directly from github to get the most up to date version of it:
pip install https://github.com/MarcYin/S2_TOA_TO_LAI/archive/master.zip
- Using PyPI (This one is generally related to release)
pip install S2-TOA-TO-LAI
- Using anaconda from anaconda for 'better' package managements
conda install -c f0xy -c conda-forge s2-toa-to-lai
To save your time for installing GDAL:
conda uninstall gdal libgdal
conda update --all -c conda-forge
conda install -c conda-forge gdal>2.1,<2.4
Usage
- Using Sentinel 2 tiles directly:
from S2_TOA_TO_LAI import TOA2LAI_S2
TOA2LAI_S2(tiles = ['50SMG'], start='2018-01-02', end='2018-01-03')
- Using LatLon (Lat first then Lon) and this can be a 2D list of latlon:
from S2_TOA_TO_LAI import TOA2LAI_S2
TOA2LAI_S2(latlon = '35.4, 56.2', start='2018-01-02', end='2018-01-03')
- Using polygon from string(s) or (a) vector file(s):
from S2_TOA_TO_LAI import TOA2LAI_S2
aoi = 'POLYGON((115.79984234354565 39.41267418434987,115.81853363330639 39.41267418434987,115.81853363330639 39.42542974293974,115.79984234354565 39.42542974293974,115.79984234354565 39.41267418434987))' # or a vector file
TOA2LAI_S2(aoi = aoi, start='2018-01-02', end='2018-01-03')
You can also specify cloud_cover
but this may lead to losing of S2 observations due to a bad cloud mask from L1C data