changeset 5214:ebcf33d79d2e new-fwa

Use breaks to classfify.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 11 May 2020 19:12:13 +0200
parents de417840dfee
children ea60b76d8abd
files pkg/controllers/fwa.go
diffstat 1 files changed, 19 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/controllers/fwa.go	Mon May 11 16:42:36 2020 +0200
+++ b/pkg/controllers/fwa.go	Mon May 11 19:12:13 2020 +0200
@@ -252,11 +252,16 @@
 
 	// separate breaks for depth and width
 	var (
-		breaks      = parseBreaks(req.FormValue("breaks"), afdRefs)
-		depthBreaks = parseBreaks(req.FormValue("depthbreaks"), breaks)
-		widthBreaks = parseBreaks(req.FormValue("widthbreaks"), breaks)
-		useDepth    = bottlenecks.hasLimiting(limitingDepth, from, to)
-		useWidth    = bottlenecks.hasLimiting(limitingWidth, from, to)
+		breaks       = parseBreaks(req.FormValue("breaks"), afdRefs)
+		depthBreaks  = parseBreaks(req.FormValue("depthbreaks"), breaks)
+		widthBreaks  = parseBreaks(req.FormValue("widthbreaks"), breaks)
+		chooseBreaks = [...][]float64{
+			limitingDepth: depthBreaks,
+			limitingWidth: widthBreaks,
+		}
+
+		useDepth = bottlenecks.hasLimiting(limitingDepth, from, to)
+		useWidth = bottlenecks.hasLimiting(limitingWidth, from, to)
 	)
 
 	if useDepth && useWidth && len(widthBreaks) != len(depthBreaks) {
@@ -269,11 +274,6 @@
 		return
 	}
 
-	// TODO: use these.
-	_ = breaks
-	_ = depthBreaks
-	_ = widthBreaks
-
 	// For every day on every bottleneck we need to find out if this day is valid.
 	validities := make([]func(time.Time, time.Time) *limitingValidity, len(bottlenecks))
 	for i := range bottlenecks {
@@ -313,6 +313,15 @@
 				if result[1] < 12*time.Hour {
 					shipable = false
 				}
+
+				classes := bottlenecks[i].measurements.classify(
+					current, next,
+					chooseBreaks[vs.limiting],
+					limitingAccess[vs.limiting])
+
+				// TODO: Compare with others.
+				_ = classes
+
 			}
 		}