changeset 8560:6fcf4717605f

Meta-data on sounding width associated to bed heights is redundant to real data associated to values.
author "Tom Gottfried <tom@intevation.de>"
date Mon, 16 Feb 2015 11:48:05 +0100
parents 6d8d7425a6b5
children 2b3c8ea6cbee
files artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/MiddleBedHeightCalculation.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/MiddleBedHeightData.java artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightExporter.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 backend/doc/schema/oracle-minfo.sql backend/doc/schema/postgresql-minfo.sql backend/src/main/java/org/dive4elements/river/importer/ImportBedHeight.java backend/src/main/java/org/dive4elements/river/importer/parsers/BedHeightParser.java backend/src/main/java/org/dive4elements/river/model/BedHeight.java backend/src/main/java/org/dive4elements/river/model/BedHeightValue.java
diffstat 12 files changed, 3 insertions(+), 68 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/MiddleBedHeightCalculation.java	Mon Feb 16 11:08:33 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/MiddleBedHeightCalculation.java	Mon Feb 16 11:48:05 2015 +0100
@@ -127,8 +127,7 @@
             oldElevModel,
             riverElevModel,
             type,
-            locationSystem,
-            single.getSoundingWidth());
+            locationSystem);
 
         for (BedHeightValue value: values) {
             if (value.getHeight() != null) {
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/MiddleBedHeightData.java	Mon Feb 16 11:08:33 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/MiddleBedHeightData.java	Mon Feb 16 11:48:05 2015 +0100
@@ -40,7 +40,6 @@
     private TDoubleArrayList dataGap;
     private String type;
     private String locationSystem;
-    private Integer soundWidth;
     private String oldElevationModel;
     private String curElevationModel;
     private String riverElevationModel;
@@ -50,7 +49,7 @@
     protected MiddleBedHeightData(int year, int end, String eval, String desc,
         String curElevationModel, String oldElevationModel,
         String riverElevationModel, String type,
-        String locationSystem, Integer soundingWidth) {
+        String locationSystem) {
         this.year   = year;
         this.evaluatedBy = eval;
         this.description = desc;
@@ -59,7 +58,6 @@
         this.riverElevationModel = riverElevationModel;
         this.type = type;
         this.locationSystem = locationSystem;
-        this.soundWidth = soundingWidth;
 
         this.km            = new TDoubleArrayList();
         this.middleHeight  = new TDoubleArrayList();
@@ -112,9 +110,6 @@
         return this.locationSystem;
     }
 
-    public String getSoundingWidth() {
-        return this.soundWidth.toString();
-    }
     protected void addKM(double km) {
         this.km.add(km);
     }
--- a/artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightExporter.java	Mon Feb 16 11:08:33 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightExporter.java	Mon Feb 16 11:48:05 2015 +0100
@@ -75,9 +75,6 @@
     public static final String CSV_META_RIVER_ELEV_MODEL =
         "meta.bedheight.river.elevation";
 
-    public static final String CSV_META_SOUNDING_WIDTH =
-        "meta.bedheight.sounding.width";
-
     public static final String CSV_META_RANGE =
         "meta.bedheight.range";
 
@@ -197,7 +194,6 @@
                      data.getOldElevationModel(),
                  msg(CSV_META_RIVER_ELEV_MODEL) + ": " +
                      data.getRiverElevationModel(),
-                 msg(CSV_META_SOUNDING_WIDTH) + ": " + data.getSoundingWidth(),
                  msg(CSV_META_RANGE) + ": " + data.getStations().min() +
                      " - " + data.getStations().max(),
                  msg(CSV_META_EVAL_BY) + ": " + data.getEvaluatedBy()
--- a/artifacts/src/main/resources/messages.properties	Mon Feb 16 11:08:33 2015 +0100
+++ b/artifacts/src/main/resources/messages.properties	Mon Feb 16 11:48:05 2015 +0100
@@ -230,7 +230,6 @@
 meta.bedheight.type = Type
 meta.bedheight.cur.elevation = Current elevation model
 meta.bedheight.old.elevation = Old elevation model
-meta.bedheight.sounding.width = Sounding width
 meta.bedheight.range = Range
 meta.bedheight.location.system = Location system
 meta.bedheight.evalby = Evaluated by
--- a/artifacts/src/main/resources/messages_de.properties	Mon Feb 16 11:08:33 2015 +0100
+++ b/artifacts/src/main/resources/messages_de.properties	Mon Feb 16 11:48:05 2015 +0100
@@ -230,7 +230,6 @@
 meta.bedheight.type = Aufnahmeart
 meta.bedheight.cur.elevation = H\u00f6hensystem
 meta.bedheight.old.elevation = urspr\u00fcngliches H\u00f6hensystem
-meta.bedheight.sounding.width = ausgewertete Peilbreite
 meta.bedheight.range = Strecke
 meta.bedheight.location.system = Lagesystem
 meta.bedheight.evalby = Auswerter
--- a/artifacts/src/main/resources/messages_de_DE.properties	Mon Feb 16 11:08:33 2015 +0100
+++ b/artifacts/src/main/resources/messages_de_DE.properties	Mon Feb 16 11:48:05 2015 +0100
@@ -228,7 +228,6 @@
 meta.bedheight.type = Aufnahmeart
 meta.bedheight.cur.elevation = H\u00f6hensystem
 meta.bedheight.old.elevation = urspr\u00fcngliches H\u00f6hensystem
-meta.bedheight.sounding.width = ausgewertete Peilbreite
 meta.bedheight.range = Strecke
 meta.bedheight.location.system = Lagesystem
 meta.bedheight.evalby = Auswerter
--- a/artifacts/src/main/resources/messages_en.properties	Mon Feb 16 11:08:33 2015 +0100
+++ b/artifacts/src/main/resources/messages_en.properties	Mon Feb 16 11:48:05 2015 +0100
@@ -232,7 +232,6 @@
 meta.bedheight.type = Type
 meta.bedheight.cur.elevation = Current elevation model
 meta.bedheight.old.elevation = Old elevation model
-meta.bedheight.sounding.width = Sounding width
 meta.bedheight.range = Range
 meta.bedheight.location.system = Location system
 meta.bedheight.evalby = Evaluated by
--- a/backend/doc/schema/oracle-minfo.sql	Mon Feb 16 11:08:33 2015 +0100
+++ b/backend/doc/schema/oracle-minfo.sql	Mon Feb 16 11:48:05 2015 +0100
@@ -41,7 +41,6 @@
     id                      NUMBER(38,0) NOT NULL,
     river_id                NUMBER(38,0) NOT NULL,
     year                    NUMBER(38,0),
-    sounding_width          NUMBER(38,0),
     type_id                 NUMBER(38,0) NOT NULL,
     location_system_id      NUMBER(38,0) NOT NULL,
     cur_elevation_model_id  NUMBER(38,0) NOT NULL,
--- a/backend/doc/schema/postgresql-minfo.sql	Mon Feb 16 11:08:33 2015 +0100
+++ b/backend/doc/schema/postgresql-minfo.sql	Mon Feb 16 11:48:05 2015 +0100
@@ -41,7 +41,6 @@
     id                      int NOT NULL,
     river_id                int NOT NULL,
     year                    int,
-    sounding_width          int,
     type_id                 int NOT NULL,
     location_system_id      int NOT NULL,
     cur_elevation_model_id  int NOT NULL,
--- a/backend/src/main/java/org/dive4elements/river/importer/ImportBedHeight.java	Mon Feb 16 11:08:33 2015 +0100
+++ b/backend/src/main/java/org/dive4elements/river/importer/ImportBedHeight.java	Mon Feb 16 11:48:05 2015 +0100
@@ -28,7 +28,6 @@
     private static Logger log = Logger.getLogger(ImportBedHeight.class);
 
     protected Integer year;
-    protected int soundingWidth;
 
     protected String evaluationBy;
     protected String description;
@@ -67,10 +66,6 @@
         // do nothing
     }
 
-    public void setSoundingWidth(int soundingWidth) {
-        this.soundingWidth = soundingWidth;
-    }
-
     public void setEvaluationBy(String evaluationBy) {
         this.evaluationBy = evaluationBy;
     }
@@ -161,13 +156,12 @@
 
             Query query = session.createQuery(
                 "from BedHeight where " +
-                "river=:river and year=:year and soundingWidth=:soundingWidth " +
+                "river=:river and year=:year " +
                 "and type=:type and locationSystem=:locationSystem and " +
                 "curElevationModel=:curElevationModel and range=:range");
 
             query.setParameter("river", river);
             query.setParameter("year", year);
-            query.setParameter("soundingWidth", soundingWidth);
             query.setParameter("type", theType);
             query.setParameter("locationSystem", locationSystem.getPeer());
             query.setParameter("curElevationModel", theCurModel);
@@ -180,7 +174,6 @@
                 peer = new BedHeight(
                     river,
                     year,
-                    soundingWidth,
                     theType,
                     locationSystem.getPeer(),
                     theCurModel,
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/BedHeightParser.java	Mon Feb 16 11:08:33 2015 +0100
+++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/BedHeightParser.java	Mon Feb 16 11:48:05 2015 +0100
@@ -74,9 +74,6 @@
     public static final Pattern META_OLD_ELEVATION_SYSTEM =
         Pattern.compile("^urspr.ngliches H.hensystem:\\s(\\w++) (.* )??\\[(.*)\\].*");
 
-    public static final Pattern META_SOUNDING_WIDTH =
-        Pattern.compile("^ausgewertete Peilbreite: (\\d*).*");
-
     public static final Pattern META_RANGE =
         Pattern.compile("^Strecke:\\D*(\\d++.?\\d*) ?- ?(\\d++.?\\d*).*");
 
@@ -171,9 +168,6 @@
         else if (handleMetaTimeInterval(obj, meta)) {
             return;
         }
-        else if (handleMetaSoundingWidth(obj, meta)) {
-            return;
-        }
         else if (handleMetaComment(obj, meta)) {
             return;
         }
@@ -248,28 +242,6 @@
     }
 
 
-    protected boolean handleMetaSoundingWidth(ImportBedHeight obj, String line) {
-        Matcher m = META_SOUNDING_WIDTH.matcher(line);
-
-        if (m.matches()) {
-            String tmp = m.group(1);
-
-            try {
-                obj.setSoundingWidth(Integer.valueOf(tmp));
-                return true;
-            }
-            catch (NumberFormatException e) {
-                log.warn("BHP: Could not parse sounding width in line '" + line +
-                    "'. -> Set default value '0'");
-            }
-            obj.setSoundingWidth(0);
-            return true;
-        }
-
-        return false;
-    }
-
-
     protected boolean handleMetaComment(ImportBedHeight obj, String line) {
         Matcher m = META_COMMENTS.matcher(line);
 
--- a/backend/src/main/java/org/dive4elements/river/model/BedHeight.java	Mon Feb 16 11:08:33 2015 +0100
+++ b/backend/src/main/java/org/dive4elements/river/model/BedHeight.java	Mon Feb 16 11:48:05 2015 +0100
@@ -36,7 +36,6 @@
 
     private Integer id;
     private Integer year;
-    private Integer soundingWidth;
 
     private String evaluationBy;
     private String description;
@@ -63,7 +62,6 @@
     public BedHeight(
         River          river,
         Integer        year,
-        Integer        soundingWidth,
         BedHeightType  type,
         LocationSystem locationSystem,
         ElevationModel curElevationModel,
@@ -72,7 +70,6 @@
         this(
             river,
             year,
-            soundingWidth,
             type,
             locationSystem,
             curElevationModel,
@@ -86,7 +83,6 @@
     public BedHeight(
         River          river,
         Integer        year,
-        Integer        soundingWidth,
         BedHeightType  type,
         LocationSystem locationSystem,
         ElevationModel curElevationModel,
@@ -97,7 +93,6 @@
     ) {
         this.river             = river;
         this.year              = year;
-        this.soundingWidth     = soundingWidth;
         this.type              = type;
         this.locationSystem    = locationSystem;
         this.curElevationModel = curElevationModel;
@@ -144,15 +139,6 @@
         this.year = year;
     }
 
-    @Column(name = "sounding_width")
-    public Integer getSoundingWidth() {
-        return soundingWidth;
-    }
-
-    public void setSoundingWidth(Integer soundingWidth) {
-        this.soundingWidth = soundingWidth;
-    }
-
     @OneToOne
     @JoinColumn(name = "type_id")
     public BedHeightType getType() {

http://dive4elements.wald.intevation.org