# HG changeset patch # User Sascha L. Teichmann # Date 1340359152 0 # Node ID be612065993e9032f0e6eb63813862a378416efa # Parent 05a7298c4f2099ca32fe6f5f76be2cd959900476 FixA: Calculate the standard deviation of the Q sector delta Ws, too. flys-artifacts/trunk@4753 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 05a7298c4f20 -r be612065993e flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Thu Jun 21 17:01:17 2012 +0000 +++ b/flys-artifacts/ChangeLog Fri Jun 22 09:59:12 2012 +0000 @@ -1,3 +1,12 @@ +2012-06-22 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/artifacts/model/fixings/FixCalculation.java: + Calculate the standard deviation of the Q sector delta Ws, too. + + * src/main/java/de/intevation/flys/artifacts/model/fixings/AnalysisPeriod.java: + Store the standard deviation of the Q sector delta Ws, too. + Indexed 0..3; NaN means the std dev for this sector is not existing. + 2012-06-21 Sascha L. Teichmann * src/main/java/de/intevation/flys/artifacts/model/GaugeRange.java: diff -r 05a7298c4f20 -r be612065993e flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/AnalysisPeriod.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/AnalysisPeriod.java Thu Jun 21 17:01:17 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/AnalysisPeriod.java Fri Jun 22 09:59:12 2012 +0000 @@ -8,6 +8,7 @@ protected DateRange dateRange; protected QWD [] qwds; protected QWD [] qSectorAverages; + protected double [] qSectorStdDevs; public AnalysisPeriod() { } @@ -19,16 +20,18 @@ public AnalysisPeriod(DateRange dateRange, QWD [] qwds) { this(dateRange); this.dateRange = dateRange; - this.qwds = qwds; + this.qwds = qwds; } public AnalysisPeriod( DateRange dateRange, QWD [] qwds, - QWD [] qSectorAverages + QWD [] qSectorAverages, + double [] qSectorStdDevs ) { this(dateRange, qwds); this.qSectorAverages = qSectorAverages; + this.qSectorStdDevs = qSectorStdDevs; } public DateRange getDateRange() { @@ -59,6 +62,18 @@ return qSectorAverages[i]; } + public double [] getQSectorStdDevs() { + return qSectorStdDevs; + } + + public void setQSectorStdDevs(double [] qSectorStdDevs) { + this.qSectorStdDevs = qSectorStdDevs; + } + + public double getQSectorStdDev(int i) { + return qSectorStdDevs[i]; + } + public double getMaxQ() { double maxQ = -Double.MAX_VALUE; if (qwds != null) { diff -r 05a7298c4f20 -r be612065993e flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixCalculation.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixCalculation.java Thu Jun 21 17:01:17 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixCalculation.java Fri Jun 22 09:59:12 2012 +0000 @@ -15,8 +15,6 @@ import de.intevation.flys.artifacts.model.FixingsOverview.Fixing.Filter; -import de.intevation.flys.artifacts.model.Range; - import de.intevation.flys.artifacts.model.FixingsOverview.Fixing; import de.intevation.flys.artifacts.model.FixingsOverview.IdsFilter; import de.intevation.flys.artifacts.model.FixingsOverview.KmFilter; @@ -26,6 +24,7 @@ import de.intevation.flys.artifacts.model.FixingsOverview; import de.intevation.flys.artifacts.model.FixingsOverviewFactory; import de.intevation.flys.artifacts.model.Parameters; +import de.intevation.flys.artifacts.model.Range; import de.intevation.flys.utils.DateAverager; import de.intevation.flys.utils.DoubleUtil; @@ -37,6 +36,8 @@ import java.util.List; import java.util.Map; +import org.apache.commons.math.stat.descriptive.moment.StandardDeviation; + import org.apache.log4j.Logger; public class FixCalculation @@ -362,7 +363,9 @@ analysisPeriod.getFrom(), analysisPeriod.getTo()); - QWD [] qSectorAverages = new QWD[4]; + QWD [] qSectorAverages = new QWD[4]; + double [] qSectorStdDevs = new double[4]; + ArrayList allQWDs = new ArrayList(); // for all Q sectors. @@ -384,6 +387,8 @@ double sumQ = 0.0; double sumW = 0.0; + StandardDeviation stdDev = new StandardDeviation(); + List qwds = new ArrayList(metas.size()); dateAverager.clear(); @@ -406,6 +411,8 @@ double dw = (wq[0] - fw)*100.0; + stdDev.increment(dw); + Date date = column.getDate(); String description = column.getDescription(); @@ -439,13 +446,20 @@ qSectorAverages[qSector] = avgQWD; } + qSectorStdDevs[qSector] = stdDev.getResult(); + } + else { + qSectorStdDevs[qSector] = Double.NaN; } } // for all Q sectors QWD [] aqwds = allQWDs.toArray(new QWD[allQWDs.size()]); AnalysisPeriod periodResult = new AnalysisPeriod( - analysisPeriod, aqwds, qSectorAverages); + analysisPeriod, + aqwds, + qSectorAverages, + qSectorStdDevs); periodResults.add(periodResult); }