comparison artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstCalculation.java @ 9535:3fa8551c3d1b

Fixed error in bundu bzws missing volume calculation for mean bed height; added various additional output columns (field bed height, field flow depth etc.)
author mschaefer
date Fri, 12 Oct 2018 18:49:38 +0200
parents 55c187a0a31e
children b9c87bbff6a4
comparison
equal deleted inserted replaced
9534:b380a5693514 9535:3fa8551c3d1b
27 import org.dive4elements.river.artifacts.model.WQKms; 27 import org.dive4elements.river.artifacts.model.WQKms;
28 import org.dive4elements.river.artifacts.model.fixings.FixRealizingCalculation; 28 import org.dive4elements.river.artifacts.model.fixings.FixRealizingCalculation;
29 import org.dive4elements.river.artifacts.model.fixings.FixRealizingResult; 29 import org.dive4elements.river.artifacts.model.fixings.FixRealizingResult;
30 import org.dive4elements.river.artifacts.model.river.RiverInfoProvider; 30 import org.dive4elements.river.artifacts.model.river.RiverInfoProvider;
31 import org.dive4elements.river.artifacts.resources.Resources; 31 import org.dive4elements.river.artifacts.resources.Resources;
32 import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType;
33 import org.dive4elements.river.artifacts.sinfo.tkhstate.BedHeightsFinder; 32 import org.dive4elements.river.artifacts.sinfo.tkhstate.BedHeightsFinder;
34 import org.dive4elements.river.artifacts.sinfo.tkhstate.WinfoArtifactWrapper; 33 import org.dive4elements.river.artifacts.sinfo.tkhstate.WinfoArtifactWrapper;
35 import org.dive4elements.river.artifacts.sinfo.util.CalculationUtils; 34 import org.dive4elements.river.artifacts.sinfo.util.CalculationUtils;
36 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; 35 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo;
37 import org.dive4elements.river.artifacts.sinfo.util.WstInfo; 36 import org.dive4elements.river.artifacts.sinfo.util.WstInfo;
200 else 199 else
201 row.putValue(BunduResultType.sounding, ""); 200 row.putValue(BunduResultType.sounding, "");
202 201
203 // Set bed and channel bottom height 202 // Set bed and channel bottom height
204 final double msh = bedHeightsFinder.getMeanBedHeight(station); 203 final double msh = bedHeightsFinder.getMeanBedHeight(station);
205 row.putValue(SInfoResultType.meanBedHeight, msh); 204 row.putValue(BunduResultType.heightMeanBed, msh);
206 if (!Double.isNaN(w) && !Double.isNaN(msh)) 205 if (!Double.isNaN(w) && !Double.isNaN(msh))
207 row.putValue(SInfoResultType.flowdepth, w - msh); 206 row.putValue(BunduResultType.flowdepthMeanBed, w - msh);
208 else 207 else
209 row.putValue(SInfoResultType.flowdepth, Double.NaN); 208 row.putValue(BunduResultType.flowdepthMeanBed, Double.NaN);
210 209
211 final double channelDepth = channelFinder.getDepth(station); 210 final double channelDepth = channelFinder.getDepth(station);
212 row.putValue(BunduResultType.channelDepth, channelDepth); 211 row.putValue(BunduResultType.channelDepth, channelDepth);
213 double channelHeight; 212 double channelHeight;
214 if (!Double.isNaN(w) && !Double.isNaN(channelDepth)) 213 if (!Double.isNaN(w) && !Double.isNaN(channelDepth))
286 break; 285 break;
287 } 286 }
288 } 287 }
289 if (first < 0) 288 if (first < 0)
290 return; 289 return;
290 // Calculate all kms in missing volume calc range
291 double km;
291 int last = this.rows.size() - 1; 292 int last = this.rows.size() - 1;
292 for (int i = first; i <= this.rows.size() - 1; i++) { 293 for (int i = first; i <= this.rows.size() - 1; i++) {
293 if (!isKmInMissingVolumeRange(this.rows.get(i).getDoubleValue(GeneralResultType.station))) 294 km = this.rows.get(i).getDoubleValue(GeneralResultType.station);
295 if (!isKmInMissingVolumeRange(km))
294 break; 296 break;
295 if (this.rows.get(i).getDoubleValue(GeneralResultType.station) > this.missKmTo.doubleValue() - 0.0001) 297 if (km > this.missKmTo.doubleValue() - 0.0001)
296 last = i; 298 last = i;
297 final List<Double> areas = new ArrayList<>(); 299 final List<Double> areas = new ArrayList<>();
298 final List<Double> volumes = new ArrayList<>(); 300 final List<Double> volumes = new ArrayList<>();
299 double vTotal = 0.0; 301 double vTotal = 0.0;
300 double vExcav = 0.0; 302 double vExcav = 0.0;
355 * Computes the missing area and volume of the mean bed height of a km row 357 * Computes the missing area and volume of the mean bed height of a km row
356 */ 358 */
357 private double[] computeMeanBedMissingAreaAndVolume(final int current, final int first, final int last) { 359 private double[] computeMeanBedMissingAreaAndVolume(final int current, final int first, final int last) {
358 360
359 final double areaCurr = meanBedMissingArea(current, first, last); 361 final double areaCurr = meanBedMissingArea(current, first, last);
362 if (areaCurr < 0.0001)
363 return new double[] { 0.0, 0.0 };
360 final double areaPrev = meanBedMissingArea(current - 1, first, last); 364 final double areaPrev = meanBedMissingArea(current - 1, first, last);
361 final double areaNext = meanBedMissingArea(current + 1, first, last); 365 final double areaNext = meanBedMissingArea(current + 1, first, last);
362 final double kmCurr = missingKm(current); 366 final double kmCurr = missingKm(current);
363 final double kmPrev = missingKm(current - 1); 367 final double kmPrev = missingKm(current - 1);
364 final double kmNext = missingKm(current + 1); 368 final double kmNext = missingKm(current + 1);
373 * Gets the missing area of the mean bed height and a row if in range, otherwise 0.0 377 * Gets the missing area of the mean bed height and a row if in range, otherwise 0.0
374 */ 378 */
375 private double meanBedMissingArea(final int rowIndex, final int first, final int last) { 379 private double meanBedMissingArea(final int rowIndex, final int first, final int last) {
376 if ((first <= rowIndex) && (rowIndex <= last)) { 380 if ((first <= rowIndex) && (rowIndex <= last)) {
377 final double dh = this.rows.get(rowIndex).getDoubleValue(BunduResultType.channelDepth) 381 final double dh = this.rows.get(rowIndex).getDoubleValue(BunduResultType.channelDepth)
378 - this.rows.get(rowIndex).getDoubleValue(SInfoResultType.flowdepth); 382 - this.rows.get(rowIndex).getDoubleValue(BunduResultType.flowdepthMeanBed);
379 if (dh > 0.0) 383 if (dh > 0.0)
380 return dh * this.rows.get(rowIndex).getDoubleValue(BunduResultType.channelWidth); 384 return dh * this.rows.get(rowIndex).getDoubleValue(BunduResultType.channelWidth);
381 return 0.0; 385 return 0.0;
382 } 386 }
383 return 0.0; 387 return 0.0;

http://dive4elements.wald.intevation.org