pub struct EPWFile {
pub header: Header,
pub data: WeatherData,
}
Expand description
EPWFile is the representation of the parsed file
it has only two attributes, header
which is an instance of the Header struct,
and data
which contains the weather data in a WeatherData struct.
Fields§
§header: Header
§data: WeatherData
Implementations§
Source§impl EPWFile
impl EPWFile
Sourcepub fn from_reader<R: BufRead>(reader: R) -> Result<Self, EPWParseError>
pub fn from_reader<R: BufRead>(reader: R) -> Result<Self, EPWParseError>
Sourcepub fn from_path(path: &str) -> Result<Self, EPWParseError>
pub fn from_path(path: &str) -> Result<Self, EPWParseError>
Create an EPWFile instance from a file path
§Parameters
path
: Path to file on the filesystem
§Returns
An initialized EPWFile or an EPWParseError
Examples found in repository?
examples/example.rs (line 7)
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}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EPWFile
impl RefUnwindSafe for EPWFile
impl Send for EPWFile
impl Sync for EPWFile
impl Unpin for EPWFile
impl UnwindSafe for EPWFile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more