Mercurial > dive4elements > river
changeset 5128:a020100ee6a1
SCHEME CHANGE: Merge branch dami into default.
A summary on the scheme changes:
HWS and Lines tables are dropped and will be replaced by HWS_Lines and
HWS_Points.
The catchment table removed and will be replaced
by a WMS Service.
Hydr_boundaries has an added reference to boundary_kind sectie_kind
and sobek_kind objects.
Dem has a new column srid.
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Thu, 28 Feb 2013 11:48:17 +0100 |
parents | e37b25628dd4 (diff) 3d8000616ed5 (current diff) |
children | b11f3563a117 |
files | flys-artifacts/doc/conf/meta-data.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSCatchmentArtifact.java flys-backend/contrib/hws_schema.diff flys-backend/contrib/shpimporter/catchments.py flys-backend/contrib/shpimporter/lines.py flys-backend/doc/schema/import-dems.sql flys-backend/src/main/java/de/intevation/flys/model/Catchment.java flys-backend/src/main/java/de/intevation/flys/model/Hws.java flys-backend/src/main/java/de/intevation/flys/model/Line.java |
diffstat | 9 files changed, 188 insertions(+), 81 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/init.d/README.txt Thu Feb 28 11:48:17 2013 +0100 @@ -0,0 +1,15 @@ +SLES-Init-Script fuer Dive4Elements River: + +Installation als root: +- Kopieren nach /etc/init.d/d4e-river +- chmod 755 /etc/init.d/d4e-river +- insserv /etc/init.d/d4e-river +- /etc/init.d/d4e-river start + +Deinstallation als root: +- /etc/init.d/d4e-river stop +- insserv -r /etc/init.d/d4e-river +- rm /var/log/d4e-river.log /var/run/d4e-river.pid /etc/init.d/d4e-river + +TODO: +- ggf. logrotate fuer Logdatei /var/log/d4e-river.log konfigurieren
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/init.d/d4e-river Thu Feb 28 11:48:17 2013 +0100 @@ -0,0 +1,70 @@ +#!/bin/bash +# +### BEGIN INIT INFO +# Provides: d4e-server +# Required-Start: $network $syslog $remote_fs +# Should-Start: $named $syslog $time +# Required-Stop: $network $syslog +# Should-Stop: $named $syslog $time +# Default-Start: 3 5 +# Default-Stop: 0 1 2 6 +# Short-Description: Dive4Elements server +# Description: Start Dive4Elements server +### END INIT INFO + +RUNAS=flys +DIR="/opt/flys/current/server" + +CLASSPATH= +for l in `find "$DIR/bin/lib" -name \*.jar -print`; do + CLASSPATH=$CLASSPATH:$l +done + + +LOGFILE=/var/log/d4e-river.log +PIDFILE=/var/run/d4e-river.pid +ARGS="-Xmx256m \ + -server \ + -Djava.awt.headless=true \ + -Dflys.datacage.recommendations.development=false \ + -Djava.io.tmpdir=\"$DIR/cache\" \ + -Dflys.backend.enablejmx=true \ + -Dflys.uesk.keep.artifactsdir=false \ + -Dwsplgen.bin.path=\"$DIR/bin/wsplgen.exe\" \ + -Dwsplgen.log.output=false \ + -Dartifact.database.dir=\"$DIR/conf\"" +MAINCLASS=de.intevation.artifactdatabase.App + +# For SELinux we need to use 'runuser' not 'su' +if [ -x "/sbin/runuser" ]; then + SU="/sbin/runuser" +else + SU="/bin/su" +fi + +case "$1" in + start) + echo "Starting D4E-river server..." + $SU - $RUNAS -c "/usr/bin/java -classpath $CLASSPATH $ARGS $MAINCLASS" &> $LOGFILE & + PID=$! + echo $PID > $PIDFILE + ;; + stop) + echo "Stopping D4E-river server..." + PID=`cat $PIDFILE` + STOPRES=0 + while [ $STOPRES -le 0 ] + do + kill -15 $PID &> /dev/null + STOPRES=$? + sleep 1 + done + echo "done." + ;; + restart) + $0 stop && $0 start + ;; + *) + echo "Usage: $0 [start|stop|restart]" +esac +
--- a/contrib/make_flys_release/make_release.sh Thu Feb 28 11:14:38 2013 +0100 +++ b/contrib/make_flys_release/make_release.sh Thu Feb 28 11:48:17 2013 +0100 @@ -18,6 +18,7 @@ TOMCAT_PORT=${TOMCAT_PORT:-8005} MAPSERVER_URL=${MAPSERVER_URL:-czech-republic.atlas.intevation.de} +WIKI_URL=${WIKI_URL:-https://flys-intern.intevation.de/Flys-3.0} echo "INFO: create server directories" mkdir -p $DIRECTORY/server/bin/lib/own @@ -48,9 +49,13 @@ -e "s@http://localhost:8888@http://localhost:$TOMCAT_PORT@g" \ $FLYS_HG/flys-client/src/main/webapp/WEB-INF/web.xml -sed -i -e "s@/tmp/flys-client.log@/tmp/flys-client-${RELEASE}.log@g" \ +sed -i -e "s@/tmp/flys-client.log@/var/log/flys/client-${RELEASE}.log@g" \ $FLYS_HG/flys-client/src/main/webapp/WEB-INF/log4j.properties +# Fix the Wiki URLs +find $FLYS_HG/flys-artifacts/src/main/resources/ -name messages_\*.properties \ + -exec sed -i "s@https://flys-intern.intevation.de/Flys-3.0@${WIKI_URL}@g" {} \; + echo "INFO: download OpenLayers-2.11 for client" curl -O http://openlayers.org/download/OpenLayers-2.11.tar.gz tar xvfz OpenLayers-2.11.tar.gz @@ -110,8 +115,7 @@ confs/rivermap.xml \ > $DIRECTORY/server/conf/rivermap.xml - -sed "s@/tmp/flys-server-default.log@/tmp/flys-server-${RELEASE}.log" \ +sed "s@/tmp/flys-server-default.log@/var/log/flys/server-${RELEASE}.log@" \ confs/log4j.properties \ > $DIRECTORY/server/conf/log4j.properties
--- a/flys-artifacts/doc/conf/artifacts/fixanalysis.xml Thu Feb 28 11:14:38 2013 +0100 +++ b/flys-artifacts/doc/conf/artifacts/fixanalysis.xml Thu Feb 28 11:48:17 2013 +0100 @@ -270,6 +270,7 @@ <facet name="w_differences.manualpoints" description="Manuelle Punkte"/> <facet name="longitudinal_section.manualpoints" description="Manuelle Punkte"/> <facet name="longitudinal_section.annotations" description="facet.longitudinal_section.annotations"/> + <facet name="longitudinal_section.area" description="facet.longitudinal_section.area"/> </facets> </outputmode> <outputmode name="fix_wq_curve" description="output.fix_wq_curve" mine-type="image/png" type="chart">
--- a/flys-artifacts/doc/conf/meta-data.xml Thu Feb 28 11:14:38 2013 +0100 +++ b/flys-artifacts/doc/conf/meta-data.xml Thu Feb 28 11:48:17 2013 +0100 @@ -631,6 +631,9 @@ <dc:if test="dc:contains($artifact-outs, 'fix_wq_curve')"> <dc:call-macro name="qsectors"/> </dc:if> + <dc:if test="dc:contains($artifact-outs, 'longitudinal_section')"> + <dc:call-macro name="annotations"/> + </dc:if> <dc:if test="dc:contains($artifact-outs, 'fix_longitudinal_section_curve')"> <dc:call-macro name="annotations"/> </dc:if>
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Segment.java Thu Feb 28 11:14:38 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Segment.java Thu Feb 28 11:48:17 2013 +0100 @@ -178,18 +178,21 @@ DischargeTable dt = gauge.fetchMasterDischargeTable(); + //TODO: Change scale from 100 to 1 immediately after + // discharge table import changed to cm! double [][] table = - DischargeTables.loadDischargeTableValues(dt, 1); + DischargeTables.loadDischargeTableValues(dt, 100); // need the original values for naming segment.backup(); for (int i = 0; i < values.length; ++i) { - double w = values[i] / 100.0; + //TODO: s.o. + double w = values[i]; /* / 100.0; */ double [] qs = DischargeTables.getQsForW(table, w); if (qs.length == 0) { log.warn("No Qs found for W = " + values[i]); - report.addProblem("cannot.find.w.for.q", values[i]); + report.addProblem("cannot.find.q.for.w", values[i]); values[i] = Double.NaN; success = false; }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/AbstractExporter.java Thu Feb 28 11:14:38 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/AbstractExporter.java Thu Feb 28 11:48:17 2013 +0100 @@ -74,6 +74,12 @@ /** The master artifact. */ protected Artifact master; + private NumberFormat kmFormat; + + private NumberFormat wFormat; + + private NumberFormat qFormat; + /** * Concrete subclasses need to use this method to write their special data @@ -301,7 +307,10 @@ * @return the number formatter for kilometer values. */ protected NumberFormat getKmFormatter() { - return Formatter.getWaterlevelKM(context); + if (kmFormat == null) { + kmFormat = Formatter.getWaterlevelKM(context); + } + return kmFormat; } @@ -311,7 +320,10 @@ * @return the number formatter for W values. */ protected NumberFormat getWFormatter() { - return Formatter.getWaterlevelW(context); + if (wFormat == null) { + wFormat = Formatter.getWaterlevelW(context); + } + return wFormat; } @@ -321,7 +333,10 @@ * @return the number formatter for Q values. */ protected NumberFormat getQFormatter() { - return Formatter.getWaterlevelQ(context); + if (qFormat == null) { + qFormat = Formatter.getWaterlevelQ(context); + } + return qFormat; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java Thu Feb 28 11:14:38 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java Thu Feb 28 11:48:17 2013 +0100 @@ -449,6 +449,50 @@ } + /** Linearly search for gauge which is valid at km. */ + private Gauge findGauge(double km, List<Gauge> gauges) { + for (Gauge gauge: gauges) { + if (km >= gauge.getRange().getA().doubleValue() + && km <= gauge.getRange().getB().doubleValue()) { + return gauge; + } + } + return null; + } + + + private void writeRow4(CSVWriter writer, double wqkm[], FLYSArtifact flys) { + 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]), + FLYSUtils.getLocationDescription(flys, wqkm[2]) + }); + } + + + /** Write an csv-row at gauge location. */ + private void writeRow6(CSVWriter writer, double wqkm[], String wOrQDesc, + FLYSArtifact flys, String gaugeName) { + 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]), + wOrQDesc, + FLYSUtils.getLocationDescription(flys, wqkm[2]), + gaugeName + }); + } + + /** * Write "rows" of csv data from wqkms with writer. */ @@ -473,6 +517,7 @@ double[] result = new double[3]; FLYSArtifact flys = (FLYSArtifact) master; + List<Gauge> gauges = FLYSUtils.getGauges(flys); Gauge gauge = FLYSUtils.getGauge(flys); String gaugeName = gauge.getName(); String desc = ""; @@ -496,6 +541,7 @@ String colDesc = desc; List<Segment> segments = null; + boolean isFixRealize = false; if (flys instanceof WINFOArtifact) { if (wqkms != null && wqkms.getRawValue() != null) { WINFOArtifact winfo = (WINFOArtifact) flys; @@ -506,6 +552,9 @@ // Get W/Q input per gauge for this case. FixRealizingAccess fixAccess = new FixRealizingAccess(flys, getCallContext()); segments = fixAccess.getSegments(); + if (segments != null && segments.size() > 0) { + isFixRealize = true; + } } for (int i = 0; i < size; i ++) { @@ -521,25 +570,21 @@ } if (atGauge) { - writer.writeNext(new String[] { - kmf.format(result[2]), - wf.format(result[0]), - qf.format(result[1]), - colDesc, - FLYSUtils.getLocationDescription(flys, result[2]), + String gaugeN; + // TODO issue1131, name gauge + if (isFixRealize) { + gaugeN = findGauge(result[2], gauges).getName(); + } + else { // TODO issue1114: Take correct gauge - result[2] >= a && result[2] <= b + gaugeN = result[2] >= a && result[2] <= b ? gaugeName - : notinrange - }); + : notinrange; + } + writeRow6(writer, result, colDesc, flys, gaugeN); } else { - writer.writeNext(new String[] { - kmf.format(result[2]), - wf.format(result[0]), - qf.format(result[1]), - FLYSUtils.getLocationDescription(flys, result[2]) - }); + writeRow4(writer, result, flys); } }
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/WQAdaptedInputPanel.java Thu Feb 28 11:14:38 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/WQAdaptedInputPanel.java Thu Feb 28 11:48:17 2013 +0100 @@ -129,7 +129,6 @@ layout.addMember(widget); layout.addMember(submit); - return layout; } @@ -190,6 +189,7 @@ } + /** Create area showing previously entered w or q data. */ protected Canvas createOldWQValues(Data wqData) { VLayout layout = new VLayout(); @@ -268,8 +268,7 @@ } } - - protected List<String> validateW() { + protected List<String> validateRange(Map<String, double[]> ranges) { List<String> errors = new ArrayList<String>(); NumberFormat nf = NumberFormat.getDecimalFormat(); @@ -286,7 +285,7 @@ return errors; } - double[] mm = wranges.get(key); + double[] mm = ranges.get(key); if (mm == null) { SC.warn(MSG.error_read_minmax_values()); continue; @@ -326,65 +325,17 @@ } - protected List<String> validateQ() { - List<String> errors = new ArrayList<String>(); - NumberFormat nf = NumberFormat.getDecimalFormat(); - - Iterator<String> iter = wqranges.keySet().iterator(); - - while (iter.hasNext()) { - List<String> tmpErrors = new ArrayList<String>(); - - String key = iter.next(); - DoubleArrayPanel dap = wqranges.get(key); - - if (!dap.validateForm()) { - errors.add(MSG.error_invalid_double_value()); - return errors; - } - - double[] mm = qranges.get(key); - if (mm == null) { - SC.warn(MSG.error_read_minmax_values()); - continue; - } - - double[] values = dap.getInputValues(); - double[] good = new double[values.length]; + protected List<String> validateW() { + return validateRange(wranges); + } - int idx = 0; - for (double value: values) { - if (value < mm[0] || value > mm[1]) { - String tmp = MSG.error_validate_range(); - tmp = tmp.replace("$1", nf.format(value)); - tmp = tmp.replace("$2", nf.format(mm[0])); - tmp = tmp.replace("$3", nf.format(mm[1])); - tmpErrors.add(tmp); - } - else { - good[idx++] = value; - } - } - - double[] justGood = new double[idx]; - for (int i = 0; i < justGood.length; i++) { - justGood[i] = good[i]; - } - - if (!tmpErrors.isEmpty()) { - dap.setValues(justGood); - - errors.addAll(tmpErrors); - } - } - - return errors; + protected List<String> validateQ() { + return validateRange(qranges); } protected void initUserDefaults(DataList dataList) { - initUserWQValues(dataList); initUserWQMode(dataList); }