[PATCH 1 of 2] Bedheight differences exports sounding width and data gap for minuend and subtrahend

Wald Commits scm-commit at wald.intevation.org
Fri Oct 17 13:34:56 CEST 2014


# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1413545648 -7200
# Node ID 96bf5135cd0e089c0b61c90772f1c09cbc49c96b
# Parent  0fa963038c61ac5216ac2670c09b8d07fd4f9a1f
Bedheight differences exports sounding width and data gap for minuend and subtrahend.

diff -r 0fa963038c61 -r 96bf5135cd0e artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java	Fri Oct 17 13:17:12 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java	Fri Oct 17 13:34:08 2014 +0200
@@ -69,13 +69,15 @@
         TDoubleArrayList stations = s1.getStations();
         int size = stations.size();
 
-        TDoubleArrayList diffRes   = new TDoubleArrayList(size);
-        TDoubleArrayList kms       = new TDoubleArrayList(size);
-        TDoubleArrayList soundings = new TDoubleArrayList(size);
-        TDoubleArrayList absolute  = new TDoubleArrayList(size);
-        TDoubleArrayList gap       = new TDoubleArrayList(size);
-        TDoubleArrayList heights1  = new TDoubleArrayList(size);
-        TDoubleArrayList heights2  = new TDoubleArrayList(size);
+        TDoubleArrayList diffRes    = new TDoubleArrayList(size);
+        TDoubleArrayList kms        = new TDoubleArrayList(size);
+        TDoubleArrayList soundings1 = new TDoubleArrayList(size);
+        TDoubleArrayList soundings2 = new TDoubleArrayList(size);
+        TDoubleArrayList absolute   = new TDoubleArrayList(size);
+        TDoubleArrayList gap1       = new TDoubleArrayList(size);
+        TDoubleArrayList gap2       = new TDoubleArrayList(size);
+        TDoubleArrayList heights1   = new TDoubleArrayList(size);
+        TDoubleArrayList heights2   = new TDoubleArrayList(size);
         //TDoubleArrayList morphs1   = new TDoubleArrayList(size);
         //TDoubleArrayList morphs2   = new TDoubleArrayList(size);
 
@@ -96,13 +98,11 @@
                 diffRes.add(hDiff);
                 kms.add(station);
 
-                soundings.add(Math.max(
-                    s1.getSoundingWidth(station),
-                    s2.getSoundingWidth(station)));
+                soundings1.add(s1.getSoundingWidth(station));
+                soundings2.add(s2.getSoundingWidth(station));
 
-                gap.add(Math.max(
-                    s1.getDataGap(station),
-                    s2.getDataGap(station)));
+                gap1.add(s1.getDataGap(station));
+                gap2.add(s2.getDataGap(station));
 
                 if (range != null) {
                     absolute.add((hDiff / range) * 100d);
@@ -120,9 +120,11 @@
             heights2,
             //morphs1,
             //morphs2,
-            soundings,
+            soundings1,
+            soundings2,
             absolute,
-            gap,
+            gap1,
+            gap2,
             s1.getYear(),
             s2.getYear(),
             s1.getName(),
diff -r 0fa963038c61 -r 96bf5135cd0e artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffSoundingWidthFacet.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffSoundingWidthFacet.java	Fri Oct 17 13:17:12 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffSoundingWidthFacet.java	Fri Oct 17 13:34:08 2014 +0200
@@ -40,7 +40,8 @@
 
         if (resultData != null && resultData.length > index) {
             BedDiffYearResult data = resultData[index];
-            return data.getSoundingWidthData();
+            //TODO this only returns sounding width for minuend.
+            return data.getSoundingWidth1Data();
         }
         return null;
     }
diff -r 0fa963038c61 -r 96bf5135cd0e artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffYearResult.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffYearResult.java	Fri Oct 17 13:17:12 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffYearResult.java	Fri Oct 17 13:34:08 2014 +0200
@@ -16,8 +16,10 @@
 extends BedDifferencesResult
 {
     protected TDoubleArrayList diffsPerYear;
-    protected TDoubleArrayList dataGap;
-    protected TDoubleArrayList soundingWidth;
+    protected TDoubleArrayList dataGap1;
+    protected TDoubleArrayList dataGap2;
+    protected TDoubleArrayList soundingWidth1;
+    protected TDoubleArrayList soundingWidth2;
     //protected TDoubleArrayList morphWidth1;
     //protected TDoubleArrayList morphWidth2;
     protected Integer start;
@@ -30,8 +32,10 @@
     public BedDiffYearResult () {
         super();
         this.diffsPerYear = new TDoubleArrayList();
-        this.dataGap = new TDoubleArrayList();
-        this.soundingWidth = new TDoubleArrayList();
+        this.dataGap1 = new TDoubleArrayList();
+        this.dataGap2 = new TDoubleArrayList();
+        this.soundingWidth1 = new TDoubleArrayList();
+        this.soundingWidth2 = new TDoubleArrayList();
         //this.morphWidth1 = new TDoubleArrayList();
         //this.morphWidth2 = new TDoubleArrayList();
     }
@@ -50,9 +54,11 @@
         TDoubleArrayList heights2,
         //TDoubleArrayList morphWidth1,
         //TDoubleArrayList morphWidth2,
-        TDoubleArrayList soundingWidth,
+        TDoubleArrayList soundingWidth1,
+        TDoubleArrayList soundingWidth2,
         TDoubleArrayList diffsPerYear,
-        TDoubleArrayList dataGap,
+        TDoubleArrayList dataGap1,
+        TDoubleArrayList dataGap2,
         Integer start,
         Integer end,
         String nameFirst,
@@ -62,8 +68,10 @@
     ) {
         super(kms, differences, heights1, heights2);
         this.diffsPerYear = diffsPerYear;
-        this.dataGap = dataGap;
-        this.soundingWidth = soundingWidth;
+        this.dataGap1 = dataGap1;
+        this.dataGap2 = dataGap2;
+        this.soundingWidth1 = soundingWidth1;
+        this.soundingWidth2 = soundingWidth2;
         //this.morphWidth1 = morphWidth1;
         //this.morphWidth2 = morphWidth2;
         this.start = start;
@@ -78,8 +86,12 @@
         return this.diffsPerYear;
     }
 
-    public TDoubleArrayList getDataGap() {
-        return this.dataGap;
+    public TDoubleArrayList getDataGap1() {
+        return this.dataGap1;
+    }
+
+    public TDoubleArrayList getDataGap2() {
+        return this.dataGap2;
     }
 
     /*
@@ -92,8 +104,12 @@
     }
     */
 
-    public TDoubleArrayList getSoundingWidth() {
-        return this.soundingWidth;
+    public TDoubleArrayList getSoundingWidth1() {
+        return this.soundingWidth1;
+    }
+
+    public TDoubleArrayList getSoundingWidth2() {
+        return this.soundingWidth2;
     }
 
     public Integer getStart() {
@@ -142,8 +158,12 @@
     }
     */
 
-    public void addSoundingWidth(double value) {
-        this.soundingWidth.add(value);
+    public void addSoundingWidth1(double value) {
+        this.soundingWidth1.add(value);
+    }
+
+    public void addSoundingWidth2(double value) {
+        this.soundingWidth2.add(value);
     }
 
     public void addBedHeights(double value) {
@@ -166,10 +186,31 @@
     }
     */
 
-    public double[][] getSoundingWidthData() {
+    public double[][] getSoundingWidth1Data() {
         return new double[][] {
             kms.toNativeArray(),
-            soundingWidth.toNativeArray()
+            soundingWidth1.toNativeArray()
+        };
+    }
+
+    public double[][] getSoundingWidth2Data() {
+        return new double[][] {
+            kms.toNativeArray(),
+            soundingWidth2.toNativeArray()
+        };
+    }
+
+    public double[][] getDataGap1Data() {
+        return new double[][] {
+            kms.toNativeArray(),
+            dataGap1.toNativeArray()
+        };
+    }
+
+    public double[][] getDataGap2Data() {
+        return new double[][] {
+            kms.toNativeArray(),
+            dataGap2.toNativeArray()
         };
     }
 
diff -r 0fa963038c61 -r 96bf5135cd0e artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDifferenceJRDataSource.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDifferenceJRDataSource.java	Fri Oct 17 13:17:12 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDifferenceJRDataSource.java	Fri Oct 17 13:34:08 2014 +0200
@@ -85,14 +85,18 @@
         else if ("diff".equals(fieldName)) {
             value = data.get(index)[2];
         }
-        /*
-        else if ("morph1".equals(fieldName)) {
+        else if ("sounding1".equals(fieldName)) {
             value = data.get(index)[3];
         }
-        else if ("morph2".equals(fieldName)) {
+        else if ("sounding2".equals(fieldName)) {
             value = data.get(index)[4];
         }
-        */
+        else if ("gap1".equals(fieldName)) {
+            value = data.get(index)[3];
+        }
+        else if ("gap2".equals(fieldName)) {
+            value = data.get(index)[4];
+        }
         return value;
     }
 }
diff -r 0fa963038c61 -r 96bf5135cd0e artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceExporter.java	Fri Oct 17 13:17:12 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceExporter.java	Fri Oct 17 13:34:08 2014 +0200
@@ -67,6 +67,18 @@
         "export.minfo.beddifference.morph2";
     */
 
+    private static final String CSV_HEADER_SOUNDING1 =
+        "export.minfo.beddifference.sounding1";
+
+    private static final String CSV_HEADER_SOUNDING2 =
+        "export.minfo.beddifference.sounding2";
+
+    private static final String CSV_HEADER_GAP1 =
+        "export.minfo.beddifference.gap1";
+
+    private static final String CSV_HEADER_GAP2 =
+        "export.minfo.beddifference.gap2";
+
     public static final String JASPER_FILE =
         "export.minfo.beddifference.pdf.file";
 
@@ -93,6 +105,10 @@
                 BedDiffYearResult yResult = (BedDiffYearResult) result;
                 String desc = result.getDiffDescription();
                 double[][] kms = yResult.getDifferencesData();
+                double[][] sounding1 = yResult.getSoundingWidth1Data();
+                double[][] sounding2 = yResult.getSoundingWidth2Data();
+                double[][] gap1 = yResult.getDataGap1Data();
+                double[][] gap2 = yResult.getDataGap2Data();
                 //double[][] morph1 = yResult.getMorphWidth1Data();
                 //double[][] morph2 = yResult.getMorphWidth2Data();
                 for (int j = 0; j < kms[0].length; j++) {
@@ -100,6 +116,10 @@
                         kmf.format(kms[0][j]),
                         desc,
                         mf.format(kms[1][j]),
+                        mf.format(sounding1[1][j]),
+                        mf.format(sounding2[1][j]),
+                        mf.format(gap1[1][j]),
+                        mf.format(gap2[1][j])
                         //mf.format(morph1[1][j]),
                         //mf.format(morph2[1][j]),
                         });
@@ -184,8 +204,10 @@
             /*
             if (results.length > 0 &&
                 results[0] instanceof BedDiffYearResult) {
-                header.add(msg(CSV_HEADER_MORPH1, "morph width minuend [m]"));
-                header.add(msg(CSV_HEADER_MORPH2, "morph width subtrahend [m]"));
+                header.add(msg(CSV_HEADER_SOUNDING1, "soundung width minuend [m]"));
+                header.add(msg(CSV_HEADER_SOUNDING2, "sounding width subtrahend [m]"));
+                header.add(msg(CSV_HEADER_GAP1, "data gap minuend"));
+                header.add(msg(CSV_HEADER_GAP2, "data gap subtrahend"));
             }
             */
         }
@@ -202,6 +224,10 @@
             BedDiffYearResult yResult = (BedDiffYearResult) result;
             double[][] kms = result.getDifferencesData();
             String desc = result.getDiffDescription();
+            double[][] sounding1 = yResult.getSoundingWidth1Data();
+            double[][] sounding2 = yResult.getSoundingWidth2Data();
+            double[][] gap1 = yResult.getDataGap1Data();
+            double[][] gap2 = yResult.getDataGap2Data();
             //double[][] morph1 = yResult.getMorphWidth1Data();
             //double[][] morph2 = yResult.getMorphWidth2Data();
             for (int j = 0; j < kms[0].length; j++) {
@@ -209,6 +235,10 @@
                     kmf.format(kms[0][j]),
                     desc,
                     mf.format(kms[1][j]),
+                    mf.format(sounding1[1][j]),
+                    mf.format(sounding2[1][j]),
+                    mf.format(gap1[1][j]),
+                    mf.format(gap2[1][j])
                     //mf.format(morph1[1][j]),
                     //mf.format(morph2[1][j])
                     });


More information about the Dive4Elements-commits mailing list