sentinel-hub / sentinelhub-py

Download and process satellite imagery in Python using Sentinel Hub services.
http://sentinelhub-py.readthedocs.io/en/latest/
MIT License
822 stars 249 forks source link

[HELP] Possibly unclear documentation on downloading Sentinel-1 SAR images using Copernicus? #546

Open ksd3 opened 1 month ago

ksd3 commented 1 month ago

I'm trying to download Sentinel-1 SAR images using Copernicus. Specifically, I'm trying to follow example #15 in the tutorial. To get OGC data, I'm trying to set up my instance_id through Copernicus' dataspace, as I'd like to keep everything in the same ecosystem. However after generating an instance_id by logging in to dataspace.copernicus.eu, then going to Configuration Utility->New Configuration->Naming my configuration and selecting Sentinel-1 Template, then copying the ID from Service Endpoint into my configuration file, I cannot pull Sentinel-1 data.

Specifically, I get the following error log (note that all personal information has been removed):

---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
File myenv/lib/python3.10/site-packages/sentinelhub/download/handlers.py:40, in fail_user_errors.<locals>.new_download_func(self, request)
     [39](https://vscode-remote+wsl-002bubuntu-002d22-002e04.vscode-resource.vscode-cdn.net/myenv/lib/python3.10/site-packages/sentinelhub/download/handlers.py:39) try:
---> [40](https://vscode-remote+wsl-002bubuntu-002d22-002e04.vscode-resource.vscode-cdn.net/myenv/lib/python3.10/site-packages/sentinelhub/download/handlers.py:40)     return download_func(self, request)
     [41](https://vscode-remote+wsl-002bubuntu-002d22-002e04.vscode-resource.vscode-cdn.net/myenv/lib/python3.10/site-packages/sentinelhub/download/handlers.py:41) except requests.HTTPError as exception:

File myenv/lib/python3.10/site-packages/sentinelhub/download/sentinelhub_client.py:100, in SentinelHubDownloadClient._execute_download(self, request)
     [98](https://vscode-remote+wsl-002bubuntu-002d22-002e04.vscode-resource.vscode-cdn.net/myenv/lib/python3.10/site-packages/sentinelhub/download/sentinelhub_client.py:98)     continue
--> [100](https://vscode-remote+wsl-002bubuntu-002d22-002e04.vscode-resource.vscode-cdn.net/myenv/lib/python3.10/site-packages/sentinelhub/download/sentinelhub_client.py:100) response.raise_for_status()
    [102](https://vscode-remote+wsl-002bubuntu-002d22-002e04.vscode-resource.vscode-cdn.net/myenv/lib/python3.10/site-packages/sentinelhub/download/sentinelhub_client.py:102) LOGGER.debug("Successful %s request to %s", request.request_type.value, request.url)

File myenv/lib/python3.10/site-packages/requests/models.py:1024, in Response.raise_for_status(self)
   [1023](https://vscode-remote+wsl-002bubuntu-002d22-002e04.vscode-resource.vscode-cdn.net/myenv/lib/python3.10/site-packages/requests/models.py:1023) if http_error_msg:
-> [1024](https://vscode-remote+wsl-002bubuntu-002d22-002e04.vscode-resource.vscode-cdn.net/myenv/lib/python3.10/site-packages/requests/models.py:1024)     raise HTTPError(http_error_msg, response=self)

HTTPError: 400 Client Error: Bad Request for url: https://services.sentinel-hub.com/ogc/wfs/[my-id]?SERVICE=wfs&WARNINGS=False&REQUEST=GetFeature&TYPENAMES=DSS3&BBOX=46.757161%2C15.461282%2C46.851514%2C15.574922&OUTPUTFORMAT=application%2Fjson&SRSNAME=EPSG%3A4326&TIME=2017-10-03T00%3A00%3A00Z%2F2017-10-03T23%3A59%3A59Z&MAXCC=100.0&MAXFEATURES=100&FEATURE_OFFSET=0

The above exception was the direct cause of the following exception:

DownloadFailedException                   Traceback (most recent call last)
Cell In[3], [line 13](vscode-notebook-cell:?execution_count=3&line=13)
     [10](vscode-notebook-cell:?execution_count=3&line=10) custom_config = CustomConfig.load("cdse")
     [11](vscode-notebook-cell:?execution_count=3&line=11) print(custom_config)
---> [13](vscode-notebook-cell:?execution_count=3&line=13) s1_request = WmsRequest(
...
DownloadFailedException: Failed to download from:
https://services.sentinel-hub.com/ogc/wfs/[my-id]?SERVICE=wfs&WARNINGS=False&REQUEST=GetFeature&TYPENAMES=DSS3&BBOX=46.757161%2C15.461282%2C46.851514%2C15.574922&OUTPUTFORMAT=application%2Fjson&SRSNAME=EPSG%3A4326&TIME=2017-10-03T00%3A00%3A00Z%2F2017-10-03T23%3A59%3A59Z&MAXCC=100.0&MAXFEATURES=100&FEATURE_OFFSET=0
with HTTPError:
400 Client Error: Bad Request for url: https://services.sentinel-hub.com/ogc/wfs/[my-id]?SERVICE=wfs&WARNINGS=False&REQUEST=GetFeature&TYPENAMES=DSS3&BBOX=46.757161%2C15.461282%2C46.851514%2C15.574922&OUTPUTFORMAT=application%2Fjson&SRSNAME=EPSG%3A4326&TIME=2017-10-03T00%3A00%3A00Z%2F2017-10-03T23%3A59%3A59Z&MAXCC=100.0&MAXFEATURES=100&FEATURE_OFFSET=0
Server response: "Invalid instance id: [my-id]"

Is this the right way to go about doing this? Note that 'CustomConfig' is simply a class I wrote to get config files from a user-defined location, and it's not the problem, as I can easily pull Sentinel-2 images with it.

zigaLuksic commented 1 month ago

Hi @ksd3, from the error it seems like the request was not sent to Copernicus dataspace

here you have the same example but with some additional info for using Copernicus dataspace, and hopefully you'll find something useful there.