# HG changeset patch # User Felix Wolfsteller # Date 1343056108 0 # Node ID f903f1e5aed60a9e469a6985fdab063cc36a4060 # Parent ee2ae91c96e51b8068b8f3eb8404ef540daaaa03 Preparing W/Q per gauge input for FixationArtifact. flys-artifacts/trunk@5107 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r ee2ae91c96e5 -r f903f1e5aed6 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Mon Jul 23 14:58:04 2012 +0000 +++ b/flys-artifacts/ChangeLog Mon Jul 23 15:08:28 2012 +0000 @@ -1,3 +1,18 @@ +2012-07-23 Felix Wolfsteller + + Towards per-Gauge-input of W/Q values for FixationArtifact. + + * src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java, + src/main/java/de/intevation/flys/utils/FLYSUtils.java: + (getGauges): Refactored, moved from WINFOArtifact to FLYSUtils. + + * src/main/java/de/intevation/flys/utils/FLYSUtils.java: + Handle unlucky differences in names of data for + WINFOArtifact/FixationArtifact. + + * doc/conf/artifacts/fixanalysis.xml: + (Re-)use WQAdapted State for fix.analysis. + 2012-07-23 Felix Wolfsteller * doc/conf/artifacts/winfo.xml, diff -r ee2ae91c96e5 -r f903f1e5aed6 flys-artifacts/doc/conf/artifacts/fixanalysis.xml --- a/flys-artifacts/doc/conf/artifacts/fixanalysis.xml Mon Jul 23 14:58:04 2012 +0000 +++ b/flys-artifacts/doc/conf/artifacts/fixanalysis.xml Mon Jul 23 15:08:28 2012 +0000 @@ -210,8 +210,9 @@ - + state="de.intevation.flys.artifacts.states.WQAdapted"> + + diff -r ee2ae91c96e5 -r f903f1e5aed6 flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java Mon Jul 23 14:58:04 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java Mon Jul 23 15:08:28 2012 +0000 @@ -530,7 +530,7 @@ logger.warn("no wq_values given"); return Collections.emptyList(); } - String input = (String)wqValues.getValue(); + String input = (String) wqValues.getValue(); if (input == null || (input = input.trim()).length() == 0) { logger.warn("wq_values are empty"); return Collections.emptyList(); @@ -888,25 +888,6 @@ } - /** - * Returns the gauges that match the selected kilometer range. - * - * @return the gauges based on the selected kilometer range. - */ - public List getGauges() { - - River river = FLYSUtils.getRiver(this); - if (river == null) { - return null; - } - - double [] dist = FLYSUtils.getKmRange(this); - if (dist == null) { - return null; - } - - return river.determineGauges(dist[0], dist[1]); - } /** diff -r ee2ae91c96e5 -r f903f1e5aed6 flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java --- a/flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java Mon Jul 23 14:58:04 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/FLYSUtils.java Mon Jul 23 15:08:28 2012 +0000 @@ -179,7 +179,7 @@ } String values = flys.getDataAsString("wq_values"); - Boolean isQ = flys.getDataAsBoolean("wq_isq"); + Boolean isQ = flys.getDataAsBoolean("wq_isq"); if (values != null) { return isQ ? WQ_MODE.QGAUGE : WQ_MODE.WGAUGE; @@ -296,6 +296,14 @@ String strFrom = flys.getDataAsString("ld_from"); String strTo = flys.getDataAsString("ld_to"); + if (strFrom == null) { + strFrom = flys.getDataAsString("from"); + } + + if (strTo == null) { + strTo = flys.getDataAsString("to"); + } + if (strFrom == null || strTo == null) { return null; } @@ -891,5 +899,32 @@ return doubles.toNativeArray(); } + + + /** + * Returns the gauges that match the selected kilometer range. + * + * @param flys the flys artifact. + * + * @return the gauges based on the selected kilometer range (null if + * none/no range set). + */ + public static List getGauges(FLYSArtifact flys) { + + River river = getRiver(flys); + if (river == null) { + logger.debug("getGauges: no river!"); + return null; + } + + double [] dist = getKmRange(flys); + if (dist == null) { + logger.debug("getGauges: no dist!"); + return null; + } + logger.debug("getGauges: " + dist[0] + " - " + dist[1]); + + return river.determineGauges(dist[0], dist[1]); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :