[−][src]Struct sounding_base::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.
Methods
impl Sounding
[src]
impl Sounding
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_base::Sounding; let snd = Sounding::new(); println!("{:?}", snd);
pub fn set_station_info(self, new_value: StationInfo) -> Self | [src] |
Use with_station_info
instead.
Set the station info.
pub fn with_station_info(self, new_value: StationInfo) -> Self | [src] |
Builder function for setting the station info.
Examples
use sounding_base::{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_base::StationInfo; let snd = make_test_sounding(); let stn: StationInfo = snd.station_info(); println!("{:?}", stn);
pub fn set_pressure_profile(self, profile: Vec<Optioned<HectoPascal>>) -> Self | [src] |
Use with_pressure_profile
instead.
Set the pressure profile.
pub fn with_pressure_profile(self, profile: Vec<Optioned<HectoPascal>>) -> Self | [src] |
Builder method for the pressure profile.
Examples
use sounding_base::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_base::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 set_temperature_profile(self, profile: Vec<Optioned<Celsius>>) -> Self | [src] |
Use with_temperature_profile
instead.
Set the temperature profile.
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 set_dew_point_profile(self, profile: Vec<Optioned<Celsius>>) -> Self | [src] |
Use with_dew_point_profile
instead.
Set the dew point profile.
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 set_wet_bulb_profile(self, profile: Vec<Optioned<Celsius>>) -> Self | [src] |
Use with_wet_bulb_profile
instead.
Set the wet bulb profile.
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 set_theta_e_profile(self, profile: Vec<Optioned<Kelvin>>) -> Self | [src] |
Use with_wet_bulb_profile
instead.
Set the theta e profile.
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( | [src] |
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 set_pvv_profile(self, profile: Vec<Optioned<PaPS>>) -> Self | [src] |
Use with_pvv_profile
instead.
Set the pressure vertical velocity profile.
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 set_height_profile(self, profile: Vec<Optioned<Meters>>) -> Self | [src] |
Use with_height_profile
instead.
Set the geopotential height profile.
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 set_cloud_fraction_profile(self, profile: Vec<Optioned<f64>>) -> Self | [src] |
Use with_cloud_fraction_profile
instead.
Set the cloud cover profile.
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 set_mslp<T, U>(self, value: T) -> Self where | [src] |
Use with_mslp
instead.
Set the mean sea level pressure.
pub fn with_mslp<T, U>(self, value: T) -> Self where | [src] |
Builder method for the mean sea level pressure.
Examples
use metfor::{HectoPascal, Millibar}; use sounding_base::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 set_station_pressure<T, U>(self, value: T) -> Self where | [src] |
Use with_station_pressure
instead.
Set the station pressure.
pub fn with_station_pressure<T, U>(self, value: T) -> Self where | [src] |
Biulder method for the station pressure.
Examples
use metfor::{HectoPascal, Millibar}; use sounding_base::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 set_sfc_temperature<T, U>(self, value: T) -> Self where | [src] |
Use with_sfc_temperature
instead.
Set the surface temperature.
pub fn with_sfc_temperature<T, U>(self, value: T) -> Self where | [src] |
Builder method the surface temperature.
Examples
use metfor::{Fahrenheit, Celsius, Kelvin}; use sounding_base::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 set_sfc_dew_point<T, U>(self, value: T) -> Self where | [src] |
Use with_sfc_dew_point
instead.
Set the surface dew point.
pub fn with_sfc_dew_point<T, U>(self, value: T) -> Self where | [src] |
Set the surface dew point.
Examples
use metfor::{Fahrenheit, Celsius, Kelvin}; use sounding_base::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 | [src] |
Set the surface wind.
Examples
use sounding_base::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 set_precipitation<T, U>(self, value: T) -> Self where | [src] |
Use with_precipitation
instead.
Set the precipitation.
pub fn with_precipitation<T, U>(self, value: T) -> Self where | [src] |
Builder method for the precipitation.
Examples
use sounding_base::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 set_low_cloud<T>(self, value: T) -> Self where | [src] |
Use with_low_cloud
instead.
Set the low cloud amount in the range 0.0 to 1.0.
pub fn with_low_cloud<T>(self, value: T) -> Self where | [src] |
Builder method for the low cloud amount in the range 0.0 to 1.0.
Examples
use sounding_base::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 set_mid_cloud<T>(self, value: T) -> Self where | [src] |
Use with_mid_cloud
instead.
Set the mid cloud amount in the range 0.0 to 1.0.
pub fn with_mid_cloud<T>(self, value: T) -> Self where | [src] |
Builder method for the mid cloud amount in the range 0.0 to 1.0.
Examples
use sounding_base::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 set_high_cloud<T>(self, value: T) -> Self where | [src] |
Use with_high_cloud
instead.
Set the high cloud amount in the range 0.0 to 1.0.
pub fn with_high_cloud<T>(self, value: T) -> Self where | [src] |
Builder method for the high cloud amount in the range 0.0 to 1.0.
Examples
use sounding_base::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 set_lead_time<T>(self, lt: T) -> Self where | [src] |
Use with_lead_time
instead.
Difference in model initialization time and valid_time
in hours.
pub fn with_lead_time<T>(self, lt: T) -> Self where | [src] |
Difference in model initialization time and valid_time
in hours.
Examples
use sounding_base::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 get_lead_time(&self) -> Optioned<i32> | [src] |
Use lead_time()
instead.
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 get_valid_time(&self) -> Option<NaiveDateTime> | [src] |
Use valid_time()
instead.
Valid time of the sounding.
pub fn set_valid_time<T>(self, valid_time: T) -> Self where | [src] |
Use with_valid_time
instead.
Builder method to set the valid time of the sounding.
pub fn with_valid_time<T>(self, valid_time: T) -> Self where | [src] |
Builder method to set the valid time of the sounding.
Examples
use sounding_base::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>( | [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_base::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>( | [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_base::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 get_data_row(&self, idx: usize) -> Option<DataRow> | [src] |
Use data_row
instead.
Get a row of data values from this sounding.
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_base::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 | [src] |
Given a target pressure, return the row of data values closest to this one.
Trait Implementations
impl Default for Sounding
[src]
impl Default for Sounding
impl Clone for Sounding
[src]
impl Clone for Sounding
fn clone(&self) -> Sounding | [src] |
fn clone_from(&mut self, source: &Self) | 1.0.0 [src] |
Performs copy-assignment from source
. Read more
impl Debug for Sounding
[src]
impl Debug for Sounding
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)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> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T | [src] |
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error> | [src] |
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId | [src] |