openmeteo-rs 1.0.0

Rust client for the Open-Meteo weather API.
Documentation
use openmeteo_rs::{Client, EnsembleModel, HourlyVar, Result, Timezone};

#[tokio::main]
async fn main() -> Result<()> {
    let client = Client::new();
    let response = client
        .ensemble(47.3769, 8.5417)
        .hourly([HourlyVar::Temperature2m])
        .models([EnsembleModel::IconSeamlessEps])
        .forecast_hours(6)
        .timezone(Timezone::Iana("Europe/Zurich".to_owned()))
        .send()
        .await?;

    if let Some(hourly) = response.hourly {
        for (index, row) in hourly.iter_rows().enumerate() {
            let member_01 = hourly
                .get("temperature_2m_member01")
                .and_then(|series| series.values_f32())
                .and_then(|values| values.get(index).copied().flatten());
            println!(
                "{} control={:?} member01={:?}",
                row.time(),
                row.temperature_2m(),
                member_01
            );
        }
    }

    Ok(())
}