Mercurial > dive4elements > river
changeset 3145:be612065993e
FixA: Calculate the standard deviation of the Q sector delta Ws, too.
flys-artifacts/trunk@4753 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 22 Jun 2012 09:59:12 +0000 |
parents | 05a7298c4f20 |
children | 1edc17b0d79d |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/AnalysisPeriod.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixCalculation.java |
diffstat | 3 files changed, 44 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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 <sascha.teichmann@intevation.de> + + * 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 <sascha.teichmann@intevation.de> * src/main/java/de/intevation/flys/artifacts/model/GaugeRange.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) {
--- 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<QWD> allQWDs = new ArrayList<QWD>(); // for all Q sectors. @@ -384,6 +387,8 @@ double sumQ = 0.0; double sumW = 0.0; + StandardDeviation stdDev = new StandardDeviation(); + List<QWD> qwds = new ArrayList<QWD>(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); }