eo-identifiers

Crates.ioeo-identifiers
lib.rseo-identifiers
version0.1.1
sourcesrc
created_at2022-11-28 16:29:22.52174
updated_at2022-11-30 19:49:27.630527
descriptionParsers for naming conventions of earth observation products and datasets
homepagehttps://github.com/nmandery/eo-identifiers
repositoryhttps://github.com/nmandery/eo-identifiers
max_upload_size
id724597
size129,698
Nico Mandery (nmandery)

documentation

README

Parsers for naming conventions of earth observation products and datasets

Latest Version Documentation ci dependency status

use eo_identifiers::Identifier;
use eo_identifiers::identifiers::sentinel2::ProductLevel;
use std::str::FromStr;
use chrono::{NaiveDate, NaiveDateTime, NaiveTime};

fn example() {
    let ident = Identifier::from_str("S2A_MSIL1C_20170105T013442_N0204_R031_T53NMJ_20170105T013443")
        .unwrap();

    if let Identifier::Sentinel2Product(product) = ident {
        assert_eq!(product.product_level, ProductLevel::L1C);
        assert_eq!(
            product.start_datetime,
            NaiveDateTime::new(
                NaiveDate::from_ymd_opt(2017, 1, 5).unwrap(),
                NaiveTime::from_hms_opt(1, 34, 42).unwrap()
            )
        );
        assert_eq!(product.relative_orbit_number, 31);
    }
    else {
        unreachable!();
    }
}

This crate is at an early stage. There are lots of parser missing - pull requests are welcome.

Commit count: 9

cargo fmt