example/
example.rs

1/*! Example usage of library demonstrating how to read an EPW File from the filesystem and
2access both header data and weather data
3!*/
4use epw_rs::EPWFile;
5
6fn main() {
7    let parsed = EPWFile::from_path("./data/USA_FL_Tampa_TMY2.epw");
8    match parsed {
9        Ok(epw) => {
10            let location = epw.header.location;
11            let data = epw.data;
12            let max_temp = match data.dry_bulb_temperature.into_iter().reduce(f64::max) {
13                Some(t) => t,
14                None => panic!("Couldn't calculate max temperature"),
15            };
16            println!("Location:        {}", location);
17            println!("Max Temperature: {:.2}°C", max_temp);
18        }
19        Err(e) => println!("{:?}", e),
20    }
21}