annotate artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstCalculation.java @ 9598:17414e70746e

Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
author mschaefer
date Tue, 05 Feb 2019 15:51:35 +0100
parents c57caff9b00b
children 4c73fe16533d
rev   line source
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
1 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
9313
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
2 * Software engineering by
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
3 * Björnsen Beratende Ingenieure GmbH
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
5 *
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
6 * This file is Free Software under the GNU AGPL (>=v3)
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
8 * documentation coming with Dive4Elements River for details.
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
9 */
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
10
9313
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
11 package org.dive4elements.river.artifacts.bundu.bezugswst;
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
12
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
13 import java.util.ArrayList;
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
14 import java.util.List;
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
15
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
16 import org.dive4elements.artifacts.CallContext;
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
17 import org.dive4elements.river.artifacts.access.FixRealizingAccess;
9313
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
18 import org.dive4elements.river.artifacts.bundu.BUNDUArtifact;
9318
7b2b086e45f0 collision pdf details, ResultType refactoring, bezugswst result
gernotbelger
parents: 9313
diff changeset
19 import org.dive4elements.river.artifacts.bundu.BunduResultType;
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
20 import org.dive4elements.river.artifacts.common.AbstractResultType;
9313
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
21 import org.dive4elements.river.artifacts.common.GeneralResultType;
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
22 import org.dive4elements.river.artifacts.common.ResultRow;
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
23 import org.dive4elements.river.artifacts.model.Calculation;
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
24 import org.dive4elements.river.artifacts.model.Calculation.Problem;
9313
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
25 import org.dive4elements.river.artifacts.model.CalculationResult;
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
26 import org.dive4elements.river.artifacts.model.DateRange;
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
27 import org.dive4elements.river.artifacts.model.WQKms;
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
28 import org.dive4elements.river.artifacts.model.fixings.FixRealizingCalculation;
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
29 import org.dive4elements.river.artifacts.model.fixings.FixRealizingResult;
9499
853f2dafc16e VegetationZones in CrossSectionsDiagram
gernotbelger
parents: 9495
diff changeset
30 import org.dive4elements.river.artifacts.model.river.RiverInfoProvider;
9313
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
31 import org.dive4elements.river.artifacts.resources.Resources;
9588
c57caff9b00b Punkt 10.6 CSV-Ausgabe Abflusszeitreihenlänge
gernotbelger
parents: 9573
diff changeset
32 import org.dive4elements.river.artifacts.services.DynamicMainValuesTimeRangeDeterminationService;
c57caff9b00b Punkt 10.6 CSV-Ausgabe Abflusszeitreihenlänge
gernotbelger
parents: 9573
diff changeset
33 import org.dive4elements.river.artifacts.services.DynamicMainValuesTimeRangeDeterminationService.GaugeInfoResult;
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
34 import org.dive4elements.river.artifacts.sinfo.tkhstate.BedHeightsFinder;
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
35 import org.dive4elements.river.artifacts.sinfo.tkhstate.BedQualityD50TimeRangeConfig;
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
36 import org.dive4elements.river.artifacts.sinfo.tkhstate.WinfoArtifactWrapper;
9313
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
37 import org.dive4elements.river.artifacts.sinfo.util.CalculationUtils;
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
38 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo;
9323
86d2cbfe7f7f bundu bezugswst excel metadaten
gernotbelger
parents: 9318
diff changeset
39 import org.dive4elements.river.artifacts.sinfo.util.WstInfo;
9528
55c187a0a31e Fixed: consistent gauge assignment with downstream gauge as reference gauge for calc range starting at a gauge range limit
mschaefer
parents: 9505
diff changeset
40 import org.dive4elements.river.artifacts.states.WaterlevelData;
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
41 import org.dive4elements.river.exports.WaterlevelDescriptionBuilder;
9444
ecadc9ed0ba0 Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents: 9438
diff changeset
42 import org.dive4elements.river.model.BedHeightValueType;
9313
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
43 import org.dive4elements.river.model.River;
9451
fd6621f47a72 Bundu bzws density calculation completed
mschaefer
parents: 9450
diff changeset
44 import org.dive4elements.river.utils.DoubleUtil;
9313
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
45
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
46 class BezugswstCalculation {
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
47
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
48 // private static Logger log = Logger.getLogger(BezugswstCalculation.class);
9313
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
49
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
50 /**
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
51 * Additional depth (m) to compute the excavation volume
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
52 */
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
53 private final static double EXCAVATION_DEPTH = 0.2; // REMARK Sollte von außen einstellbar sein
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
54
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
55 /**
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
56 * Excavation costs (euro) per cubic meter
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
57 */
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
58 private final static double EXPENSE_PER_CBM = 12.0; // REMARK Sollte von außen einstellbar sein
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
59
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
60 private final static double KM_TO_M = 1000.0;
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
61
9313
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
62 private final CallContext context;
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
63
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
64 private final List<ResultRow> rows;
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
65
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
66 private Double missKmFrom;
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
67
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
68 private Double missKmTo;
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
69
9313
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
70 public BezugswstCalculation(final CallContext context) {
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
71 this.context = context;
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
72 this.rows = new ArrayList<>();
9313
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
73 }
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
74
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
75 /**
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
76 * Calculates the result rows of a bundu bzws workflow
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
77 */
9313
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
78 public CalculationResult calculate(final BUNDUArtifact bunduartifact) {
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
79
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
80 // Get input data
9313
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
81 final String user = CalculationUtils.findArtifactUser(this.context, bunduartifact);
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
82 final BunduAccess access = new BunduAccess(bunduartifact);
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
83 final River river = access.getRiver();
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
84 final RiverInfo riverInfo = new RiverInfo(river);
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
85 final String calcModeLabel = Resources.getMsg(this.context.getMeta(), "bundu_bezugswst");
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
86 final boolean preprocessing = access.getPreprocessing();
9323
86d2cbfe7f7f bundu bezugswst excel metadaten
gernotbelger
parents: 9318
diff changeset
87 final int startYear = access.getStartYear();
86d2cbfe7f7f bundu bezugswst excel metadaten
gernotbelger
parents: 9318
diff changeset
88 final int endYear = access.getBezugsJahr();
86d2cbfe7f7f bundu bezugswst excel metadaten
gernotbelger
parents: 9318
diff changeset
89 final Integer ud = access.getUd();
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
90 this.missKmFrom = access.getMissingVolFrom();
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
91 this.missKmTo = access.getMissingVolTo();
9330
0a0937f33bb5 bundu.bezugswst first result for missing volume added
gernotbelger
parents: 9323
diff changeset
92
9588
c57caff9b00b Punkt 10.6 CSV-Ausgabe Abflusszeitreihenlänge
gernotbelger
parents: 9573
diff changeset
93 final GaugeInfoResult gi = DynamicMainValuesTimeRangeDeterminationService
c57caff9b00b Punkt 10.6 CSV-Ausgabe Abflusszeitreihenlänge
gernotbelger
parents: 9573
diff changeset
94 .getCommonTimeRangeForGauges(river.determineGauges(access.getLowerKm(), access.getUpperKm()), startYear, endYear, this.context.getMeta());
c57caff9b00b Punkt 10.6 CSV-Ausgabe Abflusszeitreihenlänge
gernotbelger
parents: 9573
diff changeset
95 final int globalAdjustedEndYear = gi.getGlobalEndYear();
c57caff9b00b Punkt 10.6 CSV-Ausgabe Abflusszeitreihenlänge
gernotbelger
parents: 9573
diff changeset
96 final int globalAdjustedStartYear = gi.getGlobalStartYear();
c57caff9b00b Punkt 10.6 CSV-Ausgabe Abflusszeitreihenlänge
gernotbelger
parents: 9573
diff changeset
97
9495
bb278c927b66 Datenkorb bezugswasserstände längsschnitte + minor fixes
gernotbelger
parents: 9480
diff changeset
98 final BezugswstCalculationResults results = new BezugswstCalculationResults(calcModeLabel, user, riverInfo, access.getRange(),
bb278c927b66 Datenkorb bezugswasserstände längsschnitte + minor fixes
gernotbelger
parents: 9480
diff changeset
99 access.isCalculateMissingVolume());
9330
0a0937f33bb5 bundu.bezugswst first result for missing volume added
gernotbelger
parents: 9323
diff changeset
100
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
101 final Calculation problems = new Calculation();
9331
127638669052 bundu bezugswst result 2
gernotbelger
parents: 9330
diff changeset
102
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
103 // Calculate the wspl for the selected river range as in fixa awspl
9465
be9bd06a1e3f bezugswst sounding select for miss'vol only (calc crashes)
gernotbelger
parents: 9451
diff changeset
104 bunduartifact.addStringData("wq_isq", "true");
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
105 final WinfoArtifactWrapper winfo = new WinfoArtifactWrapper(bunduartifact);
9528
55c187a0a31e Fixed: consistent gauge assignment with downstream gauge as reference gauge for calc range starting at a gauge range limit
mschaefer
parents: 9505
diff changeset
106 final RiverInfoProvider riverInfoProvider = RiverInfoProvider.forRange(this.context, river, access.getRange());
9438
d2f5375ede26 Replaced own W and Q facets in bundu bzws by subclass of FixWaterlevelFacet, added annotations and datacage
mschaefer
parents: 9437
diff changeset
107 final FixRealizingResult fixResult = calculateWspl(bunduartifact, problems);
d2f5375ede26 Replaced own W and Q facets in bundu bzws by subclass of FixWaterlevelFacet, added annotations and datacage
mschaefer
parents: 9437
diff changeset
108 if (fixResult == null)
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
109 return new CalculationResult(results, problems);
9438
d2f5375ede26 Replaced own W and Q facets in bundu bzws by subclass of FixWaterlevelFacet, added annotations and datacage
mschaefer
parents: 9437
diff changeset
110
d2f5375ede26 Replaced own W and Q facets in bundu bzws by subclass of FixWaterlevelFacet, added annotations and datacage
mschaefer
parents: 9437
diff changeset
111 final WQKms wqkms = fixResult.getWQKms()[0];
9528
55c187a0a31e Fixed: consistent gauge assignment with downstream gauge as reference gauge for calc range starting at a gauge range limit
mschaefer
parents: 9505
diff changeset
112 // We have no wst year as the wst is created by a calculation; we do not need it though
55c187a0a31e Fixed: consistent gauge assignment with downstream gauge as reference gauge for calc range starting at a gauge range limit
mschaefer
parents: 9505
diff changeset
113 final int wspYear = -1;
55c187a0a31e Fixed: consistent gauge assignment with downstream gauge as reference gauge for calc range starting at a gauge range limit
mschaefer
parents: 9505
diff changeset
114 // Remark: showAllGauges true for Fixierungsanalyse, false for WInfo, so true here as well
55c187a0a31e Fixed: consistent gauge assignment with downstream gauge as reference gauge for calc range starting at a gauge range limit
mschaefer
parents: 9505
diff changeset
115 final boolean showAllGauges = true;
55c187a0a31e Fixed: consistent gauge assignment with downstream gauge as reference gauge for calc range starting at a gauge range limit
mschaefer
parents: 9505
diff changeset
116 final WaterlevelData waterlevel = new WaterlevelData(wqkms, wspYear, showAllGauges, true);
55c187a0a31e Fixed: consistent gauge assignment with downstream gauge as reference gauge for calc range starting at a gauge range limit
mschaefer
parents: 9505
diff changeset
117 final RiverInfoProvider riverInfoProvider2 = riverInfoProvider.forWaterlevel(waterlevel);
55c187a0a31e Fixed: consistent gauge assignment with downstream gauge as reference gauge for calc range starting at a gauge range limit
mschaefer
parents: 9505
diff changeset
118 final WstInfo wstInfo = new WstInfo(wqkms.getName(), 0, riverInfoProvider2.getReferenceGauge(), true);
9331
127638669052 bundu bezugswst result 2
gernotbelger
parents: 9330
diff changeset
119
9573
b9c87bbff6a4 mean bed height -> mean bed LEVEL
gernotbelger
parents: 9535
diff changeset
120 // Fetch the bed levels of the selected sounding
9480
7228bd10a8cc Fixed bundu bzws bedheightfinder todos, added types for excavation volume and costs total
mschaefer
parents: 9479
diff changeset
121 final Integer bedHeightId = access.getBedHeightID();
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
122 final BedHeightsFinder bedHeightsFinder = (bedHeightId != null) ? BedHeightsFinder.forId(problems, bedHeightId, access.getRange(), false)
9480
7228bd10a8cc Fixed bundu bzws bedheightfinder todos, added types for excavation volume and costs total
mschaefer
parents: 9479
diff changeset
123 : BedHeightsFinder.NullFinder();
9332
c64de8cc4e97 bundu.bezugswst missing volume calcResult3
gernotbelger
parents: 9331
diff changeset
124
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
125 // Fetch the river channel data
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
126 final ChannelFinder channelFinder = ChannelFinder.loadValues(problems, river, access.getBezugsJahr());
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
127 if (channelFinder == null)
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
128 return new CalculationResult(results, problems);
9332
c64de8cc4e97 bundu.bezugswst missing volume calcResult3
gernotbelger
parents: 9331
diff changeset
129
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
130 // Compute the result rows
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
131 for (int i = 0; i <= wqkms.size() - 1; i++) {
9528
55c187a0a31e Fixed: consistent gauge assignment with downstream gauge as reference gauge for calc range starting at a gauge range limit
mschaefer
parents: 9505
diff changeset
132 this.rows.add(createRow(wqkms.getKm(i), wqkms.getW(i), wqkms.getQ(i), bedHeightsFinder, channelFinder, riverInfoProvider2, wstInfo));
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
133 }
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
134
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
135 // Compute the missing volumes
9495
bb278c927b66 Datenkorb bezugswasserstände längsschnitte + minor fixes
gernotbelger
parents: 9480
diff changeset
136 if (access.isCalculateMissingVolume()) {
9480
7228bd10a8cc Fixed bundu bzws bedheightfinder todos, added types for excavation volume and costs total
mschaefer
parents: 9479
diff changeset
137 if ((bedHeightsFinder == null) || bedHeightsFinder.isNull())
9465
be9bd06a1e3f bezugswst sounding select for miss'vol only (calc crashes)
gernotbelger
parents: 9451
diff changeset
138 return new CalculationResult(results, problems);
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
139 computeMissingVolumes(problems);
9451
fd6621f47a72 Bundu bzws density calculation completed
mschaefer
parents: 9450
diff changeset
140 final BedQualityCalculator bqCalculator = computeDensities(problems, bunduartifact, access, river);
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
141 if (bqCalculator != null)
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
142 computeMissingMasses(problems, bqCalculator);
9330
0a0937f33bb5 bundu.bezugswst first result for missing volume added
gernotbelger
parents: 9323
diff changeset
143 }
0a0937f33bb5 bundu.bezugswst first result for missing volume added
gernotbelger
parents: 9323
diff changeset
144
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
145 // Add the result to the results collection
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
146 final WaterlevelDescriptionBuilder descBuilder = new WaterlevelDescriptionBuilder(winfo, this.context);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
147 final String qtext = descBuilder.getMetadataQ();
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
148 final BezugswstMainCalculationResult result = new BezugswstMainCalculationResult("bundu-bzws", this.rows, bedHeightsFinder.getInfo(), wstInfo,
9588
c57caff9b00b Punkt 10.6 CSV-Ausgabe Abflusszeitreihenlänge
gernotbelger
parents: 9573
diff changeset
149 access.getFunction(), preprocessing, globalAdjustedStartYear, globalAdjustedEndYear, ud, qtext, wqkms, this.missKmFrom, this.missKmTo);
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
150 results.addResult(result, problems);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
151
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
152 // Create the missing volume results
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
153 if (access.getMissingVolFrom() != null) {
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
154 final String title1 = Resources.getMsg(this.context.getMeta(), "bundu.export.csv.title.bezugswst.result1");
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
155 final BezugswstMissVolCalculationResult1 r1 = new BezugswstMissVolCalculationResult1(title1, this.rows);
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
156 results.addResult(r1, null);
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
157
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
158 final String title2 = Resources.getMsg(this.context.getMeta(), "bundu.export.csv.title.bezugswst.result2");
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
159 final List<ResultRow> rows2 = copyMissRows();
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
160 final BezugswstMissVolCalculationResult2 r2 = new BezugswstMissVolCalculationResult2(title2, rows2);
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
161 results.addResult(r2, null);
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
162
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
163 final String title3 = Resources.getMsg(this.context.getMeta(), "bundu.export.csv.title.bezugswst.result3");
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
164 final List<ResultRow> totalRows = new ArrayList<>();
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
165 totalRows.add(createTotalsRow(problems));
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
166 final BezugswstMissVolCalculationResult3 r3 = new BezugswstMissVolCalculationResult3(title3, totalRows);
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
167 results.addResult(r3, null);
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
168 }
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
169
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
170 return new CalculationResult(results, problems);
9313
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
171 }
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
172
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
173 /**
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
174 * Calculates a w-q-longitudinal section for a river range and Q specified in an artifact
9313
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
175 */
9438
d2f5375ede26 Replaced own W and Q facets in bundu bzws by subclass of FixWaterlevelFacet, added annotations and datacage
mschaefer
parents: 9437
diff changeset
176 private FixRealizingResult calculateWspl(final BUNDUArtifact bundu, final Calculation problems) {
9313
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
177
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
178 final FixRealizingAccess access = new FixRealizingAccess(bundu);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
179 final FixRealizingCalculation calc = new FixRealizingCalculation(access);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
180
9479
2b83d3a96703 i18n TODO "benutzerdefiniert" = "custom" fixed
gernotbelger
parents: 9465
diff changeset
181 final CalculationResult res = calc.calculate(this.context.getMeta());
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
182
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
183 final FixRealizingResult fixRes = (FixRealizingResult) res.getData();
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
184
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
185 final List<Problem> problems2 = res.getReport().getProblems();
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
186 if (problems2 != null) {
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
187 for (final Problem problem : problems2) {
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
188 problems.addProblem(problem);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
189 }
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
190 }
9438
d2f5375ede26 Replaced own W and Q facets in bundu bzws by subclass of FixWaterlevelFacet, added annotations and datacage
mschaefer
parents: 9437
diff changeset
191 return fixRes;
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
192 }
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
193
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
194 /**
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
195 * Create a result row for a station
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
196 */
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
197 private ResultRow createRow(final double station, final double w, final double q, final BedHeightsFinder bedHeightsFinder,
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
198 final ChannelFinder channelFinder, final RiverInfoProvider riverInfoProv, final WstInfo wstInfo) {
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
199
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
200 // Set W and Q
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
201 final ResultRow row = ResultRow.create();
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
202 row.putValue(GeneralResultType.station, station);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
203 row.putValue(BunduResultType.bezugswst, w);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
204 row.putValue(GeneralResultType.dischargeQwithUnit, q);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
205 row.putValue(GeneralResultType.waterlevelLabel, wstInfo.getLabel());
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
206 row.putValue(GeneralResultType.gaugeLabel, riverInfoProv.findGauge(station));
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
207 row.putValue(GeneralResultType.location, riverInfoProv.getLocation(station));
9480
7228bd10a8cc Fixed bundu bzws bedheightfinder todos, added types for excavation volume and costs total
mschaefer
parents: 9479
diff changeset
208 if (bedHeightsFinder.getInfo() != null)
7228bd10a8cc Fixed bundu bzws bedheightfinder todos, added types for excavation volume and costs total
mschaefer
parents: 9479
diff changeset
209 row.putValue(BunduResultType.sounding, bedHeightsFinder.getInfo().getDescription());
7228bd10a8cc Fixed bundu bzws bedheightfinder todos, added types for excavation volume and costs total
mschaefer
parents: 9479
diff changeset
210 else
7228bd10a8cc Fixed bundu bzws bedheightfinder todos, added types for excavation volume and costs total
mschaefer
parents: 9479
diff changeset
211 row.putValue(BunduResultType.sounding, "");
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
212
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
213 // Set bed and channel bottom height
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
214 final double msh = bedHeightsFinder.getMeanBedHeight(station);
9535
3fa8551c3d1b Fixed error in bundu bzws missing volume calculation for mean bed height;
mschaefer
parents: 9528
diff changeset
215 row.putValue(BunduResultType.heightMeanBed, msh);
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
216 if (!Double.isNaN(w) && !Double.isNaN(msh))
9535
3fa8551c3d1b Fixed error in bundu bzws missing volume calculation for mean bed height;
mschaefer
parents: 9528
diff changeset
217 row.putValue(BunduResultType.flowdepthMeanBed, w - msh);
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
218 else
9535
3fa8551c3d1b Fixed error in bundu bzws missing volume calculation for mean bed height;
mschaefer
parents: 9528
diff changeset
219 row.putValue(BunduResultType.flowdepthMeanBed, Double.NaN);
9465
be9bd06a1e3f bezugswst sounding select for miss'vol only (calc crashes)
gernotbelger
parents: 9451
diff changeset
220
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
221 final double channelDepth = channelFinder.getDepth(station);
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
222 row.putValue(BunduResultType.channelDepth, channelDepth);
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
223 double channelHeight;
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
224 if (!Double.isNaN(w) && !Double.isNaN(channelDepth))
9505
3f230fe8eb19 Bezugspegel-assignment changed for coinciding gauge and calculation range (Meilenstein-2 2.2.4)
mschaefer
parents: 9499
diff changeset
225 channelHeight = w - channelDepth;
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
226 else
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
227 channelHeight = Double.NaN;
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
228 row.putValue(BunduResultType.channelLowerEdge, channelHeight);
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
229 final double channelWidth = channelFinder.getWidth(station);
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
230 row.putValue(BunduResultType.channelWidth, channelWidth);
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
231 if (!Double.isNaN(channelHeight)) {
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
232 if (Double.isNaN(msh))
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
233 row.putValue(BunduResultType.missDepthMeanBed, Double.NaN);
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
234 else if (msh > channelHeight + 0.001)
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
235 row.putValue(BunduResultType.missDepthMeanBed, msh - channelHeight);
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
236 else
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
237 row.putValue(BunduResultType.missDepthMeanBed, 0.0);
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
238 }
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
239
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
240 // Set field heights and missing heights
9444
ecadc9ed0ba0 Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents: 9438
diff changeset
241 final List<Double> fieldHeights = new ArrayList<>();
ecadc9ed0ba0 Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents: 9438
diff changeset
242 final List<Double> fieldDepths = new ArrayList<>();
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
243 final List<Double> fieldMissDepths = new ArrayList<>();
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
244 final List<Double> fieldMissWidths = new ArrayList<>();
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
245 final List<Double> fieldNulls = new ArrayList<>();
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
246 int missFieldCnt = 0;
9444
ecadc9ed0ba0 Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents: 9438
diff changeset
247 for (int i = BedHeightValueType.FIELD_FIRST_INDEX; i <= BedHeightValueType.FIELD_LAST_INDEX; i++) {
ecadc9ed0ba0 Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents: 9438
diff changeset
248 final double h = bedHeightsFinder.getFieldHeight(station, i);
ecadc9ed0ba0 Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents: 9438
diff changeset
249 fieldHeights.add(Double.valueOf(h));
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
250 fieldDepths.add(Double.valueOf(w - h));
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
251 if (Double.isNaN(h)) {
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
252 fieldMissDepths.add(Double.NaN);
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
253 fieldMissWidths.add(Double.NaN);
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
254 }
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
255 else if (h > channelHeight + 0.001) {
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
256 missFieldCnt++;
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
257 fieldMissDepths.add(Double.valueOf(h - channelHeight));
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
258 fieldMissWidths.add(Double.valueOf(channelWidth / BedHeightValueType.FIELD_LAST_INDEX));
9448
d32b11d585cd CSV-Export bundu.wst fehlvolumen
gernotbelger
parents: 9446
diff changeset
259 } else {
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
260 fieldMissDepths.add(Double.valueOf(0.0));
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
261 fieldMissWidths.add(Double.valueOf(0.0));
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
262 }
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
263 fieldNulls.add(Double.NaN);
9444
ecadc9ed0ba0 Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents: 9438
diff changeset
264 }
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
265 if (!Double.isNaN(msh) && isKmInMissingVolumeRange(station)) {
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
266 row.putValue(BunduResultType.missDepthFields, fieldMissDepths);
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
267 row.putValue(BunduResultType.missWidthFields, fieldMissWidths);
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
268 row.putValue(BunduResultType.hasMissingDepth, (missFieldCnt >= 1));
9465
be9bd06a1e3f bezugswst sounding select for miss'vol only (calc crashes)
gernotbelger
parents: 9451
diff changeset
269 } else {
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
270 row.putValue(BunduResultType.missDepthFields, fieldNulls);
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
271 row.putValue(BunduResultType.missWidthFields, fieldNulls);
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
272 row.putValue(BunduResultType.hasMissingDepth, null);
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
273 }
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
274 row.putValue(BunduResultType.missVolumeFields, fieldNulls);
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
275 row.putValue(BunduResultType.missMassFields, fieldNulls);
9444
ecadc9ed0ba0 Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents: 9438
diff changeset
276 row.putValue(BunduResultType.bedHeightFields, fieldHeights);
ecadc9ed0ba0 Added heights and depths of cross section fields in the bundu bzws calculation and longitudinal section charts
mschaefer
parents: 9438
diff changeset
277 row.putValue(BunduResultType.depthFields, fieldDepths);
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
278
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
279 // Preset the missing volume fields with NaN
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
280 row.putValue(BunduResultType.excavationCosts, Double.NaN);
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
281 row.putValue(BunduResultType.excavationVolume, Double.NaN);
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
282 row.putValue(BunduResultType.missVolumeMeanBed, Double.NaN);
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
283 row.putValue(BunduResultType.missMassMeanBed, Double.NaN);
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
284 row.putValue(BunduResultType.missVolumeTotal, Double.NaN);
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
285 row.putValue(BunduResultType.missMassTotal, Double.NaN);
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
286 row.putValue(BunduResultType.density, Double.NaN);
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
287 row.putValue(BunduResultType.missStationRangeFrom, Double.NaN);
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
288 row.putValue(BunduResultType.missStationRangeTo, Double.NaN);
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
289
9432
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
290 return row;
d194c5b24bf8 Added bundu bzws w calculation and longitudinal sections of wspl and depth
mschaefer
parents: 9337
diff changeset
291 }
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
292
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
293 /**
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
294 * Computes the missing volumes in a km range
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
295 */
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
296 private void computeMissingVolumes(final Calculation problems) {
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
297 // Search start km
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
298 int first = -1;
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
299 for (int j = 0; j <= this.rows.size() - 1; j++) {
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
300 if (isKmInMissingVolumeRange(this.rows.get(j).getDoubleValue(GeneralResultType.station))) {
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
301 first = j;
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
302 break;
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
303 }
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
304 }
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
305 if (first < 0)
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
306 return;
9535
3fa8551c3d1b Fixed error in bundu bzws missing volume calculation for mean bed height;
mschaefer
parents: 9528
diff changeset
307 // Calculate all kms in missing volume calc range
3fa8551c3d1b Fixed error in bundu bzws missing volume calculation for mean bed height;
mschaefer
parents: 9528
diff changeset
308 double km;
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
309 int last = this.rows.size() - 1;
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
310 for (int i = first; i <= this.rows.size() - 1; i++) {
9535
3fa8551c3d1b Fixed error in bundu bzws missing volume calculation for mean bed height;
mschaefer
parents: 9528
diff changeset
311 km = this.rows.get(i).getDoubleValue(GeneralResultType.station);
3fa8551c3d1b Fixed error in bundu bzws missing volume calculation for mean bed height;
mschaefer
parents: 9528
diff changeset
312 if (!isKmInMissingVolumeRange(km))
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
313 break;
9535
3fa8551c3d1b Fixed error in bundu bzws missing volume calculation for mean bed height;
mschaefer
parents: 9528
diff changeset
314 if (km > this.missKmTo.doubleValue() - 0.0001)
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
315 last = i;
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
316 if (this.rows.get(i).getValue(BunduResultType.hasMissingDepth) == null)
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
317 continue;
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
318 final double chDepth = this.rows.get(i).getDoubleValue(BunduResultType.channelDepth) + EXCAVATION_DEPTH;
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
319 final List<Double> areas = new ArrayList<>();
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
320 final List<Double> volumes = new ArrayList<>();
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
321 double vTotal = 0.0;
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
322 double vExcav = 0.0;
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
323 for (int j = BedHeightValueType.FIELD_FIRST_INDEX; j <= BedHeightValueType.FIELD_LAST_INDEX; j++) {
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
324 if (getFieldValue(i, BunduResultType.missDepthFields, j) > 0.0001) {
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
325 computeMissingVolume(volumes, areas, i, first, last, j, ActualMissingHeightComputer.Instance);
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
326 vTotal += volumes.get(j - 1);
9448
d32b11d585cd CSV-Export bundu.wst fehlvolumen
gernotbelger
parents: 9446
diff changeset
327 } else {
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
328 volumes.add(Double.valueOf(0.0));
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
329 areas.add(Double.valueOf(0.0));
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
330 }
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
331 if (chDepth - getFieldValue(i, BunduResultType.depthFields, j) > 0.0001) {
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
332 vExcav += computeMissingVolume(null, null, i, first, last, j, ExcavationMissingAreaComputer.Instance);
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
333 }
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
334 }
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
335 final double[] meanBedVolumeArea = computeMeanBedMissingAreaAndVolume(i, first, last);
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
336 this.rows.get(i).putValue(BunduResultType.missVolumeMeanBed, meanBedVolumeArea[0]);
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
337 this.rows.get(i).putValue(BunduResultType.missAreaMeanBed, meanBedVolumeArea[1]);
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
338 this.rows.get(i).putValue(BunduResultType.missVolumeFields, volumes);
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
339 this.rows.get(i).putValue(BunduResultType.missAreaFields, areas);
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
340 this.rows.get(i).putValue(BunduResultType.missVolumeTotal, vTotal);
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
341 this.rows.get(i).putValue(BunduResultType.excavationVolume, vExcav);
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
342 this.rows.get(i).putValue(BunduResultType.excavationCosts, vExcav * EXPENSE_PER_CBM);
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
343 }
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
344 }
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
345
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
346 /**
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
347 * Computes the missing volume of a field of a km row
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
348 */
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
349 private double computeMissingVolume(final List<Double> volumes, final List<Double> areas, final int current, final int first, final int last,
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
350 final int field, final MissingHeightComputer heightcomputer) {
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
351
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
352 final double dhCurr = heightcomputer.missingHeight(this.rows.get(current), current, first, last, field);
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
353 final double dhPrev = heightcomputer.missingHeight(this.rows.get(current - 1), current - 1, first, last, field);
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
354 final double dhNext = heightcomputer.missingHeight(this.rows.get(current + 1), current + 1, first, last, field);
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
355 final double kmCurr = missingKm(current);
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
356 final double kmPrev = missingKm(current - 1);
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
357 final double kmNext = missingKm(current + 1);
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
358 final double width = getFieldValue(current, BunduResultType.missWidthFields, field);
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
359 final double area1 = Double.isNaN(kmPrev) ? 0.0 : (0.25 * dhPrev + 0.75 * dhCurr) * width;
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
360 final double area2 = Double.isNaN(kmNext) ? 0.0 : (0.75 * dhCurr + 0.25 * dhNext) * width;
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
361 final double volume = Double.valueOf((Math.abs(kmCurr - kmPrev) * KM_TO_M / 2 * area1) + (Math.abs(kmNext - kmCurr) * KM_TO_M / 2 * area2));
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
362 if (volumes != null)
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
363 volumes.add(volume);
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
364 if (areas != null) {
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
365 if (!Double.isNaN(volume))
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
366 areas.add(Double.valueOf(area1 + area2));
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
367 else
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
368 areas.add(Double.NaN);
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
369 }
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
370 return volume;
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
371 }
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
372
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
373 /**
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
374 * Interface for the function that computes the missing height of a field
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
375 */
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
376 private interface MissingHeightComputer {
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
377 /**
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
378 * Gets the missing area of a field and a row if in range, otherwise 0.0
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
379 */
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
380 double missingHeight(final ResultRow row, final int rowIndex, final int first, final int last, final int fieldIndex);
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
381 }
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
382
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
383 /**
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
384 * Computation of the actual missing height of a field
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
385 */
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
386 private static class ActualMissingHeightComputer implements MissingHeightComputer {
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
387 public static MissingHeightComputer Instance = new ActualMissingHeightComputer();
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
388
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
389 /**
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
390 * Gets the missing height of a field and a row if in range, otherwise 0.0
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
391 */
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
392 @SuppressWarnings("unchecked")
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
393 @Override
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
394 public double missingHeight(final ResultRow row, final int rowIndex, final int first, final int last, final int fieldIndex) {
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
395 if ((first <= rowIndex) && (rowIndex <= last)) {
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
396 return ((List<Double>) row.getValue(BunduResultType.missDepthFields)).get(fieldIndex - 1).doubleValue();
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
397 }
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
398 else
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
399 return 0.0;
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
400 }
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
401 }
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
402
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
403 /**
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
404 * Computation of the excavation height of a field
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
405 */
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
406 private static class ExcavationMissingAreaComputer implements MissingHeightComputer {
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
407 public static MissingHeightComputer Instance = new ExcavationMissingAreaComputer();
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
408
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
409 /**
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
410 * Gets the excavation height of a field and a row if in range, otherwise 0.0
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
411 */
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
412 @SuppressWarnings("unchecked")
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
413 @Override
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
414 public double missingHeight(final ResultRow row, final int rowIndex, final int first, final int last, final int fieldIndex) {
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
415 if ((first <= rowIndex) && (rowIndex <= last)) {
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
416 final double channeldepth = row.getDoubleValue(BunduResultType.channelDepth) + EXCAVATION_DEPTH;
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
417 final double fielddepth = ((List<Double>) row.getValue(BunduResultType.depthFields)).get(fieldIndex - 1).doubleValue();
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
418 return (channeldepth - fielddepth);
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
419 }
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
420 else
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
421 return 0.0;
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
422 }
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
423 }
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
424
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
425 /**
9573
b9c87bbff6a4 mean bed height -> mean bed LEVEL
gernotbelger
parents: 9535
diff changeset
426 * Computes the missing area and volume of the mean bed level of a km row
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
427 */
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
428 private double[] computeMeanBedMissingAreaAndVolume(final int current, final int first, final int last) {
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
429
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
430 final double dhCurr = meanBedMissingHeight(current, first, last);
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
431 if (dhCurr < 0.0001)
9535
3fa8551c3d1b Fixed error in bundu bzws missing volume calculation for mean bed height;
mschaefer
parents: 9528
diff changeset
432 return new double[] { 0.0, 0.0 };
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
433 final double dhPrev = meanBedMissingHeight(current - 1, first, last);
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
434 final double dhNext = meanBedMissingHeight(current + 1, first, last);
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
435 final double kmCurr = missingKm(current);
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
436 final double kmPrev = missingKm(current - 1);
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
437 final double kmNext = missingKm(current + 1);
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
438 final double width = this.rows.get(current).getDoubleValue(BunduResultType.channelWidth);
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
439 final double area1 = Double.isNaN(kmPrev) ? 0.0 : (0.25 * dhPrev + 0.75 * dhCurr) * width;
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
440 final double area2 = Double.isNaN(kmNext) ? 0.0 : (0.75 * dhCurr + 0.25 * dhNext) * width;
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
441 final double volume = Double.valueOf((Math.abs(kmCurr - kmPrev) * KM_TO_M / 2 * area1) + (Math.abs(kmNext - kmCurr) * KM_TO_M / 2 * area2));
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
442 final double area = Double.isNaN(volume) ? Double.NaN : Double.valueOf(area1 + area2);
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
443 return new double[] { volume, area };
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
444 }
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
445
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
446 /**
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
447 * Gets the missing height of the mean bed level and a row if in range, otherwise 0.0
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
448 */
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
449 private double meanBedMissingHeight(final int rowIndex, final int first, final int last) {
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
450 if ((first <= rowIndex) && (rowIndex <= last)) {
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
451 final double dh = this.rows.get(rowIndex).getDoubleValue(BunduResultType.channelDepth)
9535
3fa8551c3d1b Fixed error in bundu bzws missing volume calculation for mean bed height;
mschaefer
parents: 9528
diff changeset
452 - this.rows.get(rowIndex).getDoubleValue(BunduResultType.flowdepthMeanBed);
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
453 if (dh > 0.0)
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
454 return dh;
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
455 return 0.0;
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
456 }
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
457 return 0.0;
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
458 }
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
459
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
460 /**
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
461 * Gets the km of a row if within range, otherwise NaN
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
462 */
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
463 private double missingKm(final int rowIndex) {
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
464 if ((0 <= rowIndex) && (rowIndex <= this.rows.size() - 1) && (this.rows.get(rowIndex).getValue(BunduResultType.hasMissingDepth) != null))
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
465 return this.rows.get(rowIndex).getDoubleValue(GeneralResultType.station);
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
466 return Double.NaN;
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
467 }
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
468
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
469 /**
9451
fd6621f47a72 Bundu bzws density calculation completed
mschaefer
parents: 9450
diff changeset
470 * Create a density calculator and compute the densities of the missing volume km range and time period according to the
fd6621f47a72 Bundu bzws density calculation completed
mschaefer
parents: 9450
diff changeset
471 * reference year
fd6621f47a72 Bundu bzws density calculation completed
mschaefer
parents: 9450
diff changeset
472 */
fd6621f47a72 Bundu bzws density calculation completed
mschaefer
parents: 9450
diff changeset
473 private BedQualityCalculator computeDensities(final Calculation problems, final BUNDUArtifact bunduartifact, final BunduAccess access, final River river) {
fd6621f47a72 Bundu bzws density calculation completed
mschaefer
parents: 9450
diff changeset
474 final BedQualityCalculator bqCalculator = new BedQualityCalculator(this.context, bunduartifact);
fd6621f47a72 Bundu bzws density calculation completed
mschaefer
parents: 9450
diff changeset
475 // REMARK 10km tolerance at start and end to enable interpolation there
fd6621f47a72 Bundu bzws density calculation completed
mschaefer
parents: 9450
diff changeset
476 final double[] kms = DoubleUtil.explode(access.getMissingVolFrom().doubleValue() - 10.0, access.getMissingVolTo().doubleValue() + 10.0,
fd6621f47a72 Bundu bzws density calculation completed
mschaefer
parents: 9450
diff changeset
477 access.getStep().doubleValue() / 1000);
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
478 final DateRange dateRange = BedQualityD50TimeRangeConfig.getDefaults(river, access.getBezugsJahr().intValue(), problems);
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
479 if (dateRange == null)
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
480 return null;
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
481 bqCalculator.execute(problems, river, kms, dateRange.getFrom(), dateRange.getTo());
9451
fd6621f47a72 Bundu bzws density calculation completed
mschaefer
parents: 9450
diff changeset
482 return bqCalculator;
fd6621f47a72 Bundu bzws density calculation completed
mschaefer
parents: 9450
diff changeset
483 }
fd6621f47a72 Bundu bzws density calculation completed
mschaefer
parents: 9450
diff changeset
484
fd6621f47a72 Bundu bzws density calculation completed
mschaefer
parents: 9450
diff changeset
485 /**
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
486 * Computes the missing masses
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
487 */
9451
fd6621f47a72 Bundu bzws density calculation completed
mschaefer
parents: 9450
diff changeset
488 private void computeMissingMasses(final Calculation problems, final BedQualityCalculator densityFinder) {
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
489 for (final ResultRow row : this.rows) {
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
490 @SuppressWarnings("unchecked")
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
491 final List<Double> volumes = (List<Double>) row.getValue(BunduResultType.missVolumeFields);
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
492 if ((volumes == null) || Double.isNaN(volumes.get(0)))
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
493 continue;
9451
fd6621f47a72 Bundu bzws density calculation completed
mschaefer
parents: 9450
diff changeset
494 final double density = getDensity(row.getDoubleValue(GeneralResultType.station), densityFinder);
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
495 final List<Double> masses = new ArrayList<>();
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
496 double kmTotal = 0.0;
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
497 int mcnt = 0;
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
498 for (int j = BedHeightValueType.FIELD_FIRST_INDEX; j <= BedHeightValueType.FIELD_LAST_INDEX; j++) {
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
499 final double m = volumes.get(j - 1) * density;
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
500 masses.add(m);
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
501 if (!Double.isNaN(m)) {
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
502 kmTotal += m;
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
503 mcnt += 1;
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
504 }
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
505 }
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
506 if (mcnt == 0)
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
507 kmTotal = Double.NaN;
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
508 row.putValue(BunduResultType.density, density);
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
509 row.putValue(BunduResultType.missMassFields, masses);
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
510 row.putValue(BunduResultType.missMassTotal, kmTotal);
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
511 row.putValue(BunduResultType.missMassMeanBed, row.getDoubleValue(BunduResultType.missVolumeMeanBed) * density);
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
512 }
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
513 }
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
514
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
515 /**
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
516 * Gets a value of one of the field list types of a row
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
517 *
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
518 * @param rowIndex
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
519 * @param type
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
520 * @param fieldIndex
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
521 * 1-based field index
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
522 */
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
523 private double getFieldValue(final int rowIndex, final AbstractResultType type, final int fieldIndex) {
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
524 @SuppressWarnings("unchecked")
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
525 final List<Double> values = (List<Double>) this.rows.get(rowIndex).getValue(type);
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
526 return values.get(fieldIndex - 1);
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
527 }
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
528
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
529 /**
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
530 * Computes the volume and mass total of all rows with missing volumes
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
531 */
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
532 private ResultRow createTotalsRow(final Calculation problems) {
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
533 // Search start km
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
534 double vTotal = 0.0;
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
535 double mTotal = 0.0;
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
536 double eTotal = 0.0;
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
537 double cTotal = 0.0;
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
538 int vcnt = 0;
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
539 int mcnt = 0;
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
540 int ecnt = 0;
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
541 for (final ResultRow row : this.rows) {
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
542 final double volume = row.getDoubleValue(BunduResultType.missVolumeTotal);
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
543 final double mass = row.getDoubleValue(BunduResultType.missMassTotal);
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
544 if (!Double.isNaN(volume)) {
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
545 vTotal += volume;
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
546 vcnt++;
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
547 if (!Double.isNaN(mass)) {
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
548 mTotal += mass;
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
549 mcnt++;
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
550 }
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
551 }
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
552 final double excavation = row.getDoubleValue(BunduResultType.excavationVolume);
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
553 final double costs = row.getDoubleValue(BunduResultType.excavationCosts);
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
554 if (!Double.isNaN(excavation)) {
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
555 eTotal += excavation;
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
556 cTotal += costs;
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
557 ecnt++;
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
558 }
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
559 }
9598
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
560 if (vcnt == 0)
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
561 vTotal = Double.NaN;
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
562 if (mcnt == 0)
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
563 mTotal = Double.NaN;
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
564 if (ecnt == 0) {
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
565 eTotal = Double.NaN;
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
566 cTotal = Double.NaN;
17414e70746e Softwaretests...20181219 10.1/10.2/10.5/10.9: corrected computation of missing volume and excavation volume, date range for density queries as in Sinfo/Tkh, empty values instead of 0 if computation not possible
mschaefer
parents: 9588
diff changeset
567 }
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
568 final ResultRow sumRow = ResultRow.create();
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
569 sumRow.putValue(BunduResultType.missStationRangeFrom, Double.valueOf(this.missKmFrom));
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
570 sumRow.putValue(BunduResultType.missStationRangeTo, Double.valueOf(this.missKmTo));
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
571 sumRow.putValue(BunduResultType.missVolumeTotal, vTotal);
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
572 sumRow.putValue(BunduResultType.missMassTotal, mTotal);
9480
7228bd10a8cc Fixed bundu bzws bedheightfinder todos, added types for excavation volume and costs total
mschaefer
parents: 9479
diff changeset
573 sumRow.putValue(BunduResultType.excavationVolumeTotal, eTotal);
7228bd10a8cc Fixed bundu bzws bedheightfinder todos, added types for excavation volume and costs total
mschaefer
parents: 9479
diff changeset
574 sumRow.putValue(BunduResultType.excavationCostsTotal, cTotal);
9446
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
575 return sumRow;
e60584f2a531 Added bundu bzws calculation for missing volumes (masses still not yet ready) and results1/2/3
mschaefer
parents: 9444
diff changeset
576 }
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
577
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
578 /**
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
579 * Copies the rows of the missing volume calculation range into a new list
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
580 */
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
581 private List<ResultRow> copyMissRows() {
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
582 final List<ResultRow> missRows = new ArrayList<>();
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
583 for (final ResultRow row : this.rows) {
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
584 final double km = row.getDoubleValue(GeneralResultType.station);
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
585 if (isKmInMissingVolumeRange(km))
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
586 missRows.add(row);
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
587 }
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
588 return missRows;
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
589 }
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
590
9451
fd6621f47a72 Bundu bzws density calculation completed
mschaefer
parents: 9450
diff changeset
591 /**
fd6621f47a72 Bundu bzws density calculation completed
mschaefer
parents: 9450
diff changeset
592 * Gets the density of a km from the densities calculation
fd6621f47a72 Bundu bzws density calculation completed
mschaefer
parents: 9450
diff changeset
593 */
fd6621f47a72 Bundu bzws density calculation completed
mschaefer
parents: 9450
diff changeset
594 private double getDensity(final double km, final BedQualityCalculator densityFinder) {
fd6621f47a72 Bundu bzws density calculation completed
mschaefer
parents: 9450
diff changeset
595 return densityFinder.getDensity(km);
9450
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
596 }
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
597
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
598 /**
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
599 * Checks whether a km lies in the missing volume calculation range
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
600 */
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
601 private boolean isKmInMissingVolumeRange(final double km) {
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
602 if ((this.missKmFrom == null) || (this.missKmTo == null))
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
603 return false;
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
604 return (this.missKmFrom.doubleValue() - 0.0001 < km) && (km < this.missKmTo.doubleValue() + 0.0001);
7e1fb8d0cb0d Bundu bzws calculation nearly completed, some corrections with csv output, started with linking the minfo density calculation
mschaefer
parents: 9448
diff changeset
605 }
9313
6ffcbb4f35d5 bundu.bezugswst first result stump
gernotbelger
parents:
diff changeset
606 }

http://dive4elements.wald.intevation.org