nws: refactored the NWS source files to relocate normalization logic to internal/normalizers.
This commit is contained in:
15
internal/normalizers/common/units.go
Normal file
15
internal/normalizers/common/units.go
Normal file
@@ -0,0 +1,15 @@
|
||||
// FILE: ./internal/normalizers/common/units.go
|
||||
package common
|
||||
|
||||
// Common unit conversions used across providers.
|
||||
//
|
||||
// These helpers are intentionally small and “obvious” and are meant to remove
|
||||
// duplication across normalizers (and eventually across sources, once refactored).
|
||||
|
||||
func TempCFromF(f float64) float64 { return (f - 32.0) * 5.0 / 9.0 }
|
||||
func TempCFromK(k float64) float64 { return k - 273.15 }
|
||||
|
||||
func SpeedKmhFromMps(ms float64) float64 { return ms * 3.6 }
|
||||
func SpeedKmhFromMph(mph float64) float64 { return mph * 1.609344 }
|
||||
|
||||
func PressurePaFromHPa(hpa float64) float64 { return hpa * 100.0 }
|
||||
Reference in New Issue
Block a user