Mercurial > dive4elements > river
changeset 6616:03cc3bc74964
Merged.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 19 Jul 2013 06:56:30 +0200 |
parents | 61dc90b2fbe2 (current diff) 764371d4db6a (diff) |
children | 67b4728723df |
files | |
diffstat | 6 files changed, 83 insertions(+), 47 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgtags Thu Jul 18 15:44:31 2013 +0200 +++ b/.hgtags Fri Jul 19 06:56:30 2013 +0200 @@ -59,3 +59,4 @@ 0000000000000000000000000000000000000000 3.0.10 0000000000000000000000000000000000000000 3.0.10 bfcb513c1fdace07ce39616bc9fda3899e8ee914 3.0.10 +63baa1873b1f86a78ab10d19ae4221ec01cc75a2 3.0.11
--- a/artifacts/doc/conf/datacage.sql Thu Jul 18 15:44:31 2013 +0200 +++ b/artifacts/doc/conf/datacage.sql Fri Jul 19 06:56:30 2013 +0200 @@ -41,7 +41,7 @@ artifact_id INT NOT NULL REFERENCES artifacts(id) ON DELETE CASCADE, kind VARCHAR(256) NOT NULL, k VARCHAR(256) NOT NULL, - v VARCHAR(256), -- Maybe too short + v TEXT, UNIQUE (artifact_id, k) );
--- a/artifacts/src/main/java/org/dive4elements/river/exports/WaterlevelExporter.java Thu Jul 18 15:44:31 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/WaterlevelExporter.java Fri Jul 19 06:56:30 2013 +0200 @@ -393,14 +393,14 @@ if (first > last) { for (int i = wqkms.size() - 1; i >= 0; i--) { dp = wqkms.get(i, dp); - if (dp[2] < first && dp[2] > last) { + if (dp[2] <= first + 1E-5 && dp[2] > last - 1E-5) { filtered.add(dp[0], dp[1], dp[2]); } } } else { for (int i = 0; i < wqkms.size(); i++) { dp = wqkms.get(i, dp); - if (dp[2] < last && dp[2] > first) { + if (dp[2] < last + 1E-5 && dp[2] > first - 1E-5) { filtered.add(dp[0], dp[1], dp[2]); } } @@ -591,13 +591,12 @@ NumberFormat kmf = getKmFormatter(); NumberFormat wf = getWFormatter(); NumberFormat qf = getQFormatter(); - - writer.writeNext(new String[] { - kmf.format(wqkm[2]), - wf.format(wqkm[0]), - qf.format(wqkm[1]), - RiverUtils.getLocationDescription(flys, wqkm[2]) - }); + writer.writeNext(new String[] { + kmf.format(wqkm[2]), + wf.format(wqkm[0]), + qf.format(wqkm[1]), + RiverUtils.getLocationDescription(flys, wqkm[2]) + }); } @@ -618,6 +617,38 @@ }); } + private String getDesc(WQKms wqkms, boolean isQ) + { + D4EArtifact flys = (D4EArtifact) master; + String colDesc = ""; + + if (flys instanceof WINFOArtifact && isQ) { + colDesc = getCSVRowTitle((WINFOArtifact)flys, wqkms); + } + else if (!isQ) { + Double value = RiverUtils.getValueFromWQ(wqkms); + colDesc = (value != null) ? + Formatter.getWaterlevelW(context).format(value) : null; + } + + if (flys instanceof WINFOArtifact) { + if (wqkms != null && wqkms.getRawValue() != null) { + WINFOArtifact winfo = (WINFOArtifact) flys; + colDesc = RiverUtils.getNamedMainValue(winfo, wqkms.getRawValue()); + // For 'W am Pegel' s + if (colDesc == null) { + colDesc = ((D4EArtifact)master).getDataAsString("wq_single"); + } + } + } + if (colDesc != null) { + /* Quick hack. Can be removed when database strings are + * adapted or left in here as it should never be harmful. */ + colDesc = colDesc.replace("Amtl.Festlegung_", "Amtl. "); + } + + return colDesc == null ? "" : colDesc; + } /** * Write "rows" of csv data from wqkms with writer. @@ -650,35 +681,16 @@ String notinrange = msg( CSV_NOT_IN_GAUGE_RANGE, DEFAULT_CSV_NOT_IN_GAUGE_RANGE); + List<Segment> segments = null; + boolean isFixRealize = false; double a = gauge.getRange().getA().doubleValue(); double b = gauge.getRange().getB().doubleValue(); - - if (flys instanceof WINFOArtifact && isQ) { - desc = getCSVRowTitle((WINFOArtifact)flys, wqkms); - } - else if (!isQ) { - Double value = RiverUtils.getValueFromWQ(wqkms); - desc = value != null - ? Formatter.getWaterlevelW(context).format(value) : null; - } - long startTime = System.currentTimeMillis(); - String colDesc = desc; - List<Segment> segments = null; - boolean isFixRealize = false; - if (flys instanceof WINFOArtifact) { - if (wqkms != null && wqkms.getRawValue() != null) { - WINFOArtifact winfo = (WINFOArtifact) flys; - colDesc = RiverUtils.getNamedMainValue(winfo, wqkms.getRawValue()); - // For 'W am Pegel' s - if (colDesc == null) { - colDesc = ((D4EArtifact)master).getDataAsString("wq_single"); - } - } - } - else if (flys instanceof FixationArtifact) { + desc = getDesc(wqkms, isQ); + + if (flys instanceof FixationArtifact) { // Get W/Q input per gauge for this case. FixRealizingAccess fixAccess = new FixRealizingAccess(flys); segments = fixAccess.getSegments(); @@ -708,7 +720,7 @@ : findSegment(km, segments); if (found != null) { - colDesc = nf.format(found.getValues()[0]); + desc = nf.format(found.getValues()[0]); } lastSegment = found; } @@ -729,7 +741,7 @@ ? gaugeName : notinrange; } - writeRow6(writer, result, colDesc, flys, gaugeN); + writeRow6(writer, result, desc, flys, gaugeN); } } else { // Not at gauge. @@ -855,12 +867,38 @@ boolean atGauge = mode == WQ_MODE.QGAUGE || mode == WQ_MODE.WGAUGE; boolean isQ = mode == WQ_MODE.QGAUGE || mode == WQ_MODE.QFREE; + Double first = Double.NaN; + Double last = Double.NaN; + addMetaData(source); for (WQKms[] tmp: data) { for (WQKms wqkms: tmp) { addWKmsData(wqkms, atGauge, isQ, source); + double[] firstLast = wqkms.getFirstLastKM(); + if (first.isNaN()) { + /* Initialize */ + first = firstLast[0]; + last = firstLast[1]; + } + if (firstLast[0] > firstLast[1]) { + /* Calculating upstream we assert that it is + * impossible that the direction changes during this + * loop */ + first = Math.max(first, firstLast[0]); + last = Math.min(last, firstLast[1]); + } else if (firstLast[0] < firstLast[1]) { + first = Math.min(first, firstLast[0]); + last = Math.max(last, firstLast[1]); + } else { + first = last = firstLast[0]; + } } } + + /* Append the official fixing at the bottom */ + for (WQKms wqkms: officalFixings) { + addWKmsData(filterWQKms(wqkms, first, last), atGauge, isQ, source); + } return source; } @@ -919,15 +957,7 @@ double a = gauge.getRange().getA().doubleValue(); double b = gauge.getRange().getB().doubleValue(); - if (flys instanceof WINFOArtifact && isQ) { - desc = getCSVRowTitle((WINFOArtifact)flys, wqkms); - } - else if (!isQ) { - Double value = RiverUtils.getValueFromWQ(wqkms); - desc = value != null - ? Formatter.getWaterlevelW(context).format(value) : null; - } - + desc = getDesc(wqkms, isQ); long startTime = System.currentTimeMillis(); for (int i = 0; i < size; i ++) {
--- a/artifacts/src/main/resources/messages_de.properties Thu Jul 18 15:44:31 2013 +0200 +++ b/artifacts/src/main/resources/messages_de.properties Fri Jul 19 06:56:30 2013 +0200 @@ -330,7 +330,7 @@ export.waterlevel.csv.meta.gauge = # Bezugspegel: {0} export.waterlevel.csv.meta.q = # Q (m\u00b3/s): {0} export.waterlevel.csv.meta.w = # W (NN + m): {0} - {1} -export.waterlevel.csv.not.in.gauge.range = au\u00dferhalb gew\u00e4hlter Bezugspegels +export.waterlevel.csv.not.in.gauge.range = au\u00dferh. d. Bez.pegels export.computed.discharge.curve.csv.header.w = W [{0}] export.computed.discharge.curve.csv.header.q = Q [m\u00b3/s] export.duration.curve.csv.header.duration = D [Tagen]
--- a/artifacts/src/main/resources/messages_de_DE.properties Thu Jul 18 15:44:31 2013 +0200 +++ b/artifacts/src/main/resources/messages_de_DE.properties Fri Jul 19 06:56:30 2013 +0200 @@ -328,7 +328,7 @@ export.waterlevel.csv.meta.gauge = # Bezugspegel: {0} export.waterlevel.csv.meta.q = # Q (m\u00b3/s): {0} export.waterlevel.csv.meta.w = # W (NN + m): {0} - {1} -export.waterlevel.csv.not.in.gauge.range = au\u00dferhalb gew\u00e4hlter Bezugspegels +export.waterlevel.csv.not.in.gauge.range = au\u00dferh. d. Bez.pegels export.computed.discharge.curve.csv.header.w = W [{0}] export.computed.discharge.curve.csv.header.q = Q [m\u00b3/s] export.duration.curve.csv.header.duration = D [Tagen]
--- a/contrib/make_flys_release/make_release.sh Thu Jul 18 15:44:31 2013 +0200 +++ b/contrib/make_flys_release/make_release.sh Fri Jul 19 06:56:30 2013 +0200 @@ -367,6 +367,11 @@ mv $WORK_DIR/datacagedb $WORK_DIR/server/ echo "INFO: create tarball" +if [ -d "$WORK_DIR/flys-$VERSION" ]; then + echo "INFO: removing old directory" + rm -rf "$WORK_DIR/flys-$VERSION" +fi + mkdir $WORK_DIR/flys-$VERSION mv $WORK_DIR/server $WORK_DIR/client $WORK_DIR/flys-$VERSION cd $WORK_DIR