[PATCH 24 of 45] Morphological width imported and stored with heights is redundant to table morphologic_width

Wald Commits scm-commit at wald.intevation.org
Tue Mar 10 17:05:52 CET 2015


# HG changeset patch
# User "Tom Gottfried <tom at intevation.de>"
# Date 1424073608 -3600
# Node ID 3a0522f1a532569f5ce94346fdf1a04ead27ec76
# Parent  17c476e90c078abecb2b0cfd553446131369fa87
Morphological width imported and stored with heights is redundant to table morphologic_width.

diff -r 17c476e90c07 -r 3a0522f1a532 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	Mon Feb 16 08:39:06 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightFactory.java	Mon Feb 16 09:00:08 2015 +0100
@@ -30,8 +30,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, bhsv.width" +
+        "SELECT bhsv.height, bhsv.station, bhsv.data_gap," +
+        "       bhsv.sounding_width, bhs.year" +
         "   FROM bed_height_single bhs" +
         "       JOIN bed_height_single_values bhsv on bhsv.bed_height_single_id = bhs.id";
 
@@ -157,7 +157,6 @@
                 .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);
             if (!Double.isNaN(from) && !Double.isNaN(to)) {
@@ -172,8 +171,7 @@
                 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;
-                Double row4 = row[4] != null ? (Double)row[4] : Double.NaN;
-                height.add(row0, row1, row2, row3, row4, (Integer) row[5]);
+                height.add(row0, row1, row2, row3, (Integer) row[4]);
             }
             return height;
         }
diff -r 17c476e90c07 -r 3a0522f1a532 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	Mon Feb 16 08:39:06 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightSingleData.java	Mon Feb 16 09:00:08 2015 +0100
@@ -17,20 +17,17 @@
     protected Integer year;
     protected TDoubleArrayList data_gap;
     protected TDoubleArrayList soundingWidth;
-    protected TDoubleArrayList width;
 
     public BedHeightSingleData() {
         super();
         data_gap = new TDoubleArrayList();
         soundingWidth = new TDoubleArrayList();
-        width = new TDoubleArrayList();
     }
 
     public BedHeightSingleData(String name) {
         super(name);
         data_gap = new TDoubleArrayList();
         soundingWidth = new TDoubleArrayList();
-        width = new TDoubleArrayList();
     }
 
     public void add(
@@ -38,7 +35,6 @@
         double station,
         double gap,
         double sounding,
-        double width,
         Integer year
     ) {
         super.add(value, station);
@@ -47,7 +43,6 @@
         }
         this.data_gap.add(gap);
         this.soundingWidth.add(sounding);
-        this.width.add(width);
     }
 
     public Integer getYear() {
@@ -76,15 +71,4 @@
         return this.soundingWidth.toNativeArray();
     }
 
-    public double getWidth(int ndx) {
-        return width.getQuick(ndx);
-    }
-
-    public double getWidth(double station) {
-        int ndx = this.station.indexOf(station);
-        if (ndx < 0) {
-            return Double.NaN;
-        }
-        return width.get(ndx);
-    }
 }
diff -r 17c476e90c07 -r 3a0522f1a532 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/MiddleBedHeightCalculation.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/MiddleBedHeightCalculation.java	Mon Feb 16 08:39:06 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/MiddleBedHeightCalculation.java	Mon Feb 16 09:00:08 2015 +0100
@@ -143,7 +143,6 @@
                     uncert,
                     sounding,
                     gap,
-                    value.getWidth().doubleValue(),
                     false);
              }
             else {
@@ -152,7 +151,6 @@
                     0,
                     0,
                     0,
-                    0,
                     true);
             }
         }
diff -r 17c476e90c07 -r 3a0522f1a532 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/MiddleBedHeightData.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/MiddleBedHeightData.java	Mon Feb 16 08:39:06 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/MiddleBedHeightData.java	Mon Feb 16 09:00:08 2015 +0100
@@ -38,7 +38,6 @@
     private TDoubleArrayList uncertainty;
     private TDoubleArrayList soundingWidth;
     private TDoubleArrayList dataGap;
-    private TDoubleArrayList width;
     private String type;
     private String locationSystem;
     private Integer soundWidth;
@@ -67,18 +66,16 @@
         this.uncertainty   = new TDoubleArrayList();
         this.soundingWidth = new TDoubleArrayList();
         this.dataGap       = new TDoubleArrayList();
-        this.width         = new TDoubleArrayList();
         this.empty         = new ArrayList();
     }
 
     public void addAll(double station, double height, double uncertainty,
-        double soundingWidth, double dataGap, double width, boolean isEmpty) {
+        double soundingWidth, double dataGap, boolean isEmpty) {
         addKM(station);
         addMiddleHeight(height);
         addUncertainty(uncertainty);
         addSoundingWidth(soundingWidth);
         addDataGap(dataGap);
-        addWidth(width);
         addIsEmpty(isEmpty);
     }
 
@@ -170,15 +167,6 @@
         return (Boolean) empty.get(idx);
     }
 
-
-    protected void addWidth(double width) {
-        this.width.add(width);
-    }
-
-    public double getWidth(int idx) {
-        return width.get(idx);
-    }
-
     public int size() {
         return km.size();
     }
diff -r 17c476e90c07 -r 3a0522f1a532 artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightExporter.java	Mon Feb 16 08:39:06 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightExporter.java	Mon Feb 16 09:00:08 2015 +0100
@@ -57,9 +57,6 @@
     public static final String CSV_SOUNDING_WIDTH =
         "export.bedheight_middle.csv.header.soundingwidth";
 
-    public static final String CSV_WIDTH =
-        "export.bedheight_middle.csv.header.width";
-
     public static final String CSV_LOCATIONS =
         "export.bedheight_middle.csv.header.locations";
 
@@ -131,14 +128,13 @@
         River river = RiverUtils.getRiver((D4EArtifact) master);
         String riverUnit = river.getWstUnit().getName();
         writer.writeNext(new String[] {
-            msg(CSV_KM, CSV_KM),
-            msg(CSV_SOUNDING, CSV_SOUNDING),
-            msg(CSV_HEIGHT, CSV_HEIGHT, new Object[] {riverUnit}),
-            msg(CSV_UNCERTAINTY, CSV_UNCERTAINTY),
-            msg(CSV_DATA_GAP, CSV_DATA_GAP),
-            msg(CSV_SOUNDING_WIDTH, CSV_SOUNDING_WIDTH),
-            msg(CSV_WIDTH, CSV_WIDTH),
-            msg(CSV_LOCATIONS, CSV_LOCATIONS)
+            msg(CSV_KM),
+            msg(CSV_SOUNDING),
+            msg(CSV_HEIGHT, new Object[] {riverUnit}),
+            msg(CSV_UNCERTAINTY),
+            msg(CSV_DATA_GAP),
+            msg(CSV_SOUNDING_WIDTH),
+            msg(CSV_LOCATIONS)
         });
     }
 
@@ -155,7 +151,6 @@
         NumberFormat uncertF = Formatter.getMiddleBedHeightUncert(context);
         NumberFormat gapF    = Formatter.getMiddleBedHeightDataGap(context);
         NumberFormat soundF  = Formatter.getMiddleBedHeightSounding(context);
-        NumberFormat widthF  = Formatter.getMiddleBedHeightWidth(context);
 
         heightF.setMaximumFractionDigits(1);
         soundF.setMaximumFractionDigits(1);
@@ -180,7 +175,6 @@
                     uncert,
                     gap,
                     sound,
-                    widthF.format(data.getWidth(i)),
                     RiverUtils.getLocationDescription(flys, data.getKM(i)),
                 });
         }
@@ -212,7 +206,7 @@
 
     @Override
     protected void writePDF(OutputStream out) {
-        log.error("TODO: Implement FlowVelocityExporter.writePDF");
+        log.error("TODO: Implement MiddleBedHeightExporter.writePDF");
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
diff -r 17c476e90c07 -r 3a0522f1a532 artifacts/src/main/java/org/dive4elements/river/utils/Formatter.java
--- a/artifacts/src/main/java/org/dive4elements/river/utils/Formatter.java	Mon Feb 16 08:39:06 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/utils/Formatter.java	Mon Feb 16 09:00:08 2015 +0100
@@ -415,13 +415,6 @@
     }
 
 
-    public static NumberFormat getMiddleBedHeightWidth(CallContext context) {
-        return getFormatter(
-                context,
-                MIDDLE_BED_HEIGHT_WIDTH_MIN_DIGITS,
-                MIDDLE_BED_HEIGHT_WIDTH_MAX_DIGITS);
-    }
-
     public static NumberFormat getFixDeltaWKM(CallContext context) {
         return getFormatter(
                 context,
diff -r 17c476e90c07 -r 3a0522f1a532 artifacts/src/main/resources/messages.properties
--- a/artifacts/src/main/resources/messages.properties	Mon Feb 16 08:39:06 2015 +0100
+++ b/artifacts/src/main/resources/messages.properties	Mon Feb 16 09:00:08 2015 +0100
@@ -430,7 +430,6 @@
 export.bedheight_middle.csv.header.uncertainty = Uncertainty [m]
 export.bedheight_middle.csv.header.datagap = Data Gap
 export.bedheight_middle.csv.header.soundingwidth = Sounding Width [m]
-export.bedheight_middle.csv.header.width = morphological active width [m]
 export.bedheight_middle.csv.header.locations = Location
 
 export.sedimentload.csv.header.coarse = Coarse gravel [{0}]
diff -r 17c476e90c07 -r 3a0522f1a532 artifacts/src/main/resources/messages_de.properties
--- a/artifacts/src/main/resources/messages_de.properties	Mon Feb 16 08:39:06 2015 +0100
+++ b/artifacts/src/main/resources/messages_de.properties	Mon Feb 16 09:00:08 2015 +0100
@@ -432,7 +432,6 @@
 export.bedheight_middle.csv.header.uncertainty = Unsicherheit [m]
 export.bedheight_middle.csv.header.datagap = Datenl\u00fccke
 export.bedheight_middle.csv.header.soundingwidth = Peilbreite [m]
-export.bedheight_middle.csv.header.width = morphologisch ausgewertete Breite [m]
 export.bedheight_middle.csv.header.locations = Streckendaten
 
 export.sedimentload.csv.header.coarse = Grober Kies/Steine [{0}]
diff -r 17c476e90c07 -r 3a0522f1a532 artifacts/src/main/resources/messages_de_DE.properties
--- a/artifacts/src/main/resources/messages_de_DE.properties	Mon Feb 16 08:39:06 2015 +0100
+++ b/artifacts/src/main/resources/messages_de_DE.properties	Mon Feb 16 09:00:08 2015 +0100
@@ -428,7 +428,6 @@
 export.bedheight_middle.csv.header.uncertainty = Unsicherheit [m]
 export.bedheight_middle.csv.header.datagap = Datenl\u00fccke
 export.bedheight_middle.csv.header.soundingwidth = Peilbreite [m]
-export.bedheight_middle.csv.header.width = morphologisch ausgewertete Breite [m]
 export.bedheight_middle.csv.header.locations = Streckendaten
 
 export.sedimentload.csv.header.coarse = Grober Kies/Steine [{0}]
diff -r 17c476e90c07 -r 3a0522f1a532 artifacts/src/main/resources/messages_en.properties
--- a/artifacts/src/main/resources/messages_en.properties	Mon Feb 16 08:39:06 2015 +0100
+++ b/artifacts/src/main/resources/messages_en.properties	Mon Feb 16 09:00:08 2015 +0100
@@ -432,7 +432,6 @@
 export.bedheight_middle.csv.header.uncertainty = Uncertainty [m]
 export.bedheight_middle.csv.header.datagap = Data Gap
 export.bedheight_middle.csv.header.soundingwidth = Sounding Width [m]
-export.bedheight_middle.csv.header.width = morphological active width [m]
 export.bedheight_middle.csv.header.locations = Location
 
 export.sedimentload.csv.header.coarse = Coarse gravel [{0}]
diff -r 17c476e90c07 -r 3a0522f1a532 backend/doc/schema/oracle-minfo.sql
--- a/backend/doc/schema/oracle-minfo.sql	Mon Feb 16 08:39:06 2015 +0100
+++ b/backend/doc/schema/oracle-minfo.sql	Mon Feb 16 09:00:08 2015 +0100
@@ -69,7 +69,6 @@
     uncertainty             DOUBLE PRECISION,
     data_gap                DOUBLE PRECISION,
     sounding_width          DOUBLE PRECISION,
-    width                   DOUBLE PRECISION,
     PRIMARY KEY(id),
     UNIQUE (station, bed_height_single_id),
     CONSTRAINT fk_bed_single_values_parent FOREIGN KEY (bed_height_single_id) REFERENCES bed_height_single(id) ON DELETE CASCADE
diff -r 17c476e90c07 -r 3a0522f1a532 backend/doc/schema/postgresql-minfo.sql
--- a/backend/doc/schema/postgresql-minfo.sql	Mon Feb 16 08:39:06 2015 +0100
+++ b/backend/doc/schema/postgresql-minfo.sql	Mon Feb 16 09:00:08 2015 +0100
@@ -69,7 +69,6 @@
     uncertainty             NUMERIC,
     data_gap                NUMERIC,
     sounding_width          NUMERIC,
-    width                   NUMERIC,
     PRIMARY KEY(id),
     UNIQUE (station, bed_height_single_id),
     CONSTRAINT fk_bed_single_values_parent FOREIGN KEY (bed_height_single_id) REFERENCES bed_height_single(id) ON DELETE CASCADE
diff -r 17c476e90c07 -r 3a0522f1a532 backend/src/main/java/org/dive4elements/river/importer/ImportBedHeightSingleValue.java
--- a/backend/src/main/java/org/dive4elements/river/importer/ImportBedHeightSingleValue.java	Mon Feb 16 08:39:06 2015 +0100
+++ b/backend/src/main/java/org/dive4elements/river/importer/ImportBedHeightSingleValue.java	Mon Feb 16 09:00:08 2015 +0100
@@ -32,7 +32,6 @@
     protected Double uncertainty;
     protected Double dataGap;
     protected Double soundingWidth;
-    protected Double width;
 
     protected BedHeightSingleValue peer;
 
@@ -43,8 +42,7 @@
         Double height,
         Double uncertainty,
         Double dataGap,
-        Double soundingWidth,
-        Double width
+        Double soundingWidth
     ) {
         this.bedHeight     = bedHeight;
         this.station       = station;
@@ -52,7 +50,6 @@
         this.uncertainty   = uncertainty;
         this.dataGap       = dataGap;
         this.soundingWidth = soundingWidth;
-        this.width         = width;
     }
 
 
@@ -76,8 +73,7 @@
                 "   height=:height and " +
                 "   uncertainty=:uncertainty and " +
                 "   dataGap=:dataGap and " +
-                "   soundingWidth=:soundingWidth and " +
-                "   width=:width");
+                "   soundingWidth=:soundingWidth");
 
             query.setParameter("bedHeight", bedHeight);
             query.setParameter("station", station);
@@ -85,7 +81,6 @@
             query.setParameter("uncertainty", uncertainty);
             query.setParameter("dataGap", dataGap);
             query.setParameter("soundingWidth", soundingWidth);
-            query.setParameter("width", width);
 
             List<BedHeightSingleValue> values = query.list();
             if (values.isEmpty()) {
@@ -95,8 +90,7 @@
                     height,
                     uncertainty,
                     dataGap,
-                    soundingWidth,
-                    width
+                    soundingWidth
                 );
                 session.save(peer);
             }
diff -r 17c476e90c07 -r 3a0522f1a532 backend/src/main/java/org/dive4elements/river/importer/parsers/BedHeightSingleParser.java
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/BedHeightSingleParser.java	Mon Feb 16 08:39:06 2015 +0100
+++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/BedHeightSingleParser.java	Mon Feb 16 09:00:08 2015 +0100
@@ -112,24 +112,13 @@
             }
         }
 
-        Double width = null;
-        if (values[5].length() > 0) {
-            try {
-                width = new Double(nf.parse(values[5]).doubleValue());
-            }
-            catch (ParseException e) {
-                log.warn("BSP: unparseable width " + values[5]);
-            }
-        }
-
         ImportBedHeightSingleValue value = new ImportBedHeightSingleValue(
             (ImportBedHeightSingle) obj,
             km,
             height,
             uncertainty,
             dataGap,
-            soundingWidth,
-            width);
+            soundingWidth);
 
         obj.addValue(value);
     }
diff -r 17c476e90c07 -r 3a0522f1a532 backend/src/main/java/org/dive4elements/river/model/BedHeightSingleValue.java
--- a/backend/src/main/java/org/dive4elements/river/model/BedHeightSingleValue.java	Mon Feb 16 08:39:06 2015 +0100
+++ b/backend/src/main/java/org/dive4elements/river/model/BedHeightSingleValue.java	Mon Feb 16 09:00:08 2015 +0100
@@ -11,7 +11,6 @@
 import java.util.List;
 
 import java.io.Serializable;
-//import java.math.BigDecimal;
 
 import javax.persistence.Entity;
 import javax.persistence.Id;
@@ -48,7 +47,6 @@
     private Double uncertainty;
     private Double dataGap;
     private Double soundingWidth;
-    private Double width;
 
 
     public BedHeightSingleValue() {
@@ -60,8 +58,7 @@
         Double height,
         Double uncertainty,
         Double dataGap,
-        Double soundingWidth,
-        Double width
+        Double soundingWidth
     ) {
         this.bedHeight     = bedHeight;
         this.station       = station;
@@ -69,7 +66,6 @@
         this.uncertainty   = uncertainty;
         this.dataGap       = dataGap;
         this.soundingWidth = soundingWidth;
-        this.width         = width;
     }
 
     @Id
@@ -136,25 +132,14 @@
     }
 
     @Column(name="sounding_width")
-    //    public BigDecimal getSoundingWidth() {
     public Double getSoundingWidth() {
         return soundingWidth;
     }
 
-    //public void setSoundingWidth(BigDecimal soundingWidth) {
     public void setSoundingWidth(Double soundingWidth) {
         this.soundingWidth = soundingWidth;
     }
 
-    @Column(name="width")
-    public Double getWidth() {
-        return width;
-    }
-
-    public void setWidth(Double width) {
-        this.width = width;
-    }
-
 
     public static List<BedHeightSingleValue> getBedHeightSingleValues(
         BedHeightSingle single,


More information about the Dive4Elements-commits mailing list