Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixCalculation.java @ 3022:705d2058b682
FixA: Store the referenced QW for each km, too.
flys-artifacts/trunk@4589 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 05 Jun 2012 14:56:57 +0000 |
parents | ce796f1db30e |
children | fa5d5b48028a |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixCalculation.java Tue Jun 05 13:56:55 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixCalculation.java Tue Jun 05 14:56:57 2012 +0000 @@ -169,30 +169,27 @@ final double [] qs = new double[eventColumns.size()]; final double [] ws = new double[qs.length]; - // Depending on preprocessing we need to find the outliers. - Fitting.QWFactory qwFactory = !preprocessing - ? null // No outliers - : new Fitting.QWFactory() { - @Override - public QW create(double q, double w) { - // Check all the event columns for close match - // and take the description and the date from meta. - for (int i = 0; i < qs.length; ++i) { - if (Math.abs(qs[i]-q) < EPSILON - && Math.abs(ws[i]-w) < EPSILON) { - Column column = eventColumns.get(i); - return new QW( - q, w, - column.getDescription(), - column.getDate()); - } + Fitting.QWFactory qwFactory = new Fitting.QWFactory() { + @Override + public QW create(double q, double w) { + // Check all the event columns for close match + // and take the description and the date from meta. + for (int i = 0; i < qs.length; ++i) { + if (Math.abs(qs[i]-q) < EPSILON + && Math.abs(ws[i]-w) < EPSILON) { + Column column = eventColumns.get(i); + return new QW( + q, w, + column.getDescription(), + column.getDate()); } - log.warn("cannot find column for (" + q + ", " + w + ")"); - return new QW(q, w); } - }; + log.warn("cannot find column for (" + q + ", " + w + ")"); + return new QW(q, w); + } + }; - Fitting fitting = new Fitting(func, qwFactory); + Fitting fitting = new Fitting(func, qwFactory, preprocessing); String [] parameterNames = func.getParameterNames(); @@ -205,7 +202,8 @@ log.debug("number of kms: " + kms.length); } - KMIndex<QW []> outliers = new KMIndex<QW []>(); + KMIndex<QW []> outliers = new KMIndex<QW []>(); + KMIndex<QW []> referenced = new KMIndex<QW []>(kms.length); int kmIndex = results.columnIndex("km"); int chiSqrIndex = results.columnIndex("chi_sqr"); @@ -232,6 +230,8 @@ continue; } + referenced.add(km, fitting.referencedToArray()); + if (fitting.hasOutliers()) { outliers.add(km, fitting.outliersToArray()); } @@ -259,9 +259,13 @@ calculateAnalysisPeriods(func, results, overview); outliers.sort(); + referenced.sort(); analysisPeriods.sort(); - FixResult fr = new FixResult(results, analysisPeriods, outliers); + FixResult fr = new FixResult( + results, + referenced, outliers, + analysisPeriods); return new CalculationResult(fr, this); }