Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FlowVelocityCalculation.java @ 3109:63ef889eea2b
SQ: Directly sample our Function objects instead of Function2D from JFreeChart.
flys-artifacts/trunk@4708 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 19 Jun 2012 15:39:02 +0000 |
parents | 4c00cf83fff1 |
children | b888c5eb65b3 |
rev | line source |
---|---|
2702
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model; |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import java.util.ArrayList; |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 import java.util.List; |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import org.apache.log4j.Logger; |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 import de.intevation.flys.model.DischargeZone; |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import de.intevation.flys.model.FlowVelocityModel; |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.flys.model.FlowVelocityModelValue; |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.flys.model.River; |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.flys.artifacts.MINFOArtifact; |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.flys.artifacts.model.FlowVelocityData; |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.flys.utils.FLYSUtils; |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 public class FlowVelocityCalculation extends Calculation { |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 private static final Logger logger = |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 Logger.getLogger(FlowVelocityCalculation.class); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 public CalculationResult calculate(MINFOArtifact artifact) { |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 logger.info("FlowVelocityCalculation.calculate"); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 int[] mainIds = artifact.getMainChannels(); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 int[] totalIds = artifact.getTotalChannels(); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 if (logger.isDebugEnabled()) { |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 logger.debug("Artifact '" + artifact.identifier() + "' contains:"); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 if (mainIds != null) { |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 logger.debug(" " + mainIds.length + " main channel ids"); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 } |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 if (totalIds != null) { |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 logger.debug(" " + totalIds.length + " total channel ids"); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 } |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 } |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 List<DischargeZone> zones = getDischargeZones(mainIds, totalIds); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 List<FlowVelocityModel> models = getFlowVelocityModels(artifact, zones); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 return buildCalculationResult(artifact, models); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 } |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 protected List<DischargeZone> getDischargeZones( |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 int[] mainIds, |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 int[] totalIds |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 ) { |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 List<DischargeZone> zones = new ArrayList<DischargeZone>(); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 if (mainIds != null) { |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 for (int id: mainIds) { |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 DischargeZone zone = DischargeZone.getDischargeZoneById(id); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 if (zone != null) { |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 zones.add(zone); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 } |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 } |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 } |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 if (totalIds != null) { |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 for (int id: totalIds) { |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 DischargeZone zone = DischargeZone.getDischargeZoneById(id); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 if (zone != null) { |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 zones.add(zone); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 } |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 } |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 } |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 return zones; |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 } |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 protected List<FlowVelocityModel> getFlowVelocityModels( |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 MINFOArtifact artifact, |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 List<DischargeZone> zones |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 ) { |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 River river = FLYSUtils.getRiver(artifact); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 List<FlowVelocityModel> models = new ArrayList<FlowVelocityModel>(); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 for (DischargeZone zone: zones) { |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 List<FlowVelocityModel> model = |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 FlowVelocityModel.getModels(river, zone); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 if (model != null) { |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 models.addAll(model); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 } |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 } |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 return models; |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 } |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 protected void prepareData( |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 FlowVelocityData data, |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 FlowVelocityModel model, |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 double kmLo, |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
103 double kmHi |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 ) { |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
105 List<FlowVelocityModelValue> values = |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
106 FlowVelocityModelValue.getValues(model, kmLo, kmHi); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
107 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 logger.debug("Found " + values.size() + " values for model."); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
109 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
110 for (FlowVelocityModelValue value: values) { |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 data.addKM(value.getStation().doubleValue()); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
112 data.addQ(value.getQ().doubleValue()); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 data.addVTotal(value.getTotalChannel().doubleValue()); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
114 data.addVMain(value.getMainChannel().doubleValue()); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
115 data.addTauMain(value.getShearStress().doubleValue()); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
116 } |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
117 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 DischargeZone zone = model.getDischargeZone(); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
119 String lo = zone.getLowerDischarge(); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
120 String hi = zone.getUpperDischarge(); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
121 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 if (lo.equals(hi)) { |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
123 data.setZone(lo); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 } |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
125 else { |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
126 data.setZone(lo + " - " + hi); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 } |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
128 } |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
129 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
130 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
131 protected CalculationResult buildCalculationResult( |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
132 MINFOArtifact artifact, |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
133 List<FlowVelocityModel> models |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
134 ) { |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
135 double kmLo = artifact.getDataAsDouble("ld_from"); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
136 double kmHi = artifact.getDataAsDouble("ld_to"); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
137 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
138 logger.debug("Prepare data for km range: " + kmLo + " - " + kmHi); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
139 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
140 FlowVelocityData[] data = new FlowVelocityData[models.size()]; |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
141 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
142 for (int i = 0, n = models.size(); i < n; i++) { |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
143 FlowVelocityData d = new FlowVelocityData(); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
144 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
145 prepareData(d, models.get(i), kmLo, kmHi); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
146 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
147 data[i] = d; |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
148 } |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
149 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
150 logger.debug("Calculation contains " + data.length + " data items."); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
151 |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
152 return new CalculationResult(data, this); |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
153 } |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
154 } |
4c00cf83fff1
Added state, calculation and csv exporter for MINFO flow velociy calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
155 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |