Class: Astronoby::Observer
- Inherits:
-
Object
- Object
- Astronoby::Observer
- Defined in:
- lib/astronoby/observer.rb
Constant Summary collapse
- DEFAULT_ELEVATION =
0
- DEFAULT_TEMPERATURE =
BigDecimal("283.15")
- PRESSURE_AT_SEA_LEVEL =
BigDecimal("1013.25")
- PASCAL_PER_MILLIBAR =
BigDecimal("0.01")
- EARTH_GRAVITATIONAL_ACCELERATION =
BigDecimal("9.80665")
- MOLAR_MASS_OF_AIR =
BigDecimal("0.0289644")
- UNIVERSAL_GAS_CONSTANT =
BigDecimal("8.31432")
Instance Attribute Summary collapse
-
#elevation ⇒ Object
readonly
Returns the value of attribute elevation.
-
#latitude ⇒ Object
readonly
Returns the value of attribute latitude.
-
#longitude ⇒ Object
readonly
Returns the value of attribute longitude.
-
#temperature ⇒ Object
readonly
Returns the value of attribute temperature.
Instance Method Summary collapse
-
#initialize(latitude:, longitude:, elevation: DEFAULT_ELEVATION, temperature: DEFAULT_TEMPERATURE, pressure: nil) ⇒ Observer
constructor
A new instance of Observer.
-
#pressure ⇒ BigDecimal
Compute an estimation of the atmospheric pressure based on the elevation and temperature.
Constructor Details
#initialize(latitude:, longitude:, elevation: DEFAULT_ELEVATION, temperature: DEFAULT_TEMPERATURE, pressure: nil) ⇒ Observer
Returns a new instance of Observer.
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/astronoby/observer.rb', line 23 def initialize( latitude:, longitude:, elevation: DEFAULT_ELEVATION, temperature: DEFAULT_TEMPERATURE, pressure: nil ) @latitude = latitude @longitude = longitude @elevation = elevation @temperature = temperature @pressure = pressure end |
Instance Attribute Details
#elevation ⇒ Object (readonly)
Returns the value of attribute elevation.
13 14 15 |
# File 'lib/astronoby/observer.rb', line 13 def elevation @elevation end |
#latitude ⇒ Object (readonly)
Returns the value of attribute latitude.
13 14 15 |
# File 'lib/astronoby/observer.rb', line 13 def latitude @latitude end |
#longitude ⇒ Object (readonly)
Returns the value of attribute longitude.
13 14 15 |
# File 'lib/astronoby/observer.rb', line 13 def longitude @longitude end |
#temperature ⇒ Object (readonly)
Returns the value of attribute temperature.
13 14 15 |
# File 'lib/astronoby/observer.rb', line 13 def temperature @temperature end |
Instance Method Details
#pressure ⇒ BigDecimal
Compute an estimation of the atmospheric pressure based on the elevation and temperature
41 42 43 |
# File 'lib/astronoby/observer.rb', line 41 def pressure @pressure ||= PRESSURE_AT_SEA_LEVEL * pressure_ratio end |