# Outils Sentinel
## `torchgeo`
- Lien Github: https://github.com/microsoft/torchgeo
- Datasets, samplers, transforms, and pre-trained models for geospatial data
- Custom Raster Datasets (classe de `torchgeo`) : avantages par rapport à ce qu'on a fait ?
- Transforms : à regarder de plus près
- Bandes Sentinel-2 :
```
bands = {
"B1": "Coastal Aerosol",
"B2": "Blue",
"B3": "Green",
"B4": "Red",
"B5": "Vegetation Red Edge 1",
"B6": "Vegetation Red Edge 2",
"B7": "Vegetation Red Edge 3",
"B8": "NIR 1",
"B8A": "NIR 2",
"B9": "Water Vapour",
"B10": "SWIR 1",
"B11": "SWIR 2",
"B12": "SWIR 3",
}
```
- Exemple min-max normalization : calculer le min et max du dataset par bande ?
- Sentinel-2 : NDVI, NDBI, NDSI, NDWI ajoutées comme bandes supplémentaires. Probablement pas très utile pour nous... (article sur l'utilisation du NDBI en apprentissage automatique. Vieux mais peut-être des idées à en tirer : https://www.researchgate.net/publication/248977308_Use_of_normalized_difference_built-up_index_in_automatically_mapping_urban_areas_from_TM_imagery)
- https://torchgeo.readthedocs.io/en/stable/tutorials/indices.html : fonctions utilitaires qui peuvent être utiles pour DL Sentinel-2 ?
- `torchgeo` trainers : pas évident de voir l'utilité
- Modèles et poids pré-entraînés disponibles : https://torchgeo.readthedocs.io/en/stable/api/models.html
## Sentinel Hub
**DEVIENT POTENTIELLEMENT VITE PAYANT ?**
- Users can use APIs to retrieve satellite data over their AOI and specific time range from full archives in a matter of seconds
- Requests : plusieurs paramètres
- API (Processing API - par défaut, Batch Processing API, Third Party Data Import API, Catalog API, Statistical API, OGC API et "Brind Your Own Cog API")
- Data collection : 11 collections disponibles
- Time range
- Area of interest
- Output format
- Package Python :
- Il est nécessaire de s'authentifier, avec un access token (expire au bout d'1 heure): https://docs.sentinel-hub.com/api/latest/user-guides/beginners-guide/
- Ressources : https://www.sentinel-hub.com/develop/integrate/python-integrate/
- Notebooks : https://github.com/sentinel-hub/sentinelhub-py/tree/master/examples
- Doc : https://sentinelhub-py.readthedocs.io/en/latest/
- `oauthlib` pour s'authentifier :
```
# set up credentials
client = BackendApplicationClient(client_id=CLIENT_ID)
oauth = OAuth2Session(client=client)
# get an authentication token
token = oauth.fetch_token(token_url='https://services.sentinel-hub.com/oauth/token',
client_id=CLIENT_ID, client_secret=CLIENT_SECRET)
```
- Paramètres d'une requête. Les collections disponibles sont listées ici : https://docs.sentinel-hub.com/api/latest/data/
```
bbox = [-87.72171, 17.11848, -87.342682, 17.481674]
start_date = "2020-06-01"
end_date = "2020-08-31"
collection_id = "sentinel-2-l2a"
```
- Format du JSON : à approfondir
- Requête :
```
# Set the request url and headers
url_request = 'https://services.sentinel-hub.com/api/v1/process'
headers_request = {
"Authorization" : "Bearer %s" %token['access_token']
}
#Send the request
response = oauth.request(
"POST", url_request, headers=headers_request, json = json_request
)
```
- La Catalog API permet de trouver toutes les données disponibles pour une ROI, une plage temporelle et une collection données :
```
json_search = {
'bbox': bbox,
'datetime': f'{start_date}T00:00:00Z/{end_date}T23:59:59Z',
'collections': [collection_id],
'limit': 1
}
# set the url and headers
url_search = 'https://services.sentinel-hub.com/api/v1/catalog/search'
headers_search = {
'Content-Type': 'application/json'
}
# send the request
response_search = oauth.request(
"POST", url_search, headers=headers_search, json = json_search
)
```
- Sentinel-2 : L1C ou L2A ? The difference between L1C and L2A images is that L2A has been atmospherically corrected. Therefore, L2A is Bottom of Atmosphere values and L1C is Top of Atmosphere values.
- Sentinel-2 : resolution -> 10m, 20m, and 60m depending on the wavelength
- Processing API : Even though satellite imagery data are often distributed in "tiles", we do not want users to be limited to these. Tiles are an artificially introduced entity to make data distribution easier to handle. However, users should not have to care about whether their AOI is on one tile or another, or perhaps on the border of two tiles. This is why Sentinel Hub API hides this complexity and simply makes the data available over chosen area of interest and temporal period of interest. Tiles are therefore automatically stitched together based on defined parameters (AOI, time period, cloud coverage, priority, etc., depending on the data type).
## `sentinelsat`
- https://github.com/sentinelsat/sentinelsat
- Point faible : pas de L2C ?
## SAR
- https://github.com/ESA-PhiLab/OpenSarToolkit
## Download de la PEPS
- https://github.com/olivierhagolle/peps_download
- https://peps.cnes.fr/rocket/plus/plus.html pour différents pré-traitements possibles des images sat
## `eolearn` :
- https://eo-learn.readthedocs.io/en/latest/examples/land-cover-map/SI_LULC_pipeline.html
## Quelques pistes potentielles :
- Faire une ACP sur les différentes bandes pour concentrer l'information radiométrique en quelques canaux. Mais pas sûre que ce soit efficace pour détecter des zones petites comme des bidonvilles
- Utilisation de filtres passe-haut sur les images notamment pour mettre en valeur les contours présents. Permet peut-être de visualiser plus nettement un décalage des contours urbains dans le temps pour les bidonvilles qui émergent en périphéries
## Google Earth Engine
- https://developers.google.com/earth-engine/datasets/catalog : Data catalog
- SR = L2A je pense en général
- Le pipeline pour retirer les nuages a pas l'air si compliqué. Qques fonctions potentiellement pénibles à répliquer mais le gros enjeu : est-ce qu'on veut faire les calculs sur du cloud (Google) ou pas ? Pour l'instant pour nous, pas bcp de calculs à faire j'imagine donc peut-être pas nécessaire ? A discuter.