Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhcalculation/WaterlevelValuesFinder.java @ 9040:5294114b1df4
Fixed/changed some FIXMEs/TODOs
author | gernotbelger |
---|---|
date | Wed, 02 May 2018 12:19:31 +0200 |
parents | 45f1ad66560e |
children |
rev | line source |
---|---|
8946 | 1 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde |
2 * Software engineering by | |
3 * Björnsen Beratende Ingenieure GmbH | |
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt | |
5 * | |
6 * This file is Free Software under the GNU AGPL (>=v3) | |
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
8 * documentation coming with Dive4Elements River for details. | |
9 */ | |
10 package org.dive4elements.river.artifacts.sinfo.tkhcalculation; | |
11 | |
8964
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8946
diff
changeset
|
12 import org.dive4elements.river.artifacts.model.Calculation; |
8946 | 13 import org.dive4elements.river.artifacts.model.WKms; |
8964
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8946
diff
changeset
|
14 import org.dive4elements.river.artifacts.sinfo.util.LinearInterpolator; |
8946 | 15 |
16 /** | |
17 * Abstraction for access to waterlevels by station. | |
18 * | |
19 * @author Gernot Belger | |
20 */ | |
21 public class WaterlevelValuesFinder { | |
22 | |
8964
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8946
diff
changeset
|
23 private static final double MAX_DSTANCE_KM = 1.0; |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8946
diff
changeset
|
24 |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8946
diff
changeset
|
25 public static WaterlevelValuesFinder fromKms(final Calculation problems, final WKms wkms) { |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8946
diff
changeset
|
26 return new WaterlevelValuesFinder(problems, wkms); |
8946 | 27 } |
28 | |
8964
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8946
diff
changeset
|
29 private final LinearInterpolator wstInterpolator; |
8946 | 30 |
8964
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8946
diff
changeset
|
31 private WaterlevelValuesFinder(final Calculation problems, final WKms wkms) { |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8946
diff
changeset
|
32 this.wstInterpolator = LinearInterpolator.create(problems, wkms.allKms(), wkms.allWs(), MAX_DSTANCE_KM); |
8946 | 33 } |
34 | |
35 public double getWaterlevel(final double km) { | |
8964
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8946
diff
changeset
|
36 return this.wstInterpolator.value(km); |
8946 | 37 } |
38 } |