If you wanted to collect all Sentinel satellite data for a given region of interest (ROI), say, for a given day or time frame - is there any simple way to do it? That means: Without having to download all the full images manually and cropping the ROI subset manually as well afterwards?
-
Currently I use the SentinelAPI, and in api.query, I set area_relations='Contains'. However, this obviously still downloads the full product, and allows to download only data, which contains the full ROI. Is the ROI split into two or more Sentinel datasets, no mosaicking will be carried out. Another drawback: No georeferencing/terrain correction beyond the delivered standard product is included - this needs yet to be done...– MichaelSep 11, 2017 at 15:45
6 Answers
The latest release of ESA SNAP (6 beta) features so-called AOI monitoring.
http://step.esa.int/main/download/
It allows you to define a region of interest, schedule searching for the data and apply processing chains (as defined with the graph builder) on the data automatically. And with the new sci-hub integration you can download S1 data directly in SNAP (you enter the same user credentials as on https://scihub.copernicus.eu/).
However, I don't think that only downloading subsets works by now. The whole product is retrieved but as soon as you integrate the subset operator in your graph, only the desired area is proessed.
-
Oh, that sounds handy! However, when trying it, the AOI selection doesn't really work for me. At least, I cannot zoom into that worldmap somehow. Is there any method to select the AOI based on a geojson file or else?– MichaelSep 11, 2017 at 15:43
sentinelloader is a Python package that attempts to tackle this problem:
With this utility you can specify the desired polygon, image resolution, band name and aproximate dates and it will do the best effort to find all tiles needed to satisfy your requirement. Then it will download minimal data by selecting just the needed .jp2 files inside Products, combine downloaded tiles, crop the combined tiles image to the polygon and cache the results, returning a GeoTIFF image with raster for the selected area.
In other words, this still downloads the full images for the band(s) that you select (instead of the entire set), and it does so in an automatic way for the given time frame. Then it also crops and mosaics as needed to fit your ROI.
This package seems to be under development, with some bugs to clear out. I tried it out under Python 3.6.7 and managed to make it work.
Install
pip install git+https://github.com/flaviostutz/sentinelloader
Note: it will install its dependencies, but the requirements seem to be missing the following: pillow
and cartopy
Example (adapted) from the repo:
from sentinelloader import Sentinel2Loader
from shapely.geometry import Polygon
sl = Sentinel2Loader('/temp_dir/sentinel/cache', 'username', 'password',
apiUrl='https://scihub.copernicus.eu/apihub/',
showProgressbars=True,
cacheApiCalls=False, cacheTilesData=False)
area = Polygon([(-47.873796, -16.044801), (-47.933796, -16.044801),
(-47.933796, -15.924801), (-47.873796, -15.924801)])
geoTiffs = sl.getRegionHistory(area, 'TCI', '60m',
'2019-01-06', '2019-01-30', daysStep=5)
for geoTiff in geoTiffs:
print('Desired image was prepared at')
print(geoTiff)
This example will produce 5 geotiff files with TCI's at 60 m resolution. The first is dated from 2019-01-06 and then the remaining are 5 days apart from each other (11, 16, 21, and 26).
Here is the first one:
Use Google Earth Engine: https://earthengine.google.com/
You can visualize and export sentinel images for a given ROI (customizable by user input shapefile, kml, etc) in a few lines of code. There are many demos available online.
More info here https://developers.google.com/earth-engine/sentinel1
-
1Thanks a lot for this answer, which I will accept because I was already drawn into this direction myself recently: gis.stackexchange.com/questions/256529/…– MichaelSep 29, 2017 at 7:30
take a look to sentinelsat https://sentinelsat.readthedocs.io/en/stable/index.html Another option is using scihub_download
using STAC API is the modern way of subsetting and filtering to our AOI.
For sentinel-2, you'd do the following
from pystac_client import Client
URL = 'https://earth-search.aws.element84.com/v0/'
client = Client.open(URL)
search = client.search(
collections = "sentinel-s2-l2a-cogs",
intersects = AOI,
datetime = '2022-01-01/2022-01-24'
)
This is result in sentinel-2 images for Area of Interest. You can then use stackstac
python package to run analysis on the fly without downloading the data.
import stackstac
ds = stackstac.stack(search.get_all_items() , epsg=4326, assets=["B04", "B03", "B05"] )
The resulting ds
is a xarray.DataArray
. You can then perform any kind of anaylsis on this.
The above code requires you do install pystac_client
and stackstac
package
One option to automate downloading part (but not also cropping) would be to use a combination of OpenSearch API (http://opensearch.sentinel-hub.com/resto/api/collections/Sentinel2/describe.xml) and Python downloader (https://github.com/sinergise/sentinelhub).
(disclaimer: I am coming from Sinergise, a company, which developed Sentinel Hub and both of the above mentioned freely available tools; you could also use Sentinel Hub services to do exactly what you are asking for, but those are payable)
-
Thanks for the response. However, your solution seems to be centered on Sentinel-2 only; besides I cannot really make use of the linked describe.xml file in a simple manner.– MichaelSep 11, 2017 at 14:33
-
The describe.xml describes capabilities of the OGC compliant OpenSearch catalogue (opengeospatial.org/standards/opensearchgeo). An example search is provided bellow. You are right though that it only works for S-2 as only these are available on AWS (so far). opensearch.sentinel-hub.com/resto/api/collections/Sentinel2/…– Grega M.Sep 11, 2017 at 21:10