[PATCH] Look for gauge if no pnp is set in the context and return w in cm if at gauge
Wald Commits
scm-commit at wald.intevation.org
Mon Sep 29 15:49:13 CEST 2014
# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1411998544 -7200
# Node ID d6e71158222a01c21141e43a7d346bb7652949c1
# Parent ac7cb15e194684b70f50f540ffabca057e9b3c33
Look for gauge if no pnp is set in the context and return w in cm if at gauge.
diff -r ac7cb15e1946 -r d6e71158222a artifacts/src/main/java/org/dive4elements/river/artifacts/MainValuesArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/MainValuesArtifact.java Fri Sep 26 18:23:45 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/MainValuesArtifact.java Mon Sep 29 15:49:04 2014 +0200
@@ -44,6 +44,7 @@
import org.dive4elements.river.artifacts.states.StaticState;
import org.dive4elements.river.artifacts.resources.Resources;
+import org.dive4elements.river.exports.injector.InjectorConstants;
/**
@@ -373,6 +374,9 @@
}
for (MainValue mv : orig) {
+ Gauge g = river.determineGaugeByStation(
+ kms[0] - InjectorConstants.GAUGE_EPSILON,
+ kms[0] + InjectorConstants.GAUGE_EPSILON);
if (pnpObject instanceof Number) {
if (mv.getMainValue().getType().getName().equals("W")) {
filteredList.add(new NamedDouble(
@@ -380,17 +384,29 @@
mv.getValue().doubleValue()/100 + pnp
));
}
- } else
- // We cannot interpolate the W values, so derive them
- // from given Q values.
- if (mv.getMainValue().getType().getName().equals("Q")) {
- interpolator.interpolate(mv.getValue().doubleValue(),
- gaugeStation, kms, w_out, q_out, c);
+ }
+ else if (!(pnpObject instanceof Number) &&
+ g != null
+ ) {
+ if (mv.getMainValue().getType().getName().equals("W")) {
+ filteredList.add(new NamedDouble(
+ mv.getMainValue().getName(),
+ mv.getValue().doubleValue()
+ ));
+ }
+ }
+ else {
+ // We cannot interpolate the W values, so derive them
+ // from given Q values.
+ if (mv.getMainValue().getType().getName().equals("Q")) {
+ interpolator.interpolate(mv.getValue().doubleValue(),
+ gaugeStation, kms, w_out, q_out, c);
- filteredList.add(new NamedDouble(
- "W(" + mv.getMainValue().getName() +")",
- w_out[0]
- ));
+ filteredList.add(new NamedDouble(
+ "W(" + mv.getMainValue().getName() +")",
+ w_out[0]
+ ));
+ }
}
}
}
More information about the Dive4Elements-commits
mailing list