changeset 8213:ebdf34cae14d

Error reports for sediment load calculation.
author Tom Gottfried <tom@intevation.de>
date Fri, 05 Sep 2014 20:57:31 +0200
parents 3bb00338228c
children ceeeaf228fe4
files artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataCalculation.java artifacts/src/main/resources/messages.properties artifacts/src/main/resources/messages_de.properties artifacts/src/main/resources/messages_de_DE.properties artifacts/src/main/resources/messages_en.properties
diffstat 5 files changed, 59 insertions(+), 72 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataCalculation.java	Fri Sep 05 15:09:44 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataCalculation.java	Fri Sep 05 20:57:31 2014 +0200
@@ -213,21 +213,18 @@
         if ("off_epoch".equals(yearEpoch)) return calculateOffEpochs();
 
         // TODO: i18n
-        return error("minfo.sediment.load.unknown.calc.mode");
+        return error("minfo.sedimentload.unknown.calc.mode");
     }
 
     private CalculationResult calculateYears() {
         SedimentLoadData sld =
             SedimentLoadDataFactory.INSTANCE.getSedimentLoadData(river);
         if (sld == null) {
-            // TODO: i18n
-            return error("minfo.sediment.load.no.data");
+            return error("minfo.sedimentload.no.data");
         }
 
         SedimentLoadDataResult sldr = new SedimentLoadDataResult();
 
-        Set<Integer> missingFractions = new TreeSet<Integer>();
-
         Not notEpochs = new Not(IsEpoch.INSTANCE);
 
         Sum sum = new Sum();
@@ -246,12 +243,11 @@
 
                 double [][] result = sum(
                     sld, ls.getGrainFractions(), ls.getStationType(),
-                    filter, sum, missingFractions);
+                    filter, sum);
 
                 if (result[0].length == 0 || DoubleUtil.isNaN(result[1])) {
-                    // TODO: resolve i18n
-                    addProblem("minfo.sediment.load.no.fractions",
-                        ls.getDescription());
+                    addProblem("sedimentload.missing.fraction." +
+                               ls.getDescription(), period);
                     continue;
                 }
 
@@ -262,9 +258,7 @@
 
                 sldr.addFraction(sldrf);
             }
-
         }
-        // TODO: Generate messages for missing fractions.
         return new CalculationResult(sldr, this);
     }
 
@@ -272,14 +266,11 @@
         SedimentLoadData sld =
             SedimentLoadDataFactory.INSTANCE.getSedimentLoadData(river);
         if (sld == null) {
-            // TODO: i18n
-            return error("minfo.sediment.load.no.data");
+            return error("minfo.sedimentload.no.data");
         }
 
         SedimentLoadDataResult sldr = new SedimentLoadDataResult();
 
-        Set<Integer> missingFractions = new TreeSet<Integer>();
-
         Sum sum = new Sum();
 
         SedimentDensity sd = getSedimentDensity();
@@ -304,12 +295,9 @@
 
                     double [][] result = sum(
                         sld, ls.getGrainFractions(), ls.getStationType(),
-                        filter, sum, missingFractions);
+                        filter, sum);
 
                     if (result[0].length == 0 || DoubleUtil.isNaN(result[1])) {
-                        // TODO: resolve i18n
-                        addProblem("minfo.sediment.load.no.fractions",
-                            ls.getDescription());
                         continue;
                     }
 
@@ -318,6 +306,8 @@
                 }
 
                 if (results.size() == 0) {
+                    addProblem("sedimentload.missing.fraction." +
+                               ls.getDescription(), period);
                     continue;
                 }
 
@@ -329,10 +319,13 @@
                             ls.getDescription(), result, period);
                     sldr.addFraction(sldrf);
                 }
+                else {
+                    addProblem("sedimentload.missing.fraction." +
+                               ls.getDescription(), period);
+                }
             }
 
         }
-        // TODO: Generate messages for missing fractions.
         return new CalculationResult(sldr, this);
     }
 
@@ -340,8 +333,7 @@
         SedimentLoadData sld =
             SedimentLoadDataFactory.INSTANCE.getSedimentLoadData(river);
         if (sld == null) {
-            // TODO: i18n
-            return error("minfo.sediment.load.no.data");
+            return error("minfo.sedimentload.no.data");
         }
 
         SedimentLoadDataResult sldr = new SedimentLoadDataResult();
@@ -364,14 +356,14 @@
             for (LoadSum ls: LOAD_SUMS) {
                 double [][] result = sum(
                     sld, ls.getGrainFractions(), ls.getStationType(),
-                    filter, sum, missingFractions);
+                    filter, sum);
 
                 if (result[0].length == 0 || DoubleUtil.isNaN(result[1])) {
-                    // TODO: resolve i18n
-                    addProblem("minfo.sediment.load.no.fractions",
-                        ls.getDescription());
+                    addProblem("sedimentload.missing.fraction." +
+                               ls.getDescription(), period);
                     continue;
                 }
+
                 transformT2M3(sd, year, result);
                 SedimentLoadDataResult.Fraction sldrf =
                     new SedimentLoadDataResult.Fraction(ls.getDescription(), result, period);
@@ -412,8 +404,7 @@
         int []           grainFractions,
         int              lsSType,
         Value.Filter     filter,
-        Sum              sum,
-        Set<Integer>     missingFractions
+        Sum              sum
     ) {
         List<Station> stations = sld.findStations(from, to);
 
@@ -458,7 +449,6 @@
                 }
 
                 if (sum.getN() == 0) {
-                    missingFractions.add(gf);
                     values[i] = Double.NaN;
                 } else {
                     values[i] = sum.getSum();
@@ -468,8 +458,6 @@
             result[1][j] = DoubleUtil.sum(values);
         }
 
-        // TODO: Handle 'virtual' measument stations 'from' and 'to'.
-
         return result;
     }
 
--- a/artifacts/src/main/resources/messages.properties	Fri Sep 05 15:09:44 2014 +0200
+++ b/artifacts/src/main/resources/messages.properties	Fri Sep 05 20:57:31 2014 +0200
@@ -275,16 +275,16 @@
 facet.sedimentload.calc.bed_load = Bed load (calculated) - {0} [{1}]
 facet.sedimentload.calc.bed_load_susp_sand = bed building load (calculated) - {0} [{1}]
 
-missing.fraction.coarse = Year {0}: Missing coarse fraction
-missing.fraction.fine_middle = Year {0}: Missing fine/middle fraction
-missing.fraction.sand = Year {0}: Missing sand fraction
-missing.fraction.susp_sand = Year {0}: Missing susp. sand fraction
-missing.fraction.susp_sediment = Year {0}: Missing susp. sediment fraction
-missing.data.coarse = Missing coarse data at
-missing.data.fine_middle = Missing fine/middle data at
-missing.data.sand = Missing sand data at
-missing.data.susp_sand = Missing susp. sand data at
-missing.data.susp_sediment = Missing susp. sediment data at
+minfo.sedimentload.no.data = No sediment load data available
+sedimentload.missing.fraction.coarse = Missing fraction coarse gravel - {0}
+sedimentload.missing.fraction.fine_middle = Missing fraction fine/mid. gravel - {0}
+sedimentload.missing.fraction.sand = Missing fraction sand - {0}
+sedimentload.missing.fraction.susp_sand = Missing fraction suspended sand - {0}
+sedimentload.missing.fraction.susp_sand_bed = Missing fraction bed. part suspended sand - {0}
+sedimentload.missing.fraction.suspended_sediment = Missing fraction suspended sediment - {0}
+sedimentload.missing.fraction.total = Missing fraction total load - {0}
+sedimentload.missing.fraction.bed_load = Missing fraction bed load - {0}
+sedimentload.missing.fraction.bed_load_susp_sand = Missing fraction bed building load - {0}
 
 facet.longitudinal_section.annotations = POIs
 facet.discharge_curves.mainvalues.q = Q (main values)
--- a/artifacts/src/main/resources/messages_de.properties	Fri Sep 05 15:09:44 2014 +0200
+++ b/artifacts/src/main/resources/messages_de.properties	Fri Sep 05 20:57:31 2014 +0200
@@ -276,16 +276,16 @@
 facet.sedimentload.calc.bed_load = Geschiebefracht (Berechnung FLYS) - {0} [{1}]
 facet.sedimentload.calc.bed_load_susp_sand = bettbildende Fracht (Berechnung FLYS) - {0} [{1}]
 
-missing.fraction.coarse = Jahr {0}: Fehlende Fraktion: grober Kies
-missing.fraction.fine_middle = Jahr {0}: Fehlende Fraktion: fein/mittlerer Kies
-missing.fraction.sand = Jahr {0}: Fehlende Fraktion: Sand
-missing.fraction.susp_sand = Jahr {0}: Fehlende Fraktion: susp. Sand
-missing.fraction.susp_sediment = Jahr {0}: Fehlende Fraktion: Schwebstoffe
-missing.data.coarse = Fehlende Daten bei grobem Kies
-missing.data.fine_middle = Fehlende Daten bei fein/mittlerem Kies
-missing.data.sand = Fehlende Daten bei Sand
-missing.data.susp_sand = Fehlende Daten bei susp. Sand
-missing.data.susp_sediment = Fehlende Daten bei Schwebstoffen
+minfo.sedimentload.no.data = Keine Sedimentfracht-Daten verfügbar
+sedimentload.missing.fraction.coarse = Fehlende Fraktion Grober Kies/Steine - {0}
+sedimentload.missing.fraction.fine_middle = Fehlende Fraktion Fein/Mittlerer Kies - {0}
+sedimentload.missing.fraction.sand = Fehlende Fraktion Sand - {0}
+sedimentload.missing.fraction.susp_sand = Fehlende Fraktion suspendierter Sand - {0}
+sedimentload.missing.fraction.susp_sand_bed = Fehlende Fraktion bettbildender Anteil suspendierter Sand - {0}
+sedimentload.missing.fraction.suspended_sediment = Fehlende Fraktion Schwebstoff - {0}
+sedimentload.missing.fraction.total = Fehlende Fraktion Gesamtfracht - {0}
+sedimentload.missing.fraction.bed_load = Fehlende Fraktion Geschiebefracht - {0}
+sedimentload.missing.fraction.bed_load_susp_sand = Fehlende Fraktion bettbildende Fracht - {0}
 
 facet.longitudinal_section.annotations = Streckenfavoriten
 facet.discharge_curves.mainvalues.q = Q (Haupt- und Extremwerte)
--- a/artifacts/src/main/resources/messages_de_DE.properties	Fri Sep 05 15:09:44 2014 +0200
+++ b/artifacts/src/main/resources/messages_de_DE.properties	Fri Sep 05 20:57:31 2014 +0200
@@ -273,16 +273,16 @@
 facet.sedimentload.calc.bed_load = Geschiebefracht (Berechnung FLYS) - {0} [{1}]
 facet.sedimentload.calc.bed_load_susp_sand = bettbildende Fracht (Berechnung FLYS) - {0} [{1}]
 
-missing.fraction.coarse = Jahr {0}: Fehlende Fraktion: grober Kies
-missing.fraction.fine_middle = Jahr {0}: Fehlende Fraktion: fein/mittlerer Kies
-missing.fraction.sand = Jahr {0}: Fehlende Fraktion: Sand
-missing.fraction.susp_sand = Jahr {0}: Fehlende Fraktion: susp. Sand
-missing.fraction.susp_sediment = Jahr {0}: Fehlende Fraktion: Schwebstoffe
-missing.data.coarse = Fehlende Daten bei grobem Kies
-missing.data.fine_middle = Fehlende Daten bei fein/mittlerem Kies
-missing.data.sand = Fehlende Daten bei Sand
-missing.data.susp_sand = Fehlende Daten bei susp. Sand
-missing.data.susp_sediment = Fehlende Daten bei Schwebstoffen
+minfo.sedimentload.no.data = Keine Sedimentfracht-Daten verfügbar
+sedimentload.missing.fraction.coarse = Fehlende Fraktion Grober Kies/Steine - {0}
+sedimentload.missing.fraction.fine_middle = Fehlende Fraktion Fein/Mittlerer Kies - {0}
+sedimentload.missing.fraction.sand = Fehlende Fraktion Sand - {0}
+sedimentload.missing.fraction.susp_sand = Fehlende Fraktion suspendierter Sand - {0}
+sedimentload.missing.fraction.susp_sand_bed = Fehlende Fraktion bettbildender Anteil suspendierter Sand - {0}
+sedimentload.missing.fraction.suspended_sediment = Fehlende Fraktion Schwebstoff - {0}
+sedimentload.missing.fraction.total = Fehlende Fraktion Gesamtfracht - {0}
+sedimentload.missing.fraction.bed_load = Fehlende Fraktion Geschiebefracht - {0}
+sedimentload.missing.fraction.bed_load_susp_sand = Fehlende Fraktion bettbildende Fracht - {0}
 
 facet.longitudinal_section.annotations = Streckenfavoriten
 facet.discharge_curves.mainvalues.q = Q (Haupt- und Extremwerte)
--- a/artifacts/src/main/resources/messages_en.properties	Fri Sep 05 15:09:44 2014 +0200
+++ b/artifacts/src/main/resources/messages_en.properties	Fri Sep 05 20:57:31 2014 +0200
@@ -277,17 +277,16 @@
 facet.sedimentload.calc.bed_load = Bed load (calculated) - {0} [{1}]
 facet.sedimentload.calc.bed_load_susp_sand = bed building load (calculated) - {0} [{1}]
 
-missing.fraction.coarse = Year {0}: Missing coarse fraction
-missing.fraction.fine_middle = Year {0}: Missing fine/middle fraction
-missing.fraction.sand = Year {0}: Missing sand fraction
-missing.fraction.susp_sand = Year {0}: Missing susp. sand fraction
-missing.fraction.susp_sediment = Year {0}: Missing susp. sediment fraction
-missing.data.coarse = Missing coarse data at
-missing.data.fine_middle = Missing fine/middle data at
-missing.data.sand = Missing sand data at
-missing.data.susp_sand = Missing susp. sand data at
-missing.data.susp_sediment = Missing susp. sediment data at
-
+minfo.sedimentload.no.data = No sediment load data available
+sedimentload.missing.fraction.coarse = Missing fraction coarse gravel - {0}
+sedimentload.missing.fraction.fine_middle = Missing fraction fine/mid. gravel - {0}
+sedimentload.missing.fraction.sand = Missing fraction sand - {0}
+sedimentload.missing.fraction.susp_sand = Missing fraction suspended sand - {0}
+sedimentload.missing.fraction.susp_sand_bed = Missing fraction bed. part suspended sand - {0}
+sedimentload.missing.fraction.suspended_sediment = Missing fraction suspended sediment - {0}
+sedimentload.missing.fraction.total = Missing fraction total load - {0}
+sedimentload.missing.fraction.bed_load = Missing fraction bed load - {0}
+sedimentload.missing.fraction.bed_load_susp_sand = Missing fraction bed building load - {0}
 
 facet.longitudinal_section.annotations = POIs
 facet.discharge_curves.mainvalues.q = Q (main values)

http://dive4elements.wald.intevation.org