# HG changeset patch # User Andre Heinecke # Date 1427982528 -7200 # Node ID 4054c7fce43ea93eee5c6b8bc448eca6cce5e27b # Parent 3a9ce890e4c7ae0e6d8c2b2c72042775d682f365 (issue1755) Add problem / report handling to BedQualityCalculation diff -r 3a9ce890e4c7 -r 4054c7fce43e artifacts/doc/conf/artifacts/minfo.xml --- a/artifacts/doc/conf/artifacts/minfo.xml Thu Apr 02 14:10:25 2015 +0200 +++ b/artifacts/doc/conf/artifacts/minfo.xml Thu Apr 02 15:48:48 2015 +0200 @@ -496,6 +496,11 @@ + + + + + diff -r 3a9ce890e4c7 -r 4054c7fce43e artifacts/doc/conf/generators/generators.xml --- a/artifacts/doc/conf/generators/generators.xml Thu Apr 02 14:10:25 2015 +0200 +++ b/artifacts/doc/conf/generators/generators.xml Thu Apr 02 15:48:48 2015 +0200 @@ -52,6 +52,7 @@ + diff -r 3a9ce890e4c7 -r 4054c7fce43e artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedQualityCalculation.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedQualityCalculation.java Thu Apr 02 14:10:25 2015 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedQualityCalculation.java Thu Apr 02 15:48:48 2015 +0200 @@ -88,6 +88,31 @@ return new CalculationResult(); } + /** Adds non empty values to a result and adds Problems for empty ones.*/ + protected void addValuesToResult(BedQualityResult result, + BedQualityResultValue[] values) { + for (BedQualityResultValue value: values) { + if (value.isEmpty()) { + if (value.isDiameterResult()) { + log.debug("Adding diameter problem"); + addProblem("bedquality.missing.diameter." + + value.getType(), value.getName().toUpperCase(), + result.getDateRange().getFrom(), + result.getDateRange().getTo()); + } else { + log.debug("Adding diameter problem"); + addProblem("bedquality.missing." + value.getName() + "." + + value.getType(), result.getDateRange().getFrom(), + result.getDateRange().getTo()); + } + } else { + log.debug("Adding unproblematic result"); + result.add(value); + } + } + } + + protected CalculationResult internalCalculate() { List results = new LinkedList(); @@ -111,14 +136,14 @@ result.setDateRange(dr); if (!bedDiameter.isEmpty()) { log.debug("Bed diameter is not empty + " + bedDiameter); - result.add(calculateBedParameter(bedMeasurements)); + addValuesToResult(result, calculateBedParameter(bedMeasurements)); for (String bd : bedDiameter) { - result.add (calculateBed(bedMeasurements, bd)); + addValuesToResult(result, calculateBed(bedMeasurements, bd)); } } if (!bedloadDiameter.isEmpty()) { for (String bld : bedloadDiameter) { - result.add(calculateBedload(loadMeasurements, bld)); + addValuesToResult(result, calculateBedload(loadMeasurements, bld)); } } results.add(result); @@ -240,7 +265,7 @@ return results; } - protected BedQualityResultValue calculateBedload( + protected BedQualityResultValue[] calculateBedload( QualityMeasurements qm, String diameter ) { @@ -253,9 +278,10 @@ location.add(km); avDiameter.add(mid * 1000); } - return new BedQualityResultValue(diameter, + return new BedQualityResultValue[] { + new BedQualityResultValue(diameter, new double[][] {location.toNativeArray(), avDiameter.toNativeArray()}, - "bedload"); + "bedload")}; } protected double calculateAverage( diff -r 3a9ce890e4c7 -r 4054c7fce43e artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/BedQualityState.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/BedQualityState.java Thu Apr 02 14:10:25 2015 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/BedQualityState.java Thu Apr 02 15:48:48 2015 +0200 @@ -22,9 +22,11 @@ import org.dive4elements.river.artifacts.D4EArtifact; import org.dive4elements.river.artifacts.access.BedQualityAccess; import org.dive4elements.river.artifacts.model.CalculationResult; +import org.dive4elements.river.artifacts.model.Calculation; import org.dive4elements.river.artifacts.model.DataFacet; import org.dive4elements.river.artifacts.model.DateRange; import org.dive4elements.river.artifacts.model.FacetTypes; +import org.dive4elements.river.artifacts.model.ReportFacet; import org.dive4elements.river.artifacts.model.minfo.BedQualityDataFacet; import org.dive4elements.river.artifacts.model.minfo.BedQualityInterpolFacet; import org.dive4elements.river.artifacts.model.minfo.BedDiameterDataFacet; @@ -105,6 +107,13 @@ return res; } + Calculation report = res.getReport(); + + if (report != null && report.hasProblems()) { + facets.add(new ReportFacet(ComputeType.ADVANCE, hash, id)); + log.debug("Problems : " + report.problemsToString()); + } + BedQualityResult[] results = (BedQualityResult[]) res.getData(); if (results == null || results.length == 0) { diff -r 3a9ce890e4c7 -r 4054c7fce43e artifacts/src/main/resources/messages.properties --- a/artifacts/src/main/resources/messages.properties Thu Apr 02 14:10:25 2015 +0200 +++ b/artifacts/src/main/resources/messages.properties Thu Apr 02 15:48:48 2015 +0200 @@ -331,6 +331,13 @@ facet.bedquality.interpol.suffix = - interpolated bedquality.toplayer = 0.0m - 0.3m bedquality.sublayer = 0.1m - 0.5m +bedquality.missing.diameter.bedload = No bedload data found in {1,date} - {2,date} for diameter {0} for this range +bedquality.missing.diameter.sublayer = No sediment data found in {1,date} - {2,date} for diameter {0} 0.0m - 0.3m for this range +bedquality.missing.diameter.toplayer = No sediment data found in {1,date} - {2,date} for diameter {0} 0.1m - 0.5m for this range +bedquality.missing.density.toplayer = Not enough data in {0,date} - {1,date} for density 0.0m - 0.3m calculation for this range +bedquality.missing.density.sublayer = Not enough data in {0,date} - {1,date} for density 0.1m - 0.5m calculation for this range +bedquality.missing.porosity.toplayer = Not enough data in {0,date} - {1,date} for porosity 0.0m - 0.3m calculation for this range +bedquality.missing.porosity.sublayer = Not enough data in {0,date} - {1,date} for porosity 0.1m - 0.5m calculation for this range facet.bedheight.diff.year = Bedheight Difference {0} facet.bedheight.sounding_width = Sounding Width ({0}) facet.bedheight.diff.sounding = sounding Width diff -r 3a9ce890e4c7 -r 4054c7fce43e artifacts/src/main/resources/messages_de.properties --- a/artifacts/src/main/resources/messages_de.properties Thu Apr 02 14:10:25 2015 +0200 +++ b/artifacts/src/main/resources/messages_de.properties Thu Apr 02 15:48:48 2015 +0200 @@ -332,6 +332,13 @@ facet.bedquality.interpol.suffix = - interpoliert bedquality.toplayer = 0,0m - 0,3m bedquality.sublayer = 0,1m - 0,5m +bedquality.missing.diameter.bedload = F\u00fcr Geschiebedurchmesser {0} liegen auf der Berechnungsstrecke f\u00fcr {1,date} - {2,date} nicht genug Daten vor +bedquality.missing.diameter.sublayer = F\u00fcr Sohldurchmesser {0} 0,0m - 0,3m liegen auf der Berechnungsstrecke f\u00fcr {1,date} - {2,date} nicht genug Daten vor +bedquality.missing.diameter.toplayer = F\u00fcr Sohldurchmesser {0} 0,1m - 0,5m liegen auf der Berechnungsstrecke f\u00fcr {1,date} - {2,date} nicht genug Daten vor +bedquality.missing.density.toplayer = Zur Berechnung der Dichte 0.0m - 0.3m liegen auf der Berechnungsstrecke f\u00fcr {0,date} - {1,date} nicht genug daten vor +bedquality.missing.density.sublayer = Zur Berechnung der Dichte 0.1m - 0.5m liegen auf der Berechnungsstrecke f\u00fcr {0,date} - {1,date} nicht genug daten vor +bedquality.missing.porosity.toplayer = Zur Berechnung der Porosit\u00e4t 0.0m - 0.3m liegen auf der Berechnungsstrecke f\u00fcr {0,date} - {1,date} nicht genug Daten vor +bedquality.missing.porosity.sublayer = Zur Berechnung der Porosit\u00e4t 0.1m - 0.5m liegen auf der Berechnungsstrecke f\u00fcr {0,date} - {1,date} nicht genug Daten vor facet.bedheight.diff.year = Sohlh\u00f6hendifferenz {0} facet.bedheight.sounding_width = gepeilte Breite ({0}) facet.bedheight.diff.morph1 = Morph. aktive Breite Minuend diff -r 3a9ce890e4c7 -r 4054c7fce43e artifacts/src/main/resources/messages_de_DE.properties --- a/artifacts/src/main/resources/messages_de_DE.properties Thu Apr 02 14:10:25 2015 +0200 +++ b/artifacts/src/main/resources/messages_de_DE.properties Thu Apr 02 15:48:48 2015 +0200 @@ -329,6 +329,13 @@ facet.bedquality.interpol.suffix = - interpoliert bedquality.toplayer = 0,0m - 0,3m bedquality.sublayer = 0,1m - 0,5m +bedquality.missing.diameter.bedload = F\u00fcr Geschiebedurchmesser {0} liegen auf der Berechnungsstrecke f\u00fcr {1,date} - {2,date} nicht genug Daten vor +bedquality.missing.diameter.sublayer = F\u00fcr Sohldurchmesser {0} 0,0m - 0,3m liegen auf der Berechnungsstrecke f\u00fcr {1,date} - {2,date} nicht genug Daten vor +bedquality.missing.diameter.toplayer = F\u00fcr Sohldurchmesser {0} 0,1m - 0,5m liegen auf der Berechnungsstrecke f\u00fcr {1,date} - {2,date} nicht genug Daten vor +bedquality.missing.density.toplayer = Zur Berechnung der Dichte 0.0m - 0.3m liegen auf der Berechnungsstrecke f\u00fcr {0,date} nicht genug daten vor +bedquality.missing.density.sublayer = Zur Berechnung der Dichte 0.1m - 0.5m liegen auf der Berechnungsstrecke f\u00fcr {0,date} nicht genug daten vor +bedquality.missing.porosity.toplayer = Zur Berechnung der Porosit\u00e4t 0.0m - 0.3m liegen auf der Berechnungsstrecke f\u00fcr {0,date} nicht genug Daten vor +bedquality.missing.porosity.sublayer = Zur Berechnung der Porosit\u00e4t 0.1m - 0.5m liegen auf der Berechnungsstrecke f\u00fcr {0,date} nicht genug Daten vor facet.bedheight.diff.year = Sohlh\u00f6hendifferenz {0} facet.bedheight.diff.year.raw = Sohlh\u00f6hendifferenz {0} (Rohdaten) facet.bedheight.sounding_width = gepeilte Breite ({0}) diff -r 3a9ce890e4c7 -r 4054c7fce43e artifacts/src/main/resources/messages_en.properties --- a/artifacts/src/main/resources/messages_en.properties Thu Apr 02 14:10:25 2015 +0200 +++ b/artifacts/src/main/resources/messages_en.properties Thu Apr 02 15:48:48 2015 +0200 @@ -333,6 +333,13 @@ facet.bedquality.interpol.suffix = - interpolated bedquality.toplayer = 0.0m - 0.3m bedquality.sublayer = 0.1m - 0.5m +bedquality.missing.diameter.bedload = No bedload data found in {1,date} for diameter {0} for this range +bedquality.missing.diameter.sublayer = No sediment data found in {1,date} for diameter {0} 0.0m - 0.3m for this range +bedquality.missing.diameter.toplayer = No sediment data found in {1,date} for diameter {0} 0.1m - 0.5m for this range +bedquality.missing.density.toplayer = Not enough data in {0,date} - {1,date} for density 0.0m - 0.3m calculation for this range +bedquality.missing.density.sublayer = Not enough data in {0,date} - {1,date} for density 0.1m - 0.5m calculation for this range +bedquality.missing.porosity.toplayer = Not enough data in {0,date} - {1,date} for porosity 0.0m - 0.3m calculation for this range +bedquality.missing.porosity.sublayer = Not enough data in {0,date} - {1,date} for porosity 0.1m - 0.5m calculation for this range facet.bedheight.diff.year = Bedheight Difference {0} facet.bedheight.sounding_width = Sounding Width ({0}) facet.bedheight.diff.sounding = sounding Width