Mercurial > dive4elements > river
changeset 9323:86d2cbfe7f7f
bundu bezugswst excel metadaten
author | gernotbelger |
---|---|
date | Fri, 27 Jul 2018 13:29:34 +0200 |
parents | a49fe0ebb297 |
children | 058701d91552 |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstCalculation.java artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstCalculationResult.java artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BunduAccess.java artifacts/src/main/java/org/dive4elements/river/exports/WaterlevelDescriptionBuilder.java artifacts/src/main/java/org/dive4elements/river/exports/WaterlevelExporter.java artifacts/src/main/resources/messages.properties artifacts/src/main/resources/messages_de.properties |
diffstat | 7 files changed, 111 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstCalculation.java Fri Jul 27 11:13:57 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstCalculation.java Fri Jul 27 13:29:34 2018 +0200 @@ -19,8 +19,10 @@ import org.dive4elements.river.artifacts.common.ResultRow; import org.dive4elements.river.artifacts.model.CalculationResult; import org.dive4elements.river.artifacts.resources.Resources; +import org.dive4elements.river.artifacts.sinfo.util.BedHeightInfo; import org.dive4elements.river.artifacts.sinfo.util.CalculationUtils; import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; +import org.dive4elements.river.artifacts.sinfo.util.WstInfo; import org.dive4elements.river.model.River; class BezugswstCalculation { @@ -45,6 +47,19 @@ final String calcModeLabel = Resources.getMsg(this.context.getMeta(), "bundu_bezugswst"); final BezugswstCalculationResults results = new BezugswstCalculationResults(calcModeLabel, user, riverInfo, access.getRange()); + // TODO: get wst, sounding for river + final WstInfo wstInfo = null; + final BedHeightInfo sounding = null; + // final int wspYear = waterlevel.getYear(); + // final WstInfo wstInfo = new WstInfo(wspLabel, wspYear, riverInfo.getReferenceGauge()); + final String function = access.getFunction(); + final boolean preprocessing = access.getPreprocessing();// nullpointer dürfen nicht entstehen; Fehler läge woanders + final int startYear = access.getStartYear(); + final int endYear = access.getBezugsJahr(); + final Integer ud = access.getUd(); + final double[] qs = access.getQs(); + final Double missingVolFrom = access.getMissingVolFrom(); + final Double missingVolTo = access.getMissingVolTo(); final List<ResultRow> list = new ArrayList<>(); final ResultRow row = ResultRow.create(); row.putValue(GeneralResultType.station, 666.666); @@ -55,7 +70,8 @@ row.putValue(GeneralResultType.location, "keine Lage"); list.add(row); - final BezugswstCalculationResult result = new BezugswstCalculationResult("label? was fürn label?", list); + final BezugswstCalculationResult result = new BezugswstCalculationResult("label? was fürn label?", list, sounding, wstInfo, function, preprocessing, + startYear, endYear, ud, qs, missingVolFrom, missingVolTo); results.addResult(result, null); return new CalculationResult(results, null);// problems); }
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstCalculationResult.java Fri Jul 27 11:13:57 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstCalculationResult.java Fri Jul 27 13:29:34 2018 +0200 @@ -35,24 +35,54 @@ private static final String JASPER_FILE = "/jasper/templates/bundu.bezugswst.jrxml"; - private final WstInfo wst = null; - private final BedHeightInfo sounding = null; + private final WstInfo wst; + private final BedHeightInfo sounding; + private final String function; + private final boolean preprocessing; + private final int startYear; + private final int endYear; + private final Double missingVolumeFrom; + private final Double missingVolumeTo; + private final Integer ud; + private final double[] qOfGauges; - public BezugswstCalculationResult(final String label, final Collection<ResultRow> rows // , final BedHeightInfo sounding // ,final WstInfo wst - ) { + public BezugswstCalculationResult(final String label, final Collection<ResultRow> rows, final BedHeightInfo sounding, final WstInfo wst, + final String function, final boolean preprocessing, final int startYear, final int endYear, final Integer ud, final double[] qOfGauges, + final Double missingVolumeFrom, final Double missingVolumeTo) { super(label, rows); - // this.wst = this.wst; //TODO get Peilung and Wasserstand - // this.sounding = sounding; + this.wst = wst; + this.sounding = sounding; + this.function = function; + this.preprocessing = preprocessing; + this.startYear = startYear; + this.endYear = endYear; + this.missingVolumeTo = missingVolumeTo; + this.missingVolumeFrom = missingVolumeFrom; + this.ud = ud; + this.qOfGauges = qOfGauges; } @Override protected void writeCSVResultMetadata(final ExportContextCSV exportContextCSV) { // TODO: wenn wst und peilung vorhanden sind, sollte dieser Teil wieder einkommentiert werden - // exportContextCSV.writeCSVSoundingMetadata(this.sounding, " "); - // exportContextCSV.writeBlankLine(); // exportContextCSV.writeCSVWaterlevelMetadata(wst); // exportContextCSV.writeBlankLine(); + // exportContextCSV.writeCSVSoundingMetadata(this.sounding, " "); + + // Reihenfolge in der LV anders; ich finde sie aber so sinnvoller + exportContextCSV.writeCSVMetaEntry("bundu.export.bezugswst.csv.meta.function", this.function); + exportContextCSV.writeCSVMetaEntry("bundu.export.bezugswst.csv.meta.preprocessing", String.valueOf(this.preprocessing)); + exportContextCSV.writeCSVMetaEntry("bundu.export.bezugswst.csv.meta.q_period", String.valueOf(this.startYear), String.valueOf(this.endYear)); + if (this.ud != null) + exportContextCSV.writeCSVMetaEntry("bundu.export.bezugswst.csv.meta.ud", this.ud); + else if (this.qOfGauges != null) + exportContextCSV.writeCSVMetaEntry("common.export.waterlevel.csv.meta.q", this.qOfGauges); // was auch immer dieser String beinhalten mag + + exportContextCSV.writeCSVMetaEntry("bundu.export.bezugswst.csv.meta.function", this.function); + exportContextCSV.writeCSVMetaEntry("bundu.export.bezugswst.csv.meta.missing_volume_range", this.missingVolumeFrom, this.missingVolumeTo); + + exportContextCSV.writeBlankLine(); } @Override
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BunduAccess.java Fri Jul 27 11:13:57 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BunduAccess.java Fri Jul 27 13:29:34 2018 +0200 @@ -47,6 +47,48 @@ return this.artifact.getDataAsInteger("year_input_q_series"); } + public int getStartYear() { + return this.getBezugsJahr() - this.getQSeriesLength(); + + } + + public Integer getUd() { + if (getUd_Q_mode().equals("UD")) + return getInteger("bundu.wst.ud_value"); + else + return null; + } + + @Override + public double[] getQs() { + if (getUd_Q_mode().equals("Q")) + return super.getQs(); + else + return null; + } + + private String getUd_Q_mode() { + return getString("bundu.wst.mode"); + } + + public Double getMissingVolFrom() { + if (isCalculateMissingValue()) + return getDouble("ld_from_part"); + else + return null; + } + + public Double getMissingVolTo() { + if (isCalculateMissingValue()) + return getDouble("ld_to_part"); + else + return null; + } + + private boolean isCalculateMissingValue() { // probably public + return getBoolean("missing_volume"); + } + // /** Access the reference date period, return null in case of 'errors'. */ // public DateRange getReferencePeriod() { // if (this.referencePeriod == null) {
--- a/artifacts/src/main/java/org/dive4elements/river/exports/WaterlevelDescriptionBuilder.java Fri Jul 27 11:13:57 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/WaterlevelDescriptionBuilder.java Fri Jul 27 13:29:34 2018 +0200 @@ -29,7 +29,7 @@ */ public final class WaterlevelDescriptionBuilder { - private static final String CSV_META_Q = "export.waterlevel.csv.meta.q"; + private static final String CSV_META_Q = "common.export.waterlevel.csv.meta.q"; // FIXME: unit 'NN + m' is wrong: // - use river-elevation system in case of absolute heights
--- a/artifacts/src/main/java/org/dive4elements/river/exports/WaterlevelExporter.java Fri Jul 27 11:13:57 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/WaterlevelExporter.java Fri Jul 27 13:29:34 2018 +0200 @@ -103,7 +103,7 @@ public static final String CSV_META_GAUGE = "export.waterlevel.csv.meta.gauge"; - public static final String CSV_META_Q = "export.waterlevel.csv.meta.q"; + public static final String CSV_META_Q = "common.export.waterlevel.csv.meta.q"; public static final String CSV_META_W = "export.waterlevel.csv.meta.w";
--- a/artifacts/src/main/resources/messages.properties Fri Jul 27 11:13:57 2018 +0200 +++ b/artifacts/src/main/resources/messages.properties Fri Jul 27 13:29:34 2018 +0200 @@ -407,7 +407,7 @@ export.waterlevel.csv.meta.river = # River: {0} export.waterlevel.csv.meta.range = # Location/Range (km): {0} - {1} export.waterlevel.csv.meta.gauge = # Gauge: {0} -export.waterlevel.csv.meta.q = # Q (m\u00b3/s): {0} +common.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 = Outside selected gauge export.computed.discharge.curve.csv.header.w = W [{0}] @@ -899,6 +899,11 @@ sinfo.export.flow_depth.pdf.meta.calculation.label = Angewandte Gleichung sinfo.export.flow_depth.pdf.meta.calculation.name = Gill (1971) sinfo.export.flow_depth.csv.meta.height_unit.river = # H\u00f6hensystem des Flusses: {0} +bundu.export.bezugswst.csv.meta.function = # Ausgleichsfunktion: {0} +bundu.export.bezugswst.csv.meta.preprocessing = # Ausrei\u00dfertest: {0} +bundu.export.bezugswst.csv.meta.q_period = # Zeitraum der Abflusszeitreihe: {0} - {1} +bundu.export.bezugswst.csv.meta.ud = # UD (d/a): {0} +bundu.export.bezugswst.csv.meta.missing_volume_range = # Bereich der Fehltiefenermittlung: {0} - {1} export.flow_depth.csv.header.km = Fluss-km sinfo.export.flow_depth.csv.header.flowdepth = Flie\u00dftiefe
--- a/artifacts/src/main/resources/messages_de.properties Fri Jul 27 11:13:57 2018 +0200 +++ b/artifacts/src/main/resources/messages_de.properties Fri Jul 27 13:29:34 2018 +0200 @@ -407,7 +407,7 @@ export.waterlevel.csv.meta.river = # Gew\u00e4sser: {0} export.waterlevel.csv.meta.range = # Ort/Bereich (km): {0} - {1} export.waterlevel.csv.meta.gauge = # Bezugspegel: {0} -export.waterlevel.csv.meta.q = # Q (m\u00b3/s): {0} +common.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\u00dferh. d. Bez.pegels export.computed.discharge.curve.csv.header.w = W [{0}] @@ -899,6 +899,11 @@ sinfo.export.flow_depth.pdf.meta.calculation.label = Angewandte Gleichung sinfo.export.flow_depth.pdf.meta.calculation.name = Gill (1971) sinfo.export.flow_depth.csv.meta.height_unit.river = # H\u00f6hensystem des Flusses: {0} +bundu.export.bezugswst.csv.meta.function = # Ausgleichsfunktion: {0} +bundu.export.bezugswst.csv.meta.preprocessing = # Ausrei\u00dfertest: {0} +bundu.export.bezugswst.csv.meta.q_period = # Zeitraum der Abflusszeitreihe: {0} - {1} +bundu.export.bezugswst.csv.meta.ud = # UD (d/a): {0} +bundu.export.bezugswst.csv.meta.missing_volume_range = # Bereich der Fehltiefenermittlung: {0} - {1} export.flow_depth.csv.header.km = Fluss-km sinfo.export.flow_depth.csv.header.flowdepth = Flie\u00dftiefe