Mercurial > dive4elements > river
changeset 8664:b9e5fa7f7a28
(issue1787) Do not accept any non-NaN W-value but check for epsilon.
author | "Tom Gottfried <tom@intevation.de>" |
---|---|
date | Tue, 07 Apr 2015 16:35:11 +0200 |
parents | b78ca00d4659 |
children | 8fbc0649da13 |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/model/WstValueTable.java |
diffstat | 1 files changed, 7 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/WstValueTable.java Tue Apr 07 12:10:45 2015 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/WstValueTable.java Tue Apr 07 16:35:11 2015 +0200 @@ -45,6 +45,8 @@ public static final int RELATE_WS_SAMPLES = 200; + public static final double W_EPSILON = 0.000001; + /** * A Column in the table, typically representing one measurement session. */ @@ -416,7 +418,7 @@ TDoubleArrayList qs = new TDoubleArrayList(); - if (ws.length > 0 && Math.abs(ws[0]-w) < 0.000001) { + if (ws.length > 0 && Math.abs(ws[0]-w) < W_EPSILON) { double q = table.getQIndex(0, km); if (!Double.isNaN(q)) { qs.add(q); @@ -428,7 +430,7 @@ if (Double.isNaN(w2)) { continue; } - if (Math.abs(w2-w) < 0.000001) { + if (Math.abs(w2-w) < W_EPSILON) { double q = table.getQIndex(i, km); if (!Double.isNaN(q)) { qs.add(q); @@ -469,7 +471,7 @@ if (ws.length > 0) { double wt = Linear.weight(factor, ws[0], other.ws[0]); - if (!Double.isNaN(wt)) { + if (Math.abs(wt-w) < W_EPSILON) { double q = table.getQIndex(0, km); if (!Double.isNaN(q)) { qs.add(q); @@ -482,13 +484,14 @@ if (Double.isNaN(w2)) { continue; } - if (Math.abs(w2-w) < 0.000001) { + if (Math.abs(w2-w) < W_EPSILON) { double q = table.getQIndex(i, km); if (!Double.isNaN(q)) { qs.add(q); } continue; } + double w1 = Linear.weight(factor, ws[i-1], other.ws[i-1]); if (Double.isNaN(w1)) { continue;