Module: Evapotranspiration::Conversion

Defined in:
lib/evapotranspiration/conversion.rb

Class Method Summary collapse

Class Method Details

.celsius_to_kelvin(celsius) ⇒ Float

Convert temperature in degrees Celsius to degrees Kelvin

Parameters:

  • celsius (Float)

    Degrees Celsius

Returns:

  • (Float)

    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

Parameters:

  • degrees (Float)

    Value in degrees to be converted

Returns:

  • (Float)

    Value in 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

Parameters:

  • kelvin (Float)

    Degrees Kelvin

Returns:

  • (Float)

    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

Parameters:

  • kph (Float)

    Kilometers per hour

Returns:

  • (Float)

    Meters per second



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

Parameters:

  • radians (Float)

    Value in radians to be converted

Returns:

  • (Float)

    Value in 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