...
2) The CDS API is a service providing programmatic access in Python to ADS data. CDS API example queries can be conveniently constructed by using the ADS web interface and clicking on the "Show API request" buttonUsers need to have a ADS account to use it with the related API key. For a full description and some useful examples, please see How to use the CDS API.
If users have more than one CDS API key and therefore have to pass credentials in explicitly, the following method can be used:
Code Block | ||
---|---|---|
| ||
import cdsapi
import yaml
with open('/path/to/ads/cdsapirc', 'r') as f:
credentials = yaml.safe_load(f)
c = cdsapi.Client(url=credentials['url'], key=credentials['key'])
c.retrieve("dataset-short-name",
{... sub-selection request ...},
"target-file") |
We strongly suggest to construct CDS API requests by using the web interface of the relevant dataset and using the 'Show API request' button to get the code.
Note |
---|
Please note: Currently, all ADS datasets are covered by Copernicus Products Licence, and users have to accept it in order to be able to download datasets (whether through the web interface, or the CDS API). If the licence has not been accepted, the error message below will shown by the CDS API: At the time this article was written, the acceptance of the licence can only be carried out through the ADS web interface for the relevant dataset, by forming a request on the "Download data" page. The user will then be prompted to accept the licence. Once that is done, the CDS API request can be successfully submitted to the ADS. |
...