There are many ways for downloading products, I used this one
Teatinos example: ./dhusget.sh -T S2MSI2A -o product -u <user> -p <password> -c -4.565015623289649,36.67363863337091:-4.324076496929096,36.78092223486466 -l <n_products>
Pantano example: ./dhusget.sh -T S2MSI2A -o product -u <user> -p <password> -c -4.298420941807371,37.247079674117586:-4.283083381680252,37.26017567959012 -l <n_products>
After downloading some products, you need to prepare them as program input.
- Move all of them to an empty folder.
- Use
prepare_products.sh path/to/products/
. - Modify
location/paths.py
paths.
We need to pre-classify all products, I use QGIS for that.
- Install QGIS and SCP plugin, you can follow this tutorial.
- Execute
generate_script_QGIS.py
, that generateslocation/QGIS/automatic_classification.txt
. - Open training window in QGIS and import
location/QGIS/clas.scp
, then check all class boxes. - Open batch in QGIS and import
automatic_classification.txt
. - Run.
You can modify input arguments at /location/config.py
#either teatinos or pantano are avaiable
location=teatinos
# The -Wignore flag can be use to ignore warning
python3 generate_dataset_multiprocessing.py $location && python3 detect_outliers_dataset.py $location && python3 classifier.py $location && python3 prediction.py $location
For those who want to make an advanced use of the program, it is possible to add new locations. Currently, Sentinel-2 provide coverage over these areas. This process is similar to explained above, but familiarity with geoJSON and geographic coordinate systems is needed.
Now, create the location folder:
location=example
mkdir -p $location/QGIS $location/geojson
cp pantano/paths.py $location
cp pantano/config.py $location
cp pantano/QGIS/clas.scp $location/QGIS
It is needed the polygon of the area that you want to classify in geoJSON format. This page allows interactive creation of geoJSONs, if your shape is not a rectangle, you need another geoJSON representing a rectangle that covers your first shape (this is necessary due to bands' different spatial resolution, in order to avoid data loss). Save them in $location/geojson/
.
Finally, modify $location/paths.py
parameters.
If you want other classes than default ones, you can change them using a different location/QGIS/clas.scp
. This tutorial shows how to create a custom .scf file using QGIS.
Preclassification images have to be classified using that file.
Finally, modify 'classes' dictionary in location/config.py
.