# HG changeset patch # User Raimund Renkert # Date 1396002049 -3600 # Node ID 1aba7532144155df2031842cf71ebaaf6dfd582c # Parent 8faa8cfd238531eceb2490f8463ae5748f7aa8a0 Added morph. active width to bed height difference calculation. diff -r 8faa8cfd2385 -r 1aba75321441 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 Thu Mar 27 14:56:34 2014 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java Fri Mar 28 11:20:49 2014 +0100 @@ -140,6 +140,8 @@ TDoubleArrayList gap = new TDoubleArrayList(size); TDoubleArrayList heights1 = new TDoubleArrayList(size); TDoubleArrayList heights2 = new TDoubleArrayList(size); + TDoubleArrayList morphs1 = new TDoubleArrayList(size); + TDoubleArrayList morphs2 = new TDoubleArrayList(size); int range = Math.abs(s1.getYear() - s2.getYear()); @@ -147,6 +149,8 @@ double station = stations.getQuick(i); double h1 = s1.getHeight(station); double h2 = s2.getHeight(station); + double m1 = s1.getWidth(station); + double m2 = s2.getWidth(station); double hDiff = h1 - h2; if (!Double.isNaN(hDiff)) { @@ -164,6 +168,8 @@ absolute.add((hDiff / range) * 100d); heights1.add(h1); heights2.add(h2); + morphs1.add(m1); + morphs2.add(m2); } } return new BedDiffYearResult( @@ -171,6 +177,8 @@ diffRes, heights1, heights2, + morphs1, + morphs2, soundings, absolute, gap, diff -r 8faa8cfd2385 -r 1aba75321441 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffYearFilterFacet.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffYearFilterFacet.java Thu Mar 27 14:56:34 2014 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffYearFilterFacet.java Fri Mar 28 11:20:49 2014 +0100 @@ -63,12 +63,16 @@ double[][] diffs = MovingAverage.weighted(oldData.getDifferencesData(), radius); double[][] heights1 = MovingAverage.weighted(oldData.getHeights1Data(), radius); double[][] heights2 = MovingAverage.weighted(oldData.getHeights2Data(), radius); - double[][] morph = oldData.getMorphWidthData(); + double[][] morph1 = oldData.getMorphWidth1Data(); + double[][] morph2 = oldData.getMorphWidth2Data(); + double[][] sounding = oldData.getSoundingWidthData(); double[][] year = MovingAverage.weighted(oldData.getHeightPerYearData(), radius); for(int j = 0; j < diffs[0].length; j++) { newData.addKm(diffs[0][j]); newData.addBedHeights(year[1][j]); - newData.addMorphWidth(morph[1][j]); + newData.addMorphWidth1(morph1[1][j]); + newData.addMorphWidth2(morph2[1][j]); + newData.addSoundingWidth(sounding[1][j]); newData.addDifference(diffs[1][j]); newData.addHeight1(heights1[1][j]); newData.addHeight2(heights2[1][j]); diff -r 8faa8cfd2385 -r 1aba75321441 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 Thu Mar 27 14:56:34 2014 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffYearResult.java Fri Mar 28 11:20:49 2014 +0100 @@ -17,7 +17,9 @@ { protected TDoubleArrayList bedHeights; protected TDoubleArrayList dataGap; - protected TDoubleArrayList morphWidth; + protected TDoubleArrayList soundingWidth; + protected TDoubleArrayList morphWidth1; + protected TDoubleArrayList morphWidth2; protected int start; protected int end; protected String nameFirst; @@ -27,7 +29,9 @@ super(); this.bedHeights = new TDoubleArrayList(); this.dataGap = new TDoubleArrayList(); - this.morphWidth = new TDoubleArrayList(); + this.soundingWidth = new TDoubleArrayList(); + this.morphWidth1 = new TDoubleArrayList(); + this.morphWidth2 = new TDoubleArrayList(); this.start = -1; this.end = -1; } @@ -44,7 +48,9 @@ TDoubleArrayList differences, TDoubleArrayList heights1, TDoubleArrayList heights2, - TDoubleArrayList morphWidth, + TDoubleArrayList morphWidth1, + TDoubleArrayList morphWidth2, + TDoubleArrayList soundingWidth, TDoubleArrayList bedHeights, TDoubleArrayList dataGap, int start, @@ -55,7 +61,9 @@ super(kms, differences, heights1, heights2); this.bedHeights = bedHeights; this.dataGap = dataGap; - this.morphWidth = morphWidth; + this.soundingWidth = soundingWidth; + this.morphWidth1 = morphWidth1; + this.morphWidth2 = morphWidth2; this.start = start; this.end = end; this.nameFirst = nameFirst; @@ -70,8 +78,16 @@ return this.dataGap; } - public TDoubleArrayList getMorphWidth() { - return this.morphWidth; + public TDoubleArrayList getMorphWidth1() { + return this.morphWidth1; + } + + public TDoubleArrayList getMorphWidth2() { + return this.morphWidth2; + } + + public TDoubleArrayList getSoundingWidth() { + return this.soundingWidth; } public int getStart() { @@ -100,18 +116,40 @@ return this.nameSecond; } - public void addMorphWidth(double value) { - this.morphWidth.add(value); + public void addMorphWidth1(double value) { + this.morphWidth1.add(value); + } + + public void addMorphWidth2(double value) { + this.morphWidth2.add(value); + } + + public void addSoundingWidth(double value) { + this.soundingWidth.add(value); } public void addBedHeights(double value) { this.bedHeights.add(value); } - public double[][] getMorphWidthData() { + public double[][] getMorphWidth1Data() { return new double[][] { kms.toNativeArray(), - morphWidth.toNativeArray() + morphWidth1.toNativeArray() + }; + } + + public double[][] getMorphWidth2Data() { + return new double[][] { + kms.toNativeArray(), + morphWidth2.toNativeArray() + }; + } + + public double[][] getSoundingWidthData() { + return new double[][] { + kms.toNativeArray(), + soundingWidth.toNativeArray() }; } diff -r 8faa8cfd2385 -r 1aba75321441 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightFactory.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightFactory.java Thu Mar 27 14:56:34 2014 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightFactory.java Fri Mar 28 11:20:49 2014 +0100 @@ -32,7 +32,8 @@ /** Query to get km and ws for wst_id and column_pos. */ public static final String SQL_SELECT_SINGLE = - "SELECT bhsv.height, bhsv.station, bhsv.data_gap, bhsv.sounding_width, bhs.year " + + "SELECT bhsv.height, bhsv.station, bhsv.data_gap, bhsv.sounding_width," + + " bhs.year, bhsv.width" + " FROM bed_height_single bhs" + " JOIN bed_height_single_values bhsv on bhsv.bed_height_single_id = bhs.id" + " WHERE bhs.id = :height_id" + @@ -148,6 +149,7 @@ .addScalar("station", StandardBasicTypes.DOUBLE) .addScalar("data_gap", StandardBasicTypes.DOUBLE) .addScalar("sounding_width", StandardBasicTypes.DOUBLE) + .addScalar("width", StandardBasicTypes.DOUBLE) .addScalar("year", StandardBasicTypes.INTEGER); sqlQuery.setInteger("height_id", height_id); List results = sqlQuery.list(); @@ -158,7 +160,8 @@ Double row1 = row[1] != null ? (Double)row[1] : Double.NaN; Double row2 = row[2] != null ? (Double)row[2] : Double.NaN; Double row3 = row[3] != null ? (Double)row[3] : Double.NaN; - height.add(row0, row1, row2, row3, (Integer) row[4]); + Double row4 = row[4] != null ? (Double)row[4] : Double.NaN; + height.add(row0, row1, row2, row3, row4, (Integer) row[5]); } return height; } diff -r 8faa8cfd2385 -r 1aba75321441 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightSingleData.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightSingleData.java Thu Mar 27 14:56:34 2014 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightSingleData.java Fri Mar 28 11:20:49 2014 +0100 @@ -17,12 +17,14 @@ protected int year; protected TDoubleArrayList data_gap; protected TDoubleArrayList soundingWidth; + protected TDoubleArrayList width; public BedHeightSingleData() { super(); this.year = -1; data_gap = new TDoubleArrayList(); soundingWidth = new TDoubleArrayList(); + width = new TDoubleArrayList(); } public BedHeightSingleData(String name) { @@ -30,19 +32,22 @@ this.year = -1; data_gap = new TDoubleArrayList(); soundingWidth = new TDoubleArrayList(); + width = new TDoubleArrayList(); } public void add( double value, double station, double gap, + double sounding, double width, int year ) { super.add(value, station); this.year = year; this.data_gap.add(gap); - this.soundingWidth.add(width); + this.soundingWidth.add(sounding); + this.width.add(width); } public int getYear() { @@ -70,4 +75,13 @@ public double[] getSoundingWidths() { return this.soundingWidth.toNativeArray(); } + + public double getWidth(int ndx) { + return width.getQuick(ndx); + } + + public double getWidth(double station) { + int ndx = this.station.indexOf(station); + return width.get(ndx); + } }