[PATCH 2 of 2] Add meta data to middle bed height CSV export

Wald Commits scm-commit at wald.intevation.org
Wed Jul 2 14:43:51 CEST 2014


# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1404304963 -7200
# Branch facet-metadata
# Node ID 3c1a16755e61878118bf1ac14c9fc1d70b55bedb
# Parent  150d71261cade764f9a681bcc9f1e1f4045cd805
Add meta data to middle bed height CSV export.

diff -r 150d71261cad -r 3c1a16755e61 artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightExporter.java	Wed Jul 02 14:42:07 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightExporter.java	Wed Jul 02 14:42:43 2014 +0200
@@ -63,6 +63,29 @@
     public static final String CSV_LOCATIONS =
         "export.bedheight_middle.csv.header.locations";
 
+    public static final String CSV_META_YEAR =
+        "export.bedheight_middle.csv.header.year";
+
+    public static final String CSV_META_TYPE =
+        "export.bedheight_middle.csv.header.type";
+
+    public static final String CSV_META_CUR_ELEV_MODEL =
+        "export.bedheight_middle.csv.header.cur.elevation";
+
+    public static final String CSV_META_OLD_ELEV_MODEL =
+        "export.bedheight_middle.csv.header.old.elevation";
+
+    public static final String CSV_META_SOUNDING_WIDTH =
+        "export.bedheight_middle.csv.header.sounding.width";
+
+    public static final String CSV_META_RANGE =
+        "export.bedheight_middle.csv.header.range";
+
+    public static final String CSV_META_LOC_SYSTEM =
+        "export.bedheight_middle.csv.header.location.system";
+
+    public static final String CSV_META_EVAL_BY =
+        "export.bedheight_middle.csv.header.evalby";
 
     protected List<MiddleBedHeightData> data;
 
@@ -90,7 +113,6 @@
         logger.info("MiddleBedHeightExporter.writeCSVData");
         logger.debug("CSV gets " + data.size() + " MiddleBedHeightData objects.");
 
-        writeCSVHeader(writer);
 
         Collections.sort(data);
 
@@ -121,6 +143,10 @@
 
         D4EArtifact flys = (D4EArtifact) master;
 
+        writeMetaData(writer, data);
+
+        writeCSVHeader(writer);
+
         NumberFormat kmF     = Formatter.getMiddleBedHeightKM(context);
         NumberFormat heightF = Formatter.getMiddleBedHeightHeight(context);
         NumberFormat uncertF = Formatter.getMiddleBedHeightUncert(context);
@@ -176,6 +202,27 @@
     }
 
 
+    private void writeMetaData(CSVWriter writer, MiddleBedHeightData data) {
+         writer.writeNext(new String[]{"#"});
+         writer.writeNext(new String[]{"# " + msg(CSV_META_YEAR) +
+             ": " + data.getStartYear()});
+         writer.writeNext(new String[]{"# " + msg(CSV_META_TYPE) +
+             ": " + data.getType()});
+         writer.writeNext(new String[]{"# " + msg(CSV_META_LOC_SYSTEM) +
+             ": " + data.getLocationSystem()});
+         writer.writeNext(new String[]{"# " + msg(CSV_META_CUR_ELEV_MODEL) +
+             ": " + data.getCurElevationModel()});
+         writer.writeNext(new String[]{"# " + msg(CSV_META_OLD_ELEV_MODEL) +
+             ": " + data.getOldElevationModel()});
+         writer.writeNext(new String[]{"# " + msg(CSV_META_SOUNDING_WIDTH) +
+             ": " + data.getSoundingWidth()});
+         writer.writeNext(new String[]{"# " + msg(CSV_META_RANGE) +
+             ": " + data.getStations().min() + " - " + data.getStations().max()});
+         writer.writeNext(new String[]{"# " + msg(CSV_META_EVAL_BY) +
+             ": " + data.getEvaluatedBy()});
+         writer.writeNext(new String[]{"#"});
+    }
+
     @Override
     protected void writePDF(OutputStream out) {
         logger.error("TODO: Implement FlowVelocityExporter.writePDF");
diff -r 150d71261cad -r 3c1a16755e61 artifacts/src/main/resources/messages.properties
--- a/artifacts/src/main/resources/messages.properties	Wed Jul 02 14:42:07 2014 +0200
+++ b/artifacts/src/main/resources/messages.properties	Wed Jul 02 14:42:43 2014 +0200
@@ -415,6 +415,14 @@
 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.bedheight_middle.csv.header.year = Year
+export.bedheight_middle.csv.header.type = Type
+export.bedheight_middle.csv.header.cur.elevation = Current elevation model
+export.bedheight_middle.csv.header.old.elevation = Old elevation model
+export.bedheight_middle.csv.header.sounding.width = Sounding width
+export.bedheight_middle.csv.header.range = Range
+export.bedheight_middle.csv.header.location.system = Location system
+export.bedheight_middle.csv.header.evalby = Evaluated by
 export.sedimentload_ls.csv.header.km = km
 export.sedimentload_ls.csv.header.year = year
 export.sedimentload_ls.csv.header.coarse = coarse
diff -r 150d71261cad -r 3c1a16755e61 artifacts/src/main/resources/messages_de.properties
--- a/artifacts/src/main/resources/messages_de.properties	Wed Jul 02 14:42:07 2014 +0200
+++ b/artifacts/src/main/resources/messages_de.properties	Wed Jul 02 14:42:43 2014 +0200
@@ -416,6 +416,14 @@
 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.bedheight_middle.csv.header.year = Jahr
+export.bedheight_middle.csv.header.type = Aufnahmeart
+export.bedheight_middle.csv.header.cur.elevation = H\u00f6hensystem
+export.bedheight_middle.csv.header.old.elevation = urspr\u00fcngliches H\u00f6hensystem
+export.bedheight_middle.csv.header.sounding.width = ausgewertete Peilbreite
+export.bedheight_middle.csv.header.range = Strecke
+export.bedheight_middle.csv.header.location.system = Lagesystem
+export.bedheight_middle.csv.header.evalby = Auswerter
 export.sedimentload_ls.csv.header.km = km
 export.sedimentload_ls.csv.header.year = Jahr
 export.sedimentload_ls.csv.header.coarse = Kies(g)
diff -r 150d71261cad -r 3c1a16755e61 artifacts/src/main/resources/messages_de_DE.properties
--- a/artifacts/src/main/resources/messages_de_DE.properties	Wed Jul 02 14:42:07 2014 +0200
+++ b/artifacts/src/main/resources/messages_de_DE.properties	Wed Jul 02 14:42:43 2014 +0200
@@ -413,6 +413,14 @@
 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.bedheight_middle.csv.header.year = Jahr
+export.bedheight_middle.csv.header.type = Aufnahmeart
+export.bedheight_middle.csv.header.cur.elevation = H\u00f6hensystem
+export.bedheight_middle.csv.header.old.elevation = urspr\u00fcngliches H\u00f6hensystem
+export.bedheight_middle.csv.header.sounding.width = ausgewertete Peilbreite
+export.bedheight_middle.csv.header.range = Strecke
+export.bedheight_middle.csv.header.location.system = Lagesystem
+export.bedheight_middle.csv.header.evalby = Auswerter
 export.sedimentload_ls.csv.header.km = km
 export.sedimentload_ls.csv.header.year = Jahr
 export.sedimentload_ls.csv.header.coarse = Kies(g)
diff -r 150d71261cad -r 3c1a16755e61 artifacts/src/main/resources/messages_en.properties
--- a/artifacts/src/main/resources/messages_en.properties	Wed Jul 02 14:42:07 2014 +0200
+++ b/artifacts/src/main/resources/messages_en.properties	Wed Jul 02 14:42:43 2014 +0200
@@ -418,6 +418,14 @@
 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.bedheight_middle.csv.header.year = Year
+export.bedheight_middle.csv.header.type = Type
+export.bedheight_middle.csv.header.cur.elevation = Current elevation model
+export.bedheight_middle.csv.header.old.elevation = Old elevation model
+export.bedheight_middle.csv.header.sounding.width = Sounding width
+export.bedheight_middle.csv.header.range = Range
+export.bedheight_middle.csv.header.location.system = Location system
+export.bedheight_middle.csv.header.evalby = Evaluated by
 export.sedimentload_ls.csv.header.km = km
 export.sedimentload_ls.csv.header.year = year
 export.sedimentload_ls.csv.header.coarse = coarse


More information about the Dive4Elements-commits mailing list