To use cdsapi via Docker, you must provide a JSON request file containing your API credentials and the specific data parameters you wish to retrieve. The container expects the request file at /input/request.json and will save the downloaded data to the /output directory.
1. Prepare the request JSON
Create a JSON file (e.g., request.json) with the following structure:
url: The CDS API endpoint.uuid: Your user ID.key: Your user key.variable: The dataset identifier.options: A dictionary of parameters for the request (e.g., date, time, format).filename: The desired name for the downloaded file.
2. Run the Docker container
Execute the docker run command, mounting your local request file to /input/request.json and your current working directory to /output to retrieve the file locally.
{
"url": "https://cds.climate.copernicus.eu/api/v2",
"uuid": "<user id>",
"key": "<user key>",
"variable": "reanalysis-era5-pressure-levels",
"options": {
"variable": "temperature",
"pressure_level": "1000",
"product_type": "reanalysis",
"date": "2017-12-01/2017-12-31",
"time": "12:00",
"format": "grib"
},
"filename":"test.grib"
}