Module: Evapotranspiration::Conversion
- Defined in:
- lib/evapotranspiration/conversion.rb
Class Method Summary collapse
-
.celsius_to_kelvin(celsius) ⇒ Float
Convert temperature in degrees Celsius to degrees Kelvin.
-
.deg_to_rad(degrees) ⇒ Float
Convert angular degrees to radians.
-
.kelvin_to_celsius(kelvin) ⇒ Float
Convert temperature in degrees Kelvin to degrees Celsius.
-
.kph_to_mps(kph) ⇒ Float
Convert km/hr to m/s.
-
.rad_to_deg(radians) ⇒ Float
Convert radians to angular degrees.
Class Method Details
.celsius_to_kelvin(celsius) ⇒ Float
Convert temperature in degrees Celsius to degrees Kelvin
8 9 10 |
# File 'lib/evapotranspiration/conversion.rb', line 8 def self.celsius_to_kelvin(celsius) celsius.to_f + 273.15 end |
.deg_to_rad(degrees) ⇒ Float
Convert angular degrees to radians
24 25 26 |
# File 'lib/evapotranspiration/conversion.rb', line 24 def self.deg_to_rad(degrees) degrees.to_f * (Math::PI / 180.0) end |
.kelvin_to_celsius(kelvin) ⇒ Float
Convert temperature in degrees Kelvin to degrees Celsius
16 17 18 |
# File 'lib/evapotranspiration/conversion.rb', line 16 def self.kelvin_to_celsius(kelvin) kelvin.to_f - 273.15 end |
.kph_to_mps(kph) ⇒ Float
Convert km/hr to m/s
40 41 42 |
# File 'lib/evapotranspiration/conversion.rb', line 40 def self.kph_to_mps(kph) (kph.to_f * 1000) / 3600 end |
.rad_to_deg(radians) ⇒ Float
Convert radians to angular degrees
32 33 34 |
# File 'lib/evapotranspiration/conversion.rb', line 32 def self.rad_to_deg(radians) radians.to_f * (180.0 / Math::PI) end |