Mercurial > dive4elements > river
changeset 2992:0abdede5a0b8
FixA: Added facet to return delta w/t as CSV
flys-artifacts/trunk@4543 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 28 May 2012 18:35:01 +0000 (2012-05-28) |
parents | fcb2166b8e0d |
children | 70469e3d34b9 |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixCalculation.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixationCompute.java |
diffstat | 3 files changed, 32 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Sun May 27 18:11:31 2012 +0000 +++ b/flys-artifacts/ChangeLog Mon May 28 18:35:01 2012 +0000 @@ -1,3 +1,11 @@ +2012-05-28 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/flys/artifacts/model/fixings/FixCalculation.java: + Units of step is in meter and not km. Added more debug output. + + * src/main/java/de/intevation/flys/artifacts/states/fixation/FixationCompute.java: + Stupidly forgot to add facet to return the delta w/t as CSV. + 2012-05-27 Sascha L. Teichmann <sascha.teichmann@intevation.de> * src/main/java/de/intevation/flys/artifacts/model/ReportFacet.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixCalculation.java Sun May 27 18:11:31 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixCalculation.java Mon May 28 18:35:01 2012 +0000 @@ -125,6 +125,8 @@ public CalculationResult calculate() { + boolean debug = log.isDebugEnabled(); + FixingsOverview overview = FixingsOverviewFactory.getOverview(river); @@ -173,7 +175,7 @@ return new CalculationResult(this); } - double [] kms = DoubleUtil.explode(from, to, step); + double [] kms = DoubleUtil.explode(from, to, step / 1000.0); double [] ws = new double[dataColumns.size()]; double [] qs = new double[ws.length]; @@ -185,6 +187,12 @@ boolean invalid = false; + if (debug) { + log.debug("number of kms: " + kms.length); + } + + int numFailed = 0; + for (int i = 0; i < kms.length; ++i) { double km = kms[i]; @@ -198,6 +206,7 @@ // TODO: Do preprocessing here! double [] parameters = fit(func, km, ws, qs); if (parameters == null) { // Problems are reported already. + ++numFailed; continue; } @@ -215,6 +224,11 @@ // TODO: Calculate statistics, too! } + if (debug) { + log.debug("success: " + (kms.length - numFailed)); + log.debug("failed: " + numFailed); + } + if (invalid) { // TODO: i18n addProblem("fix.invalid.values"); @@ -408,6 +422,7 @@ return cf.fit(function, function.getInitialGuess()); } catch (MathException me) { + log.warn(me, me); addProblem(km, "fix.fitting.failed"); }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixationCompute.java Sun May 27 18:11:31 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixationCompute.java Mon May 28 18:35:01 2012 +0000 @@ -8,6 +8,8 @@ import de.intevation.flys.artifacts.FixationArtifactAccess; import de.intevation.flys.artifacts.model.CalculationResult; +import de.intevation.flys.artifacts.model.DataFacet; +import de.intevation.flys.artifacts.model.FacetTypes; import de.intevation.flys.artifacts.model.ReportFacet; import de.intevation.flys.artifacts.model.fixings.FixCalculation; @@ -21,7 +23,10 @@ /** * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> */ -public class FixationCompute extends DefaultState { +public class FixationCompute +extends DefaultState +implements FacetTypes +{ /** The log used in this class. */ private static Logger log = Logger.getLogger(FixationCompute.class); @@ -65,6 +70,8 @@ if (res.getReport().hasProblems()) { facets.add(new ReportFacet(ComputeType.ADVANCE, hash, id)); } + facets.add( + new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, hash, id)); return res; }