[PATCH] A duration curve is always calculated for a single location

Wald Commits scm-commit at wald.intevation.org
Fri Jun 26 16:23:40 CEST 2015


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1435328612 -7200
# Node ID d4caab3fedde88b2b6224c5a8a29aa409d8754cd
# Parent  bd17bd07db69b93050acf0cb64fdd14674878158
A duration curve is always calculated for a single location.

   This implies that the gauge can be determined directly from that
   location using the default for limits between gauge ranges.

diff -r bd17bd07db69 -r d4caab3fedde artifacts/src/main/java/org/dive4elements/river/artifacts/WINFOArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/WINFOArtifact.java	Fri Jun 26 14:31:08 2015 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/WINFOArtifact.java	Fri Jun 26 16:23:32 2015 +0200
@@ -313,25 +313,23 @@
     public CalculationResult getDurationCurveData() {
         log.debug("WINFOArtifact.getDurationCurveData");
 
-        River r = RiverUtils.getRiver(this);
+        RangeAccess rangeAccess = new RangeAccess(this);
 
+        River r = rangeAccess.getRiver();
         if (r == null) {
             return error(null, "no.river.selected");
         }
 
-        Gauge g = RiverUtils.getGauge(this);
+        double[] locations = rangeAccess.getLocations();
+        if (locations == null) {
+            return error(null, "no.locations.selected");
+        }
 
+        Gauge g = r.determineGaugeByPosition(locations[0]);
         if (g == null) {
            return error(null, "no.gauge.selected");
         }
 
-        RangeAccess rangeAccess = new RangeAccess(this);
-        double[] locations = rangeAccess.getLocations();
-
-        if (locations == null) {
-            return error(null, "no.locations.selected");
-        }
-
         WstValueTable wst = WstValueTableFactory.getTable(r);
         if (wst == null) {
             return error(null, "no.wst.for.river");


More information about the Dive4Elements-commits mailing list