[−][src]Struct sounding_analysis::Sounding
All the variables stored in the sounding.
The upper air profile variables are stored in parallel vectors. If a profile lacks a certain variable, e.g. cloud fraction, that whole vector has length 0 instead of being full of missing values.
Implementations
impl Sounding
[src]
pub fn new() -> Self
[src]
Create a new sounding with default values. This is a proxy for default with a clearer name.
Examples
use sounding_analysis::Sounding; let snd = Sounding::new(); println!("{:?}", snd);
pub fn with_source_description<S>(self, desc: S) -> Self where
Option<String>: From<S>,
[src]
Option<String>: From<S>,
Add a source description to this sounding.
Examples
use sounding_analysis::Sounding; let snd = Sounding::new().with_source_description("An empty sounding.".to_owned()); let snd = snd.with_source_description( Some("Still empty, just added a description.".to_owned()), ); let _snd = snd.with_source_description(None);
pub fn source_description(&self) -> Option<&str>
[src]
Retrieve a source description for this sounding.
Examples
use sounding_analysis::Sounding; let snd = Sounding::new().with_source_description("An empty sounding.".to_owned()); assert_eq!(snd.source_description().unwrap(), "An empty sounding."); let snd = snd.with_source_description(None); assert!(snd.source_description().is_none());
pub fn with_station_info(self, new_value: StationInfo) -> Self
[src]
Builder function for setting the station info.
Examples
use sounding_analysis::{Sounding, StationInfo}; let stn = StationInfo::new(); let _snd = Sounding::new().with_station_info(stn);
pub fn station_info(&self) -> &StationInfo
[src]
Get the station info
Examples
use sounding_analysis::StationInfo; let snd = make_test_sounding(); let stn: &StationInfo = snd.station_info(); println!("{:?}", stn);
pub fn with_pressure_profile(self, profile: Vec<Optioned<HectoPascal>>) -> Self
[src]
Builder method for the pressure profile.
Examples
use sounding_analysis::Sounding; use metfor::HectoPascal; use optional::{some, Optioned}; let data = vec![1000.0, 925.0, 850.0, 700.0, 500.0, 300.0, 250.0, 200.0, 150.0, 100.0]; let pressure_data: Vec<Optioned<HectoPascal>> = data.into_iter() .map(HectoPascal) .map(some) .collect(); let _snd = Sounding::new() .with_pressure_profile(pressure_data);
pub fn pressure_profile(&self) -> &[Optioned<HectoPascal>]
[src]
Get the pressure profile
Examples
use sounding_analysis::Sounding; let snd = make_test_sounding(); let data = snd.pressure_profile(); for p in data { if let Some(p) = p.into_option() { println!("{:?}", p); } else { println!("missing value!"); } } // Uninitialized profiles just return an empty vector. let snd = Sounding::new(); let data = snd.pressure_profile(); assert!(data.is_empty());
pub fn with_temperature_profile(self, profile: Vec<Optioned<Celsius>>) -> Self
[src]
Builder method for the temperature profile.
See with_pressure_profile
for an example of usage, keeping in mind the units type may
be different.
pub fn temperature_profile(&self) -> &[Optioned<Celsius>]
[src]
Get the temperature profile.
See pressure_profile
for an example of using getters, keeping in mind the units type may
be different.
pub fn with_dew_point_profile(self, profile: Vec<Optioned<Celsius>>) -> Self
[src]
Builder method for the dew point profile.
See with_pressure_profile
for an example of usage, keeping in mind the units type may
be different.
pub fn dew_point_profile(&self) -> &[Optioned<Celsius>]
[src]
Get the dew point profile.
See pressure_profile
for an example of using getters, keeping in mind the units type may
be different.
pub fn with_wet_bulb_profile(self, profile: Vec<Optioned<Celsius>>) -> Self
[src]
Builder method for the wet bulb profile.
See with_pressure_profile
for an example of usage, keeping in mind the units type may
be different.
pub fn wet_bulb_profile(&self) -> &[Optioned<Celsius>]
[src]
Get the wet bulb temperature profile.
See pressure_profile
for an example of using getters, keeping in mind the units type may
be different.
pub fn with_theta_e_profile(self, profile: Vec<Optioned<Kelvin>>) -> Self
[src]
Builder method for the theta e profile.
See with_pressure_profile
for an example of usage, keeping in mind the units type may
be different.
pub fn theta_e_profile(&self) -> &[Optioned<Kelvin>]
[src]
Get the equivalent potential temperature profile.
See pressure_profile
for an example of using getters, keeping in mind the units type may
be different.
pub fn with_wind_profile(
self,
profile: Vec<Optioned<WindSpdDir<Knots>>>
) -> Self
[src]
self,
profile: Vec<Optioned<WindSpdDir<Knots>>>
) -> Self
Builder method for the wind profile.
See set_pressure_profile
for an example of usage, keeping in mind the units type may
be different.
pub fn wind_profile(&self) -> &[Optioned<WindSpdDir<Knots>>]
[src]
Get the wind profile.
See pressure_profile
for an example of using getters, keeping in mind the units type may
be different.
pub fn with_pvv_profile(self, profile: Vec<Optioned<PaPS>>) -> Self
[src]
Builder method for the pressure vertical velocity profile.
See set_pressure_profile
for an example of usage, keeping in mind the units type may
be different.
pub fn pvv_profile(&self) -> &[Optioned<PaPS>]
[src]
Get the pressure vertical velocity profile.
See pressure_profile
for an example of using getters, keeping in mind the units type may
be different.
pub fn with_height_profile(self, profile: Vec<Optioned<Meters>>) -> Self
[src]
Builder method for the geopotential height profile.
See set_pressure_profile
for an example of usage, keeping in mind the units type may
be different.
pub fn height_profile(&self) -> &[Optioned<Meters>]
[src]
Get the geopotential height profile.
See pressure_profile
for an example of using getters, keeping in mind the units type may
be different.
pub fn with_cloud_fraction_profile(self, profile: Vec<Optioned<f64>>) -> Self
[src]
Builder method for the cloud cover profile.
See set_pressure_profile
for an example of usage, keeping in mind the units type may
be different.
pub fn cloud_fraction_profile(&self) -> &[Optioned<f64>]
[src]
Get the cloud fraction profile.
See pressure_profile
for an example of using getters, keeping in mind the units type may
be different.
pub fn with_mslp<T, U>(self, value: T) -> Self where
Optioned<U>: From<T>,
U: Noned + Pressure,
HectoPascal: From<U>,
[src]
Optioned<U>: From<T>,
U: Noned + Pressure,
HectoPascal: From<U>,
Builder method for the mean sea level pressure.
Examples
use metfor::{HectoPascal, Millibar}; use sounding_analysis::Sounding; use optional::{some, none}; let _snd = Sounding::new().with_mslp(HectoPascal(1021.5)); let _snd = Sounding::new().with_mslp(some(HectoPascal(1021.5))); let _snd = Sounding::new().with_mslp(none::<HectoPascal>()); let _snd = Sounding::new().with_mslp(Millibar(1021.5)); let _snd = Sounding::new().with_mslp(some(Millibar(1021.5))); let _snd = Sounding::new().with_mslp(none::<Millibar>());
pub fn mslp(&self) -> Optioned<HectoPascal>
[src]
Get the mean sea level pressure
pub fn with_station_pressure<T, U>(self, value: T) -> Self where
Optioned<U>: From<T>,
U: Noned + Pressure,
HectoPascal: From<U>,
[src]
Optioned<U>: From<T>,
U: Noned + Pressure,
HectoPascal: From<U>,
Biulder method for the station pressure.
Examples
use metfor::{HectoPascal, Millibar}; use sounding_analysis::Sounding; use optional::{some, none}; let _snd = Sounding::new().with_station_pressure(HectoPascal(1021.5)); let _snd = Sounding::new().with_station_pressure(some(HectoPascal(1021.5))); let _snd = Sounding::new().with_station_pressure(none::<HectoPascal>()); let _snd = Sounding::new().with_station_pressure(Millibar(1021.5)); let _snd = Sounding::new().with_station_pressure(some(Millibar(1021.5))); let _snd = Sounding::new().with_station_pressure(none::<Millibar>());
pub fn station_pressure(&self) -> Optioned<HectoPascal>
[src]
Get the mean sea level pressure.
pub fn with_sfc_temperature<T, U>(self, value: T) -> Self where
Optioned<U>: From<T>,
U: Noned + Temperature,
Celsius: From<U>,
[src]
Optioned<U>: From<T>,
U: Noned + Temperature,
Celsius: From<U>,
Builder method the surface temperature.
Examples
use metfor::{Fahrenheit, Celsius, Kelvin}; use sounding_analysis::Sounding; use optional::{some, none}; let _snd = Sounding::new().with_sfc_temperature(Celsius(20.0)); let _snd = Sounding::new().with_sfc_temperature(some(Celsius(20.0))); let _snd = Sounding::new().with_sfc_temperature(none::<Celsius>()); let _snd = Sounding::new().with_sfc_temperature(Kelvin(290.0)); let _snd = Sounding::new().with_sfc_temperature(some(Kelvin(290.0))); let _snd = Sounding::new().with_sfc_temperature(none::<Kelvin>()); let _snd = Sounding::new().with_sfc_temperature(Fahrenheit(72.1)); let _snd = Sounding::new().with_sfc_temperature(some(Fahrenheit(72.1))); let _snd = Sounding::new().with_sfc_temperature(none::<Fahrenheit>());
pub fn sfc_temperature(&self) -> Optioned<Celsius>
[src]
Get the surface temperature.
pub fn with_sfc_dew_point<T, U>(self, value: T) -> Self where
Optioned<U>: From<T>,
U: Noned + Temperature,
Celsius: From<U>,
[src]
Optioned<U>: From<T>,
U: Noned + Temperature,
Celsius: From<U>,
Set the surface dew point.
Examples
use metfor::{Fahrenheit, Celsius, Kelvin}; use sounding_analysis::Sounding; use optional::{some, none}; let _snd = Sounding::new().with_sfc_dew_point(Celsius(20.0)); let _snd = Sounding::new().with_sfc_dew_point(some(Celsius(20.0))); let _snd = Sounding::new().with_sfc_dew_point(none::<Celsius>()); let _snd = Sounding::new().with_sfc_dew_point(Kelvin(290.0)); let _snd = Sounding::new().with_sfc_dew_point(some(Kelvin(290.0))); let _snd = Sounding::new().with_sfc_dew_point(none::<Kelvin>()); let _snd = Sounding::new().with_sfc_dew_point(Fahrenheit(72.1)); let _snd = Sounding::new().with_sfc_dew_point(some(Fahrenheit(72.1))); let _snd = Sounding::new().with_sfc_dew_point(none::<Fahrenheit>());
pub fn sfc_dew_point(&self) -> Optioned<Celsius>
[src]
Get the surface dew point.
pub fn with_sfc_wind<T, U>(self, value: T) -> Self where
Optioned<U>: From<T>,
U: Noned + Copy,
WindSpdDir<Knots>: From<U>,
[src]
Optioned<U>: From<T>,
U: Noned + Copy,
WindSpdDir<Knots>: From<U>,
Set the surface wind.
Examples
use sounding_analysis::Sounding; use metfor::{WindSpdDir, WindUV, Knots, MetersPSec}; use optional::{some, none}; let _snd = Sounding::new() .with_sfc_wind(WindSpdDir{speed: Knots(10.0), direction: 270.0}); let _snd = Sounding::new() .with_sfc_wind(some(WindSpdDir{speed: Knots(10.0), direction: 270.0})); let _snd = Sounding::new().with_sfc_wind(none::<WindSpdDir<_>>()); let _snd = Sounding::new() .with_sfc_wind(some(WindUV{u: MetersPSec(-7.3), v: MetersPSec(5.2)})); let _snd = Sounding::new() .with_sfc_wind(WindUV{u: MetersPSec(-7.3), v: MetersPSec(5.2)}); let _snd = Sounding::new().with_sfc_wind(none::<WindUV<MetersPSec>>());
pub fn sfc_wind(&self) -> Optioned<WindSpdDir<Knots>>
[src]
Get the surface wind.
pub fn with_precipitation<T, U>(self, value: T) -> Self where
Optioned<U>: From<T>,
U: Noned + Length,
Mm: From<U>,
[src]
Optioned<U>: From<T>,
U: Noned + Length,
Mm: From<U>,
Builder method for the precipitation.
Examples
use sounding_analysis::Sounding; use metfor::{Inches, Mm, Cm}; use optional::{some, none}; let _snd = Sounding::new().with_precipitation(Inches(1.0)); let _snd = Sounding::new().with_precipitation(some(Inches(1.0))); let _snd = Sounding::new().with_precipitation(none::<Inches>()); let _snd = Sounding::new().with_precipitation(some(Cm(2.5))); let _snd = Sounding::new().with_precipitation(Cm(2.5)); let _snd = Sounding::new().with_precipitation(none::<Cm>()); let _snd = Sounding::new().with_precipitation(some(Mm(25.0))); let _snd = Sounding::new().with_precipitation(Mm(25.0)); let _snd = Sounding::new().with_precipitation(none::<Mm>());
pub fn precipitation(&self) -> Optioned<Mm>
[src]
Get the precipitation.
pub fn with_low_cloud<T>(self, value: T) -> Self where
Optioned<f64>: From<T>,
[src]
Optioned<f64>: From<T>,
Builder method for the low cloud amount in the range 0.0 to 1.0.
Examples
use sounding_analysis::Sounding; use optional::{some, none}; let _snd = Sounding::new().with_low_cloud(0.5); let _snd = Sounding::new().with_low_cloud(some(0.5)); let _snd = Sounding::new().with_low_cloud(none());
pub fn low_cloud(&self) -> Optioned<f64>
[src]
Get the low cloud
pub fn with_mid_cloud<T>(self, value: T) -> Self where
Optioned<f64>: From<T>,
[src]
Optioned<f64>: From<T>,
Builder method for the mid cloud amount in the range 0.0 to 1.0.
Examples
use sounding_analysis::Sounding; use optional::{some, none}; let _snd = Sounding::new().with_mid_cloud(0.5); let _snd = Sounding::new().with_mid_cloud(some(0.5)); let _snd = Sounding::new().with_mid_cloud(none());
pub fn mid_cloud(&self) -> Optioned<f64>
[src]
Get the mid cloud
pub fn with_high_cloud<T>(self, value: T) -> Self where
Optioned<f64>: From<T>,
[src]
Optioned<f64>: From<T>,
Builder method for the high cloud amount in the range 0.0 to 1.0.
Examples
use sounding_analysis::Sounding; use optional::{some, none}; let _snd = Sounding::new().with_high_cloud(0.5); let _snd = Sounding::new().with_high_cloud(some(0.5)); let _snd = Sounding::new().with_high_cloud(none());
pub fn high_cloud(&self) -> Optioned<f64>
[src]
Get the high cloud
pub fn with_lead_time<T>(self, lt: T) -> Self where
Optioned<i32>: From<T>,
[src]
Optioned<i32>: From<T>,
Difference in model initialization time and valid_time
in hours.
Examples
use sounding_analysis::Sounding; let _snd = Sounding::new().with_lead_time(24); let snd = Sounding::new().with_lead_time(Some(24)); assert_eq!(snd.lead_time().unwrap(), 24);
pub fn lead_time(&self) -> Optioned<i32>
[src]
Difference in model initialization time and valid_time
in hours.
pub fn valid_time(&self) -> Option<NaiveDateTime>
[src]
Valid time of the sounding.
pub fn with_valid_time<T>(self, valid_time: T) -> Self where
Option<NaiveDateTime>: From<T>,
[src]
Option<NaiveDateTime>: From<T>,
Builder method to set the valid time of the sounding.
Examples
use sounding_analysis::Sounding; use chrono::NaiveDate; let vtime = NaiveDate::from_ymd(2019, 1, 1).and_hms(12, 0, 0); let _snd = Sounding::new().with_valid_time(vtime); let _snd = Sounding::new().with_valid_time(Some(vtime));
pub fn bottom_up<'a>(&'a self) -> impl Iterator<Item = DataRow> + 'a
[src]
Get a bottom up iterator over the data rows. The first value returned from the iterator is surface values.
Examples
use metfor::{HectoPascal, Millibar, Celsius}; use optional::some; use sounding_analysis::Sounding; let pres: Vec<_> = vec![1000.0, 925.0, 850.0].into_iter() .map(HectoPascal).map(some).collect(); let temps: Vec<_> = vec![20.0, 18.0, 17.0].into_iter() .map(Celsius).map(some).collect(); let snd = Sounding::new() .with_pressure_profile(pres) .with_temperature_profile(temps) .with_station_pressure(Millibar(1014.0)); let mut iter = snd.bottom_up(); let mut row = iter.next().unwrap(); assert_eq!(row.pressure.unwrap(), HectoPascal(1014.0)); // Surface values first! assert!(row.temperature.is_none()); // We never set a surface temprature! assert!(row.wind.is_none()); // We never set wind profile. row = iter.next().unwrap(); assert_eq!(row.pressure.unwrap(), HectoPascal(1000.0)); assert_eq!(row.temperature.unwrap(), Celsius(20.0)); assert!(row.wind.is_none()); // We never set wind profile. row = iter.next().unwrap(); assert_eq!(row.pressure.unwrap(), HectoPascal(925.0)); assert_eq!(row.temperature.unwrap(), Celsius(18.0)); assert!(row.wind.is_none()); // We never set wind profile. row = iter.next().unwrap(); assert_eq!(row.pressure.unwrap(), HectoPascal(850.0)); assert_eq!(row.temperature.unwrap(), Celsius(17.0)); assert!(row.wind.is_none()); // We never set wind profile. let row_opt = iter.next(); assert!(row_opt.is_none());
pub fn top_down<'a>(&'a self) -> impl Iterator<Item = DataRow> + 'a
[src]
Get a top down iterator over the data rows. The last value returned is the surface values.
Examples
use metfor::{HectoPascal, Millibar, Celsius}; use optional::some; use sounding_analysis::Sounding; let pres: Vec<_> = vec![1000.0, 925.0, 850.0].into_iter() .map(HectoPascal).map(some).collect(); let temps: Vec<_> = vec![20.0, 18.0, 17.0].into_iter() .map(Celsius).map(some).collect(); let snd = Sounding::new() .with_pressure_profile(pres) .with_temperature_profile(temps) .with_station_pressure(Millibar(1014.0)); let mut iter = snd.top_down(); let mut row = iter.next().unwrap(); assert_eq!(row.pressure.unwrap(), HectoPascal(850.0)); assert_eq!(row.temperature.unwrap(), Celsius(17.0)); assert!(row.wind.is_none()); // We never set wind profile. row = iter.next().unwrap(); assert_eq!(row.pressure.unwrap(), HectoPascal(925.0)); assert_eq!(row.temperature.unwrap(), Celsius(18.0)); assert!(row.wind.is_none()); // We never set wind profile. row = iter.next().unwrap(); assert_eq!(row.pressure.unwrap(), HectoPascal(1000.0)); assert_eq!(row.temperature.unwrap(), Celsius(20.0)); assert!(row.wind.is_none()); // We never set wind profile. row = iter.next().unwrap(); assert_eq!(row.pressure.unwrap(), HectoPascal(1014.0)); // Surface values first! assert!(row.temperature.is_none()); // We never set a surface temprature! assert!(row.wind.is_none()); // We never set wind profile. let row_opt = iter.next(); assert!(row_opt.is_none());
pub fn data_row(&self, idx: usize) -> Option<DataRow>
[src]
Get a row of data values from this sounding.
Examples
use metfor::{HectoPascal, Millibar, Celsius}; use optional::some; use sounding_analysis::Sounding; let pres: Vec<_> = vec![1000.0, 925.0, 850.0].into_iter() .map(HectoPascal).map(some).collect(); let temps: Vec<_> = vec![20.0, 18.0, 17.0].into_iter() .map(Celsius).map(some).collect(); let snd = Sounding::new() .with_pressure_profile(pres) .with_temperature_profile(temps) .with_station_pressure(Millibar(1014.0)); let row = snd.data_row(0).unwrap(); // This is the surface assert_eq!(row.pressure.unwrap(), HectoPascal(1014.0)); assert!(row.temperature.is_none()); // We never set a surface temperature. let row = snd.data_row(1).unwrap(); // This is the lowest layer above the surface. assert_eq!(row.pressure.unwrap(), HectoPascal(1000.0)); assert_eq!(row.temperature.unwrap(), Celsius(20.0)); assert!(snd.data_row(4).is_none()); // There weren't that many rows!
pub fn surface_as_data_row(&self) -> Option<DataRow>
[src]
Get the surface values in a DataRow
format.
pub fn fetch_nearest_pnt<P>(&self, target_p: P) -> DataRow where
HectoPascal: From<P>,
P: Pressure,
[src]
HectoPascal: From<P>,
P: Pressure,
Given a target pressure, return the row of data values closest to this one.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Sounding
impl Send for Sounding
impl Sync for Sounding
impl Unpin for Sounding
impl UnwindSafe for Sounding
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,