3

I am a beginner with computer programming and I trying to use Python pack, sentinel-sat 0.12, to download images of Sentinel 2, but I get back a response I don't understand:

sentinelsat.sentinel.SentinelAPIError: HTTP status 500 Internal Server Error: IOException : Server returned HTTP response code: 400 for URL: http://localhost:30333//solr/dhus/select?q=beginposition:[2017-08-01T00:00:00Z%20TO%202017-08-30T00:00:00Z]%20cloudcoverpercentage:[0%20,%20100]%20platformname:Sentinel-2%20footprint:"Intersects(POLYGON((16.6085%2038.8957,16.6221%2039.4901,17.2206%2039.4802,17.2020%2038.8860,16.6085%2038.8957)))"&wt=xslt&tr=opensearch_atom.xsl&dhusLongName=Sentinels+Scientific+Data+Hub&dhusServer=https%3A%2F%2Fscihub.copernicus.eu%2Fdhus%2F&originalQuery=beginPosition%3A%5B2017-08-01T00%3A00%3A00Z+TO+2017-08-30T00%3A00%3A00Z%5D+cloudcoverpercentage%3A%5B0+%2C+100%5D+platformname%3ASentinel-2+footprint%3A%22Intersects%28POLYGON%28%2816.6085+38.8957%2C16.6221+39.4901%2C17.2206+39.4802%2C17.2020+38.8860%2C16.6085+38.8957%29%29%29%22&rows=100&start=0&sort=ingestiondate+desc

The script I have used is:

from sentinelsat.sentinel import SentinelAPI, read_geojson, geojson_to_wkt
api = SentinelAPI('**********', '*********','https://scihub.copernicus.eu/dhus')

# search by polygon, time, and SciHub query keywords
footprint = geojson_to_wkt(read_geojson('KR_REFEFA_POLY_extent_4326.geojson'))
products = api.query(footprint,
                     date = ('20170801', '20170830'),
                     platformname = 'Sentinel-2',
                     cloudcoverpercentage = '[0 , 100]')

The GeoJSON file SRC is in WGS84 (EPSG:4326).

I hope can you help me with this problem.

  • Thanks Bera, but if I try writing date in this way the program respond me to define date: name 'date' is not defined – Luca Caliciotti Sep 20 '17 at 15:03
2

You need to change cloudcoverpercentage = '[0 , 100]' to cloudcoverpercentage = (0,100) With this your code works for me:

from sentinelsat.sentinel import SentinelAPI, read_geojson, geojson_to_wkt
api = SentinelAPI('username', 'password','https://scihub.copernicus.eu/dhus')

# search by polygon, time, and SciHub query keywords
footprint = geojson_to_wkt(read_geojson('C:/path/area.geojson'))
products = api.query(footprint,
                     date = ('20170801','20170830'),
                     platformname = 'Sentinel-2',
                     cloudcoverpercentage = (0,100))

I dont know why though. According to the Sentinelsat Documentation your way should also work.

  • 1
    Unfortunately this is an error in the sentinelsat documentation. The .query() documentation is correct. I filed an issue for the rest. – Kersten Sep 25 '17 at 8:01
1

This was an error in the sentinelsat documentation. As of version 0.12 parameter ranges should be provided as tuples.

Most commonly this is used in the date=(<start>, <end>) and cloudcoverpercentage=(<min>, <max>) parameters.

The error in the documentation has been fixed and the latest version of the docs is correct: http://sentinelsat.readthedocs.io/en/master/api.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.