4

I am trying to query Sentinel1A data using the Sentinel API, by using the following scripts.

from sentinelsat.sentinel import SentinelAPI
api = SentinelAPI('username', 'password',
                          'https://scihub.copernicus.eu/dhus/')
api.query(location_str, '20150101', '20150110', producttype='GRD')

I am getting the following error

sentinelsat.sentinel.SentinelAPIError: (HTTP status: 500, code: None) # HTTP Status 500 - Request processing failed; nested exception is java.lang.IllegalArgumentException: parameter rows exceeds the maximum value (100)

Scihub and API Hub recently updated to limit the number of rows to be returned in a single query to 100, as posted here might be the reason for this error.

How to make OpenSearch API query to return less than 100 rows ?

  • 1
    We are working on a new release. In the meantime you can follow the Pull Request for this. – Kersten Oct 28 '16 at 9:15
  • Thanks @Kersten . I got it working for time being by changing the line number 132 of sentinel.py as in double quotes "return urljoin(self.api_url, 'search?format=json&rows=90')" – S. Thiyaku Oct 28 '16 at 10:16
5

Version 0.7.1 of sentinelsat has just been published to Pypi and solves this issue.

Root cause was the change in behaviour of the rows argument in SciHubs OpenSearch protocol. sentinelsat now queries 100 results at a time until no new scenes are returned. (see the documentation for further info).

Discussion of the changes can be found in the related pull request.

disclaimer: I am a contributor to the sentinelsat project.

2

You can use $top parameter in OpenSearch:

$top : Determines the maximum number of records to return.

Example:

https://scihub.copernicus.eu/dhus/odata/v1/Products?$top=50  

this OData URI allows to list 50 products.

ATTENTION: $top accepts as maximum value 100. For higher values it will result in an error ( http 500 ).

Reference:
https://scihub.copernicus.eu/userguide/5APIsAndBatchScripting

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.