# HG changeset patch # User gernotbelger # Date 1518716440 -3600 # Node ID a66f2a7c4f84d3e390afee69d5c96ae4e1c4800e # Parent ffebc94cf67938ef2616e6bbdbc3b0071c0b17a2 SINFO FlowDepth - slight code cleanup diff -r ffebc94cf679 -r a66f2a7c4f84 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/BedHeightInfo.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/BedHeightInfo.java Thu Feb 15 13:47:19 2018 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde - * Software engineering by - * Björnsen Beratende Ingenieure GmbH - * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt - * - * This file is Free Software under the GNU AGPL (>=v3) - * and comes with ABSOLUTELY NO WARRANTY! Check out the - * documentation coming with Dive4Elements River for details. - */ -package org.dive4elements.river.artifacts.sinfo.flowdepth; - -import java.io.Serializable; - -import org.dive4elements.river.model.BedHeight; - -/** - * Basic infos about a {@link BedHeight}. - * - * @author Gernot Belger - */ -final class BedHeightInfo implements Serializable { - - private static final long serialVersionUID = 1L; - - private final Integer year; - - private final String description; - - private final String type; - - private final String evaluationBy; - - private final String locationSystem; - - private final String curElevationModelUnit; - - private final String oldElevationModelUnit; - - - public static BedHeightInfo from(final BedHeight bedHeight) { - return new BedHeightInfo(bedHeight); - } - - private BedHeightInfo(final BedHeight bedHeight) { - this.year = bedHeight.getYear(); - this.description = bedHeight.getDescription(); - this.type = bedHeight.getType().getName(); - this.evaluationBy = bedHeight.getEvaluationBy(); - this.locationSystem = bedHeight.getLocationSystem().getName(); - this.curElevationModelUnit = bedHeight.getCurElevationModel().getUnit().getName(); - this.oldElevationModelUnit = bedHeight.getCurElevationModel().getUnit().getName(); - } - - public Integer getYear() { - return this.year; - } - - public String getDescription() { - return this.description; - } - - public String getType() { - return this.type; - } - - public String getEvaluationBy() { - return this.evaluationBy; - } - - public String getLocationSystem() { - return this.locationSystem; - } - - public String getCurElevationModelUnit() { - return this.curElevationModelUnit; - } - - public String getOldElevationModelUnit() { - return this.oldElevationModelUnit; - } -} diff -r ffebc94cf679 -r a66f2a7c4f84 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculation.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculation.java Thu Feb 15 13:47:19 2018 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculation.java Thu Feb 15 18:40:40 2018 +0100 @@ -16,6 +16,7 @@ import java.util.Date; import java.util.List; +import org.apache.commons.lang.math.DoubleRange; import org.apache.commons.math.FunctionEvaluationException; import org.apache.commons.math.analysis.UnivariateRealFunction; import org.dive4elements.artifacts.ArtifactDatabase; @@ -31,6 +32,9 @@ import org.dive4elements.river.artifacts.resources.Resources; import org.dive4elements.river.artifacts.sinfo.SINFOArtifact; import org.dive4elements.river.artifacts.sinfo.flowdepth.FlowDepthAccess.DifferencesPair; +import org.dive4elements.river.artifacts.sinfo.util.BedHeightInfo; +import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; +import org.dive4elements.river.artifacts.sinfo.util.WstInfo; import org.dive4elements.river.artifacts.states.WaterlevelData; import org.dive4elements.river.artifacts.states.WaterlevelFetcher; import org.dive4elements.river.model.BedHeight; @@ -65,11 +69,13 @@ /* access input data */ final FlowDepthAccess access = new FlowDepthAccess(sinfo); final River river = access.getRiver(); + final RiverInfo riverInfo = new RiverInfo(river); final Collection diffPairs = access.getDifferencePairs(); final double from = access.getFrom(); final double to = access.getTo(); + final DoubleRange calcRange = new DoubleRange(from, to); final boolean useTkh = access.isUseTransportBodies(); @@ -81,10 +87,10 @@ final String calcModeLabel = Resources.getMsg(this.context.getMeta(), sinfo.getCalculationMode().name()); - final FlowDepthCalculationResults results = new FlowDepthCalculationResults(calcModeLabel, user, river, from, to, useTkh); + final FlowDepthCalculationResults results = new FlowDepthCalculationResults(calcModeLabel, user, riverInfo, calcRange, useTkh); for (final DifferencesPair diffPair : diffPairs) { - final FlowDepthCalculationResult result = calculateResult(river, from, to, diffPair, problems, gaugeIndex); + final FlowDepthCalculationResult result = calculateResult(river, calcRange, diffPair, problems, gaugeIndex); if (result != null) results.addResult(result); } @@ -92,14 +98,14 @@ return new CalculationResult(results, problems); } - private FlowDepthCalculationResult calculateResult(final River river, final double from, final double to, final DifferencesPair diffPair, + private FlowDepthCalculationResult calculateResult(final River river, final DoubleRange calcRange, final DifferencesPair diffPair, final Calculation problems, final GaugeIndex gaugeIndex) { /* access real input data from database */ final String soundingId = diffPair.getSoundingId(); final String wstId = diffPair.getWstId(); - final BedHeight bedHeight = loadBedHeight(soundingId, from, to); + final BedHeight bedHeight = loadBedHeight(soundingId); if (bedHeight == null) { final String message = Resources.format(this.context.getMeta(), "Failed to access sounding with id '{0}'", soundingId); problems.addProblem(message); @@ -120,7 +126,8 @@ final String label = String.format("%s - %s", wspLabel, soundingLabel); checkYearDifference(label, waterlevel, bedHeight, problems); - checkWaterlevelDiscretisation(wstKms, problems); + checkWaterlevelDiscretisation(wstKms, calcRange, problems); + // TODO: prüfen, ob sohlhöen die calcRange abdecken/überschneiden /* re-determine the reference gauge, in the same way as the WaterlevelArtifact would do it */ final String notinrange = Resources.getMsg(this.context.getMeta(), CSV_NOT_IN_GAUGE_RANGE, CSV_NOT_IN_GAUGE_RANGE); @@ -142,7 +149,7 @@ // TODO: keine Berechnung TKH } - final QualityMeasurements bedMeasurements = getBedMeasurements(river, from, to, sounding.getYear()); + final QualityMeasurements bedMeasurements = getBedMeasurements(river, calcRange, sounding.getYear()); // FIXME: prüfung ob (genug) werte vorhanden sind? was sind genau die kriterien? falls nein, problemhinzufügen und keine // berechnung tkh // FIXME: wie wird ggf. interpoliert? --> absprache? @@ -165,7 +172,7 @@ final List sortedValues = new ArrayList<>(values); Collections.sort(sortedValues, new BedHeightStationComparator()); - SoilKind lastKind = SoilKind.mobil; + SoilKind lastKind = SoilKind.starr; for (final BedHeightValue bedHeightValue : sortedValues) { @@ -180,6 +187,9 @@ final double km = station; final double meanBedHeight = meanBedHeightDbl; + if (!calcRange.containsDouble(km)) + continue; + try { // FIXME: check out of range final double wst = wstInterpolator.value(km); @@ -193,7 +203,7 @@ // FIXME: calculate tkh // REMARK: bissl spielerei zum testen damit die sohlart nicht zu schnell wechselt - final boolean changeKind = Math.random() > 0.95; + final boolean changeKind = false; // Math.random() > 0.95; SoilKind kind; if (changeKind) { switch (lastKind) { @@ -231,7 +241,6 @@ break; } - // REMARK: access the location once only during calculation final String location = LocationProvider.getLocation(river.getName(), km); @@ -258,7 +267,7 @@ * Sohlbeschaffenheit (D50 Korndurchmesser aus Seddb) * Abhängig von Peiljahr */ - private QualityMeasurements getBedMeasurements(final River river, final double from, final double to, final int soundingYear) { + private QualityMeasurements getBedMeasurements(final River river, final DoubleRange calcRange, final Integer soundingYear) { /* construct valid measurement time range */ final Calendar cal = Calendar.getInstance(); @@ -270,7 +279,7 @@ cal.set(soundingYear + VALID_BED_MEASUREMENT_YEARS, 11, 31); final Date endTime = cal.getTime(); - return QualityMeasurementFactory.getBedMeasurements(river.getName(), from, to, startTime, endTime); + return QualityMeasurementFactory.getBedMeasurements(river.getName(), calcRange.getMinimumDouble(), calcRange.getMaximumDouble(), startTime, endTime); } /** @@ -296,7 +305,8 @@ final int difference = Math.abs(soundingYear - wstYear); if (difference > maxDifference) { - final String message = Resources.getMsg(this.context.getMeta(), "sinfo_calc_flow_depth.warning.year_difference", null, label, difference); + final String message = Resources.getMsg(this.context.getMeta(), "sinfo_calc_flow_depth.warning.year_difference", null, label, wstYear, + soundingYear); problems.addProblem(message); } } @@ -332,23 +342,27 @@ } /* Checks if the discretisation of the waterlevel exceeds 1000m */ - // FIXME: vermutlich sollten wir diesen check auf den gültigkeitsbereich einschränken - private void checkWaterlevelDiscretisation(final WKms wstKms, final Calculation problems) { + + private void checkWaterlevelDiscretisation(final WKms wstKms, final DoubleRange calcRange, final Calculation problems) { + final int size = wstKms.size(); for (int i = 0; i < size - 2; i++) { final double kmPrev = wstKms.getKm(i); final double kmNext = wstKms.getKm(i + 1); - if (Math.abs(kmPrev - kmNext) > 1) { - final String label = wstKms.getName(); + /* only check if we are within the calculation range */ + if (calcRange.overlapsRange(new DoubleRange(kmPrev, kmNext))) { + if (Math.abs(kmPrev - kmNext) > 1) { + final String label = wstKms.getName(); - final String message = Resources.getMsg(this.context.getMeta(), "sinfo_calc_flow_depth.warning.waterlevel_discretisation", null, label); - problems.addProblem(kmPrev, message); + final String message = Resources.getMsg(this.context.getMeta(), "sinfo_calc_flow_depth.warning.waterlevel_discretisation", null, label); + problems.addProblem(kmPrev, message); + } } } } - private BedHeight loadBedHeight(final String soundingId, final double from, final double to) { + private BedHeight loadBedHeight(final String soundingId) { // REMARK: absolutely unbelievable.... // The way how bed-heights (and other data too) is accessed is different for nearly ever calculation-type diff -r ffebc94cf679 -r a66f2a7c4f84 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculationResult.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculationResult.java Thu Feb 15 13:47:19 2018 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculationResult.java Thu Feb 15 18:40:40 2018 +0100 @@ -15,6 +15,9 @@ import java.util.Collections; import java.util.List; +import org.dive4elements.river.artifacts.sinfo.util.BedHeightInfo; +import org.dive4elements.river.artifacts.sinfo.util.WstInfo; + import gnu.trove.TDoubleArrayList; /** diff -r ffebc94cf679 -r a66f2a7c4f84 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculationResults.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculationResults.java Thu Feb 15 13:47:19 2018 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculationResults.java Thu Feb 15 18:40:40 2018 +0100 @@ -14,7 +14,8 @@ import java.util.Collections; import java.util.List; -import org.dive4elements.river.model.River; +import org.apache.commons.lang.math.DoubleRange; +import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; /** * @author Gernot Belger @@ -24,25 +25,22 @@ private final List results = new ArrayList<>(); - private final River river; - - private final double from; - - private final double to; - - private final boolean useTkh; - private final String calcModeLabel; private final String user; - public FlowDepthCalculationResults(final String calcModeLabel, final String user, final River river, - final double from, final double to, final boolean useTkh) { + private final RiverInfo river; + + private final boolean useTkh; + + private final DoubleRange calcRange; + + public FlowDepthCalculationResults(final String calcModeLabel, final String user, final RiverInfo river, final DoubleRange calcRange, + final boolean useTkh) { this.calcModeLabel = calcModeLabel; this.user = user; this.river = river; - this.from = from; - this.to = to; + this.calcRange = calcRange; this.useTkh = useTkh; } @@ -54,16 +52,12 @@ return this.user; } - public River getRiver() { + public RiverInfo getRiver() { return this.river; } - public double getFrom() { - return this.from; - } - - public double getTo() { - return this.to; + public DoubleRange getCalcRange() { + return this.calcRange; } public boolean isUseTkh() { @@ -77,4 +71,4 @@ public List getResults() { return Collections.unmodifiableList(this.results); } -} +} \ No newline at end of file diff -r ffebc94cf679 -r a66f2a7c4f84 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthExporter.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthExporter.java Thu Feb 15 13:47:19 2018 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthExporter.java Thu Feb 15 18:40:40 2018 +0100 @@ -10,6 +10,7 @@ import java.io.OutputStream; import java.text.DateFormat; +import java.text.NumberFormat; import java.util.ArrayList; import java.util.Collection; import java.util.Date; @@ -18,16 +19,18 @@ import java.util.Map; import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.math.DoubleRange; import org.apache.log4j.Logger; import org.dive4elements.artifacts.CallMeta; import org.dive4elements.artifacts.common.utils.Config; import org.dive4elements.river.FLYS; import org.dive4elements.river.artifacts.model.CalculationResult; import org.dive4elements.river.artifacts.resources.Resources; +import org.dive4elements.river.artifacts.sinfo.util.BedHeightInfo; import org.dive4elements.river.artifacts.sinfo.util.MetaAndTableJRDataSource; +import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; +import org.dive4elements.river.artifacts.sinfo.util.WstInfo; import org.dive4elements.river.exports.AbstractExporter; -import org.dive4elements.river.model.River; -import org.dive4elements.river.model.Unit; import org.dive4elements.river.utils.RiverUtils; import au.com.bytecode.opencsv.CSVWriter; @@ -151,7 +154,7 @@ final FlowDepthCalculationResults results = this.data; final boolean useTkh = results.isUseTkh(); - final River river = results.getRiver(); + final RiverInfo river = results.getRiver(); /* write as csv */ writeCSVMeta(writer, results); @@ -204,7 +207,7 @@ log.info("FlowDepthExporter.writeCSVMeta"); final String calcModeLabel = results.getCalcModeLabel(); - final River river = results.getRiver(); + final RiverInfo river = results.getRiver(); writeCSVMetaEntry(writer, CSV_META_HEADER_RESULT, msg(CSV_META_HEADER_RESULT_LABEL), river.getName(), calcModeLabel); // "# FLYS-Version: " @@ -222,12 +225,12 @@ writeCSVMetaEntry(writer, CSV_META_RIVER, msg(CSV_META_RIVER_LABEL), river.getName()); // "# Höhensystem des Flusses: " - final Unit wstUnit = river.getWstUnit(); - writeCSVMetaEntry(writer, CSV_META_HEIGHT_UNIT_RIVER, wstUnit.getName()); + writeCSVMetaEntry(writer, CSV_META_HEIGHT_UNIT_RIVER, river.getWstUnit()); // "# Ort/Bereich (km): " - writeCSVMetaEntry(writer, CSV_META_RANGE, msg(CSV_META_RANGE_LABEL), getKmFormatter().format(results.getFrom()), - getKmFormatter().format(results.getTo())); + final DoubleRange calcRange = results.getCalcRange(); + writeCSVMetaEntry(writer, CSV_META_RANGE, msg(CSV_META_RANGE_LABEL), getKmFormatter().format(calcRange.getMinimumDouble()), + getKmFormatter().format(calcRange.getMaximumDouble())); writer.writeNext(new String[] { "" }); } @@ -246,7 +249,7 @@ * @param river * @param useTkh */ - private void writeCSVHeader(final CSVWriter writer, final River river, final boolean useTkh) { + private void writeCSVHeader(final CSVWriter writer, final RiverInfo river, final boolean useTkh) { log.info("FlowDepthExporter.writeCSVHeader"); final Collection header = new ArrayList<>(11); @@ -258,12 +261,11 @@ header.add(msgUnit(CSV_TKH_HEADER, UNIT_CM)); } - final String wstUnitName = river.getWstUnit().getName(); - header.add(msgUnit(CSV_WATERLEVEL_HEADER, wstUnitName)); + header.add(msgUnit(CSV_WATERLEVEL_HEADER, river.getWstUnit())); header.add(msgUnit(CSV_DISCHARGE_HEADER, UNIT_CUBIC_M)); header.add(msg(CSV_LABEL_HEADER)); header.add(msg(CSV_GAUGE_HEADER)); - header.add(msgUnit(CSV_MEAN_BED_HEIGHT_HEADER, wstUnitName)); + header.add(msgUnit(CSV_MEAN_BED_HEIGHT_HEADER, river.getWstUnit())); header.add(msg(CSV_SOUNDING_HEADER)); header.add(msg(CSV_LOCATION_HEADER)); @@ -376,8 +378,8 @@ private void addJRMetaData(final MetaAndTableJRDataSource source, final FlowDepthCalculationResults results) { - final River river = results.getRiver(); - final String wstUnitName = river.getWstUnit().getName(); + final RiverInfo river = results.getRiver(); + final String wstUnitName = river.getWstUnit(); /* general metadata */ source.addMetaData("header", msg(CSV_META_HEADER_RESULT_LABEL)); @@ -397,7 +399,9 @@ source.addMetaData("river_label", msg(CSV_META_RIVER_LABEL)); source.addMetaData("river", river.getName()); - final String rangeValue = String.format("%s - %s", getKmFormatter().format(results.getFrom()), getKmFormatter().format(results.getTo())); + final DoubleRange calcRange = results.getCalcRange(); + final NumberFormat kmFormatter = getKmFormatter(); + final String rangeValue = String.format("%s - %s", kmFormatter.format(calcRange.getMinimumDouble()), kmFormatter.format(calcRange.getMaximumDouble())); source.addMetaData("range_label", msg(CSV_META_RANGE_LABEL)); source.addMetaData("range", rangeValue); diff -r ffebc94cf679 -r a66f2a7c4f84 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/WstInfo.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/WstInfo.java Thu Feb 15 13:47:19 2018 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde - * Software engineering by - * Björnsen Beratende Ingenieure GmbH - * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt - * - * This file is Free Software under the GNU AGPL (>=v3) - * and comes with ABSOLUTELY NO WARRANTY! Check out the - * documentation coming with Dive4Elements River for details. - */ -package org.dive4elements.river.artifacts.sinfo.flowdepth; - -import java.io.Serializable; - -/** - * @author Gernot Belger - */ -final class WstInfo implements Serializable { - - private static final long serialVersionUID = 1L; - - private final String label; - - private final int year; - - private final String gauge; - - public WstInfo(final String label, final int year, final String gauge) { - this.label = label; - this.year = year; - this.gauge = gauge; - } - - public String getLabel() { - return this.label; - } - - public int getYear() { - return this.year; - } - - public String getGauge() { - return this.gauge; - } -} \ No newline at end of file diff -r ffebc94cf679 -r a66f2a7c4f84 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/util/BedHeightInfo.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/util/BedHeightInfo.java Thu Feb 15 18:40:40 2018 +0100 @@ -0,0 +1,81 @@ +/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde + * Software engineering by + * Björnsen Beratende Ingenieure GmbH + * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt + * + * This file is Free Software under the GNU AGPL (>=v3) + * and comes with ABSOLUTELY NO WARRANTY! Check out the + * documentation coming with Dive4Elements River for details. + */ +package org.dive4elements.river.artifacts.sinfo.util; + +import java.io.Serializable; + +import org.dive4elements.river.model.BedHeight; + +/** + * Basic infos about a {@link BedHeight}. + * + * @author Gernot Belger + */ +public final class BedHeightInfo implements Serializable { + + private static final long serialVersionUID = 1L; + + private final Integer year; + + private final String description; + + private final String type; + + private final String evaluationBy; + + private final String locationSystem; + + private final String curElevationModelUnit; + + private final String oldElevationModelUnit; + + + public static BedHeightInfo from(final BedHeight bedHeight) { + return new BedHeightInfo(bedHeight); + } + + private BedHeightInfo(final BedHeight bedHeight) { + this.year = bedHeight.getYear(); + this.description = bedHeight.getDescription(); + this.type = bedHeight.getType().getName(); + this.evaluationBy = bedHeight.getEvaluationBy(); + this.locationSystem = bedHeight.getLocationSystem().getName(); + this.curElevationModelUnit = bedHeight.getCurElevationModel().getUnit().getName(); + this.oldElevationModelUnit = bedHeight.getCurElevationModel().getUnit().getName(); + } + + public Integer getYear() { + return this.year; + } + + public String getDescription() { + return this.description; + } + + public String getType() { + return this.type; + } + + public String getEvaluationBy() { + return this.evaluationBy; + } + + public String getLocationSystem() { + return this.locationSystem; + } + + public String getCurElevationModelUnit() { + return this.curElevationModelUnit; + } + + public String getOldElevationModelUnit() { + return this.oldElevationModelUnit; + } +} diff -r ffebc94cf679 -r a66f2a7c4f84 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/util/RiverInfo.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/util/RiverInfo.java Thu Feb 15 18:40:40 2018 +0100 @@ -0,0 +1,41 @@ +/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde + * Software engineering by + * Björnsen Beratende Ingenieure GmbH + * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt + * + * This file is Free Software under the GNU AGPL (>=v3) + * and comes with ABSOLUTELY NO WARRANTY! Check out the + * documentation coming with Dive4Elements River for details. + */ +package org.dive4elements.river.artifacts.sinfo.util; + +import java.io.Serializable; + +import org.dive4elements.river.model.River; + +/** + * Contains similar data as {@link River}, but is used in instead to avoid keeping database objects. + * + * @author Gernot Belger + */ +public class RiverInfo implements Serializable { + + private static final long serialVersionUID = 1L; + + private final String name; + + private final String wstUnit; + + public RiverInfo(final River river) { + this.name = river.getName(); + this.wstUnit = river.getWstUnit().getName(); + } + + public String getName() { + return this.name; + } + + public String getWstUnit() { + return this.wstUnit; + } +} \ No newline at end of file diff -r ffebc94cf679 -r a66f2a7c4f84 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/util/WstInfo.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/util/WstInfo.java Thu Feb 15 18:40:40 2018 +0100 @@ -0,0 +1,44 @@ +/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde + * Software engineering by + * Björnsen Beratende Ingenieure GmbH + * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt + * + * This file is Free Software under the GNU AGPL (>=v3) + * and comes with ABSOLUTELY NO WARRANTY! Check out the + * documentation coming with Dive4Elements River for details. + */ +package org.dive4elements.river.artifacts.sinfo.util; + +import java.io.Serializable; + +/** + * @author Gernot Belger + */ +public final class WstInfo implements Serializable { + + private static final long serialVersionUID = 1L; + + private final String label; + + private final int year; + + private final String gauge; + + public WstInfo(final String label, final int year, final String gauge) { + this.label = label; + this.year = year; + this.gauge = gauge; + } + + public String getLabel() { + return this.label; + } + + public int getYear() { + return this.year; + } + + public String getGauge() { + return this.gauge; + } +} \ No newline at end of file diff -r ffebc94cf679 -r a66f2a7c4f84 artifacts/src/main/resources/messages.properties --- a/artifacts/src/main/resources/messages.properties Thu Feb 15 13:47:19 2018 +0100 +++ b/artifacts/src/main/resources/messages.properties Thu Feb 15 18:40:40 2018 +0100 @@ -772,7 +772,7 @@ sinfo_calc_flow_depth=Flie\u00dftiefen sinfo_calc_flow_depth.warning.missingQ = {0}: keine Abflussdaten vorhanden, Transportk\u00f6rperh\u00f6henberechnung nicht m\u00f6glich sinfo_calc_flow_depth.warning.waterlevel_discretisation = Wasserspiegel {0}: r\u00e4umliche Aufl\u00f6sung betr\u00e4gt mehr als 1000m -sinfo_calc_flow_depth.warning.year_difference = {0}: Zeitliche Abweichung betr\u00e4gt {1} Jahre. Dies kann zu unplausiblen Ergebnissen f\u00fchren +sinfo_calc_flow_depth.warning.year_difference = {0}: Sie verwenden als Differenzenpaar eine Wasserspiegellage aus dem Jahr {1} und eine Peilung aus dem Jahr {2}. Dies kann zu unplausiblen Werten f\u00fchren. sinfo_calc_flow_depth_development=Flie\u00dftiefenentwicklung sinfo_calc_flow_depth_minmax=Minimale und Maximale Flie\u00dftiefe diff -r ffebc94cf679 -r a66f2a7c4f84 artifacts/src/main/resources/messages_de.properties --- a/artifacts/src/main/resources/messages_de.properties Thu Feb 15 13:47:19 2018 +0100 +++ b/artifacts/src/main/resources/messages_de.properties Thu Feb 15 18:40:40 2018 +0100 @@ -778,7 +778,7 @@ sinfo_calc_flow_depth=Flie\u00dftiefen sinfo_calc_flow_depth.warning.missingQ = {0}: keine Abflussdaten vorhanden, Transportk\u00f6rperh\u00f6henberechnung nicht m\u00f6glich sinfo_calc_flow_depth.warning.waterlevel_discretisation = Wasserspiegel {0}: r\u00e4umliche Aufl\u00f6sung betr\u00e4gt mehr als 1000m -sinfo_calc_flow_depth.warning.year_difference = {0}: Zeitliche Abweichung betr\u00e4gt {1} Jahre. Dies kann zu unplausiblen Ergebnissen f\u00fchren +sinfo_calc_flow_depth.warning.year_difference = {0}: Sie verwenden als Differenzenpaar eine Wasserspiegellage aus dem Jahr {1} und eine Peilung aus dem Jahr {2}. Dies kann zu unplausiblen Werten f\u00fchren. sinfo_calc_flow_depth_development=Flie\u00dftiefenentwicklung sinfo_calc_flow_depth_minmax=Minimale und Maximale Flie\u00dftiefe diff -r ffebc94cf679 -r a66f2a7c4f84 artifacts/src/main/resources/messages_de_DE.properties --- a/artifacts/src/main/resources/messages_de_DE.properties Thu Feb 15 13:47:19 2018 +0100 +++ b/artifacts/src/main/resources/messages_de_DE.properties Thu Feb 15 18:40:40 2018 +0100 @@ -774,7 +774,9 @@ sinfo_calc_flow_depth=Flie\u00dftiefen sinfo_calc_flow_depth.warning.missingQ = {0}: keine Abflussdaten vorhanden, Transportk\u00f6rperh\u00f6henberechnung nicht m\u00f6glich sinfo_calc_flow_depth.warning.waterlevel_discretisation = Wasserspiegel {0}: r\u00e4umliche Aufl\u00f6sung betr\u00e4gt mehr als 1000m -sinfo_calc_flow_depth.warning.year_difference = {0}: Zeitliche Abweichung betr\u00e4gt {1} Jahre. Dies kann zu unplausiblen Ergebnissen f\u00fchren +sinfo_calc_flow_depth.warning.year_difference = {0}: Sie verwenden als Differenzenpaar eine Wasserspiegellage aus dem Jahr {1} und eine Peilung aus dem Jahr {2}. Dies kann zu unplausiblen Werten f\u00fchren. + +Zeitliche Abweichung betr\u00e4gt {1} Jahre. Dies kann zu unplausiblen Ergebnissen f\u00fchren sinfo_calc_flow_depth_development=Flie\u00dftiefenentwicklung sinfo_calc_flow_depth_minmax=Minimale und Maximale Flie\u00dftiefe diff -r ffebc94cf679 -r a66f2a7c4f84 artifacts/src/main/resources/messages_en.properties --- a/artifacts/src/main/resources/messages_en.properties Thu Feb 15 13:47:19 2018 +0100 +++ b/artifacts/src/main/resources/messages_en.properties Thu Feb 15 18:40:40 2018 +0100 @@ -773,7 +773,7 @@ sinfo_calc_flow_depth=Flie\u00dftiefen sinfo_calc_flow_depth.warning.missingQ = {0}: keine Abflussdaten vorhanden, Transportk\u00f6rperh\u00f6henberechnung nicht m\u00f6glich sinfo_calc_flow_depth.warning.waterlevel_discretisation = Wasserspiegel {0}: r\u00e4umliche Aufl\u00f6sung betr\u00e4gt mehr als 1000m -sinfo_calc_flow_depth.warning.year_difference = {0}: Zeitliche Abweichung betr\u00e4gt {1} Jahre. Dies kann zu unplausiblen Ergebnissen f\u00fchren +sinfo_calc_flow_depth.warning.year_difference = {0}: Sie verwenden als Differenzenpaar eine Wasserspiegellage aus dem Jahr {1} und eine Peilung aus dem Jahr {2}. Dies kann zu unplausiblen Werten f\u00fchren. sinfo_calc_flow_depth_development=Flie\u00dftiefenentwicklung sinfo_calc_flow_depth_minmax=Minimale und Maximale Flie\u00dftiefe