Add forecast daypart derivation

This commit is contained in:
2026-05-29 17:12:20 +00:00
parent a885959d39
commit d494550b20
10 changed files with 935 additions and 29 deletions

View File

@@ -0,0 +1,20 @@
package forecast
func DifferenceAtLeast(previous float64, current float64, threshold float64) bool {
return abs(current-previous) >= threshold
}
func CrossesAtOrAbove(previous float64, current float64, threshold float64) bool {
return previous < threshold && current >= threshold
}
func CrossesBelow(previous float64, current float64, threshold float64) bool {
return previous >= threshold && current < threshold
}
func abs(value float64) float64 {
if value < 0 {
return -value
}
return value
}