changeset 7994:3c1a16755e61 facet-metadata

Add meta data to middle bed height CSV export.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 02 Jul 2014 14:42:43 +0200
parents 150d71261cad
children 2f88a98d9aae
files 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
diffstat 5 files changed, 80 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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");
--- 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
--- 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)
--- 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)
--- 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

http://dive4elements.wald.intevation.org