Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MiddleBedHeightCalculation.java @ 3253:209d50ee8e9f
Add missing themes for fixation charts
flys-artifacts/trunk@4887 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Fri, 06 Jul 2012 13:02:35 +0000 |
parents | cdbc457e23e2 |
children | 3c006a53e551 |
rev | line source |
---|---|
2713
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model; |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import java.util.ArrayList; |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 import java.util.List; |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import org.apache.log4j.Logger; |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 |
3230
b888c5eb65b3
Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2715
diff
changeset
|
8 import de.intevation.artifacts.Artifact; |
2713
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import de.intevation.artifacts.common.utils.DateUtils; |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.flys.model.BedHeightEpoch; |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 import de.intevation.flys.model.BedHeightEpochValue; |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.flys.model.BedHeightSingle; |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.flys.model.BedHeightSingleValue; |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.flys.model.TimeInterval; |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 |
3230
b888c5eb65b3
Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2715
diff
changeset
|
17 import de.intevation.flys.artifacts.access.BedHeightAccess; |
2713
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.flys.artifacts.model.MiddleBedHeightData; |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 public class MiddleBedHeightCalculation extends Calculation { |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 private static final Logger logger = |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 Logger.getLogger(MiddleBedHeightCalculation.class); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 |
3230
b888c5eb65b3
Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2715
diff
changeset
|
27 public CalculationResult calculate(BedHeightAccess access) { |
2713
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 logger.info("MiddleBedHeightCalculation.calculate"); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 |
3230
b888c5eb65b3
Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2715
diff
changeset
|
30 int[] singleIds = access.getBedHeightSingleIDs(); |
b888c5eb65b3
Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2715
diff
changeset
|
31 int[] epochIds = access.getBedHeightEpochIDs(); |
3232
cdbc457e23e2
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3230
diff
changeset
|
32 |
2713
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 if (logger.isDebugEnabled()) { |
3230
b888c5eb65b3
Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2715
diff
changeset
|
35 Artifact artifact = access.getArtifact(); |
3232
cdbc457e23e2
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3230
diff
changeset
|
36 |
2713
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 logger.debug("Artifact '" + artifact.identifier() + "' contains:"); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 if (singleIds != null) { |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 logger.debug(" " + singleIds.length + " single bedheight ids"); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 } |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 if (epochIds != null) { |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 logger.debug(" " + epochIds.length + " epoch bedheight ids"); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 } |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 } |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 |
3230
b888c5eb65b3
Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2715
diff
changeset
|
47 List<BedHeightSingle> singles = getSingles(access, singleIds); |
b888c5eb65b3
Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2715
diff
changeset
|
48 List<BedHeightEpoch> epochs = getEpochs(access, epochIds); |
2713
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 |
3230
b888c5eb65b3
Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2715
diff
changeset
|
50 return buildCalculationResult(access, singles, epochs); |
2713
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 } |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 |
3230
b888c5eb65b3
Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2715
diff
changeset
|
54 protected List<BedHeightSingle> getSingles( |
b888c5eb65b3
Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2715
diff
changeset
|
55 BedHeightAccess access, |
b888c5eb65b3
Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2715
diff
changeset
|
56 int[] ids |
b888c5eb65b3
Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2715
diff
changeset
|
57 ) { |
2713
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 List<BedHeightSingle> singles = new ArrayList<BedHeightSingle>(); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 for (int id: ids) { |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 BedHeightSingle s = BedHeightSingle.getBedHeightSingleById(id); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 if (s != null) { |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 singles.add(s); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 } |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 else { |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 logger.warn("Cannot find Sngle by id: " + id); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 // TODO ADD WARNING |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 } |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 } |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 return singles; |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 } |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 |
3230
b888c5eb65b3
Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2715
diff
changeset
|
76 protected List<BedHeightEpoch> getEpochs( |
b888c5eb65b3
Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2715
diff
changeset
|
77 BedHeightAccess access, |
b888c5eb65b3
Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2715
diff
changeset
|
78 int[] ids |
b888c5eb65b3
Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2715
diff
changeset
|
79 ) { |
2713
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 List<BedHeightEpoch> epochs = new ArrayList<BedHeightEpoch>(); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 for (int id: ids) { |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 BedHeightEpoch e = BedHeightEpoch.getBedHeightEpochById(id); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 if (e != null) { |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 epochs.add(e); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 } |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 else { |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 logger.warn("Cannot find Epoch by id: " + id); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 // TODO ADD WARNING |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 } |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 } |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 return epochs; |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 } |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 protected CalculationResult buildCalculationResult( |
3230
b888c5eb65b3
Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2715
diff
changeset
|
99 BedHeightAccess access, |
2713
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 List<BedHeightSingle> singles, |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 List<BedHeightEpoch> epochs |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 ) { |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
103 logger.info("MiddleBedHeightCalculation.buildCalculationResult"); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 |
3230
b888c5eb65b3
Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2715
diff
changeset
|
105 double kmLo = access.getLowerKM(); |
b888c5eb65b3
Added new *Access objects for bed height calculation and flow velocity calculation; removed methods for specific data access from MINFOArtifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2715
diff
changeset
|
106 double kmHi = access.getUpperKM(); |
2713
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
107 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 List<MiddleBedHeightData> data = new ArrayList<MiddleBedHeightData>(); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
109 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
110 for (BedHeightSingle single: singles) { |
2715
250a370c377d
Added chart generator for middle bed height charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2713
diff
changeset
|
111 MiddleBedHeightData d = prepareSingleData(single, kmLo, kmHi); |
2713
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
112 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 if (d != null) { |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
114 data.add(d); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
115 } |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
116 } |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
117 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 for (BedHeightEpoch epoch: epochs) { |
2715
250a370c377d
Added chart generator for middle bed height charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2713
diff
changeset
|
119 MiddleBedHeightData d = prepareEpochData(epoch, kmLo, kmHi); |
2713
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
120 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
121 if (d != null) { |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 data.add(d); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
123 } |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 } |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
125 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
126 logger.debug("Calculation results in " + data.size() + " data objects."); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
128 return new CalculationResult((MiddleBedHeightData[]) |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
129 data.toArray(new MiddleBedHeightData[data.size()]), this); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
130 } |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
131 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
132 |
2715
250a370c377d
Added chart generator for middle bed height charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2713
diff
changeset
|
133 protected MiddleBedHeightData prepareSingleData( |
250a370c377d
Added chart generator for middle bed height charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2713
diff
changeset
|
134 BedHeightSingle single, |
250a370c377d
Added chart generator for middle bed height charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2713
diff
changeset
|
135 double kmLo, |
250a370c377d
Added chart generator for middle bed height charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2713
diff
changeset
|
136 double kmHi |
250a370c377d
Added chart generator for middle bed height charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2713
diff
changeset
|
137 ) { |
2713
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
138 logger.debug("Prepare data for single: " + single.getDescription()); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
139 |
2715
250a370c377d
Added chart generator for middle bed height charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2713
diff
changeset
|
140 List<BedHeightSingleValue> values = |
250a370c377d
Added chart generator for middle bed height charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2713
diff
changeset
|
141 BedHeightSingleValue.getBedHeightSingleValues(single, kmLo, kmHi); |
2713
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
142 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
143 MiddleBedHeightData data = new MiddleBedHeightData( |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
144 single.getYear(), |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
145 single.getYear(), |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
146 single.getEvaluationBy(), |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
147 single.getDescription()); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
148 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
149 for (BedHeightSingleValue value: values) { |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
150 data.addKM(value.getStation().doubleValue()); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
151 data.addMiddleHeight(value.getHeight().doubleValue()); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
152 data.addUncertainty(value.getUncertainty().doubleValue()); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
153 data.addSoundingWidth(value.getSoundingWidth().doubleValue()); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
154 data.addDataGap(value.getDataGap().doubleValue()); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
155 data.addWidth(value.getWidth().doubleValue()); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
156 } |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
157 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
158 logger.debug("Single contains " + values.size() + " values"); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
159 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
160 return data; |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
161 } |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
162 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
163 |
2715
250a370c377d
Added chart generator for middle bed height charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2713
diff
changeset
|
164 protected MiddleBedHeightData prepareEpochData( |
250a370c377d
Added chart generator for middle bed height charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2713
diff
changeset
|
165 BedHeightEpoch epoch, |
250a370c377d
Added chart generator for middle bed height charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2713
diff
changeset
|
166 double kmLo, |
250a370c377d
Added chart generator for middle bed height charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2713
diff
changeset
|
167 double kmHi |
250a370c377d
Added chart generator for middle bed height charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2713
diff
changeset
|
168 ) { |
2713
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
169 logger.debug("Prepare data for epoch: " + epoch.getDescription()); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
170 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
171 TimeInterval ti = epoch.getTimeInterval(); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
172 |
2715
250a370c377d
Added chart generator for middle bed height charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2713
diff
changeset
|
173 List<BedHeightEpochValue> values = |
250a370c377d
Added chart generator for middle bed height charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2713
diff
changeset
|
174 BedHeightEpochValue.getBedHeightEpochValues(epoch, kmLo, kmHi); |
2713
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
175 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
176 MiddleBedHeightData data = new MiddleBedHeightData( |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
177 DateUtils.getYearFromDate(ti.getStartTime()), |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
178 DateUtils.getYearFromDate(ti.getStopTime()), |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
179 epoch.getEvaluationBy(), |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
180 epoch.getDescription() |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
181 ); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
182 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
183 for (BedHeightEpochValue value: values) { |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
184 data.addKM(value.getStation().doubleValue()); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
185 data.addMiddleHeight(value.getHeight().doubleValue()); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
186 } |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
187 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
188 logger.debug("Epoch contains " + values.size() + " values"); |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
189 |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
190 return data; |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
191 } |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
192 } |
b60751cfdd6c
Start MINFO middle bed height calculation in the relevant state and creates facets for chart and csv.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
193 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |