pub struct Location {
pub latitude: f64,
pub longitude: f64,
pub tz: Tz,
pub altitude: f64,
pub name: String,
}Expand description
Represents a physical location on Earth.
pvlib-python equivalently uses Location class with attributes:
latitude, longitude, tz, altitude, and name.
Fields§
§latitude: f64§longitude: f64§tz: Tz§altitude: f64§name: StringImplementations§
Source§impl Location
impl Location
Sourcepub fn new(
latitude: f64,
longitude: f64,
tz: Tz,
altitude: f64,
name: &str,
) -> Self
pub fn new( latitude: f64, longitude: f64, tz: Tz, altitude: f64, name: &str, ) -> Self
Create a new Location instance.
Inputs are not validated — pass garbage latitude or longitude and
you will get garbage solar-position output. Use Location::try_new
at trust boundaries (weather API input, user-supplied config) for a
validated constructor.
§Arguments
latitude- Latitude in decimal degrees. Positive north of equator, negative to south.longitude- Longitude in decimal degrees. Positive east of prime meridian, negative to west.tz- Timezone as achrono_tz::Tzenum variant.altitude- Altitude from sea level in meters.name- Name of the location.
Sourcepub fn try_new(
latitude: f64,
longitude: f64,
tz: Tz,
altitude: f64,
name: &str,
) -> Result<Self, LocationError>
pub fn try_new( latitude: f64, longitude: f64, tz: Tz, altitude: f64, name: &str, ) -> Result<Self, LocationError>
Create a new Location with validated coordinates.
Returns Err(LocationError) if latitude is outside [-90, 90],
longitude is outside [-180, 180], or altitude is non-finite.
Sourcepub fn get_solarposition(
&self,
time: DateTime<Tz>,
) -> Result<SolarPosition, SpaError>
pub fn get_solarposition( &self, time: DateTime<Tz>, ) -> Result<SolarPosition, SpaError>
Calculate the solar position for this location at the given time.
Convenience wrapper around solarposition::get_solarposition.
Sourcepub fn get_clearsky(
&self,
time: DateTime<Tz>,
model: &str,
) -> ClearSkyIrradiance
pub fn get_clearsky( &self, time: DateTime<Tz>, model: &str, ) -> ClearSkyIrradiance
Sourcepub fn get_airmass(&self, time: DateTime<Tz>) -> (f64, f64)
pub fn get_airmass(&self, time: DateTime<Tz>) -> (f64, f64)
Calculate relative and absolute airmass for this location at the given time.
Uses Kasten-Young model for relative airmass and site pressure derived from altitude for absolute airmass.
§Returns
(airmass_relative, airmass_absolute). Values may be NaN if the sun is
below the horizon.
Trait Implementations§
impl StructuralPartialEq for Location
Auto Trait Implementations§
impl Freeze for Location
impl RefUnwindSafe for Location
impl Send for Location
impl Sync for Location
impl Unpin for Location
impl UnsafeUnpin for Location
impl UnwindSafe for Location
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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