Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhcalculation/BedQualityD50KmValueFinder.java @ 9017:9b9f5f4ddb80
Small changes with debug log
author | mschaefer |
---|---|
date | Mon, 23 Apr 2018 15:19:27 +0200 |
parents | 45f1ad66560e |
children | 5294114b1df4 |
rev | line source |
---|---|
8898 | 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 | |
8915
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
11 package org.dive4elements.river.artifacts.sinfo.tkhcalculation; |
8898 | 12 |
8915
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
13 import java.util.Calendar; |
8898 | 14 import java.util.Date; |
15 import java.util.List; | |
16 | |
17 import org.apache.commons.lang.math.DoubleRange; | |
18 import org.apache.commons.math.ArgumentOutsideDomainException; | |
19 import org.apache.commons.math.analysis.interpolation.LinearInterpolator; | |
20 import org.apache.commons.math.analysis.polynomials.PolynomialSplineFunction; | |
21 import org.apache.log4j.Logger; | |
8920
29442c03c6e3
d50 aggregation by median instead of arithmetic mean,
mschaefer
parents:
8915
diff
changeset
|
22 import org.dive4elements.river.artifacts.math.Utils; |
8964
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
23 import org.dive4elements.river.artifacts.model.Calculation; |
8898 | 24 import org.dive4elements.river.backend.SedDBSessionHolder; |
25 import org.dive4elements.river.model.River; | |
26 import org.hibernate.SQLQuery; | |
27 import org.hibernate.Session; | |
28 import org.hibernate.type.StandardBasicTypes; | |
29 | |
8920
29442c03c6e3
d50 aggregation by median instead of arithmetic mean,
mschaefer
parents:
8915
diff
changeset
|
30 import gnu.trove.TDoubleArrayList; |
29442c03c6e3
d50 aggregation by median instead of arithmetic mean,
mschaefer
parents:
8915
diff
changeset
|
31 |
8898 | 32 /** |
8915
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
33 * Searchable sorted km array with parallel bed measurements value array and linear interpolation for km and d50 between |
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
34 * the array elements.<br /> |
8901 | 35 * <br /> |
36 * See comment of SQL command on how the values are filtered and aggregated. | |
8915
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
37 * |
8898 | 38 * @author Matthias Schäfer |
39 * | |
40 */ | |
8920
29442c03c6e3
d50 aggregation by median instead of arithmetic mean,
mschaefer
parents:
8915
diff
changeset
|
41 public class BedQualityD50KmValueFinder { |
8915
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
42 |
8898 | 43 /***** FIELDS *****/ |
8915
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
44 |
8898 | 45 /** |
46 * Private log to use here. | |
47 */ | |
48 private static Logger log = Logger.getLogger(BedQualityD50KmValueFinder.class); | |
49 | |
50 /** | |
8920
29442c03c6e3
d50 aggregation by median instead of arithmetic mean,
mschaefer
parents:
8915
diff
changeset
|
51 * Query selecting all sub layer bed measurements with their d50 for a km range and a time period<br /> |
8898 | 52 * <br /> |
53 * A km may have bed measurements for multiple dates, multiple distances from the river bank, and multiple depth layers. | |
8920
29442c03c6e3
d50 aggregation by median instead of arithmetic mean,
mschaefer
parents:
8915
diff
changeset
|
54 * The query filters by km range, time period and layer (sub layer: below bed to max. 50 cm depth).<br /> |
8964
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
55 * |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
56 * If PostgreSQL would support a median aggregate function like Oracle does, the aggregation could be placed into this |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
57 * query. |
8898 | 58 */ |
9017 | 59 private static final String SQL_BED_D50_SUBLAYER_MEASUREMENT = // |
60 "SELECT t.km, t.datum, p.tiefevon, p.tiefebis, a.d50" // | |
61 + " FROM sohltest t INNER JOIN station s ON t.stationid = s.stationid" // | |
62 + " INNER JOIN gewaesser g ON s.gewaesserid = g.gewaesserid" // | |
63 + " INNER JOIN sohlprobe p ON t.sohltestid = p.sohltestid" // | |
64 + " INNER JOIN siebanalyse a ON p.sohlprobeid = a.sohlprobeid" // | |
65 + " WHERE (g.name = :name) AND (s.km BETWEEN :fromkm - 0.0001 AND :tokm + 0.0001)" // | |
66 + " AND (p.tiefevon > 0.0) AND (p.tiefebis <= 0.5)" // | |
67 + " AND (t.datum BETWEEN :fromdate AND :todate)" // | |
68 + " ORDER BY t.km ASC, a.d50 ASC"; | |
8964
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
69 |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
70 private Calculation problems; |
8898 | 71 |
72 /** | |
8920
29442c03c6e3
d50 aggregation by median instead of arithmetic mean,
mschaefer
parents:
8915
diff
changeset
|
73 * Real linear interpolator for kms and d50 values (m) |
8898 | 74 */ |
8915
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
75 private final PolynomialSplineFunction interpolator; |
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
76 |
8920
29442c03c6e3
d50 aggregation by median instead of arithmetic mean,
mschaefer
parents:
8915
diff
changeset
|
77 /***** CONSTRUCTORS *****/ |
8964
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
78 |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
79 private BedQualityD50KmValueFinder(final Calculation problems, final double[] kms, final double[] values) { |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
80 this.problems = problems; |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
81 |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
82 // FIXME: check: max distance prüfen? dann D4E-LinearInterpolator verwenden |
8915
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
83 this.interpolator = new LinearInterpolator().interpolate(kms, values); |
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
84 } |
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
85 |
8920
29442c03c6e3
d50 aggregation by median instead of arithmetic mean,
mschaefer
parents:
8915
diff
changeset
|
86 /***** METHODS *****/ |
8964
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
87 |
8898 | 88 /** |
8915
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
89 * Sohlbeschaffenheit (D50 Korndurchmesser aus Seddb) |
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
90 * Abhängig von Peiljahr |
8964
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
91 * |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
92 * @param problems |
8898 | 93 */ |
8964
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
94 public static BedQualityD50KmValueFinder loadBedMeasurements(final Calculation problems, final River river, final DoubleRange kmRange, |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
95 final int soundingYear, final int validYears) { |
8915
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
96 |
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
97 /* construct valid measurement time range */ |
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
98 final Calendar cal = Calendar.getInstance(); |
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
99 cal.clear(); |
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
100 |
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
101 cal.set(soundingYear - validYears, 0, 1); |
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
102 final Date startTime = cal.getTime(); |
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
103 |
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
104 cal.set(soundingYear + validYears, 11, 31); |
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
105 final Date endTime = cal.getTime(); |
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
106 |
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
107 log.debug(String.format("loadValues km %.3f - %.3f %tF - %tF", kmRange.getMinimumDouble(), kmRange.getMaximumDouble(), startTime, endTime)); |
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
108 final Session session = SedDBSessionHolder.HOLDER.get(); |
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
109 final SQLQuery sqlQuery = session.createSQLQuery(SQL_BED_D50_SUBLAYER_MEASUREMENT).addScalar("km", StandardBasicTypes.DOUBLE) |
8964
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
110 .addScalar("datum", StandardBasicTypes.DATE).addScalar("tiefevon", StandardBasicTypes.DOUBLE).addScalar("tiefebis", StandardBasicTypes.DOUBLE) |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
111 .addScalar("d50", StandardBasicTypes.DOUBLE); |
8915
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
112 final String seddbRiver = river.nameForSeddb(); |
8898 | 113 sqlQuery.setString("name", seddbRiver); |
114 sqlQuery.setDouble("fromkm", kmRange.getMinimumDouble()); | |
115 sqlQuery.setDouble("tokm", kmRange.getMaximumDouble()); | |
8915
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
116 sqlQuery.setDate("fromdate", startTime); |
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
117 sqlQuery.setDate("todate", endTime); |
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
118 |
8898 | 119 final List<Object[]> rows = sqlQuery.list(); |
8920
29442c03c6e3
d50 aggregation by median instead of arithmetic mean,
mschaefer
parents:
8915
diff
changeset
|
120 final TDoubleArrayList kms = new TDoubleArrayList(); |
29442c03c6e3
d50 aggregation by median instead of arithmetic mean,
mschaefer
parents:
8915
diff
changeset
|
121 final TDoubleArrayList values = new TDoubleArrayList(); |
29442c03c6e3
d50 aggregation by median instead of arithmetic mean,
mschaefer
parents:
8915
diff
changeset
|
122 final TDoubleArrayList kmd50s = new TDoubleArrayList(); |
8964
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
123 |
9017 | 124 // Median aggregate d50 values for each km |
8920
29442c03c6e3
d50 aggregation by median instead of arithmetic mean,
mschaefer
parents:
8915
diff
changeset
|
125 for (int i = 0; i <= rows.size() - 1; i++) { |
29442c03c6e3
d50 aggregation by median instead of arithmetic mean,
mschaefer
parents:
8915
diff
changeset
|
126 kmd50s.add((double) rows.get(i)[4]); |
8964
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
127 if (((i == rows.size() - 1) || !Utils.epsilonEquals((double) rows.get(i)[0], (double) rows.get(i + 1)[0], 0.0001))) { |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
128 final int k = kmd50s.size() / 2; |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
129 values.add(((k + k < kmd50s.size()) ? kmd50s.get(k) : (kmd50s.get(k - 1) + kmd50s.get(k)) / 2) / 1000); |
8920
29442c03c6e3
d50 aggregation by median instead of arithmetic mean,
mschaefer
parents:
8915
diff
changeset
|
130 kms.add((double) rows.get(i)[0]); |
9017 | 131 log.debug(String.format("loadValues km %.3f d50(mm) %.1f count %d", kms.get(kms.size() - 1), values.get(values.size() - 1) * 1000, |
132 kmd50s.size())); | |
8920
29442c03c6e3
d50 aggregation by median instead of arithmetic mean,
mschaefer
parents:
8915
diff
changeset
|
133 kmd50s.clear(); |
8964
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
134 } |
8920
29442c03c6e3
d50 aggregation by median instead of arithmetic mean,
mschaefer
parents:
8915
diff
changeset
|
135 } |
9017 | 136 if (kms.size() >= 1) |
137 log.debug(String.format("loadValues: %d kms found from %.3f to %.3f", kms.size(), kms.get(0), kms.get(kms.size() - 1))); | |
138 else | |
139 log.debug("loadValues: no kms found"); | |
8964
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
140 |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
141 if (kms.size() < 2 || values.size() < 2) { |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
142 problems.addProblem("bedqualityd50kmvaluefinder.empty", soundingYear); |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
143 return null; |
8898 | 144 } |
8964
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
145 |
8911
37ff7f435912
SINFO Flowdepth: more error checks, d50 interpolation, avoid negative tkh
mschaefer
parents:
8901
diff
changeset
|
146 try { |
8964
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
147 return new BedQualityD50KmValueFinder(problems, kms.toNativeArray(), values.toNativeArray()); |
8915
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
148 } |
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
149 catch (final Exception e) { |
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
150 e.printStackTrace(); |
8964
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
151 problems.addProblem("bedqualityd50kmvaluefinder.error", e.getLocalizedMessage()); |
8915
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
152 return null; |
8911
37ff7f435912
SINFO Flowdepth: more error checks, d50 interpolation, avoid negative tkh
mschaefer
parents:
8901
diff
changeset
|
153 } |
8898 | 154 } |
155 | |
8915
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
156 /** |
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
157 * Returns the d50 value interpolated according to a km |
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
158 * |
8920
29442c03c6e3
d50 aggregation by median instead of arithmetic mean,
mschaefer
parents:
8915
diff
changeset
|
159 * @return d50 (m) of the km, or NaN |
8915
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
160 */ |
8964
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
161 public double findD50(final double km) { |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
162 try { |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
163 return this.interpolator.value(km); |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
164 } |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
165 catch (final ArgumentOutsideDomainException e) { |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
166 e.printStackTrace(); |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
167 |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
168 if (this.problems != null) { |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
169 this.problems.addProblem(km, "bedqualityd50kmvaluefinder.missing"); |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
170 // Report only once |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
171 this.problems = null; |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
172 } |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
173 |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
174 return Double.NaN; |
45f1ad66560e
Code cleanup concerning calculations: improved error handling; improved interpolation; bed heights are now always used for spatial discretisation
gernotbelger
parents:
8921
diff
changeset
|
175 } |
8915
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
176 } |
d9dbf0b74bc2
Refaktoring of flow depth calculation, extracting tkh part. First implementation of tkh calculation.
gernotbelger
parents:
8911
diff
changeset
|
177 } |