comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculation.java @ 8879:64ca63f79f6f

Further work on SINFO-FlowDepth
author gernotbelger
date Fri, 09 Feb 2018 13:27:10 +0100
parents 9f7a285b0ee3
children f762fadc5313
comparison
equal deleted inserted replaced
8878:ddd6523e0868 8879:64ca63f79f6f
10 package org.dive4elements.river.artifacts.sinfo.flowdepth; 10 package org.dive4elements.river.artifacts.sinfo.flowdepth;
11 11
12 import java.util.Collection; 12 import java.util.Collection;
13 import java.util.List; 13 import java.util.List;
14 14
15 import org.dive4elements.artifacts.ArtifactDatabase;
15 import org.dive4elements.artifacts.CallContext; 16 import org.dive4elements.artifacts.CallContext;
16 import org.dive4elements.river.artifacts.BedHeightsArtifact; 17 import org.dive4elements.river.artifacts.BedHeightsArtifact;
17 import org.dive4elements.river.artifacts.model.Calculation; 18 import org.dive4elements.river.artifacts.model.Calculation;
18 import org.dive4elements.river.artifacts.model.CalculationResult; 19 import org.dive4elements.river.artifacts.model.CalculationResult;
19 import org.dive4elements.river.artifacts.model.LocationProvider; 20 import org.dive4elements.river.artifacts.model.LocationProvider;
39 this.context = context; 40 this.context = context;
40 } 41 }
41 42
42 public CalculationResult calculate(final SINFOArtifact sinfo) { 43 public CalculationResult calculate(final SINFOArtifact sinfo) {
43 44
44 // FIXME: find user of this artifact; probably only possible by selecting the collection that contains this artifact... 45 /*
45 final String user = "unbekannt"; 46 * find the user of this artifact, sadly this is not part of the calling context, so instead we determine the
47 * owner oft the artifact
48 */
49 final ArtifactDatabase database = this.context.getDatabase();
50 final String user = database.findArtifactUser(sinfo.identifier());
46 51
47 /* access input data */ 52 /* access input data */
48 final FlowDepthAccess access = new FlowDepthAccess(sinfo); 53 final FlowDepthAccess access = new FlowDepthAccess(sinfo);
49 final River river = access.getRiver(); 54 final River river = access.getRiver();
50 55
96 return null; 101 return null;
97 } 102 }
98 103
99 // FIXME: woher bekommen? 104 // FIXME: woher bekommen?
100 final int wspYear = 0; 105 final int wspYear = 0;
106 // FIXME: angeblich metadatum bestimmter wsps?
107 // Könnte 'source' an 'wst_columns' sein
108 final String wspSource = "FIXME";
109 // FIXME: Umsetzung IDENTISCH zu allen möglichen Arten wie ein WSPL berechnet wird....
110 final String wspGauge = "FIXME";
101 111
102 final String wspLabel = wstKms.getName(); 112 final String wspLabel = wstKms.getName();
103 final String soundingLabel = bedHeight.getDescription(); 113 final String soundingLabel = bedHeight.getDescription();
104 final String label = String.format("%s - %s", wspLabel, soundingLabel); 114 final String label = String.format("%s - %s", wspLabel, soundingLabel);
105 115
106 final BedHeightInfo sounding = BedHeightInfo.from(bedHeight); 116 final BedHeightInfo sounding = BedHeightInfo.from(bedHeight);
107 final WstInfo wstInfo = new WstInfo(wspLabel, wspYear); 117 final WstInfo wstInfo = new WstInfo(wspLabel, wspYear, wspSource, wspGauge);
108 118
109 final FlowDepthCalculationResult resultData = new FlowDepthCalculationResult(label, wstInfo, sounding); 119 final FlowDepthCalculationResult resultData = new FlowDepthCalculationResult(label, wstInfo, sounding);
110 120
111 final String notinrange = Resources.getMsg(this.context.getMeta(), CSV_NOT_IN_GAUGE_RANGE, CSV_NOT_IN_GAUGE_RANGE); 121 final String notinrange = Resources.getMsg(this.context.getMeta(), CSV_NOT_IN_GAUGE_RANGE, CSV_NOT_IN_GAUGE_RANGE);
112 122
148 158
149 // FIXME: calculate tkh 159 // FIXME: calculate tkh
150 final double tkh = 0; 160 final double tkh = 0;
151 final double flowDepthTkh = flowDepth - tkh; 161 final double flowDepthTkh = flowDepth - tkh;
152 162
153
154 // REMARK: access the location once only during calculation 163 // REMARK: access the location once only during calculation
155 final String location = LocationProvider.getLocation(river.getName(), km); 164 final String location = LocationProvider.getLocation(river.getName(), km);
156 165
157 // REMARK: access the gauge once only during calculation 166 // REMARK: access the gauge once only during calculation
158 // FIXME: copy specific handling from original wst 167 // FIXME: copy specific handling from original wst

http://dive4elements.wald.intevation.org