StationInfo

Struct StationInfo 

Source
pub struct StationInfo { /* private fields */ }
Expand description

Station information including location data and identification number.

Implementations§

Source§

impl StationInfo

Source

pub fn new_with_values<S, T, U, V, W>( station_num: T, station_id: S, location: U, elevation: V, ) -> Self
where S: Into<Option<String>>, T: Into<Optioned<i32>>, U: Into<Option<(f64, f64)>>, Optioned<W>: From<V>, W: Noned + Length, Meters: From<W>,

Create a new StationInfo object.

§Arguments

station_num: The USAF station identifier, or None.

location: The latitude and longitude as a tuple, or None.

elevation: The elevation of the station in meters.

§Examples
use metfor::{Meters, Feet};
use sounding_analysis::StationInfo;
use optional::{some, none};

let _stn = StationInfo::new_with_values(12345, None, (45.2,-113.5), Meters(2000.0));
let _stn = StationInfo::new_with_values(12345, None, (45.2,-113.5), Feet(2000.0));
let _stn = StationInfo::new_with_values(12345, None, (45.2,-113.5), some(Meters(2000.0)));
let _stn = StationInfo::new_with_values(12345, None, (45.2,-113.5), some(Feet(2000.0)));
let _stn = StationInfo::new_with_values(12345, None, Some((45.2,-113.5)), Meters(2000.0));
let _stn = StationInfo::new_with_values(12345, None, Some((45.2,-113.5)), Feet(2000.0));
let _stn = StationInfo::new_with_values(12345, None, Some((45.2,-113.5)), some(Meters(2000.0)));
let _stn = StationInfo::new_with_values(12345, None, Some((45.2,-113.5)), some(Feet(2000.0)));
let _stn = StationInfo::new_with_values(Some(12345), None, None, Meters(2000.0));
let _stn = StationInfo::new_with_values(Some(12345), None, None, Feet(2000.0));
let _stn = StationInfo::new_with_values(None, None, (45.2,-113.5), some(Meters(2000.0)));
let _stn = StationInfo::new_with_values(None, None, (45.2,-113.5), some(Feet(2000.0)));

// Note that lat-lon is an `Option` and not an `Optioned`
let _stn = StationInfo::new_with_values(some(12345), None, None, none::<Feet>());
let _stn = StationInfo::new_with_values(some(12345), None, None, none::<Meters>());
Source

pub fn new() -> Self

Create a new object with default values.

§Examples
use sounding_analysis::StationInfo;

assert!(StationInfo::new().station_num().is_none());
assert!(StationInfo::new().location().is_none());
assert!(StationInfo::new().elevation().is_none());
Source

pub fn with_station<T>(self, number: T) -> Self
where Optioned<i32>: From<T>,

Builder method to add a station number.

§Examples
use sounding_analysis::StationInfo;

assert_eq!(StationInfo::new().with_station(12345).station_num().unwrap(), 12345);
assert_eq!(StationInfo::new().with_station(Some(12345)).station_num().unwrap(), 12345);
Source

pub fn with_lat_lon<T>(self, coords: T) -> Self
where Option<(f64, f64)>: From<T>,

Builder method to add a location.

§Examples
use sounding_analysis::StationInfo;

assert_eq!(
    StationInfo::new().with_lat_lon((45.0, -116.0)).location().unwrap(), (45.0, -116.0));
assert_eq!(
    StationInfo::new().with_lat_lon(Some((45.0, -116.0)))
        .location()
        .unwrap(),
    (45.0, -116.0));
Source

pub fn with_elevation<T, U>(self, elev: T) -> Self
where Optioned<U>: From<T>, U: Noned + Length, Meters: From<U>,

Builder method to add elevation.

§Examples
 use metfor::{Meters, Feet, Km};
 use sounding_analysis::StationInfo;
 use optional::{some, none};

 let _info = StationInfo::new().with_elevation(Feet(200.0));
 let _info = StationInfo::new().with_elevation(Meters(200.0));
 let _info = StationInfo::new().with_elevation(Km(2.0));
 let _info = StationInfo::new().with_elevation(some(Feet(200.0)));
 let _info = StationInfo::new().with_elevation(some(Meters(200.0)));
 let _info = StationInfo::new().with_elevation(some(Km(2.0)));
 let _info = StationInfo::new().with_elevation(none::<Feet>());
 let _info = StationInfo::new().with_elevation(none::<Meters>());
 let _info = StationInfo::new().with_elevation(none::<Km>());
Source

pub fn with_station_id<T>(self, station_id: T) -> Self
where Option<String>: From<T>,

Builder method to add a station ID. These are usually 3 or 4 alphanumeric codes that may not be unique to the location like the station number is supposed to be.

Source

pub fn station_num(&self) -> Optioned<i32>

station number, USAF number, eg 727730

Source

pub fn location(&self) -> Option<(f64, f64)>

Latitude and longitude.

Source

pub fn elevation(&self) -> Optioned<Meters>

Elevation in meters, this may be in model terrain, not necessarily the same as the real world.

Source

pub fn station_id(&self) -> Option<&str>

Get the station ID that was used with this station. This is normally a series of 3 or 4 letters. It is not unique to the location like the station number is supposed to be.

§Examples
use sounding_analysis::StationInfo;

let info = StationInfo::new().with_station_id("KXLY".to_owned());
assert_eq!(Some("KXLY"), info.station_id());

Trait Implementations§

Source§

impl Clone for StationInfo

Source§

fn clone(&self) -> StationInfo

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StationInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StationInfo

Source§

fn default() -> StationInfo

Returns the “default value” for a type. Read more
Source§

impl PartialEq for StationInfo

Source§

fn eq(&self, other: &StationInfo) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for StationInfo

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.