.. _sen2cor:

Sen2Cor Configuration
----------------------------------

This section focuses on Sen2Cor 2.12 configuration.

1. To configure sen2cor, you must first download the context data used for certain Sentinel-2 pre-processing steps here `ESACCI-LC package for SC module <https://earth.esa.int/eogateway/ftp/Sentinel-2/ESACCI-LC-L4-ALL-FOR-SEN2COR-2.10.tar.gz>`_
Downloading may take some time. 

2. Move and extract the unzip downloaded files to this sen2cor directory : ``/Sen2Cor-02.12.03-Linux64/lib/python2.7/site-packages/sen2cor/aux_data``

3. Create DEM directory : ``./sen2cor/2.12/dem``

4. Update Sen2Cor configuration file ``nano ~/sen2cor/2.12/cfg/L2A_GIPP.xml``

Your L2A_GIPP.xml file should look like this : 

.. code-block:: html

	<DEM_Directory>dem/srtm</DEM_Directory>
	<DEM_Reference>http://srtm.csi.cgiar.org/wp-content/uploads/files/srtm_5x5/TIFF/</DEM_Reference>
	<DEM_Terrain_Correction>FALSE</DEM_Terrain_Correction>  # If you don't want DEM terrain correction

4. Update the sen2chain configuration file so sen2chain can now use your new sen2cor configuration : ``nano ~/sen2chain_data/config/config.cfg``

.. code-block:: bash
	
	~$ sen2cor_bashrc_paths = /path/to/Sen2Cor-02.12.03-Linux64/L2A_Bashrc

5. Then, in python, update Sen2Chain by using any method :

.. code-block:: python

    >>> from sen2chain import Tile
    >>> Tile('40KCB').info
    
