Documentation
¶
Index ¶
- Constants
- Variables
- func CurriedFloat64Compare(tolerance float64) func(float64, float64) int
- func CurriedFloat64Equal(tolerance float64) func(float64, float64) bool
- func Float64Compare(a, b, tolerance float64) int
- func Float64Equal(a, b, tolerance float64) bool
- func IntCompare(a, b int) int
- type HeatIndexWarning
- type Km
- type Meter
- type Mile
- type NauticalMile
- type PressureInHg
- type PressureMb
- type RelHumidity
- type SpeedKmH
- type SpeedKnots
- type SpeedMph
- type TempC
- func DewPointC(t TempC, rh RelHumidity) TempC
- func HeatIndexC(temp TempC, rh RelHumidity) TempC
- func HeatIndexCWithValidation(temp TempC, rh RelHumidity) (TempC, error)
- func WetBulbC(temp TempC, rh RelHumidity) (TempC, error)
- func WindChillC(temp TempC, windSpeed SpeedMph) TempC
- func WindChillCWithValidation(temp TempC, windSpeed SpeedMph) (TempC, error)
- type TempF
- func DewPointF(t TempF, rh RelHumidity) TempF
- func HeatIndexF(temp TempF, rh RelHumidity) TempF
- func HeatIndexFWithValidation(temp TempF, rh RelHumidity) (TempF, error)
- func WetBulbF(temp TempF, rh RelHumidity) (TempF, error)
- func WindChillF(t TempF, windSpeed SpeedMph) TempF
- func WindChillFWithValidation(t TempF, windSpeed SpeedMph) (TempF, error)
Constants ¶
const ( ToleranceExact = float64(0.0) Tolerance0 = float64(1.0) Tolerance1 = float64(0.1) Tolerance01 = float64(0.01) Tolerance001 = float64(0.001) Tolerace1 = Tolerance1 // deprecated; wasa a typo in a previous release )
const ( // HeatIndexWarningNone indicates the heat index does not warrant elevated caution. HeatIndexWarningNone = iota // HeatIndexWarningCaution indicates fatigue is possible with prolonged exposure and activity. Continuing activity could result in heat cramps. HeatIndexWarningCaution // HeatIndexWarningExtremeCaution indicates heat cramps and heat exhaustion are possible. Continuing activity could result in heat stroke. HeatIndexWarningExtremeCaution // HeatIndexWarningDanger indicates heat cramps and heat exhaustion are likely; heat stroke is probable with continued activity. HeatIndexWarningDanger // HeatIndexWarningExtremeDanger indicates heat stroke is imminent. HeatIndexWarningExtremeDanger )
Variables ¶
var ErrInputRange = errors.New("one or more input values are outside the calculation's supported range")
Functions ¶
func CurriedFloat64Compare ¶ added in v1.0.0
func CurriedFloat64Equal ¶ added in v1.0.0
func Float64Compare ¶ added in v1.0.0
func Float64Equal ¶ added in v1.0.0
func IntCompare ¶ added in v1.0.0
Types ¶
type HeatIndexWarning ¶ added in v1.1.0
type HeatIndexWarning int
func HeatIndexWarningC ¶ added in v1.1.0
func HeatIndexWarningC(heatIndex TempC) HeatIndexWarning
HeatIndexWarningC returns a heat index warning level for the given heat index temperature (in Celsius) per https://en.wikipedia.org/wiki/Heat_index#Table_of_values captured on 2024-07-17.
func HeatIndexWarningF ¶ added in v1.1.0
func HeatIndexWarningF(heatIndex TempF) HeatIndexWarning
HeatIndexWarningF returns a heat index warning level for the given heat index temperature (in Fahrenheit) per https://en.wikipedia.org/wiki/Heat_index#Table_of_values captured on 2024-07-17.
type Km ¶ added in v1.0.0
type Km float64
Km represents distance in kilometers.
func (Km) NauticalMiles ¶ added in v1.0.0
func (km Km) NauticalMiles() NauticalMile
NauticalMiles returns the distance in nautical miles.
type Meter ¶ added in v1.0.1
type Meter float64
Meter represents distance in meters.
func (Meter) NauticalMiles ¶ added in v1.0.1
func (m Meter) NauticalMiles() NauticalMile
NauticalMiles returns the distance in nautical miles.
type Mile ¶ added in v1.0.0
type Mile float64
Mile represents distance in miles.
func (Mile) NauticalMiles ¶ added in v1.0.0
func (mi Mile) NauticalMiles() NauticalMile
NauticalMiles returns the distance in nautical miles.
type NauticalMile ¶ added in v1.0.0
type NauticalMile float64
NauticalMile represents distance in nautical miles.
func (NauticalMile) Km ¶ added in v1.0.0
func (nm NauticalMile) Km() Km
Km returns the distance in kilometers.
func (NauticalMile) Meters ¶ added in v1.0.1
func (nm NauticalMile) Meters() Meter
Meters returns the distance in meters.
func (NauticalMile) Miles ¶ added in v1.0.0
func (nm NauticalMile) Miles() Mile
Miles returns the distance in miles.
func (NauticalMile) Unwrap ¶ added in v1.0.0
func (nm NauticalMile) Unwrap() float64
type PressureInHg ¶
type PressureInHg float64
PressureInHg represents barometric pressure in inches of mercury.
func (PressureInHg) Mb ¶ added in v1.0.0
func (p PressureInHg) Mb() PressureMb
Mb converts pressure in inches of mercury to millibars.
func (PressureInHg) Unwrap ¶ added in v1.0.0
func (p PressureInHg) Unwrap() float64
type PressureMb ¶
type PressureMb float64
PressureMb represents barometric pressure in millibars.
func (PressureMb) InHg ¶ added in v1.0.0
func (p PressureMb) InHg() PressureInHg
InHg converts pressure in millibars to inches of mercury.
func (PressureMb) Unwrap ¶ added in v1.0.0
func (p PressureMb) Unwrap() float64
type RelHumidity ¶
type RelHumidity int
RelHumidity represents a relative humidity percentage (0-100, inclusive).
func ClampedRelHumidity ¶ added in v1.0.0
func ClampedRelHumidity(rh int) RelHumidity
ClampedRelHumidity returns a RelHumidity from the given integer, guaranteed to be within the valid 0-100 (inclusive) range.
func IndoorHumidityRecommendationC ¶
func IndoorHumidityRecommendationC(outdoorT TempC) RelHumidity
IndoorHumidityRecommendationC returns the maximum recommended indoor relative humidity percentage for the given outdoor temperature (in degrees C).
func IndoorHumidityRecommendationF ¶
func IndoorHumidityRecommendationF(outdoorT TempF) RelHumidity
IndoorHumidityRecommendationF returns the maximum recommended indoor relative humidity percentage for the given outdoor temperature (in degrees F).
func (RelHumidity) Clamped ¶ added in v1.0.0
func (rh RelHumidity) Clamped() RelHumidity
Clamped returns a relative humidity guaranteed to be within the valid 0-100 (inclusive) range.
func (RelHumidity) Unwrap ¶ added in v1.0.0
func (rh RelHumidity) Unwrap() int
func (RelHumidity) UnwrapFloat64 ¶ added in v1.1.0
func (rh RelHumidity) UnwrapFloat64() float64
type SpeedKmH ¶ added in v1.0.0
type SpeedKmH float64
SpeedKmH represents speed in kilometers per hour.
func (SpeedKmH) Knots ¶ added in v1.0.0
func (s SpeedKmH) Knots() SpeedKnots
Knots returns the speed in knots.
type SpeedKnots ¶ added in v1.0.0
type SpeedKnots float64
SpeedKnots represents speed in knots.
func (SpeedKnots) KmH ¶ added in v1.0.0
func (s SpeedKnots) KmH() SpeedKmH
KmH returns the speed in kilometers per hour.
func (SpeedKnots) Mph ¶ added in v1.0.0
func (s SpeedKnots) Mph() SpeedMph
Mph returns the speed in miles per hour.
func (SpeedKnots) Unwrap ¶ added in v1.0.0
func (s SpeedKnots) Unwrap() float64
type SpeedMph ¶ added in v1.0.0
type SpeedMph float64
SpeedMph represents speed (e.g. wind speed) in miles per hour.
func (SpeedMph) Knots ¶ added in v1.0.0
func (s SpeedMph) Knots() SpeedKnots
Knots returns the speed in knots.
type TempC ¶
type TempC float64
TempC represents a temperature in degrees Celsius.
func DewPointC ¶
func DewPointC(t TempC, rh RelHumidity) TempC
DewPointC calculates the dew point given the current temperature (in Celsius) and relative humidity percentage (an integer 0-100, *not* a float 0.0-1.0).
func HeatIndexC ¶ added in v1.1.0
func HeatIndexC(temp TempC, rh RelHumidity) TempC
HeatIndexC is deprecated; use HeatIndexCWithValidation
func HeatIndexCWithValidation ¶ added in v1.2.0
func HeatIndexCWithValidation(temp TempC, rh RelHumidity) (TempC, error)
HeatIndexCWithValidation calculates the heat index for the given temperature (in Celsius) and relative humidity percentage.
func WetBulbC ¶ added in v1.1.0
func WetBulbC(temp TempC, rh RelHumidity) (TempC, error)
WetBulbC calculates the wet bulb temperature (in Celsius) given a dry bulb temperature (in Celsius) and relative humidity percentage. If the given temperature or relative humidity are outside the supported range, ErrInputRange is returned. See: https://journals.ametsoc.org/view/journals/apme/50/11/jamc-d-11-0143.1.xml
func WindChillC ¶
WindChillC calculates the wind chill for the given temperature (in Celsius) and wind speed (in miles/hour). If wind speed is less than 3 mph, or temperature is over 10 degrees C, the given temperature is returned - the formula works below 10 degrees C and above 3 mph.
func WindChillCWithValidation ¶ added in v1.1.0
WindChillCWithValidation calculates the wind chill for the given temperature (in Celsius) and wind speed (in miles/hour). If wind speed or temperature are outside the supported range, ErrInputRange is returned.
type TempF ¶
type TempF float64
TempF represents a temperature in degrees Fahrenheit.
func DewPointF ¶
func DewPointF(t TempF, rh RelHumidity) TempF
DewPointF calculates the dew point given the current temperature (in Fahrenheit) and relative humidity percentage (an integer 0-100, *not* a float 0.0-1.0).
func HeatIndexF ¶ added in v1.1.0
func HeatIndexF(temp TempF, rh RelHumidity) TempF
HeatIndexF is deprecated; use HeatIndexFWithValidation
func HeatIndexFWithValidation ¶ added in v1.2.0
func HeatIndexFWithValidation(temp TempF, rh RelHumidity) (TempF, error)
HeatIndexFWithValidation calculates the heat index for the given temperature (in Fahrenheit) and relative humidity percentage.
func WetBulbF ¶ added in v1.1.0
func WetBulbF(temp TempF, rh RelHumidity) (TempF, error)
WetBulbF calculates the wet bulb temperature (in Fahrenheit) given a dry bulb temperature (in Fahrenheit) and relative humidity percentage. If the given temperature or relative humidity are outside the supported range, ErrInputRange is returned. See: https://journals.ametsoc.org/view/journals/apme/50/11/jamc-d-11-0143.1.xml
func WindChillF ¶
WindChillF calculates the wind chill for the given temperature (in Fahrenheit) and wind speed (in miles/hour). If wind speed is less than 3 mph, or temperature is over 50 degrees F, the given temperature is returned - the formula works below 50 degrees F and above 3 mph.
func WindChillFWithValidation ¶ added in v1.1.0
WindChillFWithValidation calculates the wind chill for the given temperature (in Fahrenheit) and wind speed (in miles/hour). If wind speed or temperature are outside the supported range, ErrInputRange is returned.
