emissions-api / sentinel5dl

Sentinel-5(P) Downloader
https://sentinel5dl.emissions-api.org
MIT License
12 stars 9 forks source link

Error downloading data: Retrying failed HTTP request. (22, 'The requested URL returned error: 400') #86

Closed twVolc closed 1 year ago

twVolc commented 1 year ago

Hi,

I'm having an issue when trying to download TROPOMI data using (essentially) your example code:

from sentinel5dl import search, download

def download_data(polygon, begin_ts, end_ts, product, processing_level, processing_mode='Offline'):
    """
    Function to download data from Sentinel5P
    :param polygon:     str
    :param begin_ts:    str
    :param end_ts:      str
    :param product:     str
    :param processing_level:    str
    :param processing_mode:     str
    :return:
    """
    # Search for Sentinel-5 products
    result = search(
        polygon=polygon,
        begin_ts=begin_ts,
        end_ts=end_ts,
        product=product,
        processing_level=processing_level,
        processing_mode=processing_mode)
    print('Searched for data')

    # Download found products to the local folder
    download(result.get('products'))

if __name__ == '__main__':
    polygon='POLYGON((7.8 49.3,13.4 49.3,13.4 52.8,7.8 52.8,7.8 49.3))',
    begin_ts='2019-09-01T00:00:00.000Z',
    end_ts='2019-09-17T23:59:59.999Z',
    product='L2__CO____',
    processing_level='L2',
    processing_mode='Offline'
    download_data(polygon, begin_ts, end_ts, product, processing_level)

This throws the error Retrying failed HTTP request. (22, 'The requested URL returned error: 400'), which loops continuously as the code tries to connect. It looks like this means there is an issue with how the pycurl object is setup, either with an incorrect URL or access credentials, or something like this? Maybe this is an incompatibility with my pycurl version? Or has data access to TROPOMI changed since your package was released?

Some version information:

python=3.8.16
sentinel5dl=1.2
pycurl.version output='PycURL/7.45.1 libcurl/7.87.0 Schannel zlib/1.2.13 libssh2/1.10.0'

Any help you could give would be much appreciated, as this package seems like it could make accessing TROPOMI data really straightforward.

Thanks.

twVolc commented 1 year ago

I should note this is on a Windows machine. I've done the installation on a Raspberry Pi and the package works perfectly on that...

lkiesow commented 1 year ago

I don't have a Windows system to test this, but do you have a stack trace? Maybe we can already spot the problem from that.

twVolc commented 1 year ago

Thanks for such a quick response. I've just gone back to get further details, having changed nothing, and it is now working. Perhaps there was an issue with the copernicus server at the time I first tried things yesterday, otherwise I can't explain what has happened.

lkiesow commented 1 year ago

That's not unlikely. Running emissions-api.org, we noticed that this happens surprisingly often. But good to hear that things work now.