Skip to main content

Crate copernicus_explorer

Crate copernicus_explorer 

Source
Expand description

§Copernicus Explorer

A Rust client for browsing and downloading Sentinel satellite products from the Copernicus Data Space Ecosystem (CDSE).

§Async-first design

The primary API is async (tokio-based). For synchronous contexts (Python bindings, simple scripts), use the blocking module which provides thin wrappers that create a Tokio runtime internally.

§Quick start (async)

use copernicus_explorer::{Satellite, SearchQuery, get_access_token};

#[tokio::main]
async fn main() {
    let token = get_access_token("user@example.com", "password").await.unwrap();

    let products = SearchQuery::new(Satellite::Sentinel2)
        .product("L2A")
        .max_cloud_cover(20.0)
        .max_results(5)
        .execute()
        .await
        .unwrap();

    for product in &products {
        println!("{product}");
    }
}

§Quick start (blocking)

use copernicus_explorer::{Satellite, SearchQuery, blocking};

let token = blocking::get_access_token("user@example.com", "password").unwrap();

let products = SearchQuery::new(Satellite::Sentinel2)
    .product("L2A")
    .max_cloud_cover(20.0)
    .max_results(5)
    .execute_blocking()
    .unwrap();

§Module overview

Rust organises code into modules. Each file in src/ is a module. pub mod makes a module visible to users of the library. pub use re-exports items so they can be imported directly from the crate root, without needing to know the internal module structure.

Re-exports§

pub use auth::get_access_token;
pub use auth::get_access_token_from_env;
pub use download::download_by_id;
pub use download::download_by_id_to;
pub use download::download_products;
pub use download::download_products_to;
pub use download::download_scene;
pub use download::download_scene_to;
pub use error::CopernicusError;
pub use geometry::BoundingBox;
pub use geometry::Geometry;
pub use geometry::Point;
pub use geometry::Polygon;
pub use models::Product;
pub use models::Products;
pub use models::Satellite;
pub use models::format_products;
pub use models::print_products;
pub use s3::OutputDestination;
pub use s3::S3Config;
pub use s3::S3Destination;
pub use s3::parse_output_destination;
pub use search::SearchQuery;
pub use search::get_scene_id;

Modules§

auth
blocking
Blocking (synchronous) wrappers around the async API.
download
error
geometry
models
s3
search