[Dive4elements-commits] [PATCH] Write some more metadata in AT-export header
Wald Commits
scm-commit at wald.intevation.org
Thu Jan 31 14:11:54 CET 2013
# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1359637894 -3600
# Node ID b878dce3a67166414e17c00046c8e510236a177b
# Parent ce7d8e2a7e020e0d702fef151ca7e8b54dca1585
Write some more metadata in AT-export header.
diff -r ce7d8e2a7e02 -r b878dce3a671 flys-artifacts/src/main/java/de/intevation/flys/exports/ATExporter.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ATExporter.java Thu Jan 31 13:20:05 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ATExporter.java Thu Jan 31 14:11:34 2013 +0100
@@ -3,6 +3,7 @@
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.IOException;
+import java.util.List;
import org.w3c.dom.Document;
@@ -19,6 +20,9 @@
import de.intevation.flys.artifacts.model.WQ;
import de.intevation.flys.collections.FLYSArtifactCollection;
+import de.intevation.flys.model.Gauge;
+import de.intevation.flys.model.River;
+import de.intevation.flys.model.TimeInterval;
import de.intevation.flys.utils.FLYSUtils;
import de.intevation.flys.artifacts.access.RangeAccess;
@@ -83,15 +87,21 @@
throw new IOException(iae);
}
- String river = FLYSUtils.getRiver(master).getName();
+ River river = FLYSUtils.getRiver(master);
RangeAccess rangeAccess = new RangeAccess(master, context);
double[] kms = rangeAccess.getLocations();
+ Gauge gauge = river.determineGaugeByPosition(kms[0]);
+ TimeInterval interval =
+ gauge.fetchMasterDischargeTable().getTimeInterval();
at.write(
new OutputStreamWriter(out, DEFAULT_ENCODING),
context.getMeta(),
- river,
- kms[0]);
+ river.getName(),
+ kms[0],
+ gauge.getName(),
+ gauge.getDatum(),
+ interval.getStartTime());
}
diff -r ce7d8e2a7e02 -r b878dce3a671 flys-artifacts/src/main/java/de/intevation/flys/exports/ATWriter.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ATWriter.java Thu Jan 31 13:20:05 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ATWriter.java Thu Jan 31 14:11:34 2013 +0100
@@ -3,7 +3,11 @@
import java.io.IOException;
import java.io.Writer;
import java.io.PrintWriter;
+import java.math.BigDecimal;
+import java.text.DateFormat;
+import java.util.Calendar;
+import java.util.Date;
import java.util.Locale;
import de.intevation.artifacts.CallMeta;
@@ -109,25 +113,36 @@
PrintWriter out,
CallMeta callMeta,
String river,
- double km
+ double km,
+ String gName,
+ BigDecimal datum,
+ Date date
) {
+ DateFormat f = DateFormat.getDateInstance();
out.print(Resources.getMsg(
callMeta,
I18N_AT_HEADER,
I18N_AT_HEADER,
- new Object[] { river, km } ));
+ new Object[] { river, gName, f.format(date), datum } ));
out.print("\r\n");
}
- public void write(Writer writer, CallMeta meta, String river, double km)
+ public void write(
+ Writer writer,
+ CallMeta meta,
+ String river,
+ double km,
+ String gName,
+ BigDecimal datum,
+ Date date)
throws IOException
{
PrintWriter out = new PrintWriter(writer);
// a header is required, because the desktop version of FLYS will skip
// the first row.
- printHeader(out, meta, river, km);
+ printHeader(out, meta, river, km, gName, datum, date);
double rest = (minW * 100.0) % 10.0;
diff -r ce7d8e2a7e02 -r b878dce3a671 flys-artifacts/src/main/resources/messages_de.properties
--- a/flys-artifacts/src/main/resources/messages_de.properties Thu Jan 31 13:20:05 2013 +0100
+++ b/flys-artifacts/src/main/resources/messages_de.properties Thu Jan 31 14:11:34 2013 +0100
@@ -314,7 +314,7 @@
export.discharge.longitudinal.section.csv.header.w = W [NN + m]
export.discharge.longitudinal.section.csv.header.cw = W korr.
export.discharge.longitudinal.section.csv.header.q = Q [m\u00b3/s]
-export.discharge.curve.at.header = Berechnete Abflusskurve f\u00fcr {0} {0}-km: {1}
+export.discharge.curve.at.header = Abflusstafel f\u00fcr {1}/{0} ab {2} PNP[NN+m] = {3}
export.historical.discharge.csv.header.timerange = Zeitraum
export.historical.discharge.csv.header.waterlevel = Wasserstand [cm]
export.historical.discharge.csv.header.discharge = Abfluss [m\u00b3/s]
diff -r ce7d8e2a7e02 -r b878dce3a671 flys-artifacts/src/main/resources/messages_de_DE.properties
--- a/flys-artifacts/src/main/resources/messages_de_DE.properties Thu Jan 31 13:20:05 2013 +0100
+++ b/flys-artifacts/src/main/resources/messages_de_DE.properties Thu Jan 31 14:11:34 2013 +0100
@@ -323,7 +323,7 @@
export.discharge.longitudinal.section.csv.header.w = W [NN + m]
export.discharge.longitudinal.section.csv.header.cw = W korr.
export.discharge.longitudinal.section.csv.header.q = Q [m\u00b3/s]
-export.discharge.curve.at.header = Berechnete Abflusskurve f\u00fcr {0} {0}-km: {1}
+export.discharge.curve.at.header = Abflusstafel f\u00fcr {1}/{0} ab {2} PNP[NN+m] = {3}
export.historical.discharge.csv.header.timerange = Zeitraum
export.historical.discharge.csv.header.waterlevel = Wasserstand [cm]
export.historical.discharge.csv.header.discharge = Abfluss [m\u00b3/s]
diff -r ce7d8e2a7e02 -r b878dce3a671 flys-artifacts/src/main/resources/messages_en.properties
--- a/flys-artifacts/src/main/resources/messages_en.properties Thu Jan 31 13:20:05 2013 +0100
+++ b/flys-artifacts/src/main/resources/messages_en.properties Thu Jan 31 14:11:34 2013 +0100
@@ -326,7 +326,7 @@
export.discharge.longitudinal.section.csv.header.w = W [NN + m]
export.discharge.longitudinal.section.csv.header.cw = W corr.
export.discharge.longitudinal.section.csv.header.q = Q [m\u00b3/s]
-export.discharge.curve.at.header = Computed Discharge Curve for {0} {0}-km: {1}
+export.discharge.curve.at.header = Dischargetable for {1}/{0} since {2} Datum[NN+m] = {3}
export.historical.discharge.csv.header.timerange = Timerange
export.historical.discharge.csv.header.waterlevel = Waterlevel [cm]
export.historical.discharge.csv.header.discharge = Discharge [m\u00b3/s]
More information about the Dive4elements-commits
mailing list