This repository contains tools and resources for performing atmospheric correction and generating applicable indices for detecting plastic at marine/coastal environments from Sentinel-2 satellite images. The primary scripts process the images using the Sen2Cor and Acolite tools and Python libraries.
Once the sen2cor script has been applied to the sentinel-2 image you can't use the acolite script to process the same image, you must unzip the original .SAFE file again.
Besides, I noticed when I tried to run the main script in a Linux environment(Ubuntu 22.04, 16gb RAM) that the system collapsed due to the high consumption of resources, so I recommend to use windows or run the main script in a system which has over 32GB of RAM.
You can also run each script individually if something goes wrong or if you only want process/correction for a image/.tif file.
There are 4 main scripts that I consider useful: acolite_script.py, which can process a batch of Sentinel-2 scenes, and sen2cor_script.py, which does the same, calculate_indices.py which calculates the indices for plastic detection and their thresholds to detect pixels which may contain plastics and the main script that is a combination of the other scripts.
- Atmospheric correction using the Sen2Cor and Acolite tools
- Different index generation for plastic detection
- Processing of Sentinel-2 satellite images in .SAFE format
- Exporting processed images as GeoTIFF files
- Python 3.x
- Sen2Cor 2.11.0 or later
- Acolite
- Libraries: GDAL, rasterio, numpy...
I had some problems with the GDAL installation. These websites helped me a lot: lfd.uci.edu and opensourceoptions.com. There you can find the Windows installers for some needed libraries.
- Download and install the Sen2Cor tool from the official website (https://step.esa.int/main/third-party-plugins-2/sen2cor/).
- Download and set up Acolite (https://odnature.naturalsciences.be/remsem/software-and-data/acolite).
- Clone this repository or download it as a ZIP file.
- Create a virtual environment:
python -m venv venv
- Activate the virtual environment:
- On Windows:
venv\Scripts\activate.bat
- On macOS/Linux:
source venv/bin/activate
- Install required Python libraries:
pip install -r requirements.txt
- Place your Sentinel-2 satellite images in a directory.
- Update the
sen2cor
variable in thesen2cor_script.py
script to point to your Sen2Cor executable file. (the .bat file) - Update the Acolite path in the
acolite_script.py
script (replace the example path with the path to your Acolite folder; e.g: "C:\Git\acolite"). - Run the scripts using Python:
python sen2cor_script.py
python acolite_script.py
python calculate_indices.py
python main.py
- Enter the directory containing the .SAFE files and the output directory when prompted.
The scripts will process the Sentinel-2 images using Sen2Cor and Acolite, generate output files containing atmospheric-corrected images and the tif files corresponding to the indices that should detect pixels containing plastic debris
I would like to express my gratitude to everyone who has contributed to the success of this project. Your valuable resources, code, and scientific articles have been instrumental in shaping the development of this repository.
- Open Source Options - for their informative website
- Cole Krehbiel - for the open-source code they provided on GitHub
- PLP Aegean - for their scientific articles and plastic litter projects which made this project possible
Thank you all for your support and contributions. Your knowledge and expertise have truly made a difference in this project.
Please feel free to open issues, submit pull requests, or provide feedback to improve this repository. All contributions are welcome!
This project is licensed under the MIT License - see the LICENSE file for details.