[PATCH] Further work on SINFO-FlowDepth
Wald Commits
scm-commit at wald.intevation.org
Fri Feb 9 13:27:16 CET 2018
# HG changeset patch
# User gernotbelger
# Date 1518179230 -3600
# Node ID 64ca63f79f6fe5926f1fe7a5689a697c5c2531d5
# Parent ddd6523e086816a5626bcc01a9f9e49922f33954
Further work on SINFO-FlowDepth
diff -r ddd6523e0868 -r 64ca63f79f6f artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/BedHeightInfo.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/BedHeightInfo.java Fri Feb 09 13:20:16 2018 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/BedHeightInfo.java Fri Feb 09 13:27:10 2018 +0100
@@ -26,9 +26,9 @@
private final String locationSystem;
- private final String curElevationModelName;
+ private final String curElevationModelUnit;
- private final String oldElevationModelName;
+ private final String oldElevationModelUnit;
public static BedHeightInfo from(final BedHeight bedHeight) {
return new BedHeightInfo(bedHeight);
@@ -45,8 +45,8 @@
this.locationSystem = bedHeight.getLocationSystem().getName();
- this.curElevationModelName = bedHeight.getCurElevationModel().getName();
- this.oldElevationModelName = bedHeight.getCurElevationModel().getName();
+ this.curElevationModelUnit = bedHeight.getCurElevationModel().getUnit().getName();
+ this.oldElevationModelUnit = bedHeight.getCurElevationModel().getUnit().getName();
}
public Integer getYear() {
@@ -65,11 +65,11 @@
return this.locationSystem;
}
- public String getCurElevationModelName() {
- return this.curElevationModelName;
+ public String getCurElevationModelUnit() {
+ return this.curElevationModelUnit;
}
- public String getOldElevationModelName() {
- return this.oldElevationModelName;
+ public String getOldElevationModelUnit() {
+ return this.oldElevationModelUnit;
}
}
diff -r ddd6523e0868 -r 64ca63f79f6f artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculation.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculation.java Fri Feb 09 13:20:16 2018 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculation.java Fri Feb 09 13:27:10 2018 +0100
@@ -12,6 +12,7 @@
import java.util.Collection;
import java.util.List;
+import org.dive4elements.artifacts.ArtifactDatabase;
import org.dive4elements.artifacts.CallContext;
import org.dive4elements.river.artifacts.BedHeightsArtifact;
import org.dive4elements.river.artifacts.model.Calculation;
@@ -41,8 +42,12 @@
public CalculationResult calculate(final SINFOArtifact sinfo) {
- // FIXME: find user of this artifact; probably only possible by selecting the collection that contains this artifact...
- final String user = "unbekannt";
+ /*
+ * find the user of this artifact, sadly this is not part of the calling context, so instead we determine the
+ * owner oft the artifact
+ */
+ final ArtifactDatabase database = this.context.getDatabase();
+ final String user = database.findArtifactUser(sinfo.identifier());
/* access input data */
final FlowDepthAccess access = new FlowDepthAccess(sinfo);
@@ -98,13 +103,18 @@
// FIXME: woher bekommen?
final int wspYear = 0;
+ // FIXME: angeblich metadatum bestimmter wsps?
+ // Könnte 'source' an 'wst_columns' sein
+ final String wspSource = "FIXME";
+ // FIXME: Umsetzung IDENTISCH zu allen möglichen Arten wie ein WSPL berechnet wird....
+ final String wspGauge = "FIXME";
final String wspLabel = wstKms.getName();
final String soundingLabel = bedHeight.getDescription();
final String label = String.format("%s - %s", wspLabel, soundingLabel);
final BedHeightInfo sounding = BedHeightInfo.from(bedHeight);
- final WstInfo wstInfo = new WstInfo(wspLabel, wspYear);
+ final WstInfo wstInfo = new WstInfo(wspLabel, wspYear, wspSource, wspGauge);
final FlowDepthCalculationResult resultData = new FlowDepthCalculationResult(label, wstInfo, sounding);
@@ -150,7 +160,6 @@
final double tkh = 0;
final double flowDepthTkh = flowDepth - tkh;
-
// REMARK: access the location once only during calculation
final String location = LocationProvider.getLocation(river.getName(), km);
diff -r ddd6523e0868 -r 64ca63f79f6f artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthExporter.java Fri Feb 09 13:20:16 2018 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthExporter.java Fri Feb 09 13:27:10 2018 +0100
@@ -97,8 +97,6 @@
private static final String CSV_META_HEADER_WATERLEVEL_NAME = "sinfo.export.flow_depth.csv.meta.header.waterlevel.name";
- private static final String CSV_META_HEADER_WATERLEVEL_ELEVATION_MODEL = "sinfo.export.flow_depth.csv.meta.header.waterlevel.elevationmodel";
-
private static final String CSV_META_HEADER_WATERLEVEL_EVALUATOR = "sinfo.export.flow_depth.csv.meta.header.waterlevel.evaluator";
private static final String CSV_META_HEADER_WATERLEVEL_GAUGE = "sinfo.export.flow_depth.csv.meta.header.waterlevel.gauge";
@@ -180,27 +178,20 @@
// "# Lagesystem: "
writeCSVMetaEntry(writer, CSV_META_HEADER_SOUNDING_PRJ, sounding.getLocationSystem());
// "# Höhensystem: "
- // TODO: klären einheit oder name des höhensystems?
- writeCSVMetaEntry(writer, CSV_META_HEADER_SOUNDING_ELEVATIOIN_MODEL, sounding.getCurElevationModelName());
+ writeCSVMetaEntry(writer, CSV_META_HEADER_SOUNDING_ELEVATIOIN_MODEL, sounding.getCurElevationModelUnit());
// "# ursprüngliches Höhensystem: "
writeCSVMetaEntry(writer, CSV_META_HEADER_SOUNDING_ELEVATIOIN_MODEL_ORIGINAL,
- sounding.getOldElevationModelName());
+ sounding.getOldElevationModelUnit());
// "##METADATEN WASSERSPIEGELLAGE"
writeCSVMetaEntry(writer, CSV_META_HEADER_WATERLEVEL);
// "# Bezeichnung der Wasserspiegellage: "
writeCSVMetaEntry(writer, CSV_META_HEADER_WATERLEVEL_NAME, wst.getLabel());
- // "# Höhensystem der Wasserspiegellage: "
- // FIXME: discussion!
- writeCSVMetaEntry(writer, CSV_META_HEADER_WATERLEVEL_ELEVATION_MODEL, "FIXME");
- // "# Auswerter: ": discussion!
- // FIXME: discussion!
- writeCSVMetaEntry(writer, CSV_META_HEADER_WATERLEVEL_EVALUATOR, "FIXME");
- // "# Bezugspegel: " discussion
- // FIXME: Umsetzung IDENTISCH zu allen möglichen Arten wie ein WSPL berechnet wird....
- writeCSVMetaEntry(writer, CSV_META_HEADER_WATERLEVEL_GAUGE, "FIXME");
+ // "# Auswerter: "
+ writeCSVMetaEntry(writer, CSV_META_HEADER_WATERLEVEL_EVALUATOR, wst.getSource());
+ // "# Bezugspegel: "
+ writeCSVMetaEntry(writer, CSV_META_HEADER_WATERLEVEL_GAUGE, wst.getGauge());
// "# Jahr/Zeitraum der Wasserspiegellage: "
- // FIXME: discussion!
writeCSVMetaEntry(writer, CSV_META_HEADER_WATERLEVEL_YEAR, Integer.toString(wst.getYear()));
/* nwo the value rows */
@@ -233,7 +224,6 @@
writeCSVMetaEntry(writer, CSV_META_RIVER, msg(CSV_META_RIVER_LABEL), river.getName());
// "# Höhensystem des Flusses: "
- // FIXME: klären, was ist gemeint?
final Unit wstUnit = river.getWstUnit();
writeCSVMetaEntry(writer, CSV_META_HEIGHT_UNIT_RIVER, wstUnit.getName());
diff -r ddd6523e0868 -r 64ca63f79f6f artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthState.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthState.java Fri Feb 09 13:20:16 2018 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthState.java Fri Feb 09 13:27:10 2018 +0100
@@ -45,13 +45,29 @@
@Override
public Object computeFeed(
- final D4EArtifact artifact,
- final String hash,
- final CallContext context,
- final List<Facet> facets,
- final Object old
- ) {
- // FIXME: why is this necessary?
+ final D4EArtifact artifact,
+ final String hash,
+ final CallContext context,
+ final List<Facet> facets,
+ final Object old
+ ) {
+ // FIXME: why is this necessary?
+ if (artifact instanceof ChartArtifact) {
+ facets.add(new EmptyFacet());
+ return null;
+ }
+
+ return compute((SINFOArtifact) artifact, context, hash, facets, old);
+ }
+
+ @Override
+ public Object computeAdvance(
+ final D4EArtifact artifact,
+ final String hash,
+ final CallContext context,
+ final List<Facet> facets,
+ final Object old
+ ) {
if (artifact instanceof ChartArtifact) {
facets.add(new EmptyFacet());
return null;
@@ -59,37 +75,23 @@
return compute((SINFOArtifact) artifact, context, hash, facets, old);
}
- @Override
- public Object computeAdvance(
- final D4EArtifact artifact,
- final String hash,
- final CallContext context,
- final List<Facet> facets,
- final Object old
- ) {
- if (artifact instanceof ChartArtifact) {
- facets.add(new EmptyFacet());
- return null;
- }
- return compute((SINFOArtifact) artifact, context, hash, facets, old);
- }
-
/**
* Compute result or returned object from cache, create facets.
* @param old Object that was cached.
*/
private Object compute(
- final SINFOArtifact sinfo,
- final CallContext context,
- final String hash,
- final List<Facet> facets,
- final Object old
- ) {
+ final SINFOArtifact sinfo,
+ final CallContext context,
+ final String hash,
+ final List<Facet> facets,
+ final Object old
+ ) {
+
final CalculationResult res;
- if (old instanceof CalculationResult)
- res = (CalculationResult) old;
- else
- res = new FlowDepthCalculation(context).calculate(sinfo);
+ if (old instanceof CalculationResult)
+ res = (CalculationResult) old;
+ else
+ res = new FlowDepthCalculation(context).calculate(sinfo);
if (facets == null) {
return res;
@@ -101,27 +103,27 @@
final List<FlowDepthCalculationResult> resultList = results.getResults();
for (int index = 0; index < resultList.size(); index++) {
- final FlowDepthCalculationResult result = resultList.get(index);
-
- /* filtered (zoom dependent mean) flow depth */
- final String facetFlowDepthFilteredDescription = Resources.getMsg( context.getMeta(), I18N_FACET_FLOW_DEPTH_FILTERED_DESCRIPTION, I18N_FACET_FLOW_DEPTH_FILTERED_DESCRIPTION, result.getLabel() );
- facets.add(new FlowDepthFilterFacet(
- index,
- FlowDepthProcessor.FACET_FLOW_DEPTH_FILTERED,
- facetFlowDepthFilteredDescription,
- ComputeType.ADVANCE,
- id,
- hash
- ));
-
- // FIXME: add other themes
- }
+ final FlowDepthCalculationResult result = resultList.get(index);
+
+ /* filtered (zoom dependent mean) flow depth */
+ final String facetFlowDepthFilteredDescription = Resources.getMsg( context.getMeta(), I18N_FACET_FLOW_DEPTH_FILTERED_DESCRIPTION, I18N_FACET_FLOW_DEPTH_FILTERED_DESCRIPTION, result.getLabel() );
+ facets.add(new FlowDepthFilterFacet(
+ index,
+ FlowDepthProcessor.FACET_FLOW_DEPTH_FILTERED,
+ facetFlowDepthFilteredDescription,
+ ComputeType.ADVANCE,
+ this.id,
+ hash
+ ));
+
+ // FIXME: add other themes
+ }
if (!resultList.isEmpty() ) {
- Facet csv = new DataFacet(
- FacetTypes.CSV, "CSV data", ComputeType.ADVANCE, hash, id);
- Facet pdf = new DataFacet(
- FacetTypes.PDF, "PDF data", ComputeType.ADVANCE, hash, id);
+ final Facet csv = new DataFacet(
+ FacetTypes.CSV, "CSV data", ComputeType.ADVANCE, hash, this.id);
+ final Facet pdf = new DataFacet(
+ FacetTypes.PDF, "PDF data", ComputeType.ADVANCE, hash, this.id);
facets.add(csv);
facets.add(pdf);
@@ -130,7 +132,7 @@
final Calculation report = res.getReport();
if (report.hasProblems()) {
- facets.add(new ReportFacet(ComputeType.ADVANCE, hash, id));
+ facets.add(new ReportFacet(ComputeType.ADVANCE, hash, this.id));
}
return res;
diff -r ddd6523e0868 -r 64ca63f79f6f artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/WstInfo.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/WstInfo.java Fri Feb 09 13:20:16 2018 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/WstInfo.java Fri Feb 09 13:27:10 2018 +0100
@@ -16,10 +16,14 @@
private final String label;
private final int year;
+ private final String source;
+ private final String gauge;
- public WstInfo(final String label, final int year) {
+ public WstInfo(final String label, final int year, final String source, final String gauge) {
this.label = label;
this.year = year;
+ this.source = source;
+ this.gauge = gauge;
}
public String getLabel() {
@@ -29,4 +33,12 @@
public int getYear() {
return this.year;
}
+
+ public String getSource() {
+ return this.source;
+ }
+
+ public String getGauge() {
+ return this.gauge;
+ }
}
\ No newline at end of file
diff -r ddd6523e0868 -r 64ca63f79f6f artifacts/src/main/resources/messages.properties
--- a/artifacts/src/main/resources/messages.properties Fri Feb 09 13:20:16 2018 +0100
+++ b/artifacts/src/main/resources/messages.properties Fri Feb 09 13:27:10 2018 +0100
@@ -811,7 +811,6 @@
sinfo.export.flow_depth.csv.meta.header.sounding.elevationmodel.original = # urspr\u00fcngliches H\u00f6hensystem: {0}
sinfo.export.flow_depth.csv.meta.header.waterlevel = ##METADATEN WASSERSPIEGELLAGE
sinfo.export.flow_depth.csv.meta.header.waterlevel.name = # Bezeichnung der Wasserspiegellage: {0}
-sinfo.export.flow_depth.csv.meta.header.waterlevel.elevationmodel = # H\u00f6hensystem der Wasserspiegellage: {0}
sinfo.export.flow_depth.csv.meta.header.waterlevel.evaluator = # Auswerter: {0}
sinfo.export.flow_depth.csv.meta.header.waterlevel.gauge = # Bezugspegel: {0}
sinfo.export.flow_depth.csv.meta.header.waterlevel.year = # Jahr/Zeitraum der Wasserspiegellage: {0}
diff -r ddd6523e0868 -r 64ca63f79f6f artifacts/src/main/resources/messages_de.properties
--- a/artifacts/src/main/resources/messages_de.properties Fri Feb 09 13:20:16 2018 +0100
+++ b/artifacts/src/main/resources/messages_de.properties Fri Feb 09 13:27:10 2018 +0100
@@ -817,7 +817,6 @@
sinfo.export.flow_depth.csv.meta.header.sounding.elevationmodel.original = # urspr\u00fcngliches H\u00f6hensystem: {0}
sinfo.export.flow_depth.csv.meta.header.waterlevel = ##METADATEN WASSERSPIEGELLAGE
sinfo.export.flow_depth.csv.meta.header.waterlevel.name = # Bezeichnung der Wasserspiegellage: {0}
-sinfo.export.flow_depth.csv.meta.header.waterlevel.elevationmodel = # H\u00f6hensystem der Wasserspiegellage: {0}
sinfo.export.flow_depth.csv.meta.header.waterlevel.evaluator = # Auswerter: {0}
sinfo.export.flow_depth.csv.meta.header.waterlevel.gauge = # Bezugspegel: {0}
sinfo.export.flow_depth.csv.meta.header.waterlevel.year = # Jahr/Zeitraum der Wasserspiegellage: {0}
diff -r ddd6523e0868 -r 64ca63f79f6f artifacts/src/main/resources/messages_de_DE.properties
--- a/artifacts/src/main/resources/messages_de_DE.properties Fri Feb 09 13:20:16 2018 +0100
+++ b/artifacts/src/main/resources/messages_de_DE.properties Fri Feb 09 13:27:10 2018 +0100
@@ -813,7 +813,6 @@
sinfo.export.flow_depth.csv.meta.header.sounding.elevationmodel.original = # urspr\u00fcngliches H\u00f6hensystem: {0}
sinfo.export.flow_depth.csv.meta.header.waterlevel = ##METADATEN WASSERSPIEGELLAGE
sinfo.export.flow_depth.csv.meta.header.waterlevel.name = # Bezeichnung der Wasserspiegellage: {0}
-sinfo.export.flow_depth.csv.meta.header.waterlevel.elevationmodel = # H\u00f6hensystem der Wasserspiegellage: {0}
sinfo.export.flow_depth.csv.meta.header.waterlevel.evaluator = # Auswerter: {0}
sinfo.export.flow_depth.csv.meta.header.waterlevel.gauge = # Bezugspegel: {0}
sinfo.export.flow_depth.csv.meta.header.waterlevel.year = # Jahr/Zeitraum der Wasserspiegellage: {0}
diff -r ddd6523e0868 -r 64ca63f79f6f artifacts/src/main/resources/messages_en.properties
--- a/artifacts/src/main/resources/messages_en.properties Fri Feb 09 13:20:16 2018 +0100
+++ b/artifacts/src/main/resources/messages_en.properties Fri Feb 09 13:27:10 2018 +0100
@@ -812,7 +812,6 @@
sinfo.export.flow_depth.csv.meta.header.sounding.elevationmodel.original = # urspr\u00fcngliches H\u00f6hensystem: {0}
sinfo.export.flow_depth.csv.meta.header.waterlevel = ##METADATEN WASSERSPIEGELLAGE
sinfo.export.flow_depth.csv.meta.header.waterlevel.name = # Bezeichnung der Wasserspiegellage: {0}
-sinfo.export.flow_depth.csv.meta.header.waterlevel.elevationmodel = # H\u00f6hensystem der Wasserspiegellage: {0}
sinfo.export.flow_depth.csv.meta.header.waterlevel.evaluator = # Auswerter: {0}
sinfo.export.flow_depth.csv.meta.header.waterlevel.gauge = # Bezugspegel: {0}
sinfo.export.flow_depth.csv.meta.header.waterlevel.year = # Jahr/Zeitraum der Wasserspiegellage: {0}
More information about the Dive4Elements-commits
mailing list