pub struct EPWFile {
pub header: Header,
pub data: WeatherData,
}Fields§
§header: Header§data: WeatherDataImplementations§
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)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
fn main() {
let parsed = EPWFile::from_path("./data/USA_FL_Tampa_TMY2.epw");
match parsed {
Ok(epw) => {
let location = epw.header.location;
let data = epw.data;
println!(
"Location: {:.4}, {:.4} [{}, {}]",
location.latitude,
location.longitude,
location.city,
location.state_province_region
);
let max_temp = match data.dry_bulb_temperature.into_iter().reduce(f64::max) {
Some(t) => t,
None => panic!("Couldn't calculate max temperature"),
};
println!("Max Temperature: {:.2}°C", max_temp);
}
Err(e) => println!("{:?}", e),
}
}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