Skip to main content

A minimal Copernicus Ecosystem API

Project description

Copernicus Ecosystem OData API

This is a simple package based on the tutorials from https://documentation.dataspace.copernicus.eu/APIs/OData.html. It does not support full functionality for searching but only product type, start and end sensing date, geographic criterior as intersection and expand attributes. There is a lot of room for improvement. Contribution is very welcome.

All other attributes by collection are not yet supported in the search query.

Overview

Up to four parallel Downloads are supported, the maximum from OData. It uses the requests library to make API calls and the threading library to handle concurrent downloads.

Installation

To install the library, use pip:

pip install copernicus-ecosystem

Usage

To search and download images from OData

from copernicus-ecosystem import ODataAPI

api=ODataAPI(username, password)
search_result(product_type='IW_SLC',start='2021-05-20T00:00:00', end='2021-05-21T00:00:00',expand="Attributes")
api.download(id, filename)

more information on available querys can be found here: https://documentation.dataspace.copernicus.eu/APIs/OData.html#list-of-odata-query-attributes-by-collection

Multiple Downloads

If you want to download multiple files you could mange that in your own loop like that:

from copernicus-ecosystem import ODataAPI

api=ODataAPI(username, password)
ids=[id1,id2,id3] #list of image ids
run=True
while run:
    remove=[]
    for image_id in ids:
        if api.ready_to_download(): # check if api is ready or all 4 downloads are still busy
            api.download(uuid,i) #start download thread
            remove.append(i) #remember to remov ethe image id from the list
    for i in remove:
        images.remove(i) #remove the image ids that are being downloaded
    time.sleep(10) #wait for 10 seconds before you check for one of four available download slots
    if len(images)==0:
        run=False # stop the loop when the list is empty. The threads will continue to download

S3 Bucket download

It is also possible to download the data using the S3 bucket. You will need s3cmd and a s3cfg file according to this tutorial: https://documentation.dataspace.copernicus.eu/APIs/S3.html

from copernicus-eodata import ODataAPI

api=ODataAPI(username, password)
api.s3_download(fileName,path,s3Path,s3cfg,zipping=True,progress=False)

The filename and the path to where the product should be downloaded needs to be passed seperatly. By default the downloaded product will be zipped after the download which takes addtional time.

Contributing

Contributions are welcome! Please submit a pull request with your changes.

License

This library is licensed under the MIT License. See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

copernicus_eodata-0.0.1.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

copernicus_eodata-0.0.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file copernicus_eodata-0.0.1.tar.gz.

File metadata

  • Download URL: copernicus_eodata-0.0.1.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.5

File hashes

Hashes for copernicus_eodata-0.0.1.tar.gz
Algorithm Hash digest
SHA256 4f4cce3125983a10dfd8c537c1a6cf567449703a02ae0b73f06bd1fb826a862c
MD5 42dfc5bc69e26e12e81f003a0b97f233
BLAKE2b-256 442f01e052a5fbfa0f766fc31d0225ec6e0f23512c3312fd941ec3f03d525c32

See more details on using hashes here.

File details

Details for the file copernicus_eodata-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for copernicus_eodata-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d79442f14db7516b567341f2d759121f6837ab4204c5c67470944833c7235cbb
MD5 54a4113c28b704d3a5d444b72413e612
BLAKE2b-256 5c4bdf2b4b9f04b9d922a703a6ba6a38d1d12349f6c0a7a573a1f0de55c80855

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page