| Crates.io | cdsapi |
| lib.rs | cdsapi |
| version | 0.1.1 |
| created_at | 2025-12-26 13:52:33.991242+00 |
| updated_at | 2025-12-27 04:58:29.405004+00 |
| description | Rust client for the Copernicus Climate Data Store (CDS) API, inspired by the Python cdsapi library. |
| homepage | https://github.com/hkwk/cdsapi |
| repository | https://github.com/hkwk/cdsapi |
| max_upload_size | |
| id | 2005734 |
| size | 95,474 |
A Rust client for the Copernicus Climate Data Store (CDS) API, inspired by the Python cdsapi library.
This crate supports both CDS key formats currently seen in the wild:
<UID>:<APIKEY> → uses the legacy /resources + /tasks workflow.<PERSONAL_ACCESS_TOKEN> (no colon) → uses the modern Retrieve API (/api/retrieve/v1) with PRIVATE-TOKEN auth.The client loads configuration from (highest precedence first):
CDSAPI_URLCDSAPI_KEYCDSAPI_RC (path to a config file)./.cdsapirc~/.cdsapircExample .cdsapirc:
url: https://cds.climate.copernicus.eu/api
key: <PERSONAL_ACCESS_TOKEN>
# or legacy:
# key: <UID>:<APIKEY>
Notes:
key: on one line and the value on the next line.verify: 0 to disable TLS certificate validation (not recommended).Library usage:
use anyhow::Result;
use cdsapi::Client;
use serde_json::json;
fn main() -> Result<()> {
let client = Client::from_env()?;
let request = json!({
"product_type": "reanalysis",
"variable": "geopotential",
"pressure_level": "1000",
"year": "2024",
"month": "03",
"day": "01",
"time": "13:00",
"format": "grib"
});
client.retrieve(
"reanalysis-era5-pressure-levels",
&request,
Some(std::path::Path::new("download.grib")),
)?;
Ok(())
}
Example program:
cargo run --example era5_pressure_levels_geopotential
The client prints request/job status transitions to stderr while polling (for example: Request state: running or Job status: accepted).
<UID>: prefix.url is https://cds.climate.copernicus.eu/api (or your CDS deployment base URL).Licensed under the Apache License, Version 2.0. See LICENSE and NOTICE.